Merge remote-tracking branch 'origin/dev'

This commit is contained in:
wangliwen 2022-07-01 17:00:40 +08:00
commit d9ed300609
5 changed files with 64 additions and 15 deletions

View File

@ -1396,9 +1396,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//获取部门列表
List<Map<String, Object>> list = new ArrayList<>();
if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept");
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept");
} else {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
}
if (list.size() > 0) {
@ -1408,31 +1408,32 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return new PageData<>(list, list.size());
}
//分别根据部门获取应用组件数和申请组件数
//分别根据部门获取组件使用总数和申请组件数
Map<String, Object> paraMap = new ConcurrentHashMap<>();
paraMap.put("resourceType", params.get("resourceType"));
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
paraMap.put("id", m.get("id"));
paraMap.put("id", m.get("deptId"));
Map<String, Object> maps1 = new HashMap<>();
maps1 = baseDao.assemblyCarByDept(paraMap);
if (maps1 == null) {
m.put("carNum", 0);
m.put("resourceCarNum", 0);
} else {
m.put("carNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
}
});
});
//这里的使用数应该就是调用数先用这个等查询调用数的接口开发完了再改2020/07/01 ytl
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
paraMap.put("id", m.get("id"));
paraMap.put("id", m.get("deptId"));
Map<String, Object> maps2 = new HashMap<>();
maps2 = baseDao.assemblyUseByDept(paraMap);
if (maps2 == null) {
m.put("useNum", 0);
m.put("resourceUseNum", 0);
} else {
m.put("useNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
m.put("resourceUseNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
}
});
});
@ -1455,9 +1456,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Object[] ps = {params.get("id"), params.get("id")};
List<Map<String, Object>> list = new ArrayList<>();
if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept ");
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept ");
} else {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
}
if (list.size() > 0) {
@ -1470,7 +1471,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("resourceType", params.get("resourceType"));
result.forEach(r -> {
map.put("id", r.get("id"));
map.put("id", r.get("deptId"));
Map<String, Object> stringObjectMap = baseDao.assemblyCarByDept(map);
if (stringObjectMap != null) {
r.put("resourceCarNum", stringObjectMap.get("carNum"));
@ -1565,7 +1566,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
dtoList.forEach(temp->{
Map p=new HashMap();
p.put("resource_id", temp.getId());
temp.setApplyCount(String.valueOf(tResourceMountApplyService.list(p).size()));
temp.setApplyCount(String.valueOf(tAbilityApplicationService.list(p).size()));
});
return new PageData<>(dtoList, dtoList.size());
}

View File

@ -55,6 +55,14 @@ public class WorkDynamicsController {
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("/getDeptWork")
@ApiOperation("查询用户所在部门的工作动态")
@LogOperation("查询用户所在部门的工作动态")
public Result<PageData<WorkDynamicsDTO>> getDeptWork(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WorkDynamicsDTO> page = workDynamicsService.getDeptWork(params);
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("/select/{id}")
@ApiOperation("查询工作动态详细信息")
@LogOperation("查询工作动态详细信息")

View File

@ -1,9 +1,12 @@
package io.renren.modules.workDynamics.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
import java.util.Map;
/**
* 工作动态
*
@ -13,4 +16,6 @@ import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
public interface WorkDynamicsService extends CrudService<WorkDynamicsEntity, WorkDynamicsDTO> {
void deleteByIds(Long[] ids);
PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params);
}

View File

@ -2,7 +2,14 @@ package io.renren.modules.workDynamics.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import io.renren.modules.workDynamics.dao.WorkDynamicsDao;
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
@ -10,7 +17,10 @@ import io.renren.modules.workDynamics.service.WorkDynamicsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 工作动态
@ -24,6 +34,9 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
@Autowired
private WorkDynamicsDao workDynamicsDao;
@Autowired
private SysUserService sysUserService;
@Override
public QueryWrapper<WorkDynamicsEntity> getWrapper(Map<String, Object> params){
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
@ -40,4 +53,26 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
public void deleteByIds(Long[] ids) {
workDynamicsDao.deleteByIds(ids);
}
@Override
public PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params) {
Integer curPage = 1;
Integer limit = 10;
if (params.get(Constant.PAGE) != null) {
curPage = Integer.parseInt((String) params.get(Constant.PAGE));
}
if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
List<SysUserDTO> sysUserList = sysUserService.list(new HashMap());
List<Long> userIdList=sysUserList.stream().map(user->user.getId()).collect(Collectors.toList());
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag", 0);
if(userIdList.size()>0){
wrapper.in("creator", userIdList);
}
IPage<WorkDynamicsEntity> page = new Page<>(curPage, limit);
List<WorkDynamicsDTO> result=ConvertUtils.sourceToTarget(workDynamicsDao.selectPage(page, wrapper).getRecords(), WorkDynamicsDTO.class);
return new PageData<WorkDynamicsDTO>(result, result.size());
}
}

View File

@ -1340,8 +1340,8 @@
</select>
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
SELECT count(trma.id) as count, tdr.name
FROM tb_data_resource tdr left join t_resource_mount_apply trma on tdr.id=trma.resource_id
SELECT count(taa.id) as count, tdr.name
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
<if test="null != list">
where tdr.dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">