| 
						
						
						
					 | 
					@ -1,16 +1,24 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.controller; | 
					 | 
					 | 
					package com.epmet.controller; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.alibaba.excel.EasyExcel; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.alibaba.excel.ExcelWriter; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.alibaba.excel.write.metadata.WriteSheet; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; | 
					 | 
					 | 
					import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.annotation.LoginUser; | 
					 | 
					 | 
					import com.epmet.commons.tools.annotation.LoginUser; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.aop.NoRepeatSubmit; | 
					 | 
					 | 
					import com.epmet.commons.tools.aop.NoRepeatSubmit; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.AppClientConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.AppClientConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.OptionDataResultDTO; | 
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.OptionDataResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
					 | 
					 | 
					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.ExcelUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					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.AssertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.validator.group.AddGroup; | 
					 | 
					 | 
					import com.epmet.commons.tools.validator.group.AddGroup; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -28,6 +36,7 @@ import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.collections4.CollectionUtils; | 
					 | 
					 | 
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.io.FilenameUtils; | 
					 | 
					 | 
					import org.apache.commons.io.FilenameUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.io.IOUtils; | 
					 | 
					 | 
					import org.apache.commons.io.IOUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.http.HttpHeaders; | 
					 | 
					 | 
					import org.springframework.http.HttpHeaders; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.web.bind.annotation.*; | 
					 | 
					 | 
					import org.springframework.web.bind.annotation.*; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -40,11 +49,9 @@ import javax.servlet.http.HttpServletResponse; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.IOException; | 
					 | 
					 | 
					import java.io.IOException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.io.InputStream; | 
					 | 
					 | 
					import java.io.InputStream; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.net.URLEncoder; | 
					 | 
					 | 
					import java.net.URLEncoder; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import java.nio.file.Path; | 
					 | 
					 | 
					import java.util.Date; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.ArrayList; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import java.util.List; | 
					 | 
					 | 
					import java.util.List; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.concurrent.CompletableFuture; | 
					 | 
					 | 
					import java.util.concurrent.CompletableFuture; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.concurrent.atomic.AtomicInteger; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.stream.Collectors; | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -64,11 +71,6 @@ public class IcPartyUnitController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Resource | 
					 | 
					 | 
					    @Resource | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; | 
					 | 
					 | 
					    private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 联建单位上传临时目录 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private Path IC_PARTY_UNIT_UPLOAD_DIR; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 联建单位-列表查询 | 
					 | 
					 | 
					     * 联建单位-列表查询 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -122,25 +124,38 @@ public class IcPartyUnitController { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @PostMapping("export") | 
					 | 
					 | 
					    @PostMapping("export") | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void export(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO, HttpServletResponse response) throws Exception { | 
					 | 
					 | 
					    public void export(@LoginUser TokenDto tokenDto, @RequestBody PartyUnitFormDTO formDTO, HttpServletResponse response) throws Exception { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
					 | 
					 | 
					        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<IcPartyUnitDTO> list = icPartyUnitService.list(formDTO); | 
					 | 
					 | 
					        formDTO.setIsPage(false); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        List<IcPartyUnitExcel> excelList = new ArrayList<>(); | 
					 | 
					 | 
					        formDTO.setCurrentStaffId(tokenDto.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        AtomicInteger i = new AtomicInteger(1); | 
					 | 
					 | 
					        ExcelWriter excelWriter = null; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(list)) { | 
					 | 
					 | 
					        formDTO.setPageSize(NumConstant.TEN_THOUSAND); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            excelList = list.stream().map(item -> { | 
					 | 
					 | 
					        int pageNo = formDTO.getPageNo(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                IcPartyUnitExcel excel = new IcPartyUnitExcel(); | 
					 | 
					 | 
					        try { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setIndex(i.getAndIncrement()); | 
					 | 
					 | 
					            // 这里 需要指定写用哪个class去写
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setUnitName(item.getUnitName()); | 
					 | 
					 | 
					            String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setContact(item.getContact()); | 
					 | 
					 | 
					            String fileName = "行程上报信息".concat(today); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setContactMobile(item.getContactMobile()); | 
					 | 
					 | 
					            excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcPartyUnitExcel.class).build(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setType(item.getType()); | 
					 | 
					 | 
					            WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setMemberCount(item.getMemberCount()); | 
					 | 
					 | 
					            PageData<IcPartyUnitDTO> data = null; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setRemark(item.getRemark()); | 
					 | 
					 | 
					            List<IcPartyUnitExcel> list = null; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setSatisfaction(item.getSatisfaction()); | 
					 | 
					 | 
					            do { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                excel.setServiceMatter(String.join(String.valueOf((char) 10), item.getServiceMatterList())); | 
					 | 
					 | 
					                data = icPartyUnitService.search(formDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                return excel; | 
					 | 
					 | 
					                data.getList().stream().map(item -> { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    item.setServiceMatterName(StringUtils.join(item.getServiceMatterList(), StrConstant.COMMA_ZH)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return item; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                }).collect(Collectors.toList()); | 
					 | 
					 | 
					                }).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                list = ConvertUtils.sourceToTarget(data.getList(), IcPartyUnitExcel.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                formDTO.setPageNo(++pageNo); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                excelWriter.write(list, writeSheet); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log.error("export exception", e); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } finally { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 千万别忘记finish 会帮忙关闭流
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (excelWriter != null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                excelWriter.finish(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        ExcelUtils.exportExcelToTarget(response, null, excelList, IcPartyUnitExcel.class); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |