Browse Source

补充完善

master
zhangyuan 3 years ago
parent
commit
4c0fceac73
  1. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -69,6 +69,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 机关单位信息 * 机关单位信息
@ -924,12 +926,14 @@ public class AgencyServiceImpl implements AgencyService {
@Override @Override
public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) {
List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null); List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null);
List<CustomerTreeDTO> treeList = new ArrayList<>();
Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); Map<String, CustomerTreeDTO> treeMap = new HashMap<>();
if (!rootList.isEmpty()) { if (!rootList.isEmpty()) {
// 获取已有客户的所有组织架构,并转换成map,保证唯一 // 获取已有客户的所有组织架构,并转换成map,保证唯一
rootList.forEach(item -> { rootList.forEach(item -> {
customerHandle(item, treeMap); customerHandle(item, treeList);
}); });
treeMap = treeList.stream().collect(Collectors.toMap(CustomerTreeDTO::getAreaCode, Function.identity()));
// 组合成组织树 // 组合成组织树
rootList = getCustomerTree(treeMap); rootList = getCustomerTree(treeMap);
// 回显客户名称 // 回显客户名称
@ -1008,11 +1012,11 @@ public class AgencyServiceImpl implements AgencyService {
* @author zhy * @author zhy
* @date 2022/7/6 13:54 * @date 2022/7/6 13:54
*/ */
private void customerHandle(CustomerTreeDTO customer, Map<String, CustomerTreeDTO> treeMap) { private void customerHandle(CustomerTreeDTO customer, List<CustomerTreeDTO> treeList) {
Result<List<CustomerTreeDTO>> area = epmetCommonServiceOpenFeignClient.areaCodeTree(customer); Result<List<CustomerTreeDTO>> area = epmetCommonServiceOpenFeignClient.areaCodeTree(customer);
if (area.success()) { if (area.success()) {
if (area.getData() != null) { if (area.getData() != null) {
area.getData().forEach(item -> treeMap.put(item.getAreaCode(), item)); treeList.addAll(area.getData());
} }
} }
} }

Loading…
Cancel
Save