Browse Source

Merge branch 'feature/dev_union'

master
wanggongfeng 3 years ago
parent
commit
e2450dba13
  1. 40
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

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

@ -926,6 +926,7 @@ public class AgencyServiceImpl implements AgencyService {
@Override
public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) {
List<CustomerTreeDTO> resultList = new ArrayList<>();
List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null);
List<CustomerTreeDTO> treeList = new ArrayList<>();
Map<String, CustomerTreeDTO> treeMap = new HashMap<>();
@ -934,26 +935,13 @@ public class AgencyServiceImpl implements AgencyService {
rootList.forEach(item -> {
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.forEach(item -> {
List<String> customerNames = new ArrayList<>();
List<CustomerTreeDTO> subList = customerAgencyDao.selectRootCustomer(item.getAreaCode(), item.getLevel());
if (!subList.isEmpty()) {
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(item.getCustomerId());
Result<CustomerDTO> customerResult = operCrmFeignClient.getCustomerInfo(customerDTO);
if (customerResult.success() && null != customerResult.getData()) {
customerNames.add(customerResult.getData().getCustomerName());
}
}
item.setCustomerName(Joiner.on(",").join(customerNames));
});
resultList = getCustomerTree(treeList);
}
return rootList;
return resultList;
}
private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) {
@ -1027,12 +1015,27 @@ public class AgencyServiceImpl implements AgencyService {
*
* @param
* @return com.epmet.dto.result.CustomerTreeDTO
* @author zhy
* @author wgf
* @date 2022/7/6 13:54
*/
private List<CustomerTreeDTO> getCustomerTree(List<CustomerTreeDTO> treeList) {
treeList = treeList.stream().distinct().collect(Collectors.toList());
// 回显客户名称
treeList.forEach(item -> {
List<String> customerNames = new ArrayList<>();
List<CustomerTreeDTO> subList = customerAgencyDao.selectRootCustomer(item.getAreaCode(), item.getLevel());
subList.forEach(customer -> {
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(customer.getCustomerId());
Result<CustomerDTO> customerResult = operCrmFeignClient.getCustomerInfo(customerDTO);
if (customerResult.success() && null != customerResult.getData()) {
customerNames.add(customerResult.getData().getCustomerName());
}
});
item.setCustomerName(Joiner.on(",").join(customerNames));
});
// 省
List<CustomerTreeDTO> province = new ArrayList<CustomerTreeDTO>();
// 市
@ -1080,6 +1083,7 @@ public class AgencyServiceImpl implements AgencyService {
/**
* 组装子项
*
* @param parentDto
* @param childList
*/

Loading…
Cancel
Save