From 6f4d706ea8cd17c0f2f78f05a3266034f76850d8 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 13 Jan 2024 02:42:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=96=E6=B6=88=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/controller/WfTaskController.java | 2 +- .../workflow/service/impl/WfTaskServiceImpl.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/WfTaskController.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/WfTaskController.java index d20780d4..75f8b1fd 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/WfTaskController.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/controller/WfTaskController.java @@ -24,7 +24,7 @@ public class WfTaskController { private final IWfTaskService flowTaskService; /** - * 取消申请 + * 取消流程 */ @PostMapping(value = "/stopProcess") @SaCheckPermission("workflow:process:cancel") diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WfTaskServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WfTaskServiceImpl.java index 62516591..e350fe42 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WfTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/WfTaskServiceImpl.java @@ -377,15 +377,15 @@ public class WfTaskServiceImpl implements IWfTaskService { } /** - * 取消申请 + * 取消流程 * * @param bo * @return */ @Override public void stopProcess(WfTaskBo bo) { - List task = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list(); - if (CollectionUtils.isEmpty(task)) { + List taskList = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list(); + if (CollectionUtils.isEmpty(taskList)) { throw new RuntimeException("流程未启动或已执行完成,取消申请失败"); } @@ -397,8 +397,11 @@ public class WfTaskServiceImpl implements IWfTaskService { List endNodes = process.findFlowElementsOfType(EndEvent.class, false); if (CollectionUtils.isNotEmpty(endNodes)) { Authentication.setAuthenticatedUserId(TaskUtils.getUserId()); -// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), -// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment()); + runtimeService.setVariable(processInstance.getId(), ProcessConstants.PROCESS_STATUS_KEY, ProcessStatus.CANCELED.getStatus()); + for (Task task : taskList) { + taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), "取消流程"); + } + // 获取当前流程最后一个节点 String endId = endNodes.get(0).getId(); List executions = runtimeService.createExecutionQuery() -- Gitee