| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private HistoryService historyService; |
| | | |
| | | @Autowired |
| | | private RuntimeService runtimeService; |
| | | |
| | | @GetMapping("overtime-list") |
| | | @ApiOperationSupport(order = 3) |
| | |
| | | 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 { |
| | | runtimeService.deleteProcessInstance(processInstancesId, "流程查询-删除"); |
| | | } catch (Exception e) { |
| | | log.error("删除流程失败",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | page.setRecords(flowList); |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * 流程查询 功能 的分页 |
| | | * @param page |
| | | * @param createTimeBegin |
| | | * @param createTimeEnd |
| | | * @param assigneeName |
| | | * @param keyword |
| | | * @return |
| | | */ |
| | | public IPage<FlowVO> selectSearchPage(IPage<FlowVO> page, LocalDate createTimeBegin, LocalDate createTimeEnd, String keyword) { |
| | | |
| | | List<FlowVO> flowList = new LinkedList<>(); |
| | | Date now = new Date(); |
| | | TaskQuery taskQuery = taskService.createTaskQuery().active().includeProcessVariables(); |
| | | if(Func.isNotEmpty(createTimeBegin)) { |
| | | taskQuery.taskCreatedAfter(DateUtil.toDate(createTimeBegin)); |
| | | } |
| | | if(Func.isNotEmpty(createTimeEnd)) { |
| | | taskQuery.taskCreatedBefore(DateUtil.toDate(createTimeEnd.plusDays(1))); |
| | | } |
| | | |
| | | addKeywordCondition(taskQuery, keyword); |
| | | |
| | | taskQuery.orderByTaskCreateTime().desc(); |
| | | |
| | | // 构建列表数据 |
| | | FlowVO bladeFlow = new FlowVO(); |
| | | buildFlowTaskList(bladeFlow, flowList, taskQuery);//FlowEngineConstant.STATUS_TODO |
| | | |
| | | // 计算总数 |
| | | long count = taskQuery.count(); |
| | | // 设置页数 |
| | | page.setSize(count); |
| | | // 设置总数 |
| | | page.setTotal(count); |
| | | // 设置数据 |
| | | page.setRecords(flowList); |
| | | return page; |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @PostMapping("/export-approve-table") |
| | | @Operation(summary = "导出审批表", description = "导出审批表excel") |
| | | public void exportApproveTaable(@RequestBody @Parameter(description = "审批表id数组") IdsVO vo, HttpServletResponse response) { |
| | | if(vo.getIds() == null || vo.getIds().length == 0) { |
| | | throw new ServiceException("未选择文件导出"); |
| | | } |
| | | try { |
| | | String filename = "todncexp-"+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".zip"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | ncProgramExportDNCService.exportDnc(vo.getIds(),response.getOutputStream()); |
| | | } catch (IOException e) { |
| | | log.error("导出DNC异常", e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | log.warn("文件名无法匹配到数控程序,{}",filePath); |
| | | return; |
| | | } |
| | | //保存文件到css,避免后续不同部署节点拿不到文件 |
| | | String ossName; |
| | | String url; |
| | | try(FileInputStream fins = new FileInputStream(filePath.toFile());){ |
| | | BladeFile bfile = ossTemplate.putFile(programName, fins); |
| | | ossName = bfile.getName(); |
| | | url = bfile.getLink(); |
| | | |
| | | } |
| | | |
| | | prog.setOssName(ossName); |
| | | prog.setUrl(url); |
| | | //TODO,是否删除原来的文件? |
| | | ncProgramService.updateById(prog); |
| | | |
| | | cureFlowService.startOne(prog);//启动一个程序的固化流程 |
| | | /* |
| | | DncBackFile backFile = new DncBackFile(); |
| | | backFile.setNcProgramId(prog.getId()); |
| | | //保存文件到css,避免后续不同部署节点拿不到文件 |
| | |
| | | backFile.setUrl(bfile.getLink()); |
| | | } |
| | | dncBackFileService.save(backFile); |
| | | |
| | | */ |
| | | }else{ |
| | | log.warn("文件传输中,后续再操作:{}",filePath); |
| | | } |