feat(工作流模块): 新增 取消申请状态。 感谢 @醒哥 [pr:67](https://gitee.com/KonBAI-Q/ruoyi-flowable-plus/pulls/67)
This commit is contained in:
@@ -31,7 +31,7 @@ public class WfTaskController {
|
||||
private final IWfTaskService flowTaskService;
|
||||
|
||||
/**
|
||||
* 取消申请
|
||||
* 取消流程
|
||||
*/
|
||||
@PostMapping(value = "/stopProcess")
|
||||
@SaCheckPermission("workflow:process:cancel")
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user