| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -22,7 +22,10 @@ import com.epmet.dataaggre.service.ResiService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.service.epmetuser.EpmetUserService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dataaggre.service.govorg.GovOrgService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.IcNeighborHoodDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.LoginUserDetailsFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.LoginUserDetailsResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetHeartOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -48,21 +51,34 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetHeartOpenFeignClient heartOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient userOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public PageData<ResiByPolicyInfoResultDTO> listByPolicyRules(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                             String houseId, String idCard, String name, Integer pageNo, Integer pageSize, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                             List<ResisByPolicyRulesFormDTO.ResiRule> resiRule, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                             List<ResisByPolicyRulesFormDTO.HouseRule> houseRule, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                                             List<ResisByPolicyRulesFormDTO.StatRule> statRule) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String userId = EpmetRequestHolder.getLoginUserId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String app = EpmetRequestHolder.getLoginUserApp(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String client = EpmetRequestHolder.getLoginUserClient(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String customerId = EpmetRequestHolder.getLoginUserCustomerId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 查询当前组织及下级id路径
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LoginUserDetailsResultDTO userDetail = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(new LoginUserDetailsFormDTO(app, client, userId)), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String orgIdPath = userDetail.getOrgIdPath(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 结果集
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ResiByPolicyInfoResultDTO> resultResis = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 1.用户没配置house和stat规则,直接按照居民规则查询
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(statRule)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ResiByPolicyInfoResultDTO> resis = epmetUserService.listByPolicyRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ResiByPolicyInfoResultDTO> resis = epmetUserService.listByPolicyRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    houseId, idCard, name, pageNo, pageSize, resiRule, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            fillResisExtraInfoForPolicy(resis); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new PageData<>(resis, new PageInfo(resis).getTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -71,7 +87,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        int total = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 拿到房屋id列表,去查询居民列表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcHouseEntity> houseEntities = govOrgService.listHousesByRules(customerId, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcHouseEntity> houseEntities = govOrgService.listHousesByRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    houseId, houseRule, statRule, housePageNo, 50); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> houseIds = houseEntities.stream().map(icHouseEntity -> icHouseEntity.getId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -83,7 +99,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 查询居民,满了20个,不再查询数据,只查询数量
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (resultResis.size() < pageSize) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<ResiByPolicyInfoResultDTO> resis = epmetUserService.listByPolicyRules( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        customerId, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        houseId, idCard, name, pageNo, pageSize, resiRule, houseIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resultResis.addAll(resis); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -91,7 +107,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 查询数量
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Integer count = epmetUserService.getTotalByPolicyRules( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    customerId, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    houseId, idCard, name, resiRule, houseIds); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            total += count; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |