Commit 972d1830 authored by huyuchen's avatar huyuchen

花名册修改

parent 596964d2
......@@ -9,6 +9,7 @@ import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @Author fxj
......@@ -115,4 +116,7 @@ public class SocialHandleSearchVo extends TDispatchInfo {
@Schema(description ="派单增/减月份")
@ExcelIgnore
private String disMonth;
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
}
......@@ -5095,9 +5095,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
List<TDispatchSocialExportVo> list = new ArrayList<>();
try (ServletOutputStream out = response.getOutputStream()){
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchSocialExportVo.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchSocialExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
WriteSheet writeSheet;
WriteTable writeTable0;
WriteTable writeTable1;
......@@ -5156,7 +5156,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
writeSheet = EasyExcel.writerSheet("减员").build();
excelWriter.write(list,writeSheet);
}
excelWriter.finish();
if (excelWriter!= null) {
excelWriter.finish();
}
}catch (Exception e){
log.error("执行异常" ,e);
}
......@@ -5176,9 +5178,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
List<TDispatchSocialPersionExportVo> list = new ArrayList<>();
try (ServletOutputStream out = response.getOutputStream()){
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchSocialPersionExportVo.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchSocialPersionExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
WriteSheet writeSheet;
WriteTable writeTable0;
WriteTable writeTable1;
......@@ -5237,7 +5239,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
writeSheet = EasyExcel.writerSheet("减员").build();
excelWriter.write(list,writeSheet);
}
excelWriter.finish();
if (excelWriter!= null) {
excelWriter.finish();
}
}catch (Exception e){
log.error("执行异常" ,e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment