|
@@ -0,0 +1,223 @@
|
|
|
|
|
+package cn.start.tz.module.pressure2.controller.appapi.reporttemplate;
|
|
|
|
|
+
|
|
|
|
|
+import cn.start.tz.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.start.tz.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.start.tz.module.pressure2.controller.admin.reporttemplate.vo.*;
|
|
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.dynamictb.DynamicTbDO;
|
|
|
|
|
+import cn.start.tz.module.pressure2.service.reporttemplate.ReportTemplateService;
|
|
|
|
|
+import cn.start.tz.module.system.api.template.TemplateInitDataApi;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import jakarta.annotation.Resource;
|
|
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.start.tz.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@Tag(name = "管理后台 - 承压报告模版")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/pressure2/report-template")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class AppapiReportTemplateController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ReportTemplateService reportTemplateService;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TemplateInitDataApi templateInitDataApi;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ @Operation(summary = "创建承压报告模版")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:create')")
|
|
|
|
|
+ public CommonResult<String> createReportTemplate(@Valid @RequestBody ReportTemplateSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(reportTemplateService.createReportTemplate(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ @Operation(summary = "更新承压报告模版")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateReportTemplate(@Valid @RequestBody ReportTemplateSaveReqVO updateReqVO) {
|
|
|
|
|
+ reportTemplateService.updateReportTemplate(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update-status")
|
|
|
|
|
+ @Operation(summary = "更新承压报告模版状态")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateReportTemplateStatus(@Valid @RequestBody ReportTemplateUpdateReqVO updateReqVO) {
|
|
|
|
|
+ reportTemplateService.updateReportTemplateStatus(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
|
+ @Operation(summary = "删除承压报告模版")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteReportTemplate(@RequestParam("id") String id) {
|
|
|
|
|
+ reportTemplateService.deleteReportTemplate(id);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @Operation(summary = "获得承压报告模版")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:query')")
|
|
|
|
|
+ public CommonResult<ReportTemplateDetailRespVO> getReportTemplate(@RequestParam("id") String id) {
|
|
|
|
|
+ ReportTemplateDetailRespVO detailRespVO = reportTemplateService.getReportTemplateDetail(id);
|
|
|
|
|
+ return success(detailRespVO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
|
+ @Operation(summary = "获得承压报告模版分页")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:query')")
|
|
|
|
|
+ public CommonResult<PageResult<ReportTemplateRespVO>> getReportTemplatePage(@Valid ReportTemplatePageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<ReportTemplateRespVO> pageResult = reportTemplateService.getPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/audit/page")
|
|
|
|
|
+ @Operation(summary = "获得承压报告模版审核列表分页")
|
|
|
|
|
+ //@PreAuthorize("@ss.hasPermission('pressure:report-template:query')")
|
|
|
|
|
+ public CommonResult<PageResult<ReportTemplateRespVO>> getReportTemplateAuditPage(@Valid ReportTemplatePageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<ReportTemplateRespVO> pageResult = reportTemplateService.getAuditPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/notVerifyPage")
|
|
|
|
|
+ @Operation(summary = "获得承压报告模版分页(不校验菜单权限)")
|
|
|
|
|
+ public CommonResult<List<DynamicTbDO>> notReportTemplateVerifyPage(@Valid ReportTemplatePageReqVO pageReqVO) {
|
|
|
|
|
+ List<DynamicTbDO> list = reportTemplateService.getReportTemplatePage(pageReqVO);
|
|
|
|
|
+ return success(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// @GetMapping("/export-excel")
|
|
|
|
|
+// @Operation(summary = "导出承压报告模版 Excel")
|
|
|
|
|
+// //@PreAuthorize("@ss.hasPermission('pressure:report-template:export')")
|
|
|
|
|
+// @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+// public void exportReportTemplateExcel(@Valid ReportTemplatePageReqVO pageReqVO,
|
|
|
|
|
+// HttpServletResponse response) throws IOException {
|
|
|
|
|
+// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+// List<ReportTemplateRespVO> list = reportTemplateService.getReportTemplatePage(pageReqVO).getList();
|
|
|
|
|
+// // 导出 Excel
|
|
|
|
|
+// ExcelUtils.write(response, "承压报告模版.xls", "数据", ReportTemplateRespVO.class,
|
|
|
|
|
+// BeanUtils.toBean(list, ReportTemplateRespVO.class));
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// @GetMapping("/reportPreview")
|
|
|
|
|
+// @Operation(summary = "承压报告xlsx预览测试接口 type 默认100 100报告记录 200报告结论 300 报告模板 400 金额计算&关联关系, fileType 默认100 xlsx ,200 pdf")
|
|
|
|
|
+// public void reportPreview(HttpServletResponse response, @RequestParam(name = "templateId") String templateId,
|
|
|
|
|
+// @RequestParam(name = "equipCode") String equipCode,
|
|
|
|
|
+// @RequestParam(name = "type", defaultValue = "100") Integer type,
|
|
|
|
|
+// @RequestParam(name = "fileType", defaultValue = "100") Integer fileType,
|
|
|
|
|
+// @RequestParam(name = "reportId", required = false) String reportId
|
|
|
|
|
+//
|
|
|
|
|
+// ) throws Exception {
|
|
|
|
|
+// try (ByteArrayOutputStream outputStream = reportTemplateService.getRecordOutputStream(templateId, equipCode, type, fileType, reportId)) {
|
|
|
|
|
+// ServletOutputStream responseOutputStream = response.getOutputStream();
|
|
|
|
|
+// outputStream.writeTo(responseOutputStream);
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// // 5. 错误处理
|
|
|
|
|
+// response.reset();
|
|
|
|
|
+// response.setContentType("application/json");
|
|
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
|
|
+// response.getWriter().write("{\"error\":\"文件生成失败: " + e.getMessage() + "\"}");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// @PostMapping("/reportPreview")
|
|
|
|
|
+// @Operation(summary = "承压报告xlsx预览测试接口 type 默认100 100报告记录 200报告结论 300 报告模板 400 金额计算&关联关系, fileType 默认100 xlsx ,200 pdf")
|
|
|
|
|
+// public void reportPreviewPost(HttpServletResponse response, @RequestBody ReportPreviewVO reportPreviewVO) throws Exception {
|
|
|
|
|
+// try (ByteArrayOutputStream outputStream = reportTemplateService.getRecordOutputStreamMerge(reportPreviewVO)) {
|
|
|
|
|
+// ServletOutputStream responseOutputStream = response.getOutputStream();
|
|
|
|
|
+// outputStream.writeTo(responseOutputStream);
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// log.error("reportPreview error",e);
|
|
|
|
|
+// // 5. 错误处理
|
|
|
|
|
+// response.reset();
|
|
|
|
|
+// response.setContentType("application/json");
|
|
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
|
|
+// response.getWriter().write("{\"error\":\"文件生成失败: " + e.getMessage() + "\"}");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// @PutMapping("/updateBindingPathNameJson")
|
|
|
|
|
+// @Operation(summary = "更新绑定数据json字符串带注释")
|
|
|
|
|
+// //@PreAuthorize("@ss.hasPermission('pressure:report-template:update')")
|
|
|
|
|
+// public CommonResult<Boolean> updateBindingPathNameJson(@Valid @RequestBody ReportTemplateSaveReqVO updateReqVO) {
|
|
|
|
|
+// reportTemplateService.updateBindingPathNameJson(updateReqVO);
|
|
|
|
|
+// return success(true);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/report/json")
|
|
|
|
|
+ @Operation(summary = "获得承压报告json")
|
|
|
|
|
+ public CommonResult<String> getReportJson(@RequestParam(name = "type", defaultValue = "100") Integer type,
|
|
|
|
|
+ @RequestParam(name = "fileType", defaultValue = "100") Integer fileType,
|
|
|
|
|
+ @RequestParam(name = "reportId", required = true) String reportId) throws Exception {
|
|
|
|
|
+ return CommonResult.success(reportTemplateService.getReportJson(reportId, type, fileType));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// @PutMapping("/initiateApproval")
|
|
|
|
|
+// @Operation(summary = "发起审批")
|
|
|
|
|
+// public CommonResult<Boolean> reportTemplateInitiateApproval(@RequestBody ReportTemplateSubmitVO reportTemplateSubmitVO) {
|
|
|
|
|
+// Boolean result = reportTemplateService.initiateApproval(reportTemplateSubmitVO);
|
|
|
|
|
+// return success(result);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// @PostMapping("/approve")
|
|
|
|
|
+// @Operation(summary = "审批通过")
|
|
|
|
|
+// public CommonResult<Boolean> reportTemplateApprove(@RequestBody ReportTemplateAuditVO reportTemplateAuditVO) {
|
|
|
|
|
+// reportTemplateService.approve(reportTemplateAuditVO);
|
|
|
|
|
+// return success(true);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// @PostMapping("/reject")
|
|
|
|
|
+// @Operation(summary = "审批拒绝")
|
|
|
|
|
+// public CommonResult<Boolean> reportTemplateReject(@RequestBody ReportTemplateAuditVO reportTemplateAuditVO) {
|
|
|
|
|
+// reportTemplateService.reject(reportTemplateAuditVO);
|
|
|
|
|
+// return success(true);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// @GetMapping("/circulationRecord")
|
|
|
|
|
+// @Operation(summary = "流转列表")
|
|
|
|
|
+// public CommonResult<List<BpmTaskRespVO>> reportTemplateCirculationRecord(
|
|
|
|
|
+// @RequestParam(name = "id") String id) {
|
|
|
|
|
+// List<BpmTaskRespVO> pageResult = reportTemplateService.circulationRecord(id);
|
|
|
|
|
+// return success(pageResult);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// @PostMapping("/mock/preview")
|
|
|
|
|
+// @Operation(summary = "预览")
|
|
|
|
|
+// public void reportTemplateMockPreview(HttpServletResponse response, @RequestBody ReportMockPreviewVO reportPreviewVO) throws IOException {
|
|
|
|
|
+// try (ByteArrayOutputStream outputStream = reportTemplateService.reportTemplateMockPreview(reportPreviewVO)) {
|
|
|
|
|
+// ServletOutputStream responseOutputStream = response.getOutputStream();
|
|
|
|
|
+// outputStream.writeTo(responseOutputStream);
|
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
|
+// // 5. 错误处理
|
|
|
|
|
+// response.reset();
|
|
|
|
|
+// response.setContentType("application/json");
|
|
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
|
|
+// response.getWriter().write("\"error\":\"文件生成失败: " + e.getMessage() + "\"");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ // json
|
|
|
|
|
+ @PostMapping("/mock/json")
|
|
|
|
|
+ @Operation(summary = "预览")
|
|
|
|
|
+ public CommonResult<String> reportTemplateMockJson(HttpServletResponse response,
|
|
|
|
|
+ @RequestBody ReportMockPreviewVO reportPreviewVO) {
|
|
|
|
|
+ String json = reportTemplateService.reportTemplateMockJson(reportPreviewVO);
|
|
|
|
|
+ return success(json);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|