|
|
@ -147,10 +147,12 @@ public class CheckReportManager {
|
|
|
|
List<TdCheckTypeDTO> tdCheckTypeDtoS = Convert.toList(TdCheckTypeDTO.class, list);
|
|
|
|
List<TdCheckTypeDTO> tdCheckTypeDtoS = Convert.toList(TdCheckTypeDTO.class, list);
|
|
|
|
tdCheckReportDto.setCheckTypeDTOS(tdCheckTypeDtoS);
|
|
|
|
tdCheckReportDto.setCheckTypeDTOS(tdCheckTypeDtoS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ServletOutputStream out = response.getOutputStream();
|
|
|
|
String fileName = URLEncoder.encode(tdCheckReport.getCheckId() + ".xlsx", "UTF-8");
|
|
|
|
try {
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
|
|
|
|
|
|
|
|
try (ExcelWriter writer = ExcelUtil.getWriter(true); ServletOutputStream out = response.getOutputStream()) {
|
|
|
|
// 4. 使用Hutool导出Excel
|
|
|
|
// 4. 使用Hutool导出Excel
|
|
|
|
ExcelWriter writer = ExcelUtil.getWriter(true);
|
|
|
|
|
|
|
|
// 1. 先写入主表数据
|
|
|
|
// 1. 先写入主表数据
|
|
|
|
writer.renameSheet("自查信息");
|
|
|
|
writer.renameSheet("自查信息");
|
|
|
|
writer.addHeaderAlias("adduser", "检查人员");
|
|
|
|
writer.addHeaderAlias("adduser", "检查人员");
|
|
|
@ -179,10 +181,6 @@ public class CheckReportManager {
|
|
|
|
writer.write(tdCheckReportDto.getCheckTypeDTOS(), true);
|
|
|
|
writer.write(tdCheckReportDto.getCheckTypeDTOS(), true);
|
|
|
|
// 4. 可选:调整列宽自动适应
|
|
|
|
// 4. 可选:调整列宽自动适应
|
|
|
|
writer.autoSizeColumnAll();
|
|
|
|
writer.autoSizeColumnAll();
|
|
|
|
String fileName = URLEncoder.encode(tdCheckReport.getCheckId() + ".xlsx", "UTF-8");
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
|
|
|
|
|
|
|
|
// 5. 输出到浏览器
|
|
|
|
// 5. 输出到浏览器
|
|
|
|
writer.flush(out, true);
|
|
|
|
writer.flush(out, true);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|