|
|
@ -14,10 +14,7 @@ import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
|
import com.epmet.commons.tools.utils.FileUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dto.IcNatDTO; |
|
|
@ -26,6 +23,7 @@ import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.form.MyNatListFormDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.dto.result.MyNatListResultDTO; |
|
|
|
import com.epmet.dto.result.NatListCommonExcelResultDTO; |
|
|
|
import com.epmet.dto.result.NatListResultDTO; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.service.IcNatService; |
|
|
@ -268,15 +266,28 @@ public class IcNatController implements ResultDataResolver { |
|
|
|
try { |
|
|
|
// 这里 需要指定写用哪个class去写
|
|
|
|
String fileName = "核酸检测信息.xlsx"; |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response),NatListResultDTO.class).build(); |
|
|
|
if ("all".equals(formDTO.getOrgType())) { |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListResultDTO.class).build(); |
|
|
|
}else { |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListCommonExcelResultDTO.class).build(); |
|
|
|
} |
|
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); |
|
|
|
PageData<NatListResultDTO> data = null; |
|
|
|
do { |
|
|
|
data = icNucleinService.natList(formDTO); |
|
|
|
data.getList().forEach(o->o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult())?"阳性":"阴性")); |
|
|
|
data.getList().forEach(o-> { |
|
|
|
o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult()) ? "阳性" : "阴性"); |
|
|
|
o.setIsResiUser(NumConstant.ONE_STR.equals(o.getNatResult()) ? "是" : "否"); |
|
|
|
}); |
|
|
|
formDTO.setPageNo(++pageNo); |
|
|
|
excelWriter.write(data.getList(), writeSheet); |
|
|
|
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size()==formDTO.getPageSize()); |
|
|
|
if ("current".equals(formDTO.getOrgType())) { |
|
|
|
List<NatListResultDTO> list = ConvertUtils.sourceToTarget(data.getList(), NatListResultDTO.class); |
|
|
|
excelWriter.write(list, writeSheet); |
|
|
|
}else{ |
|
|
|
excelWriter.write(data.getList(), writeSheet); |
|
|
|
} |
|
|
|
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
log.error("export exception", e); |
|
|
|