...
This commit is contained in:
parent
dd08d7b139
commit
ad54ba9ac1
|
@ -2056,67 +2056,84 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectDeptDetailTypeCountList(Map params) {
|
public Object selectDeptDetailTypeCountList(Map params) {
|
||||||
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
|
if (params.containsKey("deptId") && params.get("deptId") != null) {
|
||||||
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
|
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
|
||||||
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
|
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
|
||||||
List<HashMap<String, Object>> resultList = getDeptTemp1();
|
ArrayList<Map> resultList = new ArrayList<>();
|
||||||
resultList.addAll(getDeptTemp2());
|
Map<String, Integer> countMap = new HashMap<>();
|
||||||
Map<String, Integer> countMap = new HashMap<>();
|
typeCountListMap.forEach((k, v) -> {
|
||||||
resultList = resultList.stream().map(index -> {
|
HashMap<Object, Object> map = new HashMap<>();
|
||||||
if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
|
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
||||||
index.put("count", typeCountListMap.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
map.put("name", k);
|
||||||
typeCountListMap.get(index.get("dept_id").toString()).stream().forEach(count -> {
|
v.forEach(item -> {
|
||||||
index.put(count.get("type").toString(), count.get("count"));
|
map.put(item.get("type").toString(), item.get("count"));
|
||||||
if (countMap.containsKey(count.get("type"))) {
|
if (countMap.containsKey(item.get("type"))) {
|
||||||
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
|
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
|
||||||
} else {
|
} else {
|
||||||
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
|
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
resultList.add(map);
|
||||||
|
});
|
||||||
|
Integer total = 0;
|
||||||
|
for (Integer count : countMap.values()) {
|
||||||
|
total += count;
|
||||||
}
|
}
|
||||||
return index;
|
countMap.put("count", total);
|
||||||
}).collect(Collectors.toList());
|
HashMap<String, Object> count = new HashMap<>();
|
||||||
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
|
count.put("name", "总计");
|
||||||
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("3")).collect(Collectors.groupingBy(m -> m.get("district").toString()));
|
count.putAll(countMap);
|
||||||
resultList = resultList.stream().map(index -> {
|
resultList.add(count);
|
||||||
if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
|
return resultList;
|
||||||
index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
} else { // 全部部门
|
||||||
typeCountListMap1.get(index.get("dept_id").toString()).stream().forEach(count -> {
|
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
|
||||||
index.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.getOrDefault(count.get("type").toString(), "0").toString()));
|
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
|
||||||
if (countMap.containsKey(count.get("type"))) {
|
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
|
||||||
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
|
List<HashMap<String, Object>> resultList = getDeptTemp1();
|
||||||
} else {
|
resultList.addAll(getDeptTemp2());
|
||||||
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
|
Map<String, Integer> countMap = new HashMap<>();
|
||||||
}
|
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 = // 区级部门
|
||||||
|
typeCountListByDept.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());
|
||||||
|
Integer total = 0;
|
||||||
|
for (Integer count : countMap.values()) {
|
||||||
|
total += count;
|
||||||
}
|
}
|
||||||
return index;
|
countMap.put("count", total);
|
||||||
}).collect(Collectors.toList());
|
HashMap<String, Object> count = new HashMap<>();
|
||||||
// typeCountListMap.forEach((k, v) -> {
|
count.put("name", "总计");
|
||||||
// HashMap<String, Object> map = new HashMap<>();
|
count.putAll(countMap);
|
||||||
// map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
|
resultList.add(count);
|
||||||
// map.put("name", k);
|
return resultList;
|
||||||
// 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);
|
|
||||||
// });
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue