fix(flow) complete updateBusinessStatus

deliver/approver-flow
bob 2 years ago
parent 53e458f201
commit 957f7cfc18

@ -105,7 +105,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
if (Objects.isNull(task)) { if (Objects.isNull(task)) {
return AjaxResult.error("任务不存在"); return AjaxResult.error("任务不存在");
} }
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()); runtimeService.updateBusinessStatus(taskVo.getInstanceId(), FlowStatus.APPROVING.getValue());
}
if (DelegationState.PENDING.equals(task.getDelegationState())) { if (DelegationState.PENDING.equals(task.getDelegationState())) {
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVars()); taskService.resolveTask(taskVo.getTaskId(), taskVo.getVars());
@ -115,6 +120,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskService.setAssignee(taskVo.getTaskId(), userId.toString()); taskService.setAssignee(taskVo.getTaskId(), userId.toString());
taskService.complete(taskVo.getTaskId(), taskVo.getVars()); 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(); return AjaxResult.success();
} }

Loading…
Cancel
Save