|
|
@@ -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
|
/**
|