Kaynağa Gözat

人事绩效

chenshudong 1 ay önce
ebeveyn
işleme
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 33
 import com.sundot.airport.common.utils.DateUtils;
34 34
 import com.sundot.airport.common.utils.MonthUtils;
35 35
 import com.sundot.airport.common.utils.SecurityUtils;
36
+import com.sundot.airport.common.utils.bean.BeanUtils;
36 37
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
37 38
 import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
38 39
 import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorDetailService;
@@ -332,45 +333,61 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
332 333
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
333 334
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
334 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 346
                             .filter(item -> StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType()))
339 347
                             .collect(Collectors.toList());
340
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
348
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
349
+                    return newDetail;
341 350
                 })
342 351
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
343 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 355
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
347 356
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
348 357
                         .filter(ObjUtil::isNotNull)
349 358
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
350 359
         result.setOtherIndexSafetyScoreWithSocStationQcDeduction(otherIndexSafetyScoreWithSocStationQcDeduction);
351
-        result.setOtherIndexSafetyScoreWithSocStationQcAccordList(otherIndexWithSocStationQcAccordList);
360
+        result.setOtherIndexSafetyScoreWithSocStationQcAccordList(otherIndexWithSocStationQcAccordListFiltered);
352 361
         // 其他指标-安全-不仅含SOC/站品控检查扣分
353 362
         List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithoutSocStationQcAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
354 363
                 .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
355 364
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
356 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 376
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
361 377
                             .collect(Collectors.toList());
362
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
378
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
379
+                    return newDetail;
363 380
                 })
364 381
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
365 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 385
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
369 386
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
370 387
                         .filter(ObjUtil::isNotNull)
371 388
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
372 389
         result.setOtherIndexSafetyScoreWithoutSocStationQcDeduction(otherIndexSafetyScoreWithoutSocStationQcDeduction);
373
-        result.setOtherIndexSafetyScoreWithoutSocStationQcAccordList(otherIndexWithoutSocStationQcAccordList);
390
+        result.setOtherIndexSafetyScoreWithoutSocStationQcAccordList(otherIndexWithoutSocStationQcAccordListFiltered);
374 391
         // 其他指标-非安全
375 392
         List<BasePerformanceIndicatorCategory> otherIndexNonSafetyCategory = otherIndexCategoryChildren.stream().filter(item -> !StrUtil.equals("安全", item.getName())).collect(Collectors.toList());
376 393
         List<String> otherIndexNonSafetyCategoryCodeList = getIndicatorCodeList(otherIndexNonSafetyCategory.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList()));
@@ -392,23 +409,31 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
392 409
                 .filter(item -> socStationQcInvolvedCoreSafetyCodeList.contains(item.getIndicatorCode()))
393 410
                 .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
394 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 422
                             .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getQcDeptType()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getQcDeptType())))
399 423
                             .collect(Collectors.toList());
400
-                    personnelMonthlyAssessmentIndicatorDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
424
+                    newDetail.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(filteredItemList);
425
+                    return newDetail;
401 426
                 })
402 427
                 .filter(item -> CollUtil.isNotEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()))
403 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 431
                         .flatMap(item -> CollUtil.isEmpty(item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList()) ? Stream.empty() : item.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().stream())
407 432
                         .map(PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail::getScore)
408 433
                         .filter(ObjUtil::isNotNull)
409 434
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
410 435
         result.setSocStationQcInvolvedCoreSafetyDeduction(socStationQcInvolvedCoreSafetyDeduction);
411
-        result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordList);
436
+        result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordListFiltered);
412 437
         // 分管员工数量+扣分平均值
413 438
         if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
414 439
             PersonnelNonCadreMonthlyAssessment queryKeZhang = new PersonnelNonCadreMonthlyAssessment();
@@ -460,6 +485,13 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
460 485
         } else if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
461 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
     /**