chenshudong před 1 měsícem
rodič
revize
c388c3fad5

+ 29 - 0
airport-common/src/main/java/com/sundot/airport/common/enums/BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.java

@@ -0,0 +1,29 @@
1
+package com.sundot.airport.common.enums;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Getter;
5
+
6
+/**
7
+ * 考核指标表奖罚类型枚举
8
+ */
9
+@Getter
10
+@AllArgsConstructor
11
+public enum BasePerformanceIndicatorRewardPunishmentTypeTypeEnum {
12
+
13
+    PUNISHMENT("PUNISHMENT", "惩罚"),
14
+    REWARD("REWARD", "奖励"),
15
+    OTHER("OTHER", "其他");
16
+
17
+    private final String code;
18
+    private final String desc;
19
+
20
+    public static BasePerformanceIndicatorRewardPunishmentTypeTypeEnum getByCode(String code) {
21
+        for (BasePerformanceIndicatorRewardPunishmentTypeTypeEnum itemEnum : values()) {
22
+            if (itemEnum.getCode().equals(code)) {
23
+                return itemEnum;
24
+            }
25
+        }
26
+        return null;
27
+    }
28
+
29
+}

+ 18 - 0
airport-system/src/main/java/com/sundot/airport/system/domain/BasePerformanceIndicator.java

@@ -65,6 +65,15 @@ public class BasePerformanceIndicator extends BaseEntity {
65 65
     @Excel(name = "事/病假", type = Excel.Type.IMPORT)
66 66
     private String leaveTypeDesc;
67 67
 
68
+    /** 奖罚类型 */
69
+    @Excel(name = "奖罚类型",
70
+            readConverterExp = "PUNISHMENT=惩罚," +
71
+                    "REWARD=奖励," +
72
+                    "OTHER=其他,",
73
+            combo = "惩罚,奖励,其他",
74
+            type = Excel.Type.EXPORT)
75
+    private String rewardPunishmentType;
76
+
68 77
     public void setTenantId(String tenantId) {
69 78
         this.tenantId = tenantId;
70 79
     }
@@ -161,6 +170,14 @@ public class BasePerformanceIndicator extends BaseEntity {
161 170
         this.leaveTypeDesc = leaveTypeDesc;
162 171
     }
163 172
 
173
+    public String getRewardPunishmentType() {
174
+        return rewardPunishmentType;
175
+    }
176
+
177
+    public void setRewardPunishmentType(String rewardPunishmentType) {
178
+        this.rewardPunishmentType = rewardPunishmentType;
179
+    }
180
+
164 181
     @Override
165 182
     public String toString() {
166 183
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -180,6 +197,7 @@ public class BasePerformanceIndicator extends BaseEntity {
180 197
                 .append("score", getScore())
181 198
                 .append("unit", getUnit())
182 199
                 .append("leaveType", getLeaveType())
200
+                .append("rewardPunishmentType", getRewardPunishmentType())
183 201
                 .toString();
184 202
     }
185 203
 }

+ 34 - 2
airport-system/src/main/java/com/sundot/airport/system/service/impl/BasePerformanceIndicatorServiceImpl.java

@@ -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
         // 分类编码

+ 10 - 1
airport-system/src/main/resources/mapper/system/BasePerformanceIndicatorMapper.xml

@@ -21,6 +21,7 @@
21 21
         <result property="score" column="score"/>
22 22
         <result property="unit" column="unit"/>
23 23
         <result property="leaveType" column="leave_type"/>
24
+        <result property="rewardPunishmentType" column="reward_punishment_type"/>
24 25
     </resultMap>
25 26
 
26 27
     <sql id="selectBasePerformanceIndicatorVo">
@@ -39,7 +40,8 @@
39 40
                name,
40 41
                score,
41 42
                unit,
42
-               leave_type
43
+               leave_type,
44
+               reward_punishment_type
43 45
         from base_performance_indicator
44 46
     </sql>
45 47
 
@@ -59,7 +61,11 @@
59 61
             <if test="score != null ">and score = #{score}</if>
60 62
             <if test="unit != null  and unit != ''">and unit = #{unit}</if>
61 63
             <if test="leaveType != null  and leaveType != ''">and leave_type = #{leaveType}</if>
64
+            <if test="rewardPunishmentType != null  and rewardPunishmentType != ''">and reward_punishment_type =
65
+                #{rewardPunishmentType}
66
+            </if>
62 67
         </where>
68
+        order by create_time desc
63 69
     </select>
64 70
 
65 71
     <select id="selectBasePerformanceIndicatorById" parameterType="Long" resultMap="BasePerformanceIndicatorResult">
@@ -86,6 +92,7 @@
86 92
             <if test="score != null">score,</if>
87 93
             <if test="unit != null">unit,</if>
88 94
             <if test="leaveType != null">leave_type,</if>
95
+            <if test="rewardPunishmentType != null">reward_punishment_type,</if>
89 96
         </trim>
90 97
         <trim prefix="values (" suffix=")" suffixOverrides=",">
91 98
             <if test="tenantId != null">#{tenantId},</if>
@@ -103,6 +110,7 @@
103 110
             <if test="score != null">#{score},</if>
104 111
             <if test="unit != null">#{unit},</if>
105 112
             <if test="leaveType != null">#{leaveType},</if>
113
+            <if test="rewardPunishmentType != null">#{rewardPunishmentType},</if>
106 114
         </trim>
107 115
     </insert>
108 116
 
@@ -124,6 +132,7 @@
124 132
             <if test="score != null">score = #{score},</if>
125 133
             <if test="unit != null">unit = #{unit},</if>
126 134
             <if test="leaveType != null">leave_type = #{leaveType},</if>
135
+            <if test="rewardPunishmentType != null">reward_punishment_type = #{rewardPunishmentType},</if>
127 136
         </trim>
128 137
         where id = #{id}
129 138
     </update>