|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
package com.sundot.airport.system.service.impl;
|
|
2
|
2
|
|
|
|
3
|
+import java.math.BigDecimal;
|
|
3
|
4
|
import java.util.List;
|
|
4
|
5
|
import java.util.Map;
|
|
5
|
6
|
import java.util.stream.Collectors;
|
|
|
@@ -7,6 +8,7 @@ import java.util.stream.Collectors;
|
|
7
|
8
|
import cn.hutool.core.collection.CollUtil;
|
|
8
|
9
|
import cn.hutool.core.util.ObjUtil;
|
|
9
|
10
|
import com.sundot.airport.common.core.domain.entity.SysDictData;
|
|
|
11
|
+import com.sundot.airport.common.enums.BasePerformanceIndicatorRewardPunishmentTypeTypeEnum;
|
|
10
|
12
|
import com.sundot.airport.common.exception.ServiceException;
|
|
11
|
13
|
import com.sundot.airport.common.utils.DateUtils;
|
|
12
|
14
|
import com.sundot.airport.system.domain.BasePerformanceIndicatorCategory;
|
|
|
@@ -67,6 +69,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
67
|
69
|
*/
|
|
68
|
70
|
@Override
|
|
69
|
71
|
public int insertBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
|
|
|
72
|
+ // 判断奖罚类型
|
|
|
73
|
+ if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
|
|
|
74
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
75
|
+ } else if (basePerformanceIndicator.getScore().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
76
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.REWARD.getCode());
|
|
|
77
|
+ } else if (basePerformanceIndicator.getScore().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
78
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode());
|
|
|
79
|
+ } else {
|
|
|
80
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
81
|
+ }
|
|
70
|
82
|
BasePerformanceIndicator query = new BasePerformanceIndicator();
|
|
71
|
83
|
query.setCategoryCode(basePerformanceIndicator.getCategoryCode());
|
|
72
|
84
|
query.setName(basePerformanceIndicator.getName());
|
|
|
@@ -91,6 +103,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
91
|
103
|
@Override
|
|
92
|
104
|
public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
|
|
93
|
105
|
basePerformanceIndicator.setUpdateTime(DateUtils.getNowDate());
|
|
|
106
|
+ // 判断奖罚类型
|
|
|
107
|
+ if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
|
|
|
108
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
109
|
+ } else if (basePerformanceIndicator.getScore().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
110
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.REWARD.getCode());
|
|
|
111
|
+ } else if (basePerformanceIndicator.getScore().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
112
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode());
|
|
|
113
|
+ } else {
|
|
|
114
|
+ basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
115
|
+ }
|
|
94
|
116
|
return basePerformanceIndicatorMapper.updateBasePerformanceIndicator(basePerformanceIndicator);
|
|
95
|
117
|
}
|
|
96
|
118
|
|
|
|
@@ -127,7 +149,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
127
|
149
|
@Override
|
|
128
|
150
|
public String importData(List<BasePerformanceIndicator> list, boolean isUpdateSupport) {
|
|
129
|
151
|
if (CollUtil.isEmpty(list)) {
|
|
130
|
|
- throw new ServiceException("导入速率数据不能为空!");
|
|
|
152
|
+ throw new ServiceException("导入考核指标数据不能为空!");
|
|
131
|
153
|
}
|
|
132
|
154
|
|
|
133
|
155
|
SysDictData leaveTypeQueryParam = new SysDictData();
|
|
|
@@ -146,6 +168,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
146
|
168
|
StringBuilder failureMsg = new StringBuilder();
|
|
147
|
169
|
|
|
148
|
170
|
for (BasePerformanceIndicator data : list) {
|
|
|
171
|
+ // 判断奖罚类型
|
|
|
172
|
+ if (ObjUtil.isNull(data.getScore())) {
|
|
|
173
|
+ data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
174
|
+ } else if (data.getScore().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
175
|
+ data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.REWARD.getCode());
|
|
|
176
|
+ } else if (data.getScore().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
177
|
+ data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.PUNISHMENT.getCode());
|
|
|
178
|
+ } else {
|
|
|
179
|
+ data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
|
|
|
180
|
+ }
|
|
149
|
181
|
// 根据名称填充ID字段
|
|
150
|
182
|
fillIdsByName(data, categoryMap, leaveTypeMap);
|
|
151
|
183
|
try {
|
|
|
@@ -199,7 +231,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
|
|
199
|
231
|
/**
|
|
200
|
232
|
* 根据名称填充ID字段
|
|
201
|
233
|
*
|
|
202
|
|
- * @param data 速率数据
|
|
|
234
|
+ * @param data 考核指标数据
|
|
203
|
235
|
*/
|
|
204
|
236
|
private void fillIdsByName(BasePerformanceIndicator data, Map<String, String> categoryMap, Map<String, String> leaveTypeMap) {
|
|
205
|
237
|
// 分类编码
|