Merge branch 'dev'
This commit is contained in:
commit
b263804884
|
@ -2024,34 +2024,130 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
public Object selectApplyDeptDetailTypeCountList(Map params) {
|
||||
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
|
||||
ArrayList<Map> resultList = new ArrayList<>();
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
typeCountListMap.forEach((k, v) -> {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
||||
map.put("name", k);
|
||||
v.forEach(item -> {
|
||||
map.put(item.get("type").toString(), item.get("count"));
|
||||
if (countMap.containsKey(item.get("type"))) {
|
||||
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
|
||||
} else {
|
||||
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
|
||||
}
|
||||
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) {
|
||||
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
|
||||
ArrayList<Map> resultList = new ArrayList<>();
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
typeCountListMap.forEach((k, v) -> {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
||||
map.put("name", k);
|
||||
v.forEach(item -> {
|
||||
map.put(item.get("type").toString(), item.get("count"));
|
||||
if (countMap.containsKey(item.get("type"))) {
|
||||
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
|
||||
} else {
|
||||
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
|
||||
}
|
||||
});
|
||||
resultList.add(map);
|
||||
});
|
||||
resultList.add(map);
|
||||
});
|
||||
Integer total = 0;
|
||||
for (Integer count : countMap.values()) {
|
||||
total += count;
|
||||
Integer total = 0;
|
||||
for (Integer count : countMap.values()) {
|
||||
total += count;
|
||||
}
|
||||
countMap.put("count", total);
|
||||
HashMap<String, Object> count = new HashMap<>();
|
||||
count.put("name", "总计");
|
||||
count.putAll(countMap);
|
||||
resultList.add(count);
|
||||
return resultList;
|
||||
} else {
|
||||
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
|
||||
List<HashMap<String, Object>> resultList = getDeptTemp1();
|
||||
resultList.addAll(getDeptTemp2());
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
|
||||
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
|
||||
resultList = resultList.stream().map(index -> {
|
||||
if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
|
||||
index.put("count", typeCountListMap.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
||||
typeCountListMap.get(index.get("dept_id").toString()).stream().forEach(count -> {
|
||||
index.put(count.get("type").toString(), count.get("count"));
|
||||
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());
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
|
||||
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3")).collect(Collectors.groupingBy(m -> m.get("district").toString()));
|
||||
resultList = resultList.stream().map(index -> {
|
||||
if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
|
||||
index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
||||
typeCountListMap1.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());
|
||||
|
||||
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()));
|
||||
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 -> {
|
||||
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()));
|
||||
}
|
||||
});
|
||||
typeCountListMap2.remove(typeCountListMap2.get(index.get("deptName").toString()));// 去除
|
||||
}
|
||||
return index;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (!typeCountListMap2.isEmpty()) { // 仍然有会议室信息
|
||||
List<HashMap<String, Object>> temp = typeCountListMap2.keySet().stream().map(index_ -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
typeCountListMap2.get(index_).stream().forEach(count -> {
|
||||
map.put(count.get("type").toString(), Integer.parseInt(count.get("type").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()));
|
||||
}
|
||||
});
|
||||
map.put("name", index_);
|
||||
map.put("dept_id", null);
|
||||
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");
|
||||
map.put("hys", "0");
|
||||
return map;
|
||||
}).collect(Collectors.toList()); // 会议室的
|
||||
resultList.addAll(temp);
|
||||
}
|
||||
|
||||
Integer total = 0;
|
||||
for (Integer count : countMap.values()) {
|
||||
total += count;
|
||||
}
|
||||
countMap.put("count", total);
|
||||
HashMap<String, Object> count = new HashMap<>();
|
||||
count.put("name", "总计");
|
||||
count.putAll(countMap);
|
||||
resultList.add(count);
|
||||
return resultList;
|
||||
}
|
||||
countMap.put("count", total);
|
||||
HashMap<String, Object> count = new HashMap<>();
|
||||
count.put("name", "总计");
|
||||
count.putAll(countMap);
|
||||
resultList.add(count);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1719,6 +1719,9 @@
|
|||
SELECT
|
||||
COUNT( taa.resource_id ) AS "count",
|
||||
sd.NAME AS "deptName",
|
||||
sd.id AS "dept_id",
|
||||
sd.type AS "deptType",
|
||||
sd.district AS "district",
|
||||
(
|
||||
CASE
|
||||
tdr.type
|
||||
|
@ -1777,9 +1780,11 @@
|
|||
UNION
|
||||
|
||||
SELECT
|
||||
|
||||
COUNT( id ) AS 'count' ,
|
||||
COUNT( id ) AS 'count',
|
||||
dept AS 'deptName',
|
||||
NULL AS "dept_id",
|
||||
99 AS "deptType",
|
||||
NULL AS "district",
|
||||
'hys' AS 'type'
|
||||
FROM
|
||||
t_meetingroom_book tmb
|
||||
|
|
Loading…
Reference in New Issue