chenshudong пре 1 месец
родитељ
комит
af00b118a8

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

@@ -25,12 +25,12 @@ public class BasePerformanceIndicator extends BaseEntity {
25
     /** 主键 */
25
     /** 主键 */
26
     private Long id;
26
     private Long id;
27
 
27
 
28
-    /** 所属分类编码 */
29
-    @Excel(name = "所属分类编码", type = Excel.Type.EXPORT)
28
+    /** 所属二级分类编码 */
29
+    @Excel(name = "所属二级分类编码", type = Excel.Type.EXPORT)
30
     private String categoryCode;
30
     private String categoryCode;
31
 
31
 
32
-    /** 所属分类名称 */
33
-    @Excel(name = "所属分类名称")
32
+    /** 所属二级分类名称 */
33
+    @Excel(name = "所属二级分类名称")
34
     private String categoryName;
34
     private String categoryName;
35
 
35
 
36
     /** 编码 */
36
     /** 编码 */

+ 45 - 30
airport-system/src/main/java/com/sundot/airport/system/service/impl/BasePerformanceIndicatorServiceImpl.java

@@ -48,19 +48,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
48
      */
48
      */
49
     @Override
49
     @Override
50
     public BasePerformanceIndicator selectBasePerformanceIndicatorById(Long id) {
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
     @Override
60
     @Override
73
     public List<BasePerformanceIndicator> selectBasePerformanceIndicatorList(BasePerformanceIndicator basePerformanceIndicator) {
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
     @Override
71
     @Override
95
     public int insertBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
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
         if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
88
         if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
98
             basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
89
             basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
@@ -127,6 +118,20 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
127
     @Override
118
     @Override
128
     public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
119
     public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
129
         basePerformanceIndicator.setUpdateTime(DateUtils.getNowDate());
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
         if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
136
         if (ObjUtil.isNull(basePerformanceIndicator.getScore())) {
132
             basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
137
             basePerformanceIndicator.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
@@ -182,9 +187,10 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
182
         Map<String, String> leaveTypeMap = leaveTypeList.stream().collect(Collectors.toMap(SysDictData::getDictLabel, SysDictData::getDictValue));
187
         Map<String, String> leaveTypeMap = leaveTypeList.stream().collect(Collectors.toMap(SysDictData::getDictLabel, SysDictData::getDictValue));
183
 
188
 
184
         BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
189
         BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
185
-        categoryQueryParam.setLevel(2);
186
         List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
190
         List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
187
         Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(BasePerformanceIndicatorCategory::getName, BasePerformanceIndicatorCategory::getCode, (oldValue, newValue) -> newValue));
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
         int successNum = 0;
195
         int successNum = 0;
190
         int failureNum = 0;
196
         int failureNum = 0;
@@ -203,7 +209,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
203
                 data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
209
                 data.setRewardPunishmentType(BasePerformanceIndicatorRewardPunishmentTypeTypeEnum.OTHER.getCode());
204
             }
210
             }
205
             // 根据名称填充ID字段
211
             // 根据名称填充ID字段
206
-            fillIdsByName(data, categoryMap, leaveTypeMap);
212
+            fillIdsByName(data, categoryMap, codeParentIdMap, categoryDataMap, leaveTypeMap);
207
             try {
213
             try {
208
                 if (ObjUtil.isNull(data.getCategoryCode()) || ObjUtil.isNull(data.getCategoryName())) {
214
                 if (ObjUtil.isNull(data.getCategoryCode()) || ObjUtil.isNull(data.getCategoryName())) {
209
                     failureNum++;
215
                     failureNum++;
@@ -211,7 +217,7 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
211
                     continue;
217
                     continue;
212
                 }
218
                 }
213
 
219
 
214
-                // 查询是否已存在(根据【日期+当班大队+班次】唯一)
220
+                // 查询是否已存在(根据【所属二级分类编码+指标名称】唯一)
215
                 BasePerformanceIndicator queryParam = new BasePerformanceIndicator();
221
                 BasePerformanceIndicator queryParam = new BasePerformanceIndicator();
216
                 queryParam.setCategoryCode(data.getCategoryCode());
222
                 queryParam.setCategoryCode(data.getCategoryCode());
217
                 queryParam.setName(data.getName());
223
                 queryParam.setName(data.getName());
@@ -257,12 +263,21 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
257
      *
263
      *
258
      * @param data 考核指标数据
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
         if (ObjUtil.isNotNull(data.getCategoryName())) {
268
         if (ObjUtil.isNotNull(data.getCategoryName())) {
263
             data.setCategoryCode(categoryMap.get(data.getCategoryName()));
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
         if (ObjUtil.isNotNull(data.getLeaveTypeDesc())) {
282
         if (ObjUtil.isNotNull(data.getLeaveTypeDesc())) {
268
             data.setLeaveType(leaveTypeMap.get(data.getLeaveTypeDesc()));
283
             data.setLeaveType(leaveTypeMap.get(data.getLeaveTypeDesc()));

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

@@ -22,6 +22,8 @@
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
         <result property="rewardPunishmentType" column="reward_punishment_type"/>
25
+        <result property="categoryCodeOne" column="category_code_one"/>
26
+        <result property="categoryNameOne" column="category_name_one"/>
25
     </resultMap>
27
     </resultMap>
26
 
28
 
27
     <sql id="selectBasePerformanceIndicatorVo">
29
     <sql id="selectBasePerformanceIndicatorVo">
@@ -41,7 +43,9 @@
41
                score,
43
                score,
42
                unit,
44
                unit,
43
                leave_type,
45
                leave_type,
44
-               reward_punishment_type
46
+               reward_punishment_type,
47
+               category_code_one,
48
+               category_name_one
45
         from base_performance_indicator
49
         from base_performance_indicator
46
     </sql>
50
     </sql>
47
 
51
 
@@ -64,6 +68,11 @@
64
             <if test="rewardPunishmentType != null  and rewardPunishmentType != ''">and reward_punishment_type =
68
             <if test="rewardPunishmentType != null  and rewardPunishmentType != ''">and reward_punishment_type =
65
                 #{rewardPunishmentType}
69
                 #{rewardPunishmentType}
66
             </if>
70
             </if>
71
+            <if test="categoryCodeOne != null  and categoryCodeOne != ''">and category_code_one = #{categoryCodeOne}
72
+            </if>
73
+            <if test="categoryNameOne != null  and categoryNameOne != ''">and category_name_one like
74
+                concat('%', #{categoryNameOne}, '%')
75
+            </if>
67
         </where>
76
         </where>
68
         order by create_time desc
77
         order by create_time desc
69
     </select>
78
     </select>
@@ -93,6 +102,8 @@
93
             <if test="unit != null">unit,</if>
102
             <if test="unit != null">unit,</if>
94
             <if test="leaveType != null">leave_type,</if>
103
             <if test="leaveType != null">leave_type,</if>
95
             <if test="rewardPunishmentType != null">reward_punishment_type,</if>
104
             <if test="rewardPunishmentType != null">reward_punishment_type,</if>
105
+            <if test="categoryCodeOne != null">category_code_one,</if>
106
+            <if test="categoryNameOne != null">category_name_one,</if>
96
         </trim>
107
         </trim>
97
         <trim prefix="values (" suffix=")" suffixOverrides=",">
108
         <trim prefix="values (" suffix=")" suffixOverrides=",">
98
             <if test="tenantId != null">#{tenantId},</if>
109
             <if test="tenantId != null">#{tenantId},</if>
@@ -111,6 +122,8 @@
111
             <if test="unit != null">#{unit},</if>
122
             <if test="unit != null">#{unit},</if>
112
             <if test="leaveType != null">#{leaveType},</if>
123
             <if test="leaveType != null">#{leaveType},</if>
113
             <if test="rewardPunishmentType != null">#{rewardPunishmentType},</if>
124
             <if test="rewardPunishmentType != null">#{rewardPunishmentType},</if>
125
+            <if test="categoryCodeOne != null">#{categoryCodeOne},</if>
126
+            <if test="categoryNameOne != null">#{categoryNameOne},</if>
114
         </trim>
127
         </trim>
115
     </insert>
128
     </insert>
116
 
129
 
@@ -133,6 +146,8 @@
133
             <if test="unit != null">unit = #{unit},</if>
146
             <if test="unit != null">unit = #{unit},</if>
134
             <if test="leaveType != null">leave_type = #{leaveType},</if>
147
             <if test="leaveType != null">leave_type = #{leaveType},</if>
135
             <if test="rewardPunishmentType != null">reward_punishment_type = #{rewardPunishmentType},</if>
148
             <if test="rewardPunishmentType != null">reward_punishment_type = #{rewardPunishmentType},</if>
149
+            <if test="categoryCodeOne != null">category_code_one = #{categoryCodeOne},</if>
150
+            <if test="categoryNameOne != null">category_name_one = #{categoryNameOne},</if>
136
         </trim>
151
         </trim>
137
         where id = #{id}
152
         where id = #{id}
138
     </update>
153
     </update>