feat(工作流模块): 新增 取消申请状态。 感谢 @醒哥 [pr:67](https://gitee.com/KonBAI-Q/ruoyi-flowable-plus/pulls/67)

This commit is contained in:
konbai
2024-04-14 21:20:16 +08:00
parent 158b37a246
commit 08bb0510d9
2 changed files with 7 additions and 5 deletions

View File

@@ -386,8 +386,8 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
*/
@Override
public void stopProcess(WfTaskBo bo) {
List<Task> task = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list();
if (CollectionUtils.isEmpty(task)) {
List<Task> taskList = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list();
if (CollectionUtils.isEmpty(taskList)) {
throw new RuntimeException("流程未启动或已执行完成,取消申请失败");
}
@@ -399,8 +399,10 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
List<EndEvent> 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<Execution> executions = runtimeService.createExecutionQuery()