|
|
@@ -1,18 +1,26 @@
|
|
1
|
1
|
package com.sundot.airport.personnel.service.impl;
|
|
2
|
2
|
|
|
|
3
|
+import java.math.BigDecimal;
|
|
|
4
|
+import java.util.ArrayList;
|
|
3
|
5
|
import java.util.List;
|
|
4
|
6
|
import java.util.Map;
|
|
|
7
|
+import java.util.Optional;
|
|
5
|
8
|
import java.util.stream.Collectors;
|
|
6
|
9
|
|
|
7
|
10
|
import cn.hutool.core.collection.CollUtil;
|
|
8
|
11
|
import cn.hutool.core.util.ObjUtil;
|
|
|
12
|
+import cn.hutool.core.util.StrUtil;
|
|
9
|
13
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
10
|
14
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
15
|
+import com.sundot.airport.common.enums.BasePerformanceIndicatorQcDeptTypeEnum;
|
|
|
16
|
+import com.sundot.airport.common.enums.BasePerformanceIndicatorRewardPunishmentTypeTypeEnum;
|
|
11
|
17
|
import com.sundot.airport.common.utils.DateUtils;
|
|
12
|
18
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
|
|
13
|
19
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
|
|
14
|
20
|
import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorDetailService;
|
|
15
|
21
|
import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailService;
|
|
|
22
|
+import com.sundot.airport.system.domain.BasePerformanceIndicatorCategory;
|
|
|
23
|
+import com.sundot.airport.system.service.IBasePerformanceIndicatorCategoryService;
|
|
16
|
24
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
17
|
25
|
import org.springframework.stereotype.Service;
|
|
18
|
26
|
import com.sundot.airport.personnel.mapper.PersonnelNonCadreMonthlyAssessmentMapper;
|
|
|
@@ -34,6 +42,8 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
34
|
42
|
private IPersonnelMonthlyAssessmentIndicatorDetailService personnelMonthlyAssessmentIndicatorDetailService;
|
|
35
|
43
|
@Autowired
|
|
36
|
44
|
private IPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailService personnelMonthlyAssessmentIndicatorRewardPunishmentDetailService;
|
|
|
45
|
+ @Autowired
|
|
|
46
|
+ private IBasePerformanceIndicatorCategoryService basePerformanceIndicatorCategoryService;
|
|
37
|
47
|
|
|
38
|
48
|
/**
|
|
39
|
49
|
* 查询非干部月度考核
|
|
|
@@ -66,6 +76,78 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
66
|
76
|
personnelMonthlyAssessmentIndicatorDetailList.forEach(item -> {
|
|
67
|
77
|
item.setPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList(rewardPunishmentDetailMap.get(item.getId()));
|
|
68
|
78
|
});
|
|
|
79
|
+
|
|
|
80
|
+ List<BasePerformanceIndicatorCategory> indicatorCategoryyList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(new BasePerformanceIndicatorCategory());
|
|
|
81
|
+ // 红线指标
|
|
|
82
|
+ BasePerformanceIndicatorCategory redLineIndexCategory = indicatorCategoryyList.stream().filter(item -> StrUtil.equals("红线指标", item.getName())).findFirst().orElse(null);
|
|
|
83
|
+ List<BasePerformanceIndicatorCategory> redLineIndexCategoryChildren = (List<BasePerformanceIndicatorCategory>) redLineIndexCategory.getChildren();
|
|
|
84
|
+ List<String> redLineIndexCategoryCodeList = redLineIndexCategoryChildren.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList());
|
|
|
85
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> redLineIndexAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream().filter(item -> redLineIndexCategoryCodeList.contains(item.getIndicatorCode())).collect(Collectors.toList());
|
|
|
86
|
+ Integer redLineIndexTriggerCount = redLineIndexAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getOccurCount).filter(ObjUtil::isNotNull).reduce(0, Integer::sum);
|
|
|
87
|
+ result.setRedLineIndexTriggerCount(redLineIndexTriggerCount);
|
|
|
88
|
+ result.setRedLineIndexAccordList(redLineIndexAccordList);
|
|
|
89
|
+ // 核心指标
|
|
|
90
|
+ BasePerformanceIndicatorCategory coreIndexCategory = indicatorCategoryyList.stream().filter(item -> StrUtil.equals("核心指标", item.getName())).findFirst().orElse(null);
|
|
|
91
|
+ List<BasePerformanceIndicatorCategory> coreIndexCategoryChildren = (List<BasePerformanceIndicatorCategory>) coreIndexCategory.getChildren();
|
|
|
92
|
+ List<String> coreIndexCategoryCodeList = coreIndexCategoryChildren.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList());
|
|
|
93
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> coreIndexAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream().filter(item -> coreIndexCategoryCodeList.contains(item.getIndicatorCode())).collect(Collectors.toList());
|
|
|
94
|
+ BigDecimal coreIndexScore = coreIndexAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
95
|
+ result.setCoreIndexScore(coreIndexScore);
|
|
|
96
|
+ result.setCoreIndexAccordList(coreIndexAccordList);
|
|
|
97
|
+ // 其他指标
|
|
|
98
|
+ BasePerformanceIndicatorCategory otherIndexCategory = indicatorCategoryyList.stream().filter(item -> StrUtil.equals("其他指标", item.getName())).findFirst().orElse(null);
|
|
|
99
|
+ List<BasePerformanceIndicatorCategory> otherIndexCategoryChildren = (List<BasePerformanceIndicatorCategory>) otherIndexCategory.getChildren();
|
|
|
100
|
+ List<String> otherIndexCategoryCodeList = otherIndexCategoryChildren.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList());
|
|
|
101
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream().filter(item -> otherIndexCategoryCodeList.contains(item.getIndicatorCode())).collect(Collectors.toList());
|
|
|
102
|
+ BigDecimal otherIndexScore = otherIndexAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
103
|
+ result.setOtherIndexScore(otherIndexScore);
|
|
|
104
|
+ result.setOtherIndexAccordList(otherIndexAccordList);
|
|
|
105
|
+ // 其他指标-安全
|
|
|
106
|
+ List<BasePerformanceIndicatorCategory> otherIndexSafetyCategory = otherIndexCategoryChildren.stream().filter(item -> StrUtil.equals("安全", item.getName())).collect(Collectors.toList());
|
|
|
107
|
+ List<String> otherIndexSafetyCategoryCodeList = otherIndexSafetyCategory.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList());
|
|
|
108
|
+ // 其他指标-安全-仅含SOC/站品控检查扣分
|
|
|
109
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithSocStationQcAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
110
|
+ .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
|
|
|
111
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getIndicatorCode()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getIndicatorCode()))
|
|
|
112
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
113
|
+ .collect(Collectors.toList());
|
|
|
114
|
+ BigDecimal otherIndexSafetyScoreWithSocStationQcDeduction = otherIndexWithSocStationQcAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
115
|
+ result.setOtherIndexSafetyScoreWithSocStationQcDeduction(otherIndexSafetyScoreWithSocStationQcDeduction);
|
|
|
116
|
+ result.setOtherIndexSafetyScoreWithSocStationQcAccordList(otherIndexWithSocStationQcAccordList);
|
|
|
117
|
+ // 其他指标-安全-不仅含SOC/站品控检查扣分
|
|
|
118
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexWithoutSocStationQcAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
119
|
+ .filter(item -> otherIndexSafetyCategoryCodeList.contains(item.getIndicatorCode()))
|
|
|
120
|
+ .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getIndicatorCode()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getIndicatorCode())))
|
|
|
121
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
122
|
+ .collect(Collectors.toList());
|
|
|
123
|
+ BigDecimal otherIndexSafetyScoreWithoutSocStationQcDeduction = otherIndexWithoutSocStationQcAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
124
|
+ result.setOtherIndexSafetyScoreWithoutSocStationQcDeduction(otherIndexSafetyScoreWithoutSocStationQcDeduction);
|
|
|
125
|
+ result.setOtherIndexSafetyScoreWithoutSocStationQcAccordList(otherIndexWithoutSocStationQcAccordList);
|
|
|
126
|
+ // 其他指标-非安全
|
|
|
127
|
+ List<BasePerformanceIndicatorCategory> otherIndexNonSafetyCategory = otherIndexCategoryChildren.stream().filter(item -> !StrUtil.equals("安全", item.getName())).collect(Collectors.toList());
|
|
|
128
|
+ List<String> otherIndexNonSafetyCategoryCodeList = otherIndexNonSafetyCategory.stream().map(BasePerformanceIndicatorCategory::getCode).collect(Collectors.toList());
|
|
|
129
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> otherIndexNonSafetyAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
130
|
+ .filter(item -> otherIndexNonSafetyCategoryCodeList.contains(item.getIndicatorCode()))
|
|
|
131
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
132
|
+ .collect(Collectors.toList());
|
|
|
133
|
+ BigDecimal otherIndexNonSafetyDeduction = otherIndexNonSafetyAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
134
|
+ result.setOtherIndexNonSafetyDeduction(otherIndexNonSafetyDeduction);
|
|
|
135
|
+ result.setOtherIndexNonSafetyAccordList(otherIndexNonSafetyAccordList);
|
|
|
136
|
+ // 非核心安全+核心扣分
|
|
|
137
|
+ BigDecimal nonCoreSafetyPlusCoreDeduction = result.getOtherIndexSafetyScoreWithSocStationQcDeduction().add(result.getOtherIndexSafetyScoreWithoutSocStationQcDeduction()).add(result.getOtherIndexNonSafetyDeduction());
|
|
|
138
|
+ result.setNonCoreSafetyPlusCoreDeduction(nonCoreSafetyPlusCoreDeduction);
|
|
|
139
|
+ // 核心指标+其他指标-安全
|
|
|
140
|
+ List<String> socStationQcInvolvedCoreSafetyCodeList = new ArrayList<>();
|
|
|
141
|
+ socStationQcInvolvedCoreSafetyCodeList.addAll(coreIndexCategoryCodeList);
|
|
|
142
|
+ socStationQcInvolvedCoreSafetyCodeList.addAll(otherIndexSafetyCategoryCodeList);
|
|
|
143
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> socStationQcInvolvedCoreSafetyAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
144
|
+ .filter(item -> socStationQcInvolvedCoreSafetyCodeList.contains(item.getIndicatorCode()))
|
|
|
145
|
+ .filter(item -> !(StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.SOC.getCode(), item.getIndicatorCode()) || StrUtil.equals(BasePerformanceIndicatorQcDeptTypeEnum.STATION_QC.getCode(), item.getIndicatorCode())))
|
|
|
146
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
147
|
+ .collect(Collectors.toList());
|
|
|
148
|
+ BigDecimal socStationQcInvolvedCoreSafetyDeduction = socStationQcInvolvedCoreSafetyAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
149
|
+ result.setSocStationQcInvolvedCoreSafetyDeduction(socStationQcInvolvedCoreSafetyDeduction);
|
|
|
150
|
+ result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordList);
|
|
69
|
151
|
return result;
|
|
70
|
152
|
}
|
|
71
|
153
|
|