| | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | |
| | | private FlowCommonService flowCommonService; |
| | | @Autowired |
| | | private HistoryService historyService; |
| | | @Autowired |
| | | private ApproveTableService approveTableService; |
| | | |
| | | @Autowired |
| | | private ProgramConfirmTableService programConfirmTableService; |
| | | @Autowired |
| | |
| | | return R.success(); |
| | | } |
| | | |
| | | @PostMapping("/export-approve-table") |
| | | @Operation(summary = "导出审批表", description = "导出审批表pdf") |
| | | public void exportApproveTable(String processInstanceId, HttpServletResponse response) { |
| | | |
| | | try { |
| | | FlowProgramProperties props = flowCommonService.getProgramPropertiesFromHis(processInstanceId); |
| | | String progName = props.getDrawingNo()+"-"+props.getProcessNo()+"-"+props.getProcessEdition(); |
| | | //String filename = URLEncoder.encode("数控程序编制审批单", StandardCharsets.UTF_8)+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".pdf"; |
| | | String filename = UrlUtil.encode("数控程序编制审批单"+progName)+".pdf"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | approveTableService.exportApproveTable(processInstanceId,response.getOutputStream()); |
| | | } catch (Exception e) { |
| | | log.error("导出审批表异常", e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PostMapping("/export-confirm-table") |
| | | @Operation(summary = "导出确认表", description = "导出数控程序确认表pdf") |
| | |
| | | try { |
| | | FlowProgramProperties props = flowCommonService.getProgramPropertiesFromHis(processInstanceId); |
| | | String progName = props.getDrawingNo()+"-"+props.getProcessNo()+"-"+props.getProcessEdition(); |
| | | //String filename = URLEncoder.encode("数控程序编制审批单", StandardCharsets.UTF_8)+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".pdf"; |
| | | String filename = UrlUtil.encode("数控程序确认表"+progName)+".pdf"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | programConfirmTableService.exportConfirmTable(processInstanceId,response.getOutputStream()); |
| | | programConfirmTableService.exportConfirmTable(props,response.getOutputStream()); |
| | | } catch (Exception e) { |
| | | log.error("导出数控程序确认表pdf异常", e); |
| | | throw new RuntimeException(e); |