|
|
@@ -916,29 +916,39 @@ public class DatadetailController {
|
|
|
BigDecimal notEmptyRatio = BigDecimal.valueOf(notEmptyCount).divide(BigDecimal.valueOf(allCount), 4, RoundingMode.HALF_UP);
|
|
|
result.setNotEmptyRatio(notEmptyRatio.doubleValue() + "");
|
|
|
|
|
|
- Map<String, List<Map<String, Object>>> gradeMap = list.stream().filter(x -> ObjectUtil.isNotNull(x.get("user_id"))).collect(Collectors.groupingBy(x -> x.get("grade_name").toString()));
|
|
|
+ Map<String, List<Map<String, Object>>> gradeMap = list.stream().filter(x -> ObjectUtil.isNotNull(x.get("grade_name"))).collect(Collectors.groupingBy(x -> x.get("grade_name").toString()));
|
|
|
List<ItemCount2Vo> gradeList = new ArrayList<>();
|
|
|
for (String gradeName : gradeMap.keySet()) {
|
|
|
List<Map<String, Object>> gradeDataList = gradeMap.get(gradeName);
|
|
|
- Map<String, Long> genderMap = gradeDataList.stream().collect(Collectors.groupingBy(x -> x.get("gender").toString(), Collectors.counting()));
|
|
|
+ Map<String, Long> genderMap = gradeDataList.stream().filter(x -> ObjectUtil.isNotNull(x.get("gender"))).collect(Collectors.groupingBy(x -> x.get("gender").toString(), Collectors.counting()));
|
|
|
ItemCount2Vo gradeVo = new ItemCount2Vo();
|
|
|
gradeVo.setItem(gradeName);
|
|
|
- gradeVo.setCount(genderMap.get(GenderDictionaryEnum.MALE.getCode()).intValue());
|
|
|
- gradeVo.setCount2(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()).intValue());
|
|
|
+ if(genderMap.get(GenderDictionaryEnum.MALE.getCode()) != null){
|
|
|
+ gradeVo.setCount(genderMap.get(GenderDictionaryEnum.MALE.getCode()).intValue());
|
|
|
+ }
|
|
|
+ if(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()) != null){
|
|
|
+ gradeVo.setCount2(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()).intValue());
|
|
|
+ }
|
|
|
+
|
|
|
gradeList.add(gradeVo);
|
|
|
}
|
|
|
Collections.reverse(gradeList);
|
|
|
result.setGradeList(gradeList);
|
|
|
|
|
|
- Map<String, List<Map<String, Object>>> deptMap = list.stream().filter(x -> ObjectUtil.isNotNull(x.get("user_id"))).collect(Collectors.groupingBy(x -> x.get("dept_name").toString()));
|
|
|
+ Map<String, List<Map<String, Object>>> deptMap = list.stream().filter(x -> ObjectUtil.isNotNull(x.get("dept_name"))).collect(Collectors.groupingBy(x -> x.get("dept_name").toString()));
|
|
|
List<ItemCount2Vo> deptList = new ArrayList<>();
|
|
|
for (String deptName : deptMap.keySet()) {
|
|
|
- List<Map<String, Object>> deptDataList = gradeMap.get(deptName);
|
|
|
- Map<String, Long> genderMap = deptDataList.stream().collect(Collectors.groupingBy(x -> x.get("gender").toString(), Collectors.counting()));
|
|
|
+ List<Map<String, Object>> deptDataList = deptMap.get(deptName);
|
|
|
+ Map<String, Long> genderMap = deptDataList.stream().filter(x -> ObjectUtil.isNotNull(x.get("gender"))).collect(Collectors.groupingBy(x -> x.get("gender").toString(), Collectors.counting()));
|
|
|
ItemCount2Vo deptVo = new ItemCount2Vo();
|
|
|
deptVo.setItem(deptName);
|
|
|
- deptVo.setCount(genderMap.get(GenderDictionaryEnum.MALE.getCode()).intValue());
|
|
|
- deptVo.setCount2(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()).intValue());
|
|
|
+ if(genderMap.get(GenderDictionaryEnum.MALE.getCode()) != null){
|
|
|
+ deptVo.setCount(genderMap.get(GenderDictionaryEnum.MALE.getCode()).intValue());
|
|
|
+ }
|
|
|
+ if(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()) != null){
|
|
|
+ deptVo.setCount2(genderMap.get(GenderDictionaryEnum.FEMALE.getCode()).intValue());
|
|
|
+ }
|
|
|
+
|
|
|
deptList.add(deptVo);
|
|
|
}
|
|
|
result.setDeptList(deptList);
|