|  |  | @ -94,6 +94,11 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
			
		
	
		
			
				
					|  |  |  |         // 2.用户至少配置了house和stat规则的一个,那么就先查询房屋出来,然后根据房屋去找居民
 | 
			
		
	
		
			
				
					|  |  |  |         int housePageNo = 1; | 
			
		
	
		
			
				
					|  |  |  |         int total = 0; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 只能手动分页了
 | 
			
		
	
		
			
				
					|  |  |  |         int start = (pageNo - 1) * pageSize; | 
			
		
	
		
			
				
					|  |  |  |         int end = pageNo * pageSize; // 不包含
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         do { | 
			
		
	
		
			
				
					|  |  |  |             // 拿到房屋id列表,去查询居民列表
 | 
			
		
	
		
			
				
					|  |  |  |             List<String> houseIds = govOrgService.listHouseIdsByRules(customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
	
		
			
				
					|  |  | @ -104,30 +109,32 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             // 查询居民数量
 | 
			
		
	
		
			
				
					|  |  |  |             Integer count = epmetUserService.getTotalByPolicyRules( | 
			
		
	
		
			
				
					|  |  |  |                     customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
		
			
				
					|  |  |  |                     houseId, idCard, name, resiRule, houseIds); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             total += count; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             // 查询居民,满了20个,不再查询数据,只查询数量
 | 
			
		
	
		
			
				
					|  |  |  |             if (resultResis.size() < pageSize) { | 
			
		
	
		
			
				
					|  |  |  |             if (resultResis.size() < end) { | 
			
		
	
		
			
				
					|  |  |  |                 List<ResiByPolicyInfoResultDTO> resis = epmetUserService.listByPolicyRules( | 
			
		
	
		
			
				
					|  |  |  |                         customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
		
			
				
					|  |  |  |                         houseId, idCard, name, pageNo, pageSize, resiRule, houseIds); | 
			
		
	
		
			
				
					|  |  |  |                         houseId, idCard, name, 1, end, resiRule, houseIds); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                 resultResis.addAll(resis); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             // 查询数量
 | 
			
		
	
		
			
				
					|  |  |  |             Integer count = epmetUserService.getTotalByPolicyRules( | 
			
		
	
		
			
				
					|  |  |  |                     customerId, orgIdPath, orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
		
			
				
					|  |  |  |                     houseId, idCard, name, resiRule, houseIds); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             total += count; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             housePageNo ++; | 
			
		
	
		
			
				
					|  |  |  |         } while (true); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 够了20个,那就截取前20个,否则直接返回
 | 
			
		
	
		
			
				
					|  |  |  |         if (resultResis.size() > 20) { | 
			
		
	
		
			
				
					|  |  |  |             resultResis = resultResis.subList(0, 20); | 
			
		
	
		
			
				
					|  |  |  |         // 查出来所有的数据都没够到这一页的起始条数,返回空
 | 
			
		
	
		
			
				
					|  |  |  |         if (resultResis.size() < start) { | 
			
		
	
		
			
				
					|  |  |  |             return new PageData<>(new ArrayList<>(), total); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         resultResis = resultResis.subList(start, Math.min(end, resultResis.size())); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 补充额外信息
 | 
			
		
	
		
			
				
					|  |  |  |         fillResisExtraInfoForPolicy(resultResis); | 
			
		
	
		
			
				
					|  |  |  |         return new PageData<>(resultResis, total); | 
			
		
	
	
		
			
				
					|  |  | 
 |