导出问题

Raod 3 years ago
parent b1e4b516c4
commit 2c79a61fa9

@ -66,7 +66,7 @@ public class ReportExcelController extends GaeaBaseController<ReportExcelParam,
return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE) return ResponseBean.builder().code(ResponseCode.SUCCESS_CODE)
.data(reportExcelService.exportExcel(reportExcelDto)) .data(reportExcelService.exportExcel(reportExcelDto))
.message("导出成功,请稍后在下载中心查看").build(); .message("导出成功,请稍后在文件管理中查看").build();
} }
// @PostMapping("/exportPdf") // @PostMapping("/exportPdf")

@ -132,11 +132,13 @@ public class ReportExcelServiceImpl implements ReportExcelService {
public Boolean exportExcel(ReportExcelDto reportExcelDto) { public Boolean exportExcel(ReportExcelDto reportExcelDto) {
String reportCode = reportExcelDto.getReportCode(); String reportCode = reportExcelDto.getReportCode();
String exportType = reportExcelDto.getExportType(); String exportType = reportExcelDto.getExportType();
logger.error("导出...");
if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL)) { if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL.getCodeValue())) {
ReportExcelDto report = detailByReportCode(reportCode);
reportExcelDto.setJsonStr(report.getJsonStr());
String jsonStr = analysisReportData(reportExcelDto); String jsonStr = analysisReportData(reportExcelDto);
List<JSONObject> lists=(List<JSONObject> ) JSON.parse(jsonStr); List<JSONObject> lists=(List<JSONObject> ) JSON.parse(jsonStr);
OutputStream out = null; OutputStream out;
try { try {
String fileId = UUID.randomUUID().toString(); String fileId = UUID.randomUUID().toString();
String filePath = dictPath + File.separator + fileId + ".xlsx"; String filePath = dictPath + File.separator + fileId + ".xlsx";
@ -153,6 +155,7 @@ public class ReportExcelServiceImpl implements ReportExcelService {
XlsUtil.exportXlsFile(out, true, lists); XlsUtil.exportXlsFile(out, true, lists);
gaeaFileMapper.insert(gaeaFile); gaeaFileMapper.insert(gaeaFile);
logger.info("导出成功:{}", gaeaFile);
} catch (IOException e) { } catch (IOException e) {
logger.error("导出失败", e); logger.error("导出失败", e);
} }

Loading…
Cancel
Save