|  |  | @ -5,6 +5,7 @@ import com.alibaba.excel.EasyExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.ExcelWriter; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.support.ExcelTypeEnum; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.write.metadata.WriteSheet; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.ServiceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetException; | 
			
		
	
	
		
			
				
					|  |  | @ -12,6 +13,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.EpmetRequestHolder; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ExcelUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -215,7 +217,7 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void exportResisByPolicy(String orgId, String orgType, String neighborHoodId, String buildingId, String unitId, | 
			
		
	
		
			
				
					|  |  |  |                                     String houseId, String idCard, String name, Integer pageNo, Integer pageSize, | 
			
		
	
		
			
				
					|  |  |  |                                     String houseId, String idCard, String name, | 
			
		
	
		
			
				
					|  |  |  |                                     String ruleId, List<ResisByPolicyRulesFormDTO.ResiRule> resiRule, | 
			
		
	
		
			
				
					|  |  |  |                                     List<ResisByPolicyRulesFormDTO.HouseRule> houseRule, | 
			
		
	
		
			
				
					|  |  |  |                                     List<ResisByPolicyRulesFormDTO.StatRule> statRule, | 
			
		
	
	
		
			
				
					|  |  | @ -234,24 +236,34 @@ public class ResiServiceImpl implements ResiService, ResultDataResolver { | 
			
		
	
		
			
				
					|  |  |  |             statRule = ConvertUtils.sourceToTarget(ruleList.getStatRuleList(), ResisByPolicyRulesFormDTO.StatRule.class); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         ServletOutputStream ostream = response.getOutputStream(); | 
			
		
	
		
			
				
					|  |  |  |         ExcelWriterSheetBuilder sheetBuilder = EasyExcel.write(ostream, ResisByPolicyExcel.class).sheet("居民列表"); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 循环填充数据
 | 
			
		
	
		
			
				
					|  |  |  |         do { | 
			
		
	
		
			
				
					|  |  |  |             PageData<ResiByPolicyInfoResultDTO> resis = this.listByPolicyRules(orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
		
			
				
					|  |  |  |                     houseId, idCard, name, pageNo, pageSize, resiRule, houseRule, statRule); | 
			
		
	
		
			
				
					|  |  |  |             List<ResiByPolicyInfoResultDTO> list = resis.getList(); | 
			
		
	
		
			
				
					|  |  |  |             List<ResisByPolicyExcel> excelDatas = ConvertUtils.sourceToTarget(list, ResisByPolicyExcel.class); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(excelDatas)) { | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             //sheetBuilder.write(excelDatas);
 | 
			
		
	
		
			
				
					|  |  |  |         } while (true); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // 模板导出
 | 
			
		
	
		
			
				
					|  |  |  |         ExcelWriter writer = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("政策人员预览信息导出.xlsx", response)) | 
			
		
	
		
			
				
					|  |  |  |                 //.withTemplate(inputStream)
 | 
			
		
	
		
			
				
					|  |  |  |                 .build(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         WriteSheet writeSheet = EasyExcel.writerSheet("政策人员列表") | 
			
		
	
		
			
				
					|  |  |  |                 .head(ResiByPolicyInfoResultDTO.class) | 
			
		
	
		
			
				
					|  |  |  |                 .build(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         Integer pageSize = 500; | 
			
		
	
		
			
				
					|  |  |  |         Integer pageNo = 1; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |             do { | 
			
		
	
		
			
				
					|  |  |  |                 PageData<ResiByPolicyInfoResultDTO> resis = this.listByPolicyRules(orgId, orgType, neighborHoodId, buildingId, unitId, | 
			
		
	
		
			
				
					|  |  |  |                         houseId, idCard, name, pageNo, pageSize, resiRule, houseRule, statRule); | 
			
		
	
		
			
				
					|  |  |  |                 List<ResiByPolicyInfoResultDTO> list = resis.getList(); | 
			
		
	
		
			
				
					|  |  |  |                 List<ResisByPolicyExcel> excelDatas = ConvertUtils.sourceToTarget(list, ResisByPolicyExcel.class); | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isEmpty(excelDatas)) { | 
			
		
	
		
			
				
					|  |  |  |                     break; | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         System.out.println(666); | 
			
		
	
		
			
				
					|  |  |  |                 writer.write(resis.getList(), writeSheet); | 
			
		
	
		
			
				
					|  |  |  |                 pageNo++; | 
			
		
	
		
			
				
					|  |  |  |             } while (true); | 
			
		
	
		
			
				
					|  |  |  |         } finally { | 
			
		
	
		
			
				
					|  |  |  |             writer.finish(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |