Browse Source

考核指标表

chenshudong 1 month ago
parent
commit
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
     @Excel(name = "事/病假", type = Excel.Type.IMPORT)
65
     @Excel(name = "事/病假", type = Excel.Type.IMPORT)
66
     private String leaveTypeDesc;
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
     public void setTenantId(String tenantId) {
77
     public void setTenantId(String tenantId) {
69
         this.tenantId = tenantId;
78
         this.tenantId = tenantId;
70
     }
79
     }
@@ -161,6 +170,14 @@ public class BasePerformanceIndicator extends BaseEntity {
161
         this.leaveTypeDesc = leaveTypeDesc;
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
     @Override
181
     @Override
165
     public String toString() {
182
     public String toString() {
166
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
183
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -180,6 +197,7 @@ public class BasePerformanceIndicator extends BaseEntity {
180
                 .append("score", getScore())
197
                 .append("score", getScore())
181
                 .append("unit", getUnit())
198
                 .append("unit", getUnit())
182
                 .append("leaveType", getLeaveType())
199
                 .append("leaveType", getLeaveType())
200
+                .append("rewardPunishmentType", getRewardPunishmentType())
183
                 .toString();
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
 package com.sundot.airport.system.service.impl;
1
 package com.sundot.airport.system.service.impl;
2
 
2
 
3
+import java.math.BigDecimal;
3
 import java.util.List;
4
 import java.util.List;
4
 import java.util.Map;
5
 import java.util.Map;
5
 import java.util.stream.Collectors;
6
 import java.util.stream.Collectors;
@@ -7,6 +8,7 @@ import java.util.stream.Collectors;
7
 import cn.hutool.core.collection.CollUtil;
8
 import cn.hutool.core.collection.CollUtil;
8
 import cn.hutool.core.util.ObjUtil;
9
 import cn.hutool.core.util.ObjUtil;
9
 import com.sundot.airport.common.core.domain.entity.SysDictData;
10
 import com.sundot.airport.common.core.domain.entity.SysDictData;
11
+import com.sundot.airport.common.enums.BasePerformanceIndicatorRewardPunishmentTypeTypeEnum;
10
 import com.sundot.airport.common.exception.ServiceException;
12
 import com.sundot.airport.common.exception.ServiceException;
11
 import com.sundot.airport.common.utils.DateUtils;
13
 import com.sundot.airport.common.utils.DateUtils;
12
 import com.sundot.airport.system.domain.BasePerformanceIndicatorCategory;
14
 import com.sundot.airport.system.domain.BasePerformanceIndicatorCategory;
@@ -67,6 +69,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
67
      */
69
      */
68
     @Override
70
     @Override
69
     public int insertBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
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
         BasePerformanceIndicator query = new BasePerformanceIndicator();
82
         BasePerformanceIndicator query = new BasePerformanceIndicator();
71
         query.setCategoryCode(basePerformanceIndicator.getCategoryCode());
83
         query.setCategoryCode(basePerformanceIndicator.getCategoryCode());
72
         query.setName(basePerformanceIndicator.getName());
84
         query.setName(basePerformanceIndicator.getName());
@@ -91,6 +103,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
91
     @Override
103
     @Override
92
     public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
104
     public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
93
         basePerformanceIndicator.setUpdateTime(DateUtils.getNowDate());
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
         return basePerformanceIndicatorMapper.updateBasePerformanceIndicator(basePerformanceIndicator);
116
         return basePerformanceIndicatorMapper.updateBasePerformanceIndicator(basePerformanceIndicator);
95
     }
117
     }
96
 
118
 
@@ -127,7 +149,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
127
     @Override
149
     @Override
128
     public String importData(List<BasePerformanceIndicator> list, boolean isUpdateSupport) {
150
     public String importData(List<BasePerformanceIndicator> list, boolean isUpdateSupport) {
129
         if (CollUtil.isEmpty(list)) {
151
         if (CollUtil.isEmpty(list)) {
130
-            throw new ServiceException("导入速率数据不能为空!");
152
+            throw new ServiceException("导入考核指标数据不能为空!");
131
         }
153
         }
132
 
154
 
133
         SysDictData leaveTypeQueryParam = new SysDictData();
155
         SysDictData leaveTypeQueryParam = new SysDictData();
@@ -146,6 +168,16 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
146
         StringBuilder failureMsg = new StringBuilder();
168
         StringBuilder failureMsg = new StringBuilder();
147
 
169
 
148
         for (BasePerformanceIndicator data : list) {
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
             // 根据名称填充ID字段
181
             // 根据名称填充ID字段
150
             fillIdsByName(data, categoryMap, leaveTypeMap);
182
             fillIdsByName(data, categoryMap, leaveTypeMap);
151
             try {
183
             try {
@@ -199,7 +231,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
199
     /**
231
     /**
200
      * 根据名称填充ID字段
232
      * 根据名称填充ID字段
201
      *
233
      *
202
-     * @param data 速率数据
234
+     * @param data 考核指标数据
203
      */
235
      */
204
     private void fillIdsByName(BasePerformanceIndicator data, Map<String, String> categoryMap, Map<String, String> leaveTypeMap) {
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
         <result property="score" column="score"/>
21
         <result property="score" column="score"/>
22
         <result property="unit" column="unit"/>
22
         <result property="unit" column="unit"/>
23
         <result property="leaveType" column="leave_type"/>
23
         <result property="leaveType" column="leave_type"/>
24
+        <result property="rewardPunishmentType" column="reward_punishment_type"/>
24
     </resultMap>
25
     </resultMap>
25
 
26
 
26
     <sql id="selectBasePerformanceIndicatorVo">
27
     <sql id="selectBasePerformanceIndicatorVo">
@@ -39,7 +40,8 @@
39
                name,
40
                name,
40
                score,
41
                score,
41
                unit,
42
                unit,
42
-               leave_type
43
+               leave_type,
44
+               reward_punishment_type
43
         from base_performance_indicator
45
         from base_performance_indicator
44
     </sql>
46
     </sql>
45
 
47
 
@@ -59,7 +61,11 @@
59
             <if test="score != null ">and score = #{score}</if>
61
             <if test="score != null ">and score = #{score}</if>
60
             <if test="unit != null  and unit != ''">and unit = #{unit}</if>
62
             <if test="unit != null  and unit != ''">and unit = #{unit}</if>
61
             <if test="leaveType != null  and leaveType != ''">and leave_type = #{leaveType}</if>
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
         </where>
67
         </where>
68
+        order by create_time desc
63
     </select>
69
     </select>
64
 
70
 
65
     <select id="selectBasePerformanceIndicatorById" parameterType="Long" resultMap="BasePerformanceIndicatorResult">
71
     <select id="selectBasePerformanceIndicatorById" parameterType="Long" resultMap="BasePerformanceIndicatorResult">
@@ -86,6 +92,7 @@
86
             <if test="score != null">score,</if>
92
             <if test="score != null">score,</if>
87
             <if test="unit != null">unit,</if>
93
             <if test="unit != null">unit,</if>
88
             <if test="leaveType != null">leave_type,</if>
94
             <if test="leaveType != null">leave_type,</if>
95
+            <if test="rewardPunishmentType != null">reward_punishment_type,</if>
89
         </trim>
96
         </trim>
90
         <trim prefix="values (" suffix=")" suffixOverrides=",">
97
         <trim prefix="values (" suffix=")" suffixOverrides=",">
91
             <if test="tenantId != null">#{tenantId},</if>
98
             <if test="tenantId != null">#{tenantId},</if>
@@ -103,6 +110,7 @@
103
             <if test="score != null">#{score},</if>
110
             <if test="score != null">#{score},</if>
104
             <if test="unit != null">#{unit},</if>
111
             <if test="unit != null">#{unit},</if>
105
             <if test="leaveType != null">#{leaveType},</if>
112
             <if test="leaveType != null">#{leaveType},</if>
113
+            <if test="rewardPunishmentType != null">#{rewardPunishmentType},</if>
106
         </trim>
114
         </trim>
107
     </insert>
115
     </insert>
108
 
116
 
@@ -124,6 +132,7 @@
124
             <if test="score != null">score = #{score},</if>
132
             <if test="score != null">score = #{score},</if>
125
             <if test="unit != null">unit = #{unit},</if>
133
             <if test="unit != null">unit = #{unit},</if>
126
             <if test="leaveType != null">leave_type = #{leaveType},</if>
134
             <if test="leaveType != null">leave_type = #{leaveType},</if>
135
+            <if test="rewardPunishmentType != null">reward_punishment_type = #{rewardPunishmentType},</if>
127
         </trim>
136
         </trim>
128
         where id = #{id}
137
         where id = #{id}
129
     </update>
138
     </update>