| 
						
						
							
								
							
						
						
					 | 
					@ -926,6 +926,7 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { | 
					 | 
					 | 
					    public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<CustomerTreeDTO> resultList = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null); | 
					 | 
					 | 
					        List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(null, null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<CustomerTreeDTO> treeList = new ArrayList<>(); | 
					 | 
					 | 
					        List<CustomerTreeDTO> treeList = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); | 
					 | 
					 | 
					        Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -936,24 +937,11 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//            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); | 
					 | 
					 | 
					            resultList = getCustomerTree(treeList); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            // 回显客户名称
 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					            rootList.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)); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        return rootList; | 
					 | 
					 | 
					        return resultList; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { | 
					 | 
					 | 
					    private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -1033,6 +1021,21 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private List<CustomerTreeDTO> getCustomerTree(List<CustomerTreeDTO> treeList) { | 
					 | 
					 | 
					    private List<CustomerTreeDTO> getCustomerTree(List<CustomerTreeDTO> treeList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        treeList = treeList.stream().distinct().collect(Collectors.toList()); | 
					 | 
					 | 
					        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>(); | 
					 | 
					 | 
					        List<CustomerTreeDTO> province = new ArrayList<CustomerTreeDTO>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 市
 | 
					 | 
					 | 
					        // 市
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |