| 
						
						
							
								
							
						
						
					 | 
					@ -9,10 +9,13 @@ 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; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.DimCustomerPartymemberService; | 
					 | 
					 | 
					import com.epmet.service.stats.DimCustomerPartymemberService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService; | 
					 | 
					 | 
					import com.epmet.service.stats.user.FactParticipationUserAgencyDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.stats.user.FactParticipationUserGridDailyService; | 
					 | 
					 | 
					import com.epmet.service.stats.user.FactParticipationUserGridDailyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.apache.commons.collections4.ListUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.springframework.beans.BeanUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -39,6 +42,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private ScreenCustomerAgencyService agencyService; | 
					 | 
					 | 
					    private ScreenCustomerAgencyService agencyService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private ScreenCustomerGridService gridService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private DimCustomerPartymemberService partyMemberService; | 
					 | 
					 | 
					    private DimCustomerPartymemberService partyMemberService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private FactParticipationUserGridDailyService userGridDailyService; | 
					 | 
					 | 
					    private FactParticipationUserGridDailyService userGridDailyService; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -62,20 +67,22 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ | 
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY); | 
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                disPose(customerGridInfoList,true,customerId,dateId); | 
					 | 
					 | 
					                disPose(customerGridInfoList,true,customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }else if (groupByLevel.containsKey(ScreenConstant.STREET)){ | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.STREET)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET); | 
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }else if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT); | 
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }else if (groupByLevel.containsKey(ScreenConstant.CITY)){ | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.CITY)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY); | 
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }else if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE); | 
					 | 
					 | 
					                List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
					 | 
					 | 
					                disPose(customerGridInfoList,false,customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }else { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                // TODO 干啥
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return true; | 
					 | 
					 | 
					        return true; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -89,6 +96,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void disPose(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String dateId){ | 
					 | 
					 | 
					    public void disPose(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String dateId){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(agencyIdList)){ | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(agencyIdList)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<PartyBaseInfoFormDTO> result = new ArrayList<>(); | 
					 | 
					 | 
					            List<PartyBaseInfoFormDTO> result = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (isGrid == true){ | 
					 | 
					 | 
					            if (isGrid == true){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); | 
					 | 
					 | 
					                List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -97,6 +105,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    String agencyId = agency.getAgencyId(); | 
					 | 
					 | 
					                    String agencyId = agency.getAgencyId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); | 
					 | 
					 | 
					                    Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<String> gridIds = (List<String>) agencyMap.get(agencyId); | 
					 | 
					 | 
					                    List<String> gridIds = (List<String>) agencyMap.get(agencyId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    orgIds.addAll(gridIds); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); | 
					 | 
					 | 
					                    List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    if (!CollectionUtils.isEmpty(partyMemberInfoList)){ | 
					 | 
					 | 
					                    if (!CollectionUtils.isEmpty(partyMemberInfoList)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        // 为每个人赋值年龄
 | 
					 | 
					 | 
					                        // 为每个人赋值年龄
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -137,6 +146,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
					 | 
					 | 
					                    PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    form.setOrgName(party.get(NumConstant.ZERO).getOrgName()); | 
					 | 
					 | 
					                    form.setOrgName(party.get(NumConstant.ZERO).getOrgName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    form.setOrgId(commAgencyId); | 
					 | 
					 | 
					                    form.setOrgId(commAgencyId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    form.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    form.setDataEndTime(dateId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    form.setOrgType(ScreenConstant.AGENCY); | 
					 | 
					 | 
					                    form.setOrgType(ScreenConstant.AGENCY); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    form.setParentId(party.get(NumConstant.ZERO).getParentId()); | 
					 | 
					 | 
					                    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))); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -150,30 +161,32 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); | 
					 | 
					 | 
					                    form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    result.add(form); | 
					 | 
					 | 
					                    result.add(form); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                delAndInsert(result,customerId,dateId); | 
					 | 
					 | 
					                delAndInsert(result,customerId,dateId,orgIds); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            }else { | 
					 | 
					 | 
					            }else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                List<UserCountResultDTO> userCountRList = userAgencyDailyService.selectUserCount(customerId, dateId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                agencyIdList.forEach(agency -> { | 
					 | 
					 | 
					                agencyIdList.forEach(agency -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    String agencyId = agency.getAgencyId(); | 
					 | 
					 | 
					                    String agencyId = agency.getAgencyId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    // todo
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId); | 
					 | 
					 | 
					                    List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
					 | 
					 | 
					                    if (!CollectionUtils.isEmpty(partyInfoList)){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); | 
					 | 
					 | 
					                        PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setOrgId(agencyId); | 
					 | 
					 | 
					                        form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setOrgType(ScreenConstant.AGENCY); | 
					 | 
					 | 
					                        form.setOrgId(agencyId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setParentId(partyInfoList.get(NumConstant.ZERO).getParentId()); | 
					 | 
					 | 
					                        form.setCustomerId(customerId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel1(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel1))); | 
					 | 
					 | 
					                        form.setDataEndTime(dateId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel2(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel2))); | 
					 | 
					 | 
					                        form.setOrgType(ScreenConstant.AGENCY); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel3(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel3))); | 
					 | 
					 | 
					                        form.setParentId(partyInfoList.get(NumConstant.ZERO).getParentId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); | 
					 | 
					 | 
					                        form.setAgeLevel1(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel1))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); | 
					 | 
					 | 
					                        form.setAgeLevel2(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel2))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); | 
					 | 
					 | 
					                        form.setAgeLevel3(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel3))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); | 
					 | 
					 | 
					                        form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); | 
					 | 
					 | 
					                        form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); | 
					 | 
					 | 
					                        form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    result.add(form); | 
					 | 
					 | 
					                        form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        result.add(form); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                delAndInsert(result,customerId,dateId); | 
					 | 
					 | 
					                delAndInsert(result,customerId,dateId,orgIds); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -246,14 +259,34 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2020/9/23 10:13 上午 | 
					 | 
					 | 
					     * @date 2020/9/23 10:13 上午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void delAndInsert(List<PartyBaseInfoFormDTO> result, String customerId, String dateId){ | 
					 | 
					 | 
					    public void delAndInsert(List<PartyBaseInfoFormDTO> result, String customerId, String dateId, List<String> orgIds){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyBaseInfoFormDTO> partyBaseInfoList = agencyService.selectAllAgencyIdToParty(customerId,dateId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyBaseInfoFormDTO> resultList = gridService.selectAllGridIdToParty(customerId, dateId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        resultList.addAll(partyBaseInfoList); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<PartyBaseInfoFormDTO> finalResult = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        resultList.forEach(rl -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            orgIds.forEach(orgId -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (rl.getOrgId().equals(orgId)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    finalResult.add(rl); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(result)){ | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(result)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            List<String> orgIds = result.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); | 
					 | 
					 | 
					            finalResult.forEach(fr -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer delNum; | 
					 | 
					 | 
					                result.forEach(r -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            do { | 
					 | 
					 | 
					                    if (fr.getOrgId().equals(r.getOrgId())){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds); | 
					 | 
					 | 
					                        BeanUtils.copyProperties(r,fr); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            }while (delNum > NumConstant.ZERO); | 
					 | 
					 | 
					                    } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            cpcBaseDataService.insertPartyBaseInfo(result); | 
					 | 
					 | 
					                }); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Integer delNum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        do { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            delNum = cpcBaseDataService.deleteOldPartyBaseInfo(customerId, dateId, orgIds); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }while (delNum > NumConstant.ZERO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<List<PartyBaseInfoFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        partition.forEach(p -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            cpcBaseDataService.insertPartyBaseInfo(p); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |