| 
						
						
						
					 | 
				
				 | 
				
					@ -1,9 +1,10 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import cn.afterturn.easypoi.excel.entity.TemplateExportParams; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.excel.EasyExcel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.excel.ExcelReader; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.excel.ExcelWriter; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.excel.read.metadata.ReadSheet; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.excel.write.metadata.WriteSheet; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -24,10 +25,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.FileUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.HouseQRcodeUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.CustomerGridConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.NeighborhoodConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constants.ImportTaskConstants; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -48,7 +46,6 @@ import com.epmet.model.HouseInfoModel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.model.ImportHouseInfoListener; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.redis.IcHouseRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.util.ExcelPoiUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.google.common.cache.Cache; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -377,22 +374,41 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void exportBuildinginfo(IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //如果类型是house 查房屋
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //导出房屋
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageData<IcHouseListResultDTO> icHouseExcels = new PageData<>(new ArrayList<>(), NumConstant.ZERO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcHouseListResultDTO> list = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        PageData<IcHouseListResultDTO> icHouseExcels = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Integer pageNo = NumConstant.ONE; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.setPageSize(NumConstant.TEN_THOUSAND); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ExcelWriter excelWriter = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        long start = System.currentTimeMillis(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String templatePath = "excel/house_export_for_easyexcel.xlsx"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(templatePath); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("房屋信息.xlsx", response)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .withTemplate(inputStream).build(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            WriteSheet writeSheet = EasyExcel.writerSheet().build(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            do { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                formDTO.setPageNo(pageNo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                icHouseExcels = getHouseList(formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (CollectionUtils.isEmpty(icHouseExcels.getList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            list.addAll(icHouseExcels.getList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                excelWriter.fill(icHouseExcels.getList(), writeSheet); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                pageNo++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } while (icHouseExcels.getList().size() == formDTO.getPageSize()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        TemplateExportParams templatePath = new TemplateExportParams("excel/house_export.xlsx"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, Object> map = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        map.put("maplist", list); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ExcelPoiUtils.exportExcel(templatePath, map, "房屋信息录入表", response); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } catch (EpmetException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            response.reset(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            response.setCharacterEncoding("UTF-8"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            response.setHeader("content-type", "application/json; charset=UTF-8"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            PrintWriter printWriter = response.getWriter(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            printWriter.write(JSON.toJSONString(result)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            printWriter.close(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } finally { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (excelWriter != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                excelWriter.finish(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("exportBuildinginfo cost:{}ms",System.currentTimeMillis()-start); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |