|  |  | @ -1,13 +1,22 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.controller; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.EasyExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.ExcelWriter; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.excel.write.metadata.WriteSheet; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.annotation.LoginUser; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.aop.NoRepeatSubmit; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.form.PageFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.security.dto.TokenDto; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ExcelUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.validator.AssertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.validator.ValidatorUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.validator.group.AddGroup; | 
			
		
	
	
		
			
				
					|  |  | @ -17,11 +26,17 @@ import com.epmet.dto.IcEventDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IcEventReplyDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.excel.IcEventExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.IcEventReplyService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.IcEventService; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.collections4.CollectionUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.web.bind.annotation.*; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import javax.servlet.http.HttpServletResponse; | 
			
		
	
		
			
				
					|  |  |  | import java.io.IOException; | 
			
		
	
		
			
				
					|  |  |  | import java.io.PrintWriter; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  | import java.util.LinkedList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
	
		
			
				
					|  |  | @ -34,6 +49,7 @@ import java.util.List; | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @RestController | 
			
		
	
		
			
				
					|  |  |  | @RequestMapping("icEvent") | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | public class IcEventController { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
	
		
			
				
					|  |  | @ -371,4 +387,50 @@ public class IcEventController { | 
			
		
	
		
			
				
					|  |  |  |         icEventService.resiReply(formDTO); | 
			
		
	
		
			
				
					|  |  |  |         return new Result(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Author sun | 
			
		
	
		
			
				
					|  |  |  |      * @Description  数字平台-事件导出 | 
			
		
	
		
			
				
					|  |  |  |      **/ | 
			
		
	
		
			
				
					|  |  |  |     @PostMapping("export") | 
			
		
	
		
			
				
					|  |  |  |     public void export(@RequestBody IcEventListFormDTO formDTO, HttpServletResponse response) throws IOException { | 
			
		
	
		
			
				
					|  |  |  |         formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); | 
			
		
	
		
			
				
					|  |  |  |         formDTO.setStaffId("d8dfc6c1fa2538976059f3900036d419"); | 
			
		
	
		
			
				
					|  |  |  |         formDTO.setIsPage(false); | 
			
		
	
		
			
				
					|  |  |  |         ExcelWriter excelWriter = null; | 
			
		
	
		
			
				
					|  |  |  |         formDTO.setPageSize(NumConstant.TEN_THOUSAND); | 
			
		
	
		
			
				
					|  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |             String fileName = "事件管理" + DateUtils.format(new Date()) + ".xlsx"; | 
			
		
	
		
			
				
					|  |  |  |             excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcEventExcel.class).build(); | 
			
		
	
		
			
				
					|  |  |  |             WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); | 
			
		
	
		
			
				
					|  |  |  |             PageData<IcEventListResultDTO> data = null; | 
			
		
	
		
			
				
					|  |  |  |             List<IcEventExcel> list = null; | 
			
		
	
		
			
				
					|  |  |  |             do { | 
			
		
	
		
			
				
					|  |  |  |                 data = icEventService.list(formDTO); | 
			
		
	
		
			
				
					|  |  |  |                 data.getList().forEach(d->{ | 
			
		
	
		
			
				
					|  |  |  |                     if(!org.springframework.util.CollectionUtils.isEmpty(d.getImageList())){ | 
			
		
	
		
			
				
					|  |  |  |                         d.setImageUrl(d.getImageList().get(NumConstant.ZERO)); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |                 list = ConvertUtils.sourceToTarget(data.getList(), IcEventExcel.class); | 
			
		
	
		
			
				
					|  |  |  |                 formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); | 
			
		
	
		
			
				
					|  |  |  |                 excelWriter.write(list, writeSheet); | 
			
		
	
		
			
				
					|  |  |  |             } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); | 
			
		
	
		
			
				
					|  |  |  |         } 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(); | 
			
		
	
		
			
				
					|  |  |  |         } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |             log.error("export exception", e); | 
			
		
	
		
			
				
					|  |  |  |         } finally { | 
			
		
	
		
			
				
					|  |  |  |             if (excelWriter != null) { | 
			
		
	
		
			
				
					|  |  |  |                 excelWriter.finish(); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |