chenshudong před 1 měsícem
rodič
revize
59f6c3958e

+ 53 - 21
airport-personnel/src/main/java/com/sundot/airport/personnel/service/impl/PersonnelNonCadreMonthlyAssessmentServiceImpl.java

@@ -33,6 +33,7 @@ import com.sundot.airport.common.exception.ServiceException;
33
 import com.sundot.airport.common.utils.DateUtils;
33
 import com.sundot.airport.common.utils.DateUtils;
34
 import com.sundot.airport.common.utils.MonthUtils;
34
 import com.sundot.airport.common.utils.MonthUtils;
35
 import com.sundot.airport.common.utils.SecurityUtils;
35
 import com.sundot.airport.common.utils.SecurityUtils;
36
+import com.sundot.airport.common.utils.bean.BeanUtils;
36
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
37
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
37
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
38
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
38
 import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorDetailService;
39
 import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorDetailService;
@@ -332,45 +333,61 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
332
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
333
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
333
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
334
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
334
                 .collect(Collectors.toList());
335
                 .collect(Collectors.toList());
335
-        otherIndexWithSocStationQcAccordList = otherIndexWithSocStationQcAccordList.stream()
336
-                .peek(personnelMonthlyAssessmentIndicatorDetail -> {
337
-                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream()
336
+        List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithSocStationQcAccordListFiltered = otherIndexWithSocStationQcAccordList.stream()
337
+                .map(personnelMonthlyAssessmentIndicatorDetail -> {
338
+                    PersonnelMonthlyAssessmentIndicatorDetail newDetail = new PersonnelMonthlyAssessmentIndicatorDetail();
339
+                    BeanUtils.copyProperties(personnelMonthlyAssessmentIndicatorDetail, newDetail);
340
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> originalList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList();
341
+                    if (CollUtil.isEmpty(originalList)) {
342
+                        newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(new ArrayList<>());
343
+                        return newDetail;
344
+                    }
345
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = originalList.stream()
338
                             .filter(item -> StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType()))
346
                             .filter(item -> StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType()))
339
                             .collect(Collectors.toList());
347
                             .collect(Collectors.toList());
340
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
348
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
349
+                    return newDetail;
341
                 })
350
                 })
342
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
351
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
343
                 .collect(Collectors.toList());
352
                 .collect(Collectors.toList());
344
-        BigDecimal otherIndexSafetyScoreWithSocStationQcDeduction = CollUtil.isEmpty(otherIndexWithSocStationQcAccordList) ? BigDecimal.ZERO :
345
-                otherIndexWithSocStationQcAccordList.stream()
353
+        BigDecimal otherIndexSafetyScoreWithSocStationQcDeduction = CollUtil.isEmpty(otherIndexWithSocStationQcAccordListFiltered) ? BigDecimal.ZERO :
354
+                otherIndexWithSocStationQcAccordListFiltered.stream()
346
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
355
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
347
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
356
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
348
                         .filter(ObjUtil::isNotNull)
357
                         .filter(ObjUtil::isNotNull)
349
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
358
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
350
         result.setOtherIndexSafetyScoreWithSocStationQcDeduction(otherIndexSafetyScoreWithSocStationQcDeduction);
359
         result.setOtherIndexSafetyScoreWithSocStationQcDeduction(otherIndexSafetyScoreWithSocStationQcDeduction);
351
-        result.setOtherIndexSafetyScoreWithSocStationQcAccordList(otherIndexWithSocStationQcAccordList);
360
+        result.setOtherIndexSafetyScoreWithSocStationQcAccordList(otherIndexWithSocStationQcAccordListFiltered);
352
         // 其他指标-安全-不仅含SOC/站品控检查扣分
361
         // 其他指标-安全-不仅含SOC/站品控检查扣分
353
         List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithoutSocStationQcAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
362
         List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithoutSocStationQcAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
354
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
363
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
355
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
364
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
356
                 .collect(Collectors.toList());
365
                 .collect(Collectors.toList());
357
-        otherIndexWithoutSocStationQcAccordList = otherIndexWithoutSocStationQcAccordList.stream()
358
-                .peek(personnelMonthlyAssessmentIndicatorDetail -> {
359
-                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream()
366
+        List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithoutSocStationQcAccordListFiltered = otherIndexWithoutSocStationQcAccordList.stream()
367
+                .map(personnelMonthlyAssessmentIndicatorDetail -> {
368
+                    PersonnelMonthlyAssessmentIndicatorDetail newDetail = new PersonnelMonthlyAssessmentIndicatorDetail();
369
+                    BeanUtils.copyProperties(personnelMonthlyAssessmentIndicatorDetail, newDetail);
370
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> originalList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList();
371
+                    if (CollUtil.isEmpty(originalList)) {
372
+                        newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(new ArrayList<>());
373
+                        return newDetail;
374
+                    }
375
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = originalList.stream()
360
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
376
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
361
                             .collect(Collectors.toList());
377
                             .collect(Collectors.toList());
362
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
378
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
379
+                    return newDetail;
363
                 })
380
                 })
364
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
381
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
365
                 .collect(Collectors.toList());
382
                 .collect(Collectors.toList());
366
-        BigDecimal otherIndexSafetyScoreWithoutSocStationQcDeduction = CollUtil.isEmpty(otherIndexWithoutSocStationQcAccordList) ? BigDecimal.ZERO :
367
-                otherIndexWithoutSocStationQcAccordList.stream()
383
+        BigDecimal otherIndexSafetyScoreWithoutSocStationQcDeduction = CollUtil.isEmpty(otherIndexWithoutSocStationQcAccordListFiltered) ? BigDecimal.ZERO :
384
+                otherIndexWithoutSocStationQcAccordListFiltered.stream()
368
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
385
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
369
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
386
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
370
                         .filter(ObjUtil::isNotNull)
387
                         .filter(ObjUtil::isNotNull)
371
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
388
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
372
         result.setOtherIndexSafetyScoreWithoutSocStationQcDeduction(otherIndexSafetyScoreWithoutSocStationQcDeduction);
389
         result.setOtherIndexSafetyScoreWithoutSocStationQcDeduction(otherIndexSafetyScoreWithoutSocStationQcDeduction);
373
-        result.setOtherIndexSafetyScoreWithoutSocStationQcAccordList(otherIndexWithoutSocStationQcAccordList);
390
+        result.setOtherIndexSafetyScoreWithoutSocStationQcAccordList(otherIndexWithoutSocStationQcAccordListFiltered);
374
         // 其他指标-非安全
391
         // 其他指标-非安全
375
         List<BasePerformanceIndicatorCategory> otherIndexNonSafetyCategory = otherIndexCategoryChildren.stream().filter(item -> !StrUtil.equals("安全", item.getName())).collect(Collectors.toList());
392
         List<BasePerformanceIndicatorCategory> otherIndexNonSafetyCategory = otherIndexCategoryChildren.stream().filter(item -> !StrUtil.equals("安全", item.getName())).collect(Collectors.toList());
376
         List<String> otherIndexNonSafetyCategoryCodeList = getIndicatorCodeList(otherIndexNonSafetyCategory.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList()));
393
         List<String> otherIndexNonSafetyCategoryCodeList = getIndicatorCodeList(otherIndexNonSafetyCategory.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList()));
@@ -392,23 +409,31 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
392
                 .filter(item -> socStationQcInvolvedCoreSafetyCodeList.contains(item.getIndicatorCode()))
409
                 .filter(item -> socStationQcInvolvedCoreSafetyCodeList.contains(item.getIndicatorCode()))
393
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
410
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
394
                 .collect(Collectors.toList());
411
                 .collect(Collectors.toList());
395
-        socStationQcInvolvedCoreSafetyAccordList = socStationQcInvolvedCoreSafetyAccordList.stream()
396
-                .peek(personnelMonthlyAssessmentIndicatorDetail -> {
397
-                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream()
412
+        List<PersonnelMonthlyAssessmentIndicatorDetail> socStationQcInvolvedCoreSafetyAccordListFiltered = socStationQcInvolvedCoreSafetyAccordList.stream()
413
+                .map(personnelMonthlyAssessmentIndicatorDetail -> {
414
+                    PersonnelMonthlyAssessmentIndicatorDetail newDetail = new PersonnelMonthlyAssessmentIndicatorDetail();
415
+                    BeanUtils.copyProperties(personnelMonthlyAssessmentIndicatorDetail, newDetail);
416
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> originalList = personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList();
417
+                    if (CollUtil.isEmpty(originalList)) {
418
+                        newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(new ArrayList<>());
419
+                        return newDetail;
420
+                    }
421
+                    List<PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail> filteredItemList = originalList.stream()
398
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
422
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
399
                             .collect(Collectors.toList());
423
                             .collect(Collectors.toList());
400
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
424
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
425
+                    return newDetail;
401
                 })
426
                 })
402
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
427
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
403
                 .collect(Collectors.toList());
428
                 .collect(Collectors.toList());
404
-        BigDecimal socStationQcInvolvedCoreSafetyDeduction = CollUtil.isEmpty(socStationQcInvolvedCoreSafetyAccordList) ? BigDecimal.ZERO :
405
-                socStationQcInvolvedCoreSafetyAccordList.stream()
429
+        BigDecimal socStationQcInvolvedCoreSafetyDeduction = CollUtil.isEmpty(socStationQcInvolvedCoreSafetyAccordListFiltered) ? BigDecimal.ZERO :
430
+                socStationQcInvolvedCoreSafetyAccordListFiltered.stream()
406
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
431
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
407
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
432
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
408
                         .filter(ObjUtil::isNotNull)
433
                         .filter(ObjUtil::isNotNull)
409
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
434
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
410
         result.setSocStationQcInvolvedCoreSafetyDeduction(socStationQcInvolvedCoreSafetyDeduction);
435
         result.setSocStationQcInvolvedCoreSafetyDeduction(socStationQcInvolvedCoreSafetyDeduction);
411
-        result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordList);
436
+        result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordListFiltered);
412
         // 分管员工数量+扣分平均值
437
         // 分管员工数量+扣分平均值
413
         if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
438
         if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
414
             PersonnelNonCadreMonthlyAssessment queryKeZhang = new PersonnelNonCadreMonthlyAssessment();
439
             PersonnelNonCadreMonthlyAssessment queryKeZhang = new PersonnelNonCadreMonthlyAssessment();
@@ -460,6 +485,13 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
460
         } else if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
485
         } else if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
461
             doSupervisor(result);
486
             doSupervisor(result);
462
         }
487
         }
488
+        if (CollUtil.isNotEmpty(result.getPersonnelMonthlyAssessmentIndicatorDetailList())) {
489
+            result.getPersonnelMonthlyAssessmentIndicatorDetailList().forEach(personnelMonthlyAssessmentIndicatorDetail -> {
490
+                if (CollUtil.isEmpty(personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList())) {
491
+                    throw new ServiceException("奖罚明细列表为空");
492
+                }
493
+            });
494
+        }
463
     }
495
     }
464
 
496
 
465
     /**
497
     /**