Bläddra i källkod

考核指标表

chenshudong 4 veckor sedan
förälder
incheckning
813317de6b

+ 56 - 31
airport-system/src/main/java/com/sundot/airport/system/service/impl/BasePerformanceIndicatorServiceImpl.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
4 4
 import java.util.Collections;
5 5
 import java.util.List;
6 6
 import java.util.Map;
7
+import java.util.function.Function;
7 8
 import java.util.stream.Collectors;
8 9
 
9 10
 import cn.hutool.core.collection.CollUtil;
@@ -82,24 +83,36 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
82 83
      */
83 84
     @Override
84 85
     public int insertBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
85
-        // 一级分类+二级分类
86
+//        // 一级分类+二级分类
87
+//        BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
88
+//        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(categoryQueryParam);
89
+//        if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCodeOne())) {
90
+//            BasePerformanceIndicatorCategory categoryOne = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCodeOne())).findFirst().orElse(null);
91
+//            if (ObjUtil.isNotNull(categoryOne)) {
92
+//                basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
93
+//                if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode()) && CollUtil.isNotEmpty(categoryOne.getChildren())) {
94
+//                    List<BasePerformanceIndicatorCategory> children = (List<BasePerformanceIndicatorCategory>) categoryOne.getChildren();
95
+//                    BasePerformanceIndicatorCategory categoryTwo = children.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
96
+//                    if (ObjUtil.isNotNull(categoryTwo)) {
97
+//                        basePerformanceIndicator.setCategoryName(categoryTwo.getCode());
98
+//                    } else {
99
+//                        basePerformanceIndicator.setCategoryName(null);
100
+//                    }
101
+//                }
102
+//            } else {
103
+//                basePerformanceIndicator.setCategoryNameOne(null);
104
+//            }
105
+//        }
106
+        // 一级分类编码
86 107
         BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
87
-        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(categoryQueryParam);
88
-        if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCodeOne())) {
89
-            BasePerformanceIndicatorCategory categoryOne = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCodeOne())).findFirst().orElse(null);
90
-            if (ObjUtil.isNotNull(categoryOne)) {
108
+        categoryQueryParam.setLevel(2);
109
+        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
110
+        if (CollUtil.isNotEmpty(categoryList)) {
111
+            BasePerformanceIndicatorCategory categoryTwo = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
112
+            if (ObjUtil.isNotNull(categoryTwo)) {
113
+                BasePerformanceIndicatorCategory categoryOne = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryById(categoryTwo.getParentId());
114
+                basePerformanceIndicator.setCategoryCodeOne(categoryOne.getCode());
91 115
                 basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
92
-                if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode()) && CollUtil.isNotEmpty(categoryOne.getChildren())) {
93
-                    List<BasePerformanceIndicatorCategory> children = (List<BasePerformanceIndicatorCategory>) categoryOne.getChildren();
94
-                    BasePerformanceIndicatorCategory categoryTwo = children.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
95
-                    if (ObjUtil.isNotNull(categoryTwo)) {
96
-                        basePerformanceIndicator.setCategoryName(categoryTwo.getCode());
97
-                    } else {
98
-                        basePerformanceIndicator.setCategoryName(null);
99
-                    }
100
-                }
101
-            } else {
102
-                basePerformanceIndicator.setCategoryNameOne(null);
103 116
             }
104 117
         }
105 118
         // 判断奖罚类型
@@ -137,23 +150,35 @@ public class BasePerformanceIndicatorServiceImpl implements IBasePerformanceIndi
137 150
     public int updateBasePerformanceIndicator(BasePerformanceIndicator basePerformanceIndicator) {
138 151
         basePerformanceIndicator.setUpdateTime(DateUtils.getNowDate());
139 152
         // 一级分类+二级分类
153
+//        BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
154
+//        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(categoryQueryParam);
155
+//        if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCodeOne())) {
156
+//            BasePerformanceIndicatorCategory categoryOne = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCodeOne())).findFirst().orElse(null);
157
+//            if (ObjUtil.isNotNull(categoryOne)) {
158
+//                basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
159
+//                if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode()) && CollUtil.isNotEmpty(categoryOne.getChildren())) {
160
+//                    List<BasePerformanceIndicatorCategory> children = (List<BasePerformanceIndicatorCategory>) categoryOne.getChildren();
161
+//                    BasePerformanceIndicatorCategory categoryTwo = children.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
162
+//                    if (ObjUtil.isNotNull(categoryTwo)) {
163
+//                        basePerformanceIndicator.setCategoryName(categoryTwo.getCode());
164
+//                    } else {
165
+//                        basePerformanceIndicator.setCategoryName(null);
166
+//                    }
167
+//                }
168
+//            } else {
169
+//                basePerformanceIndicator.setCategoryNameOne(null);
170
+//            }
171
+//        }
172
+        // 一级分类编码
140 173
         BasePerformanceIndicatorCategory categoryQueryParam = new BasePerformanceIndicatorCategory();
141
-        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryListTree(categoryQueryParam);
142
-        if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCodeOne())) {
143
-            BasePerformanceIndicatorCategory categoryOne = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCodeOne())).findFirst().orElse(null);
144
-            if (ObjUtil.isNotNull(categoryOne)) {
174
+        categoryQueryParam.setLevel(2);
175
+        List<BasePerformanceIndicatorCategory> categoryList = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryList(categoryQueryParam);
176
+        if (CollUtil.isNotEmpty(categoryList)) {
177
+            BasePerformanceIndicatorCategory categoryTwo = categoryList.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
178
+            if (ObjUtil.isNotNull(categoryTwo)) {
179
+                BasePerformanceIndicatorCategory categoryOne = basePerformanceIndicatorCategoryService.selectBasePerformanceIndicatorCategoryById(categoryTwo.getParentId());
180
+                basePerformanceIndicator.setCategoryCodeOne(categoryOne.getCode());
145 181
                 basePerformanceIndicator.setCategoryNameOne(categoryOne.getName());
146
-                if (ObjUtil.isNotNull(basePerformanceIndicator.getCategoryCode()) && CollUtil.isNotEmpty(categoryOne.getChildren())) {
147
-                    List<BasePerformanceIndicatorCategory> children = (List<BasePerformanceIndicatorCategory>) categoryOne.getChildren();
148
-                    BasePerformanceIndicatorCategory categoryTwo = children.stream().filter(category -> StrUtil.equals(category.getCode(), basePerformanceIndicator.getCategoryCode())).findFirst().orElse(null);
149
-                    if (ObjUtil.isNotNull(categoryTwo)) {
150
-                        basePerformanceIndicator.setCategoryName(categoryTwo.getCode());
151
-                    } else {
152
-                        basePerformanceIndicator.setCategoryName(null);
153
-                    }
154
-                }
155
-            } else {
156
-                basePerformanceIndicator.setCategoryNameOne(null);
157 182
             }
158 183
         }
159 184
         // 判断奖罚类型