|  |  | @ -18,6 +18,8 @@ import org.springframework.util.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * 中央区相关各指标查询 | 
			
		
	
	
		
			
				
					|  |  | @ -66,8 +68,26 @@ public class DistributionServiceImpl implements DistributionService { | 
			
		
	
		
			
				
					|  |  |  |         if (branchCountResultDTO.getLevel().equals(ScreenConstant.COMMUNITY)){ | 
			
		
	
		
			
				
					|  |  |  |             return new BranchCountResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         List<SubBranchCountResultDTO> agencyIds = screenCustomerAgencyDao.selectSubAgencyId(branchCountFormDTO.getAgencyId()); | 
			
		
	
		
			
				
					|  |  |  |         List<SubBranchCountResultDTO> subList = screenCustomerGridDao.selectBranchCount(branchCountFormDTO.getAgencyId()); | 
			
		
	
		
			
				
					|  |  |  |         branchCountResultDTO.setPartyDistribution(CollectionUtils.isEmpty(subList) ? new ArrayList<>() : subList); | 
			
		
	
		
			
				
					|  |  |  |         if (!CollectionUtils.isEmpty(subList)){ | 
			
		
	
		
			
				
					|  |  |  |             subList.forEach(sub -> { | 
			
		
	
		
			
				
					|  |  |  |                 agencyIds.forEach(agencyId -> { | 
			
		
	
		
			
				
					|  |  |  |                     if (sub.getAllParentIds().contains(agencyId.getSubId())){ | 
			
		
	
		
			
				
					|  |  |  |                         sub.setSubAgencyId(agencyId.getSubId()); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         Map<String, List<SubBranchCountResultDTO>> groupBySubAgency = subList.stream().collect(Collectors.groupingBy(sub -> sub.getSubAgencyId())); | 
			
		
	
		
			
				
					|  |  |  |         agencyIds.forEach(a -> { | 
			
		
	
		
			
				
					|  |  |  |             groupBySubAgency.forEach((agencyId,value) -> { | 
			
		
	
		
			
				
					|  |  |  |                 if (a.getSubId().equals(agencyId)){ | 
			
		
	
		
			
				
					|  |  |  |                     a.setTotalNum(value.stream().collect(Collectors.summingInt(v -> v.getTotalNum()))); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         branchCountResultDTO.setPartyDistribution(CollectionUtils.isEmpty(agencyIds) ? new ArrayList<>() : agencyIds); | 
			
		
	
		
			
				
					|  |  |  |         return branchCountResultDTO; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 |