能力统计增加企业部门信息

This commit is contained in:
wangliwen 2022-10-28 14:43:27 +08:00
parent 29458b0fc9
commit d245197684
1 changed files with 68 additions and 9 deletions

View File

@ -2134,6 +2134,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
List<HashMap<String, Object>> resultList = getDeptTemp1();
resultList.addAll(getDeptTemp2());
resultList.addAll(getDeptTemp4());
Map<String, Integer> countMap = new HashMap<>();
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
@ -2169,12 +2170,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return index;
}).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap2 = // 会议室
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("99")).collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("4")).collect(Collectors.groupingBy(m -> m.get("district").toString()));
resultList = resultList.stream().map(index -> {
if (typeCountListMap2.keySet().contains(index.get("name").toString())) { // 该部门存在上架信息
index.put("count", Integer.parseInt(index.get("count").toString()) + typeCountListMap2.get(index.get("name").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
typeCountListMap2.get(index.get("name").toString()).stream().forEach(count -> {
if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
typeCountListMap2.get(index.get("dept_id").toString()).stream().forEach(count -> {
index.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.getOrDefault(count.get("type").toString(), "0").toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
@ -2182,15 +2183,32 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
}
});
typeCountListMap2.remove(index.get("name").toString());// 去除
}
return index;
}).collect(Collectors.toList());
if (!typeCountListMap2.isEmpty()) { // 仍然有会议室信息
List<HashMap<String, Object>> temp = typeCountListMap2.keySet().stream().map(index_ -> {
Map<String, List<Map<String, Object>>> typeCountListMap3 = // 会议室
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("99")).collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
resultList = resultList.stream().map(index -> {
if (typeCountListMap3.keySet().contains(index.get("name").toString())) { // 该部门存在上架信息
index.put("count", Integer.parseInt(index.get("count").toString()) + typeCountListMap3.get(index.get("name").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
typeCountListMap3.get(index.get("name").toString()).stream().forEach(count -> {
index.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.getOrDefault(count.get("type").toString(), "0").toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
} else {
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
}
});
typeCountListMap3.remove(index.get("name").toString());// 去除
}
return index;
}).collect(Collectors.toList());
if (!typeCountListMap3.isEmpty()) { // 仍然有会议室信息
List<HashMap<String, Object>> temp = typeCountListMap3.keySet().stream().map(index_ -> {
HashMap<String, Object> map = new HashMap<>();
typeCountListMap2.get(index_).stream().forEach(count -> {
typeCountListMap3.get(index_).stream().forEach(count -> {
map.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
@ -2292,6 +2310,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
List<HashMap<String, Object>> resultList = getDeptTemp1();
resultList.addAll(getDeptTemp2());
resultList.addAll(getDeptTemp4());
Map<String, Integer> countMap = new HashMap<>();
resultList = resultList.stream().map(index -> {
if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
@ -2323,6 +2342,22 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
return index;
}).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("4")).collect(Collectors.groupingBy(m -> m.get("district").toString()));
resultList = resultList.stream().map(index -> {
if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
typeCountListMap2.get(index.get("dept_id").toString()).stream().forEach(count -> {
index.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.getOrDefault(count.get("type").toString(), "0").toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
} else {
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
}
});
}
return index;
}).collect(Collectors.toList());
Integer total = 0;
for (Integer count : countMap.values()) {
total += count;
@ -2387,6 +2422,30 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resultList;
}
/**
* @return 返回企业级部门的初级构造
*/
private List<HashMap<String, Object>> getDeptTemp4() {
List<HashMap<String, Object>> resultList;
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT id,`name`,type,pid,district FROM sys_dept WHERE type = 4 AND `name` != '访客部门' ORDER BY sys_dept.sort;");
resultList = maps.stream().map(index -> {
HashMap<String, Object> map = new HashMap<>();
map.put("count", 0); //
map.put("name", index.get("name").toString());
map.put("dept_id", index.get("id").toString());
map.put("yyzy", "0");
map.put("znsf", "0");
map.put("tcfw", "0");
map.put("kfzj", "0");
map.put("ywzj", "0");
map.put("jcss", "0");
map.put("zsk", "0");
map.put("sjzy", "0");
return map;
}).collect(Collectors.toList());
return resultList;
}
@Override
public Object selectCensusResourceTable(Map params) {
int curPage = 1;