|  | @ -2,10 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.commons.tools.constant.NumConstant; |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; |  |  | import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; | 
			
		
	
		
		
			
				
					
					|  |  | import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; |  |  | import com.epmet.dto.extract.result.*; | 
			
				
				
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.extract.result.PartyInfoResultDTO; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.extract.result.PartyMemberInfoResultDTO; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.extract.result.UserCountResultDTO; |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; |  |  | import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService; |  |  | import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; |  |  | import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; | 
			
		
	
	
		
		
			
				
					|  | @ -109,56 +106,27 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
			
		
	
		
		
			
				
					|  |  |                 // 是 community 级别,子级为gridId
 |  |  |                 // 是 community 级别,子级为gridId
 | 
			
		
	
		
		
			
				
					|  |  |                 List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); |  |  |                 List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); | 
			
		
	
		
		
			
				
					|  |  |                 agencyIdList.forEach(agency -> { |  |  |                 agencyIdList.forEach(agency -> { | 
			
		
	
		
		
			
				
					
					|  |  |                     // 1. 处理社区下的所有网格中的党员信息
 |  |  |                     GridPartyDTO gridPartyDTO = gridParty(customerId, dateId, agency); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                     String agencyId = agency.getAgencyId(); |  |  |                     result.addAll(gridPartyDTO.getResult()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                     // 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId)
 |  |  |                     orgIds.addAll(gridPartyDTO.getOrgIds()); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |                     Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     List<String> gridIds = (List<String>) agencyMap.get(agencyId); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     orgIds.addAll(gridIds); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     if (!CollectionUtils.isEmpty(partyMemberInfoList)){ |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         // 为每个人赋值年龄
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         partyMemberInfoList.forEach(party -> { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             party.setAge(getAge(party.getBirthday())); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         }); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         groupByGridId.forEach((gridId,partyInfos) -> { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setOrgType(ScreenConstant.GRID); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setOrgId(gridId); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setCustomerId(customerId); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setDataEndTime(dateId); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             if (!CollectionUtils.isEmpty(userCountList)){ |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                 userCountList.forEach(user -> { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                     if (gridId.equals(user.getOrgId())){ |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                         form.setResiTotal(user.getResiTotal()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                         form.setRegisterUserCount(user.getRegisterUserCount()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                         form.setPartyMemberCount(user.getPartyMemberCount()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                                 }); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             } |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                             result.add(form); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                         }); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 }); |  |  |                 }); | 
			
		
	
		
		
			
				
					|  |  |                 // 2. 处理社区级别的党员信息(因为网格级别的已算出,社区级别直接累加)
 |  |  |                 // 2. 处理社区级别的党员信息(因为网格级别的已算出,社区级别直接累加)
 | 
			
		
	
		
		
			
				
					|  |  |                 Map<String, List<PartyBaseInfoFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId)); |  |  |                 Map<String, List<PartyBaseInfoFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(result.stream().map(m -> m.getParentId()).distinct().collect(Collectors.toList())); | 
			
		
	
		
		
			
				
					|  |  |                 groupByAgency.forEach((commAgencyId,party) -> { |  |  |                 groupByAgency.forEach((commAgencyId,party) -> { | 
			
		
	
		
		
			
				
					|  |  |                     PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); |  |  |                     PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
			
		
	
		
		
			
				
					
					|  |  |                     form.setOrgName(party.get(NumConstant.ZERO).getOrgName()); |  |  |                     if (!CollectionUtils.isEmpty(orgNameAgencyList)){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                         orgNameAgencyList.forEach(name -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             if (commAgencyId.equals(name.getAgencyId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setOrgName(name.getAgencyName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setParentId(name.getParentId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                     form.setOrgId(commAgencyId); |  |  |                     form.setOrgId(commAgencyId); | 
			
		
	
		
		
			
				
					|  |  |                     form.setCustomerId(customerId); |  |  |                     form.setCustomerId(customerId); | 
			
		
	
		
		
			
				
					|  |  |                     form.setDataEndTime(dateId); |  |  |                     form.setDataEndTime(dateId); | 
			
		
	
		
		
			
				
					|  |  |                     form.setOrgType(ScreenConstant.AGENCY); |  |  |                     form.setOrgType(ScreenConstant.AGENCY); | 
			
		
	
		
		
			
				
					|  |  |                     form.setParentId(party.get(NumConstant.ZERO).getParentId()); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                     form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1))); |  |  |                     form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1))); | 
			
		
	
		
		
			
				
					|  |  |                     form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2))); |  |  |                     form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2))); | 
			
		
	
		
		
			
				
					|  |  |                     form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3))); |  |  |                     form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3))); | 
			
		
	
	
		
		
			
				
					|  | @ -173,10 +141,66 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
			
		
	
		
		
			
				
					|  |  |                 delAndInsert(result,customerId,dateId,orgIds); |  |  |                 delAndInsert(result,customerId,dateId,orgIds); | 
			
		
	
		
		
			
				
					|  |  |             }else { |  |  |             }else { | 
			
		
	
		
		
			
				
					|  |  |                 // 级别为 street,district,city,province
 |  |  |                 // 级别为 street,district,city,province
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 List<String> agencyIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 List<GridInfoResultDTO> directGridIds = gridService.selectDirectGrid(agencyIds); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); | 
			
		
	
		
		
			
				
					|  |  |                 agencyIdList.forEach(agency -> { |  |  |                 agencyIdList.forEach(agency -> { | 
			
		
	
		
		
			
				
					|  |  |                     String agencyId = agency.getAgencyId(); |  |  |                     String agencyId = agency.getAgencyId(); | 
			
		
	
		
		
			
				
					
					|  |  |                     // 查询下级机关的党员信息,直接累加
 |  |  |                     List<String> dGridId = new ArrayList<>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                     directGridIds.forEach(grid -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         if (agencyId.equals(grid.getAgencyId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             dGridId.add(grid.getGridId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     // 不为空 存在直属网格
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     if (!CollectionUtils.isEmpty(dGridId)){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         List<PartyBaseInfoFormDTO> disGrid = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, dGridId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyMemberInfoList.stream().map(m -> m.getGridId()).collect(Collectors.toList())); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         if (!CollectionUtils.isEmpty(partyMemberInfoList)){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             // 为每个人赋值年龄
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             partyMemberInfoList.forEach(party -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 party.setAge(getAge(party.getBirthday())); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 orgNameList.forEach(orgName -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                     if (party.getGridId().equals(orgName.getGridId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                         party.setGridName(orgName.getGridName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                         party.setAgencyName(orgName.getAgencyName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             groupByGridId.forEach((gridId,partyInfos) -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setOrgType(ScreenConstant.GRID); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setOrgId(gridId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setCustomerId(customerId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setDataEndTime(dateId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 if (!CollectionUtils.isEmpty(userCountList)){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                     userCountList.forEach(user -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                         if (gridId.equals(user.getOrgId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                             form.setResiTotal(user.getResiTotal()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                             form.setRegisterUserCount(user.getRegisterUserCount()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                             form.setPartyMemberCount(user.getPartyMemberCount()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                     }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                 disGrid.add(form); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         delAndInsert(disGrid,customerId,dateId,dGridId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     // 查询下级机关的党员信息,直接累加 【包括直属网格】
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     List<PartyInfoResultDTO> directGridList = cpcBaseDataService.selectDirectGridPartyInfo(dGridId, customerId, dateId); | 
			
		
	
		
		
			
				
					|  |  |                     List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId); |  |  |                     List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     partyInfoList.addAll(directGridList); | 
			
		
	
		
		
			
				
					|  |  |                     if (!CollectionUtils.isEmpty(partyInfoList)){ |  |  |                     if (!CollectionUtils.isEmpty(partyInfoList)){ | 
			
		
	
		
		
			
				
					|  |  |                         PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); |  |  |                         PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
			
		
	
		
		
			
				
					|  |  |                         form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); |  |  |                         form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); | 
			
		
	
	
		
		
			
				
					|  | @ -307,4 +331,57 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
			
		
	
		
		
			
				
					|  |  |             cpcBaseDataService.insertPartyBaseInfo(p); |  |  |             cpcBaseDataService.insertPartyBaseInfo(p); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public GridPartyDTO gridParty(String customerId,String dateId,CustomerAgencyInfoResultDTO agency){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<PartyBaseInfoFormDTO> result = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<String> orgIds = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         // 1. 处理社区下的所有网格中的党员信息
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         String agencyId = agency.getAgencyId(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         // 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId)
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<String> gridIds = (List<String>) agencyMap.get(agencyId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         orgIds.addAll(gridIds); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyMemberInfoList.stream().map(m -> m.getGridId()).collect(Collectors.toList())); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         if (!CollectionUtils.isEmpty(partyMemberInfoList)){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             // 为每个人赋值年龄
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             partyMemberInfoList.forEach(party -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 party.setAge(getAge(party.getBirthday())); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 orgNameList.forEach(orgName -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     if (party.getGridId().equals(orgName.getGridId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         party.setGridName(orgName.getGridName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         party.setAgencyName(orgName.getAgencyName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             groupByGridId.forEach((gridId,partyInfos) -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setOrgType(ScreenConstant.GRID); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setOrgId(gridId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setCustomerId(customerId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setDataEndTime(dateId); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (!CollectionUtils.isEmpty(userCountList)){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     userCountList.forEach(user -> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         if (gridId.equals(user.getOrgId())){ | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             form.setResiTotal(user.getResiTotal()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             form.setRegisterUserCount(user.getRegisterUserCount()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             form.setPartyMemberCount(user.getPartyMemberCount()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 result.add(form); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             }); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return new GridPartyDTO(orgIds, result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | } |  |  | } | 
			
		
	
	
		
		
			
				
					|  | 
 |