Selaa lähdekoodia

非干部月度考核分数汇总

chenshudong 3 viikkoa sitten
vanhempi
commit
a522e51daa

+ 27 - 3
airport-admin/src/main/java/com/sundot/airport/web/controller/personnel/PersonnelNonCadreMonthlyAssessmentScoreSummaryController.java

@@ -216,7 +216,7 @@ public class PersonnelNonCadreMonthlyAssessmentScoreSummaryController extends Ba
216
                     .filter(item -> deptIdList.contains(item.getBrigadeId()))
216
                     .filter(item -> deptIdList.contains(item.getBrigadeId()))
217
                     .collect(Collectors.toList());
217
                     .collect(Collectors.toList());
218
             if (CollUtil.isEmpty(list)) {
218
             if (CollUtil.isEmpty(list)) {
219
-                return success(createEmptyScoreRangeDistribution());
219
+                return success(createEmptyScoreRangeDistribution(deptMap));
220
             }
220
             }
221
             // 定义6个分数段
221
             // 定义6个分数段
222
             String[] rangeKeys = {"below70", "70-75", "75-80", "80-85", "85-90", "above90"};
222
             String[] rangeKeys = {"below70", "70-75", "75-80", "80-85", "85-90", "above90"};
@@ -347,7 +347,7 @@ public class PersonnelNonCadreMonthlyAssessmentScoreSummaryController extends Ba
347
     /**
347
     /**
348
      * 创建空的分值区间分布数据
348
      * 创建空的分值区间分布数据
349
      */
349
      */
350
-    private List<ScoreRangeDistributionDto> createEmptyScoreRangeDistribution() {
350
+    private List<ScoreRangeDistributionDto> createEmptyScoreRangeDistribution(Map<Long, SysDept> deptMap) {
351
         List<ScoreRangeDistributionDto> result = new ArrayList<>();
351
         List<ScoreRangeDistributionDto> result = new ArrayList<>();
352
         String[] rangeKeys = {"below70", "70-75", "75-80", "80-85", "85-90", "above90"};
352
         String[] rangeKeys = {"below70", "70-75", "75-80", "80-85", "85-90", "above90"};
353
         String[] rangeLabels = {"低于70", "[70-75)", "[75-80)", "[80-85)", "[85-90)", "90以上"};
353
         String[] rangeLabels = {"低于70", "[70-75)", "[75-80)", "[80-85)", "[85-90)", "90以上"};
@@ -357,9 +357,33 @@ public class PersonnelNonCadreMonthlyAssessmentScoreSummaryController extends Ba
357
             rangeDto.setRangeKey(rangeKeys[i]);
357
             rangeDto.setRangeKey(rangeKeys[i]);
358
             rangeDto.setRangeLabel(rangeLabels[i]);
358
             rangeDto.setRangeLabel(rangeLabels[i]);
359
             rangeDto.setTotalCount(0);
359
             rangeDto.setTotalCount(0);
360
-            rangeDto.setDeptCounts(Collections.emptyList());
360
+            List<ScoreRangeDistributionDto.DeptCountItemDto> deptCounts = new ArrayList<>();
361
+            deptMap.forEach((deptId, dept) -> {
362
+                ScoreRangeDistributionDto.DeptCountItemDto deptItem = new ScoreRangeDistributionDto.DeptCountItemDto();
363
+                deptItem.setDeptId(deptId);
364
+                deptItem.setDeptName(dept.getDeptName());
365
+                deptItem.setCount(0);
366
+                deptCounts.add(deptItem);
367
+            });
368
+            deptCounts.sort(Comparator.comparing(ScoreRangeDistributionDto.DeptCountItemDto::getDeptId));
369
+            rangeDto.setDeptCounts(deptCounts);
361
             result.add(rangeDto);
370
             result.add(rangeDto);
362
         }
371
         }
372
+        ScoreRangeDistributionDto rangeTotalDto = new ScoreRangeDistributionDto();
373
+        rangeTotalDto.setRangeKey("小计");
374
+        rangeTotalDto.setRangeLabel("小计");
375
+        rangeTotalDto.setTotalCount(0);
376
+        List<ScoreRangeDistributionDto.DeptCountItemDto> deptCountTotals = new ArrayList<>();
377
+        deptMap.forEach((deptId, dept) -> {
378
+            ScoreRangeDistributionDto.DeptCountItemDto deptItem = new ScoreRangeDistributionDto.DeptCountItemDto();
379
+            deptItem.setDeptId(deptId);
380
+            deptItem.setDeptName(dept.getDeptName());
381
+            deptItem.setCount(0);
382
+            deptCountTotals.add(deptItem);
383
+        });
384
+        deptCountTotals.sort(Comparator.comparing(ScoreRangeDistributionDto.DeptCountItemDto::getDeptId));
385
+        rangeTotalDto.setDeptCounts(deptCountTotals);
386
+        result.add(rangeTotalDto);
363
         return result;
387
         return result;
364
     }
388
     }
365
 
389