From 957f7cfc184581b8412bd9b530c155d1852b0ed1 Mon Sep 17 00:00:00 2001 From: bob Date: Wed, 15 Mar 2023 15:06:40 +0800 Subject: [PATCH] fix(flow) complete updateBusinessStatus --- .../flowable/service/impl/FlowTaskServiceImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java index 3c843f5..8a10b35 100644 --- a/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java +++ b/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java @@ -105,7 +105,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask if (Objects.isNull(task)) { return AjaxResult.error("任务不存在"); } - runtimeService.updateBusinessStatus(taskVo.getInstanceId(), FlowStatus.APPROVING.getValue()); + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); + String businessStatus = processInstance.getBusinessStatus(); +// 排除驳回状态 + if (ObjectUtil.notEqual(businessStatus,FlowStatus.REJECT.getValue() )) { + runtimeService.updateBusinessStatus(taskVo.getInstanceId(), FlowStatus.APPROVING.getValue()); + } if (DelegationState.PENDING.equals(task.getDelegationState())) { taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); taskService.resolveTask(taskVo.getTaskId(), taskVo.getVars()); @@ -115,6 +120,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask taskService.setAssignee(taskVo.getTaskId(), userId.toString()); taskService.complete(taskVo.getTaskId(), taskVo.getVars()); } +// 兼容驳回状态,提交报错;The process instance id is mandatory, but '' has been provided. + if (ObjectUtil.equals(businessStatus,FlowStatus.REJECT.getValue() )) { + runtimeService.updateBusinessStatus(taskVo.getInstanceId(), FlowStatus.APPROVING.getValue()); + } return AjaxResult.success(); }