|
|
@@ -48,19 +48,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
48
|
48
|
*/
|
|
49
|
49
|
@Override
|
|
50
|
50
|
public BasePerformanceIndicator selectBasePerformanceIndicatorById(Long id) {
|
|
51
|
|
- BasePerformanceIndicator result = basePerformanceIndicatorMapper.selectBasePerformanceIndicatorById(id);
|
|
52
|
|
- BasePerformanceIndicatorCategory basePerformanceIndicatorCategoryQuery = new BasePerformanceIndicatorCategory();
|
|
53
|
|
- basePerformanceIndicatorCategoryQuery.setCode(result.getCategoryCode());
|
|
54
|
|
- List<BasePerformanceIndicatorCategory> basePerformanceIndicatorCategoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(basePerformanceIndicatorCategoryQuery);
|
|
55
|
|
- if (CollUtil.isNotEmpty(basePerformanceIndicatorCategoryList)) {
|
|
56
|
|
- BasePerformanceIndicatorCategory basePerformanceIndicatorCategory = basePerformanceIndicatorCategoryList.get(0);
|
|
57
|
|
- BasePerformanceIndicatorCategory basePerformanceIndicatorCategoryOne = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryById(basePerformanceIndicatorCategory.getParentId());
|
|
58
|
|
- if (ObjUtil.isNotNull(basePerformanceIndicatorCategoryOne)) {
|
|
59
|
|
- result.setCategoryCodeOne(basePerformanceIndicatorCategoryOne.getCode());
|
|
60
|
|
- result.setCategoryNameOne(basePerformanceIndicatorCategoryOne.getName());
|
|
61
|
|
- }
|
|
62
|
|
- }
|
|
63
|
|
- return result;
|
|
|
51
|
+ return basePerformanceIndicatorMapper.selectBasePerformanceIndicatorById(id);
|
|
64
|
52
|
}
|
|
65
|
53
|
|
|
66
|
54
|
/**
|
|
|
@@ -71,18 +59,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
71
|
59
|
*/
|
|
72
|
60
|
@Override
|
|
73
|
61
|
public List<BasePerformanceIndicator> selectBasePerformanceIndicatorList(BasePerformanceIndicator basePerformanceIndicator) {
|
|
74
|
|
- List<BasePerformanceIndicator> result = basePerformanceIndicatorMapper.selectBasePerformanceIndicatorList(basePerformanceIndicator);
|
|
75
|
|
- List<BasePerformanceIndicatorCategory> basePerformanceIndicatorCategoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(new BasePerformanceIndicatorCategory());
|
|
76
|
|
- Map<Long, BasePerformanceIndicatorCategory> dataMap = basePerformanceIndicatorCategoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getId, Function.identity(), (oldValue, newValue) -> newValue));
|
|
77
|
|
- Map<String, Long> codeParentIdMap = basePerformanceIndicatorCategoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getCode, BasePerformanceIndicatorCategory::getParentId, (oldValue, newValue) -> newValue));
|
|
78
|
|
- result.forEach(item -> {
|
|
79
|
|
- BasePerformanceIndicatorCategory basePerformanceIndicatorCategoryOne = dataMap.get(codeParentIdMap.get(item.getCode()));
|
|
80
|
|
- if (ObjUtil.isNotNull(basePerformanceIndicatorCategoryOne)) {
|
|
81
|
|
- item.setCategoryCodeOne(basePerformanceIndicatorCategoryOne.getCode());
|
|
82
|
|
- item.setCategoryNameOne(basePerformanceIndicatorCategoryOne.getName());
|
|
83
|
|
- }
|
|
84
|
|
- });
|
|
85
|
|
- return result;
|
|
|
62
|
+ return basePerformanceIndicatorMapper.selectBasePerformanceIndicatorList(basePerformanceIndicator);
|
|
86
|
63
|
}
|
|
87
|
64
|
|
|
88
|
65
|
/**
|
|
|
@@ -93,6 +70,20 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
93
|
70
|
*/
|
|
94
|
71
|
@Override
|
|
95
|
72
|
public int insertBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
|
|
|
73
|
+ // 一级分类编码
|
|
|
74
|
+ BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
|
|
|
75
|
+ List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
|
|
|
76
|
+ if (CollUtil.isNotEmpty(categoryList)) {
|
|
|
77
|
+ Map<String, Long> codeParentIdMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getCode, BasePerformanceIndicatorCategory::getParentId, (oldValue, newValue) -> newValue));
|
|
|
78
|
+ Map<Long, BasePerformanceIndicatorCategory> categoryDataMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getId, Function.identity(), (oldValue, newValue) -> newValue));
|
|
|
79
|
+ if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode())) {
|
|
|
80
|
+ BasePerformanceIndicatorCategory categoryOne = categoryDataMap.get(codeParentIdMap.get(basePerformanceIndicator.getCategoryCode()));
|
|
|
81
|
+ if (ObjUtil.isNotNull(categoryOne)) {
|
|
|
82
|
+ basePerformanceIndicator.setCategoryCodeOne(categoryOne.getCode());
|
|
|
83
|
+ basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
|
|
|
84
|
+ }
|
|
|
85
|
+ }
|
|
|
86
|
+ }
|
|
96
|
87
|
// 判断奖罚类型
|
|
97
|
88
|
if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
|
|
98
|
89
|
basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
@@ -127,6 +118,20 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
127
|
118
|
@Override
|
|
128
|
119
|
public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
|
|
129
|
120
|
basePerformanceIndicator.setUpdateTime(DateUtils.getNowDate());
|
|
|
121
|
+ // 一级分类编码
|
|
|
122
|
+ BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
|
|
|
123
|
+ List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
|
|
|
124
|
+ if (CollUtil.isNotEmpty(categoryList)) {
|
|
|
125
|
+ Map<String, Long> codeParentIdMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getCode, BasePerformanceIndicatorCategory::getParentId, (oldValue, newValue) -> newValue));
|
|
|
126
|
+ Map<Long, BasePerformanceIndicatorCategory> categoryDataMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getId, Function.identity(), (oldValue, newValue) -> newValue));
|
|
|
127
|
+ if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode())) {
|
|
|
128
|
+ BasePerformanceIndicatorCategory categoryOne = categoryDataMap.get(codeParentIdMap.get(basePerformanceIndicator.getCategoryCode()));
|
|
|
129
|
+ if (ObjUtil.isNotNull(categoryOne)) {
|
|
|
130
|
+ basePerformanceIndicator.setCategoryCodeOne(categoryOne.getCode());
|
|
|
131
|
+ basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
|
|
|
132
|
+ }
|
|
|
133
|
+ }
|
|
|
134
|
+ }
|
|
130
|
135
|
// 判断奖罚类型
|
|
131
|
136
|
if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
|
|
132
|
137
|
basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
@@ -182,9 +187,10 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
182
|
187
|
Map<String, String> leaveTypeMap = leaveTypeList.stream().collect(Collectors.toMap(SysDictData::getDictLabel, SysDictData::getDictValue));
|
|
183
|
188
|
|
|
184
|
189
|
BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
|
|
185
|
|
- categoryQueryParam.setLevel(2);
|
|
186
|
190
|
List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
|
|
187
|
191
|
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getName, BasePerformanceIndicatorCategory::getCode, (oldValue, newValue) -> newValue));
|
|
|
192
|
+ Map<String, Long> codeParentIdMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getCode, BasePerformanceIndicatorCategory::getParentId, (oldValue, newValue) -> newValue));
|
|
|
193
|
+ Map<Long, BasePerformanceIndicatorCategory> categoryDataMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getId, Function.identity(), (oldValue, newValue) -> newValue));
|
|
188
|
194
|
|
|
189
|
195
|
int successNum = 0;
|
|
190
|
196
|
int failureNum = 0;
|
|
|
@@ -203,7 +209,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
203
|
209
|
data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
204
|
210
|
}
|
|
205
|
211
|
// 根据名称填充ID字段
|
|
206
|
|
- fillIdsByName(data, categoryMap, leaveTypeMap);
|
|
|
212
|
+ fillIdsByName(data, categoryMap, codeParentIdMap, categoryDataMap, leaveTypeMap);
|
|
207
|
213
|
try {
|
|
208
|
214
|
if (ObjUtil.isNull(data.getCategoryCode()) || ObjUtil.isNull(data.getCategoryName())) {
|
|
209
|
215
|
failureNum++;
|
|
|
@@ -211,7 +217,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
211
|
217
|
continue;
|
|
212
|
218
|
}
|
|
213
|
219
|
|
|
214
|
|
- // 查询是否已存在(根据【日期+当班大队+班次】唯一)
|
|
|
220
|
+ // 查询是否已存在(根据【所属二级分类编码+指标名称】唯一)
|
|
215
|
221
|
BasePerformanceIndicator queryParam = new BasePerformanceIndicator();
|
|
216
|
222
|
queryParam.setCategoryCode(data.getCategoryCode());
|
|
217
|
223
|
queryParam.setName(data.getName());
|
|
|
@@ -257,12 +263,21 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
257
|
263
|
*
|
|
258
|
264
|
* @param data 考核指标数据
|
|
259
|
265
|
*/
|
|
260
|
|
- private void fillIdsByName(BasePerformanceIndicator data, Map<String, String> categoryMap, Map<String, String> leaveTypeMap) {
|
|
261
|
|
- // 分类编码
|
|
|
266
|
+ private void fillIdsByName(BasePerformanceIndicator data, Map<String, String> categoryMap, Map<String, Long> codeParentIdMap, Map<Long, BasePerformanceIndicatorCategory> categoryDataMap, Map<String, String> leaveTypeMap) {
|
|
|
267
|
+ // 二级分类编码
|
|
262
|
268
|
if (ObjUtil.isNotNull(data.getCategoryName())) {
|
|
263
|
269
|
data.setCategoryCode(categoryMap.get(data.getCategoryName()));
|
|
264
|
270
|
}
|
|
265
|
271
|
|
|
|
272
|
+ // 一级分类编码
|
|
|
273
|
+ if (ObjUtil.isNotNull(data.getCategoryCode())) {
|
|
|
274
|
+ BasePerformanceIndicatorCategory categoryOne = categoryDataMap.get(codeParentIdMap.get(data.getCategoryCode()));
|
|
|
275
|
+ if (ObjUtil.isNotNull(categoryOne)) {
|
|
|
276
|
+ data.setCategoryCodeOne(categoryOne.getCode());
|
|
|
277
|
+ data.setCategoryNameOne(categoryOne.getName());
|
|
|
278
|
+ }
|
|
|
279
|
+ }
|
|
|
280
|
+
|
|
266
|
281
|
// 事/病假
|
|
267
|
282
|
if (ObjUtil.isNotNull(data.getLeaveTypeDesc())) {
|
|
268
|
283
|
data.setLeaveType(leaveTypeMap.get(data.getLeaveTypeDesc()));
|