|
|
@@ -14,6 +14,8 @@ import cn.hutool.core.util.StrUtil;
|
|
14
|
14
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
15
|
15
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
16
|
16
|
import com.sundot.airport.common.core.domain.entity.SysUser;
|
|
|
17
|
+import com.sundot.airport.common.dto.SysPersonnelUserConditionDto;
|
|
|
18
|
+import com.sundot.airport.common.dto.SysUserLeaderConditionDto;
|
|
17
|
19
|
import com.sundot.airport.common.enums.AssessmentTeamEnum;
|
|
18
|
20
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorApplicationMethodRuleEnum;
|
|
19
|
21
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorAssessmentResultRuleEnum;
|
|
|
@@ -22,9 +24,11 @@ import com.sundot.airport.common.enums.BasePerformanceIndicatorLeaveTypeEnum;
|
|
22
|
24
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorQcDeptTypeEnum;
|
|
23
|
25
|
import com.sundot.airport.common.enums.BasePerformanceIndicatorRewardPunishmentTypeTypeEnum;
|
|
24
|
26
|
import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
|
27
|
+import com.sundot.airport.common.event.PersonnelEvent;
|
|
25
|
28
|
import com.sundot.airport.common.exception.ServiceException;
|
|
26
|
29
|
import com.sundot.airport.common.utils.DateUtils;
|
|
27
|
30
|
import com.sundot.airport.common.utils.MonthUtils;
|
|
|
31
|
+import com.sundot.airport.common.utils.SecurityUtils;
|
|
28
|
32
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorDetail;
|
|
29
|
33
|
import com.sundot.airport.personnel.domain.PersonnelMonthlyAssessmentIndicatorRewardPunishmentDetail;
|
|
30
|
34
|
import com.sundot.airport.personnel.service.IPersonnelMonthlyAssessmentIndicatorDetailService;
|
|
|
@@ -33,6 +37,7 @@ import com.sundot.airport.system.domain.BasePerformanceIndicatorCategory;
|
|
33
|
37
|
import com.sundot.airport.system.service.IBasePerformanceIndicatorCategoryService;
|
|
34
|
38
|
import com.sundot.airport.system.service.ISysUserService;
|
|
35
|
39
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
40
|
+import org.springframework.context.ApplicationEventPublisher;
|
|
36
|
41
|
import org.springframework.stereotype.Service;
|
|
37
|
42
|
import com.sundot.airport.personnel.mapper.PersonnelNonCadreMonthlyAssessmentMapper;
|
|
38
|
43
|
import com.sundot.airport.personnel.domain.PersonnelNonCadreMonthlyAssessment;
|
|
|
@@ -62,6 +67,8 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
62
|
67
|
private IBasePerformanceIndicatorCategoryService basePerformanceIndicatorCategoryService;
|
|
63
|
68
|
@Autowired
|
|
64
|
69
|
private ISysUserService sysUserService;
|
|
|
70
|
+ @Autowired
|
|
|
71
|
+ private ApplicationEventPublisher eventPublisher;
|
|
65
|
72
|
|
|
66
|
73
|
/**
|
|
67
|
74
|
* 查询非干部月度考核
|
|
|
@@ -92,8 +99,6 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
92
|
99
|
});
|
|
93
|
100
|
}
|
|
94
|
101
|
}
|
|
95
|
|
- // 完善数据
|
|
96
|
|
- doImprove(result);
|
|
97
|
102
|
return result;
|
|
98
|
103
|
}
|
|
99
|
104
|
|
|
|
@@ -125,6 +130,8 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
125
|
130
|
throw new ServiceException("该用户已存在该考核月份的考核记录");
|
|
126
|
131
|
}
|
|
127
|
132
|
personnelNonCadreMonthlyAssessment.setCreateTime(DateUtils.getNowDate());
|
|
|
133
|
+ // 完善数据
|
|
|
134
|
+ doImprove(personnelNonCadreMonthlyAssessment);
|
|
128
|
135
|
int result = personnelNonCadreMonthlyAssessmentMapper.insertPersonnelNonCadreMonthlyAssessment(personnelNonCadreMonthlyAssessment);
|
|
129
|
136
|
if (CollUtil.isNotEmpty(personnelNonCadreMonthlyAssessment.getPersonnelMonthlyAssessmentIndicatorDetailList())) {
|
|
130
|
137
|
personnelNonCadreMonthlyAssessment.getPersonnelMonthlyAssessmentIndicatorDetailList().forEach(personnelMonthlyAssessmentIndicatorDetail -> {
|
|
|
@@ -142,8 +149,7 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
142
|
149
|
}
|
|
143
|
150
|
});
|
|
144
|
151
|
}
|
|
145
|
|
- PersonnelNonCadreMonthlyAssessment dto = selectPersonnelNonCadreMonthlyAssessmentById(personnelNonCadreMonthlyAssessment.getId());
|
|
146
|
|
- personnelNonCadreMonthlyAssessmentMapper.updatePersonnelNonCadreMonthlyAssessment(dto);
|
|
|
152
|
+ eventPublisher.publishEvent(new PersonnelEvent(this, personnelNonCadreMonthlyAssessment.getAssessmentMonth()));
|
|
147
|
153
|
return result;
|
|
148
|
154
|
}
|
|
149
|
155
|
|
|
|
@@ -171,9 +177,12 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
171
|
177
|
personnelMonthlyAssessmentIndicatorRewardPunishmentDetailService.removeBatchByIds(personnelMonthlyAssessmentIndicatorRewardPunishmentDetailListOld);
|
|
172
|
178
|
}
|
|
173
|
179
|
}
|
|
|
180
|
+ // 完善数据
|
|
|
181
|
+ doImprove(personnelNonCadreMonthlyAssessment);
|
|
174
|
182
|
// 新增新数据
|
|
175
|
183
|
if (CollUtil.isNotEmpty(personnelNonCadreMonthlyAssessment.getPersonnelMonthlyAssessmentIndicatorDetailList())) {
|
|
176
|
184
|
personnelNonCadreMonthlyAssessment.getPersonnelMonthlyAssessmentIndicatorDetailList().forEach(personnelMonthlyAssessmentIndicatorDetail -> {
|
|
|
185
|
+ personnelMonthlyAssessmentIndicatorDetail.setId(null);
|
|
177
|
186
|
personnelMonthlyAssessmentIndicatorDetail.setSourceId(personnelNonCadreMonthlyAssessment.getId());
|
|
178
|
187
|
personnelMonthlyAssessmentIndicatorDetail.setCreateBy(personnelNonCadreMonthlyAssessment.getCreateBy());
|
|
179
|
188
|
personnelMonthlyAssessmentIndicatorDetail.setCreateTime(DateUtils.getNowDate());
|
|
|
@@ -182,6 +191,7 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
182
|
191
|
personnelMonthlyAssessmentIndicatorDetailService.insertPersonnelMonthlyAssessmentIndicatorDetail(personnelMonthlyAssessmentIndicatorDetail);
|
|
183
|
192
|
if (CollUtil.isNotEmpty(personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList())) {
|
|
184
|
193
|
personnelMonthlyAssessmentIndicatorDetail.getPersonnelMonthlyAssessmentIndicatorRewardPunishmentDetailList().forEach(personnelMonthlyAssessmentIndicatorRewardPunishmentDetail -> {
|
|
|
194
|
+ personnelMonthlyAssessmentIndicatorRewardPunishmentDetail.setId(null);
|
|
185
|
195
|
personnelMonthlyAssessmentIndicatorRewardPunishmentDetail.setSourceId(personnelMonthlyAssessmentIndicatorDetail.getId());
|
|
186
|
196
|
personnelMonthlyAssessmentIndicatorRewardPunishmentDetail.setCreateBy(personnelMonthlyAssessmentIndicatorDetail.getCreateBy());
|
|
187
|
197
|
personnelMonthlyAssessmentIndicatorRewardPunishmentDetail.setCreateTime(DateUtils.getNowDate());
|
|
|
@@ -192,8 +202,7 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
192
|
202
|
}
|
|
193
|
203
|
});
|
|
194
|
204
|
}
|
|
195
|
|
- PersonnelNonCadreMonthlyAssessment dto = selectPersonnelNonCadreMonthlyAssessmentById(personnelNonCadreMonthlyAssessment.getId());
|
|
196
|
|
- personnelNonCadreMonthlyAssessmentMapper.updatePersonnelNonCadreMonthlyAssessment(dto);
|
|
|
205
|
+ eventPublisher.publishEvent(new PersonnelEvent(this, personnelNonCadreMonthlyAssessment.getAssessmentMonth()));
|
|
197
|
206
|
return result;
|
|
198
|
207
|
}
|
|
199
|
208
|
|
|
|
@@ -255,7 +264,8 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
255
|
264
|
* @param result 非干部月度考核
|
|
256
|
265
|
* @return 非干部月度考核
|
|
257
|
266
|
*/
|
|
258
|
|
- private void doImprove(PersonnelNonCadreMonthlyAssessment result) {
|
|
|
267
|
+ @Override
|
|
|
268
|
+ public void doImprove(PersonnelNonCadreMonthlyAssessment result) {
|
|
259
|
269
|
List<BasePerformanceIndicatorCategory> indicatorCategoryyList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(new BasePerformanceIndicatorCategory());
|
|
260
|
270
|
// 红线指标
|
|
261
|
271
|
BasePerformanceIndicatorCategory redLineIndexCategory = indicatorCategoryyList.stream().filter(item -> StrUtil.equals("红线指标", item.getName())).findFirst().orElse(null);
|
|
|
@@ -839,4 +849,86 @@ public class PersonnelNonCadreMonthlyAssessmentServiceImpl extends ServiceImpl<P
|
|
839
|
849
|
// 判断当前用户分数是否分数最低(包括并列)
|
|
840
|
850
|
return lowerOrEqualCount == 0;
|
|
841
|
851
|
}
|
|
|
852
|
+
|
|
|
853
|
+ /**
|
|
|
854
|
+ * 修改非干部月度考核-仅更新主表数据
|
|
|
855
|
+ *
|
|
|
856
|
+ * @param personnelNonCadreMonthlyAssessment 非干部月度考核
|
|
|
857
|
+ * @return 结果
|
|
|
858
|
+ */
|
|
|
859
|
+ @Override
|
|
|
860
|
+ public int updatePersonnelNonCadreMonthlyAssessmentOnly(PersonnelNonCadreMonthlyAssessment personnelNonCadreMonthlyAssessment) {
|
|
|
861
|
+ personnelNonCadreMonthlyAssessment.setUpdateTime(DateUtils.getNowDate());
|
|
|
862
|
+ return personnelNonCadreMonthlyAssessmentMapper.updatePersonnelNonCadreMonthlyAssessment(personnelNonCadreMonthlyAssessment);
|
|
|
863
|
+ }
|
|
|
864
|
+
|
|
|
865
|
+ /**
|
|
|
866
|
+ * 自动生成指定月份非干部月度考核
|
|
|
867
|
+ *
|
|
|
868
|
+ * @param month 月份值
|
|
|
869
|
+ * @return 结果
|
|
|
870
|
+ */
|
|
|
871
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
872
|
+ @Override
|
|
|
873
|
+ public List<PersonnelNonCadreMonthlyAssessment> autoGenerate(String month) {
|
|
|
874
|
+ List<PersonnelNonCadreMonthlyAssessment> result = new ArrayList<>();
|
|
|
875
|
+ SysPersonnelUserConditionDto sysPersonnelUserConditionDtoQuery = new SysPersonnelUserConditionDto();
|
|
|
876
|
+ sysPersonnelUserConditionDtoQuery.setMonth(month);
|
|
|
877
|
+ List<SysUser> sysUserList = sysUserService.selectPersonnelUserList(sysPersonnelUserConditionDtoQuery);
|
|
|
878
|
+ PersonnelNonCadreMonthlyAssessment personnelNonCadreMonthlyAssessmentQuery = new PersonnelNonCadreMonthlyAssessment();
|
|
|
879
|
+ personnelNonCadreMonthlyAssessmentQuery.setAssessmentMonth(month);
|
|
|
880
|
+ List<PersonnelNonCadreMonthlyAssessment> existList = personnelNonCadreMonthlyAssessmentMapper.selectPersonnelNonCadreMonthlyAssessmentList(personnelNonCadreMonthlyAssessmentQuery);
|
|
|
881
|
+ List<Long> existUserIdList = existList.stream().map(PersonnelNonCadreMonthlyAssessment::getUserId).collect(Collectors.toList());
|
|
|
882
|
+ sysUserList = sysUserList.stream().filter(sysUser -> !existUserIdList.contains(sysUser.getUserId())).collect(Collectors.toList());
|
|
|
883
|
+ sysUserList.forEach(sysUser -> {
|
|
|
884
|
+ PersonnelNonCadreMonthlyAssessment personnelNonCadreMonthlyAssessmentNew = new PersonnelNonCadreMonthlyAssessment();
|
|
|
885
|
+ personnelNonCadreMonthlyAssessmentNew.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
|
|
886
|
+ personnelNonCadreMonthlyAssessmentNew.setCreateTime(DateUtils.getNowDate());
|
|
|
887
|
+ personnelNonCadreMonthlyAssessmentNew.setAssessmentMonth(month);
|
|
|
888
|
+ personnelNonCadreMonthlyAssessmentNew.setUserId(sysUser.getUserId());
|
|
|
889
|
+ personnelNonCadreMonthlyAssessmentNew.setUserName(sysUser.getUserName());
|
|
|
890
|
+ if (CollUtil.isNotEmpty(sysUser.getRoles())) {
|
|
|
891
|
+ personnelNonCadreMonthlyAssessmentNew.setRoleId(sysUser.getRoles().get(0).getRoleId());
|
|
|
892
|
+ personnelNonCadreMonthlyAssessmentNew.setRoleName(sysUser.getRoles().get(0).getRoleName());
|
|
|
893
|
+ personnelNonCadreMonthlyAssessmentNew.setRoleKey(sysUser.getRoles().get(0).getRoleKey());
|
|
|
894
|
+ }
|
|
|
895
|
+ personnelNonCadreMonthlyAssessmentNew.setEmploymentType(sysUser.getEmploymentType());
|
|
|
896
|
+ personnelNonCadreMonthlyAssessmentNew.setAssessmentTeam(sysUser.getAssessmentTeam());
|
|
|
897
|
+ personnelNonCadreMonthlyAssessmentNew.setPost(sysUser.getPost());
|
|
|
898
|
+ SysUserLeaderConditionDto teamLeaderDto = new SysUserLeaderConditionDto();
|
|
|
899
|
+ teamLeaderDto.setUserId(sysUser.getUserId());
|
|
|
900
|
+ teamLeaderDto.setRoleKeyList(Collections.singletonList(RoleTypeEnum.banzuzhang.getCode()));
|
|
|
901
|
+ List<SysUser> teamLeaderList = sysUserService.selectUserLeaderListByCondition(teamLeaderDto);
|
|
|
902
|
+ if (CollUtil.isNotEmpty(teamLeaderList)) {
|
|
|
903
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputyTeamLeaderId(teamLeaderList.get(0).getUserId());
|
|
|
904
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputyTeamLeaderName(teamLeaderList.get(0).getUserName());
|
|
|
905
|
+ }
|
|
|
906
|
+ SysUserLeaderConditionDto supervisorDto = new SysUserLeaderConditionDto();
|
|
|
907
|
+ supervisorDto.setUserId(sysUser.getUserId());
|
|
|
908
|
+ supervisorDto.setRoleKeyList(Collections.singletonList(RoleTypeEnum.kezhang.getCode()));
|
|
|
909
|
+ List<SysUser> supervisorList = sysUserService.selectUserLeaderListByCondition(supervisorDto);
|
|
|
910
|
+ if (CollUtil.isNotEmpty(supervisorList)) {
|
|
|
911
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputySupervisorId(supervisorList.get(0).getUserId());
|
|
|
912
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputySupervisorName(supervisorList.get(0).getUserName());
|
|
|
913
|
+ }
|
|
|
914
|
+ SysUserLeaderConditionDto managerDto = new SysUserLeaderConditionDto();
|
|
|
915
|
+ managerDto.setUserId(sysUser.getUserId());
|
|
|
916
|
+ managerDto.setRoleKeyList(Collections.singletonList(RoleTypeEnum.jingli.getCode()));
|
|
|
917
|
+ List<SysUser> managerList = sysUserService.selectUserLeaderListByCondition(managerDto);
|
|
|
918
|
+ if (CollUtil.isNotEmpty(managerList)) {
|
|
|
919
|
+ if (managerList.size() > 1) {
|
|
|
920
|
+ managerList = managerList.stream().filter(item -> StrUtil.equals(item.getWorkArea(), sysUser.getWorkArea())).collect(Collectors.toList());
|
|
|
921
|
+ }
|
|
|
922
|
+ if (CollUtil.isNotEmpty(managerList)) {
|
|
|
923
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputyManagerId(managerList.get(0).getUserId());
|
|
|
924
|
+ personnelNonCadreMonthlyAssessmentNew.setDeputyManagerName(managerList.get(0).getUserName());
|
|
|
925
|
+ }
|
|
|
926
|
+ }
|
|
|
927
|
+ personnelNonCadreMonthlyAssessmentNew.setPersonnelMonthlyAssessmentIndicatorDetailList(new ArrayList<>());
|
|
|
928
|
+ doImprove(personnelNonCadreMonthlyAssessmentNew);
|
|
|
929
|
+ personnelNonCadreMonthlyAssessmentMapper.insertPersonnelNonCadreMonthlyAssessment(personnelNonCadreMonthlyAssessmentNew);
|
|
|
930
|
+ result.add(personnelNonCadreMonthlyAssessmentNew);
|
|
|
931
|
+ });
|
|
|
932
|
+ return result;
|
|
|
933
|
+ }
|
|
842
|
934
|
}
|