zhangyuan 3 years ago
parent
commit
0ad8be25e9
  1. 45
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

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

@ -934,21 +934,21 @@ public class AgencyServiceImpl implements AgencyService {
rootList.forEach(item -> { rootList.forEach(item -> {
customerHandle(item, treeList); customerHandle(item, treeList);
}); });
treeMap = treeList.stream().collect(Collectors.toMap(CustomerTreeDTO::getAreaCode, Function.identity(), (val1, val2) -> val2)); // treeMap = treeList.stream().collect(Collectors.toMap(CustomerTreeDTO::getAreaCode, Function.identity(), (val1, val2) -> val2));
// 组合成组织树 // 组合成组织树
rootList = getCustomerTree(treeList); rootList = getCustomerTree(treeList);
// 回显客户名称 // 回显客户名称
rootList.forEach(item -> { rootList.forEach(item -> {
List<String> customerNames = new ArrayList<>(); List<String> customerNames = new ArrayList<>();
List<CustomerTreeDTO> subList = customerAgencyDao.selectRootCustomer(item.getAreaCode(), item.getLevel()); List<CustomerTreeDTO> subList = customerAgencyDao.selectRootCustomer(item.getAreaCode(), item.getLevel());
if (!subList.isEmpty()) { subList.forEach(customer -> {
CustomerDTO customerDTO = new CustomerDTO(); CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(item.getCustomerId()); customerDTO.setId(customer.getCustomerId());
Result<CustomerDTO> customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); Result<CustomerDTO> customerResult = operCrmFeignClient.getCustomerInfo(customerDTO);
if (customerResult.success() && null != customerResult.getData()) { if (customerResult.success() && null != customerResult.getData()) {
customerNames.add(customerResult.getData().getCustomerName()); customerNames.add(customerResult.getData().getCustomerName());
} }
} });
item.setCustomerName(Joiner.on(",").join(customerNames)); item.setCustomerName(Joiner.on(",").join(customerNames));
}); });
} }
@ -1027,7 +1027,7 @@ public class AgencyServiceImpl implements AgencyService {
* *
* @param * @param
* @return com.epmet.dto.result.CustomerTreeDTO * @return com.epmet.dto.result.CustomerTreeDTO
* @author zhy * @author wgf
* @date 2022/7/6 13:54 * @date 2022/7/6 13:54
*/ */
private List<CustomerTreeDTO> getCustomerTree(List<CustomerTreeDTO> treeList) { private List<CustomerTreeDTO> getCustomerTree(List<CustomerTreeDTO> treeList) {
@ -1043,35 +1043,35 @@ public class AgencyServiceImpl implements AgencyService {
List<CustomerTreeDTO> street = new ArrayList<CustomerTreeDTO>(); List<CustomerTreeDTO> street = new ArrayList<CustomerTreeDTO>();
// 社区 // 社区
List<CustomerTreeDTO> community = new ArrayList<CustomerTreeDTO>(); List<CustomerTreeDTO> community = new ArrayList<CustomerTreeDTO>();
for(int i = 0 ; i < treeList.size() ; i++){ for (int i = 0; i < treeList.size(); i++) {
if("province".equals(treeList.get(i).getLevel())){ if ("province".equals(treeList.get(i).getLevel())) {
province.add(treeList.get(i)); province.add(treeList.get(i));
} else if("city".equals(treeList.get(i).getLevel())){ } else if ("city".equals(treeList.get(i).getLevel())) {
city.add(treeList.get(i)); city.add(treeList.get(i));
} else if("district".equals(treeList.get(i).getLevel())){ } else if ("district".equals(treeList.get(i).getLevel())) {
district.add(treeList.get(i)); district.add(treeList.get(i));
} else if("street".equals(treeList.get(i).getLevel())){ } else if ("street".equals(treeList.get(i).getLevel())) {
street.add(treeList.get(i)); street.add(treeList.get(i));
} else if("community".equals(treeList.get(i).getLevel())){ } else if ("community".equals(treeList.get(i).getLevel())) {
community.add(treeList.get(i)); community.add(treeList.get(i));
} }
} }
// 组装街道树 // 组装街道树
for(CustomerTreeDTO streetDto : street){ for (CustomerTreeDTO streetDto : street) {
this.addChild(streetDto,community); this.addChild(streetDto, community);
} }
// 组装区树 // 组装区树
for(CustomerTreeDTO districtDto : district){ for (CustomerTreeDTO districtDto : district) {
this.addChild(districtDto,street); this.addChild(districtDto, street);
} }
// 组装市树 // 组装市树
for(CustomerTreeDTO cityDto : city){ for (CustomerTreeDTO cityDto : city) {
this.addChild(cityDto,district); this.addChild(cityDto, district);
} }
// 组装省树 // 组装省树
for(CustomerTreeDTO provinceDto : province){ for (CustomerTreeDTO provinceDto : province) {
this.addChild(provinceDto,city); this.addChild(provinceDto, city);
} }
return province; return province;
@ -1080,13 +1080,14 @@ public class AgencyServiceImpl implements AgencyService {
/** /**
* 组装子项 * 组装子项
*
* @param parentDto * @param parentDto
* @param childList * @param childList
*/ */
private void addChild(CustomerTreeDTO parentDto,List<CustomerTreeDTO> childList){ private void addChild(CustomerTreeDTO parentDto, List<CustomerTreeDTO> childList) {
List<CustomerTreeDTO> children = new ArrayList<CustomerTreeDTO>(); List<CustomerTreeDTO> children = new ArrayList<CustomerTreeDTO>();
for(CustomerTreeDTO childDto : childList){ for (CustomerTreeDTO childDto : childList) {
if(parentDto.getAreaCode().equals(childDto.getParentCode())){ if (parentDto.getAreaCode().equals(childDto.getParentCode())) {
children.add(childDto); children.add(childDto);
} }
} }

Loading…
Cancel
Save