| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -67,10 +67,7 @@ import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.math.BigDecimal; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.ArrayList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Arrays; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Date; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 机关单位信息 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -926,11 +923,15 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public List<CustomerTreeDTO> getCustomerTree(TokenDto tokenDto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<CustomerTreeDTO> rootList = customerAgencyDao.selectRootCustomer(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, CustomerTreeDTO> treeMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!rootList.isEmpty()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            rootList.forEach(this::getSubCustomer); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            rootList.forEach(item -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                getSubCustomer(item, treeMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return rootList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private CustomerAgencyEntity constructInsertEntity(AddAgencyV2FormDTO formDTO, CustomerAgencyDTO parent) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        CustomerAgencyEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        insertEntity.setOrganizationName(formDTO.getAgencyName()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -988,22 +989,16 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zhy | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2022/7/6 13:54 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private CustomerRelationTreeDTO getSubCustomer(CustomerTreeDTO customer) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AreaCodeDetailFormDTO formDTO = new AreaCodeDetailFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.setAreaCode(customer.getAreaCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.setLevel(customer.getLevel()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<AreaCodeResultDTO> area = epmetCommonServiceOpenFeignClient.areaCodeDetail(formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void getSubCustomer(CustomerTreeDTO customer,Map<String, CustomerTreeDTO> treeMap) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<List<CustomerTreeDTO>> area = epmetCommonServiceOpenFeignClient.areaCodeTree(customer); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (area.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (area.getData() != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                customer.setAreaName(area.getData().getAreaName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                area.getData().forEach(item->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    treeMap.put(item.getAreaCode(),item); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<CustomerTreeDTO> children = baseDao.selectSubCustomerByPid(customer.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customer.setChildren(children); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!children.isEmpty()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            children.forEach(this::getSubCustomer); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return customer; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |