报表基础模块:模板导出支持pdf/word/excel

This commit is contained in:
gaoqr
2024-07-23 14:13:35 +08:00
parent b8227c1494
commit 9db35ced9e
3 changed files with 9 additions and 4 deletions
@@ -93,15 +93,16 @@ public class ReportTemplateController {
return success(templateService.preview(pageParametersVO));
}
@PostMapping("/template/excel")
@PostMapping("/template/export")
@Operation(summary = "模板导出")
@PreAuthorize("@ss.hasPermission('report:template:query')")
public void generateExcel(@RequestBody ReportTemplateGenerateReqDTO reqDTO, HttpServletResponse response) {
public void generateTemplate(@Valid @RequestBody ReportTemplateGenerateReqDTO reqDTO, HttpServletResponse response) {
OutputStream out = null;
try {
Report report = templateService.generateReport(reqDTO);
out = response.getOutputStream();
ExportUtils.export(out, report, ProducerEnum.EXCEL);
ProducerEnum p = ProducerEnum.valueOf(reqDTO.getProducerType().toUpperCase());
ExportUtils.export(out, report, p);
} catch (Exception ex) {
log.error("[generateExcel] 报表模板生成excel异常", ex);
} finally {