| | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.RuntimeService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.task.Comment; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineExcelVO; |
| | | import org.springblade.mdm.commons.vo.IdsVO; |
| | | import org.springblade.mdm.flow.service.ApproveRecordService; |
| | | import org.springblade.mdm.flow.service.ApproveTableService; |
| | | import org.springblade.mdm.flow.service.FlowBusinessService; |
| | | import org.springblade.mdm.flow.vo.FlowVO; |
| | | import org.springblade.mdm.flow.vo.OvertimeTaskExcelVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | |
| | | @Autowired |
| | | private HistoryService historyService; |
| | | @Autowired |
| | | private RuntimeService runtimeService; |
| | | @Autowired |
| | | private ApproveTableService approveTableService; |
| | | |
| | | @GetMapping("overtime-list") |
| | | @ApiOperationSupport(order = 3) |
| | |
| | | } |
| | | |
| | | |
| | | @Operation(summary = "流程轨迹", description = "流程轨迹") |
| | | @Operation(summary = "流程执行轨迹", description = "流程执行轨迹") |
| | | @GetMapping("process-trace") |
| | | public R<List<TaskTraceVO>> processTrace(String processInstanceId){ |
| | | List<TaskTraceVO> result = new ArrayList<>(); |
| | |
| | | return R.data(result); |
| | | } |
| | | |
| | | @GetMapping("search-list") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "流程查询", description = "查询进行中的所有流程") |
| | | public R<IPage<FlowVO>> overtimeList(@Parameter(description = "任务到达时间开始") LocalDate createTimeBegin, @Parameter(description = "任务到达时间截止")LocalDate createTimeEnd, @Parameter(description = "关键字") String keyword, Query query) { |
| | | IPage<FlowVO> pages = businessService.selectSearchPage(Condition.getPage(query), createTimeBegin,createTimeEnd,keyword); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @PostMapping("delete-instance") |
| | | @Operation(summary = "流程删除", description = "删除id指定的流程实例") |
| | | public R<Void> deleteInstance(@Parameter(description = "任务到达时间开始") String processInstancesId) { |
| | | try { |
| | | businessService.deleteProcessInstance(processInstancesId); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("删除流程失败",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |
| | | @PostMapping("/export-approve-table") |
| | | @Operation(summary = "导出审批表", description = "导出审批表excel") |
| | | public void exportApproveTable(String processInstanceId, HttpServletResponse response) { |
| | | |
| | | try { |
| | | |
| | | String filename = URLEncoder.encode("数控程序编制审批单", StandardCharsets.UTF_8)+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".pdf"; |
| | | |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | approveTableService.exportApproveTable(processInstanceId,response.getOutputStream()); |
| | | } catch (Exception e) { |
| | | log.error("导出DNC异常", e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | } |