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;
|
private final IWfTaskService flowTaskService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消申请
|
* 取消流程
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/stopProcess")
|
@PostMapping(value = "/stopProcess")
|
||||||
@SaCheckPermission("workflow:process:cancel")
|
@SaCheckPermission("workflow:process:cancel")
|
||||||
|
|||||||
@@ -386,8 +386,8 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void stopProcess(WfTaskBo bo) {
|
public void stopProcess(WfTaskBo bo) {
|
||||||
List<Task> task = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list();
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list();
|
||||||
if (CollectionUtils.isEmpty(task)) {
|
if (CollectionUtils.isEmpty(taskList)) {
|
||||||
throw new RuntimeException("流程未启动或已执行完成,取消申请失败");
|
throw new RuntimeException("流程未启动或已执行完成,取消申请失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,8 +399,10 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
|
|||||||
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
|
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
|
||||||
if (CollectionUtils.isNotEmpty(endNodes)) {
|
if (CollectionUtils.isNotEmpty(endNodes)) {
|
||||||
Authentication.setAuthenticatedUserId(TaskUtils.getUserId());
|
Authentication.setAuthenticatedUserId(TaskUtils.getUserId());
|
||||||
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
|
runtimeService.setVariable(processInstance.getId(), ProcessConstants.PROCESS_STATUS_KEY, ProcessStatus.CANCELED.getStatus());
|
||||||
// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
|
for (Task task : taskList) {
|
||||||
|
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), "取消流程");
|
||||||
|
}
|
||||||
// 获取当前流程最后一个节点
|
// 获取当前流程最后一个节点
|
||||||
String endId = endNodes.get(0).getId();
|
String endId = endNodes.get(0).getId();
|
||||||
List<Execution> executions = runtimeService.createExecutionQuery()
|
List<Execution> executions = runtimeService.createExecutionQuery()
|
||||||
|
|||||||
Reference in New Issue
Block a user