Bläddra i källkod

考核指标表

chenshudong 1 månad sedan
förälder
incheckning
28727be8a3

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

@@ -74,6 +74,14 @@ public class BasePerformanceIndicator extends BaseEntity {
74 74
             type = Excel.Type.EXPORT)
75 75
     private String rewardPunishmentType;
76 76
 
77
+    /** 所属一级分类编码 */
78
+    @Excel(name = "所属一级分类编码", type = Excel.Type.EXPORT)
79
+    private String categoryCodeOne;
80
+
81
+    /** 所属一级分类名称 */
82
+    @Excel(name = "所属一级分类名称", type = Excel.Type.EXPORT)
83
+    private String categoryNameOne;
84
+
77 85
     public void setTenantId(String tenantId) {
78 86
         this.tenantId = tenantId;
79 87
     }
@@ -178,6 +186,22 @@ public class BasePerformanceIndicator extends BaseEntity {
178 186
         this.rewardPunishmentType = rewardPunishmentType;
179 187
     }
180 188
 
189
+    public String getCategoryCodeOne() {
190
+        return categoryCodeOne;
191
+    }
192
+
193
+    public void setCategoryCodeOne(String categoryCodeOne) {
194
+        this.categoryCodeOne = categoryCodeOne;
195
+    }
196
+
197
+    public String getCategoryNameOne() {
198
+        return categoryNameOne;
199
+    }
200
+
201
+    public void setCategoryNameOne(String categoryNameOne) {
202
+        this.categoryNameOne = categoryNameOne;
203
+    }
204
+
181 205
     @Override
182 206
     public String toString() {
183 207
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -198,6 +222,8 @@ public class BasePerformanceIndicator extends BaseEntity {
198 222
                 .append("unit", getUnit())
199 223
                 .append("leaveType", getLeaveType())
200 224
                 .append("rewardPunishmentType", getRewardPunishmentType())
225
+                .append("categoryCodeOne", getCategoryCodeOne())
226
+                .append("categoryNameOne", getCategoryNameOne())
201 227
                 .toString();
202 228
     }
203 229
 }

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

@@ -3,6 +3,7 @@ package com.sundot.airport.system.service.impl;
3 3
 import java.math.BigDecimal;
4 4
 import java.util.List;
5 5
 import java.util.Map;
6
+import java.util.function.Function;
6 7
 import java.util.stream.Collectors;
7 8
 
8 9
 import cn.hutool.core.collection.CollUtil;
@@ -47,7 +48,19 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
47 48
      */
48 49
     @Override
49 50
     public BasePerformanceIndicator selectBasePerformanceIndicatorById(Long id) {
50
-        return basePerformanceIndicatorMapper.selectBasePerformanceIndicatorById(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 64
     }
52 65
 
53 66
     /**
@@ -58,7 +71,18 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
58 71
      */
59 72
     @Override
60 73
     public List<BasePerformanceIndicator> selectBasePerformanceIndicatorList(BasePerformanceIndicator basePerformanceIndicator) {
61
-        return basePerformanceIndicatorMapper.selectBasePerformanceIndicatorList(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 86
     }
63 87
 
64 88
     /**