| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -293,8 +293,38 @@ public class DataStatsServiceImpl implements DataStatsService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (subAgencyList.size() < NumConstant.ONE) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return resultList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					       // List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        subAgencyList.forEach(sub->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //0.根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> agencyList = indexService.getAgencyIdsByAgencyId(formDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            agencyList.add(sub.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<SubAgencyUserResultDTO> list = dataStatsDao.getSubAgencyUser(agencyList, formDTO.getDateId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //3.封装数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            int userTotal = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            int resiTotal = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            int partyMemberTotal = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for (SubAgencyUserResultDTO u : list){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                userTotal+=u.getUserTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resiTotal+=u.getResiTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                partyMemberTotal+=u.getPartyMemberTotal(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            SubAgencyUserResultDTO dto = new SubAgencyUserResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setAgencyId(sub.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setAgencyName(sub.getAgencyName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setLevel(null == sub.getLevel() ? "" : sub.getLevel()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setAreaCode(null == sub.getAreaCode() ? "" : sub.getAreaCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setUserTotal(userTotal); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setPartyMemberTotal(partyMemberTotal); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setResiTotal(resiTotal); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setPartyMemberRatio(dto.getPartyMemberTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getPartyMemberTotal() / (float) dto.getUserTotal()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resultList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /* | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<SubAgencyUserResultDTO> list = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -316,7 +346,7 @@ public class DataStatsServiceImpl implements DataStatsService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setResiRatio(dto.getResiTotal() == 0 || dto.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) dto.getResiTotal() / (float) dto.getUserTotal()))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resultList.add(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //4.按要求排序并返回
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Collections.sort(resultList, new Comparator<SubAgencyUserResultDTO>() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            @Override | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |