|
|
@@ -1,10 +1,10 @@
|
|
1
|
1
|
package com.sundot.airport.personnel.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import java.math.BigDecimal;
|
|
|
4
|
+import java.math.RoundingMode;
|
|
4
|
5
|
import java.util.ArrayList;
|
|
5
|
6
|
import java.util.List;
|
|
6
|
7
|
import java.util.Map;
|
|
7
|
|
-import java.util.Optional;
|
|
8
|
8
|
import java.util.stream.Collectors;
|
|
9
|
9
|
|
|
10
|
10
|
import cn.hutool.core.collection.CollUtil;
|
|
|
@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
14
|
14
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
15
|
15
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorQcDeptTypeEnum;
|
|
16
|
16
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorRewardPunishmentTypeTypeEnum;
|
|
|
17
|
+import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
|
18
|
+import com.sundot.airport.common.exception.ServiceException;
|
|
17
|
19
|
import com.sundot.airport.common.utils.DateUtils;
|
|
18
|
20
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
|
|
19
|
21
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
|
|
|
@@ -36,6 +38,11 @@ import org.springframework.transaction.annotation.Transactional;
|
|
36
|
38
|
*/
|
|
37
|
39
|
@Service
|
|
38
|
40
|
public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<PersonnelNonCadreMonthlyAssessmentMapper, PersonnelNonCadreMonthlyAssessment> implements IPersonnelNonCadreMonthlyAssessmentService {
|
|
|
41
|
+ // 基础分
|
|
|
42
|
+ private static final BigDecimal BASE_SCORE = new BigDecimal(80);
|
|
|
43
|
+ // 红线分
|
|
|
44
|
+ private static final BigDecimal RED_LINE_SCORE = new BigDecimal(69);
|
|
|
45
|
+
|
|
39
|
46
|
@Autowired
|
|
40
|
47
|
private PersonnelNonCadreMonthlyAssessmentMapper personnelNonCadreMonthlyAssessmentMapper;
|
|
41
|
48
|
@Autowired
|
|
|
@@ -148,6 +155,49 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
148
|
155
|
BigDecimal socStationQcInvolvedCoreSafetyDeduction = socStationQcInvolvedCoreSafetyAccordList.stream().map(PersonnelMonthlyAssessmentIndicatorDetail::getScoreResult).filter(ObjUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
149
|
156
|
result.setSocStationQcInvolvedCoreSafetyDeduction(socStationQcInvolvedCoreSafetyDeduction);
|
|
150
|
157
|
result.setSocStationQcInvolvedCoreSafetyAccordList(socStationQcInvolvedCoreSafetyAccordList);
|
|
|
158
|
+ // 分管员工数量+扣分平均值
|
|
|
159
|
+ if (StrUtil.equals(RoleTypeEnum.kezhang.getCode(), result.getRoleKey())) {
|
|
|
160
|
+ PersonnelNonCadreMonthlyAssessment queryKeZhang = new PersonnelNonCadreMonthlyAssessment();
|
|
|
161
|
+ queryKeZhang.setAssessmentMonth(result.getAssessmentMonth());
|
|
|
162
|
+ queryKeZhang.setDeputySupervisorId(result.getUserId());
|
|
|
163
|
+ List<PersonnelNonCadreMonthlyAssessment> personnelNonCadreMonthlyAssessmentKeZhangList = personnelNonCadreMonthlyAssessmentMapper.selectPersonnelNonCadreMonthlyAssessmentList(queryKeZhang);
|
|
|
164
|
+ result.setInChargeEmployeeCount(personnelNonCadreMonthlyAssessmentKeZhangList.size());
|
|
|
165
|
+ result.setDeductionAverage(CollUtil.isEmpty(personnelNonCadreMonthlyAssessmentKeZhangList) ? BigDecimal.ZERO : result.getSocStationQcInvolvedCoreSafetyDeduction().divide(BigDecimal.valueOf(personnelNonCadreMonthlyAssessmentKeZhangList.size()), 2, RoundingMode.HALF_UP));
|
|
|
166
|
+ }
|
|
|
167
|
+ // 总分
|
|
|
168
|
+ BigDecimal totalScore = BASE_SCORE.add(result.getCoreIndexScore()).add(result.getOtherIndexScore());
|
|
|
169
|
+ if (result.getRedLineIndexTriggerCount() > 0) {
|
|
|
170
|
+ totalScore = RED_LINE_SCORE;
|
|
|
171
|
+ }
|
|
|
172
|
+ result.setTotalScore(totalScore);
|
|
|
173
|
+ // 奖励明细+惩罚明细
|
|
|
174
|
+ List<String> coreAndOtherCategoryCodeList = new ArrayList<>();
|
|
|
175
|
+ coreAndOtherCategoryCodeList.addAll(coreIndexCategoryCodeList);
|
|
|
176
|
+ coreAndOtherCategoryCodeList.addAll(otherIndexCategoryCodeList);
|
|
|
177
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> rewardAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
178
|
+ .filter(item -> coreAndOtherCategoryCodeList.contains(item.getIndicatorCode()))
|
|
|
179
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.REWARD.getCode(), item.getRewardPunishmentType()))
|
|
|
180
|
+ .collect(Collectors.toList());
|
|
|
181
|
+ result.setRewardAccordList(rewardAccordList);
|
|
|
182
|
+ List<PersonnelMonthlyAssessmentIndicatorDetail> punishmentAccordList = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
183
|
+ .filter(item -> coreAndOtherCategoryCodeList.contains(item.getIndicatorCode()))
|
|
|
184
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
185
|
+ .collect(Collectors.toList());
|
|
|
186
|
+ punishmentAccordList.addAll(result.getRedLineIndexAccordList());
|
|
|
187
|
+ result.setPunishmentAccordList(punishmentAccordList);
|
|
|
188
|
+ // 奖励金额+惩罚金额
|
|
|
189
|
+ BigDecimal rewardAmount = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
190
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.REWARD.getCode(), item.getRewardPunishmentType()))
|
|
|
191
|
+ .map(PersonnelMonthlyAssessmentIndicatorDetail::getAmountResult)
|
|
|
192
|
+ .filter(ObjUtil::isNotNull)
|
|
|
193
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
194
|
+ result.setRewardAmount(rewardAmount);
|
|
|
195
|
+ BigDecimal punishmentAmount = result.getPersonnelMonthlyAssessmentIndicatorDetailList().stream()
|
|
|
196
|
+ .filter(item -> StrUtil.equals(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode(), item.getRewardPunishmentType()))
|
|
|
197
|
+ .map(PersonnelMonthlyAssessmentIndicatorDetail::getAmountResult)
|
|
|
198
|
+ .filter(ObjUtil::isNotNull)
|
|
|
199
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
200
|
+ result.setPunishmentAmount(punishmentAmount);
|
|
151
|
201
|
return result;
|
|
152
|
202
|
}
|
|
153
|
203
|
|
|
|
@@ -171,6 +221,13 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
171
|
221
|
@Transactional(rollbackFor = Exception.class)
|
|
172
|
222
|
@Override
|
|
173
|
223
|
public int insertPersonnelNonCadreMonthlyAssessment(PersonnelNonCadreMonthlyAssessment personnelNonCadreMonthlyAssessment) {
|
|
|
224
|
+ PersonnelNonCadreMonthlyAssessment temp = new PersonnelNonCadreMonthlyAssessment();
|
|
|
225
|
+ temp.setAssessmentMonth(personnelNonCadreMonthlyAssessment.getAssessmentMonth());
|
|
|
226
|
+ temp.setUserId(personnelNonCadreMonthlyAssessment.getUserId());
|
|
|
227
|
+ List<PersonnelNonCadreMonthlyAssessment> tempList = personnelNonCadreMonthlyAssessmentMapper.selectPersonnelNonCadreMonthlyAssessmentList(temp);
|
|
|
228
|
+ if (CollUtil.isNotEmpty(tempList)) {
|
|
|
229
|
+ throw new ServiceException("该用户已存在该考核月份的考核记录");
|
|
|
230
|
+ }
|
|
174
|
231
|
personnelNonCadreMonthlyAssessment.setCreateTime(DateUtils.getNowDate());
|
|
175
|
232
|
int result = personnelNonCadreMonthlyAssessmentMapper.insertPersonnelNonCadreMonthlyAssessment(personnelNonCadreMonthlyAssessment);
|
|
176
|
233
|
if (CollUtil.isNotEmpty(personnelNonCadreMonthlyAssessment.getPersonnelMonthlyAssessmentIndicatorDetailList())) {
|