|
@@ -107,7 +107,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
107
|
107
|
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
|
108
|
108
|
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
|
109
|
109
|
} else {
|
110
|
|
- taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
|
|
110
|
+ taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getRemark(), taskVo.getComment());
|
111
|
111
|
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
112
|
112
|
taskService.setAssignee(taskVo.getTaskId(), userId.toString());
|
113
|
113
|
taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
|
|
@@ -215,7 +215,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
215
|
215
|
}
|
216
|
216
|
}));
|
217
|
217
|
// 设置驳回意见
|
218
|
|
- currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
|
|
218
|
+ currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getRemark(), flowTaskVo.getComment()));
|
219
|
219
|
|
220
|
220
|
try {
|
221
|
221
|
// 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况
|
|
@@ -303,7 +303,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
303
|
303
|
}
|
304
|
304
|
}));
|
305
|
305
|
// 设置回退意见
|
306
|
|
- currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
|
|
306
|
+ currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getRemark(), flowTaskVo.getComment()));
|
307
|
307
|
|
308
|
308
|
try {
|
309
|
309
|
// 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
|
@@ -634,73 +634,6 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
634
|
634
|
*/
|
635
|
635
|
@Override
|
636
|
636
|
public AjaxResult revokeProcess(FlowTaskVo flowTaskVo) {
|
637
|
|
-// if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
|
638
|
|
-// throw new CustomException("任务处于挂起状态");
|
639
|
|
-// }
|
640
|
|
-// // 当前任务 task
|
641
|
|
-// Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
|
642
|
|
-// // 获取流程定义信息
|
643
|
|
-// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
|
644
|
|
-// // 获取所有节点信息
|
645
|
|
-// Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0);
|
646
|
|
-// // 获取全部节点列表,包含子节点
|
647
|
|
-// Collection<FlowElement> allElements = FlowableUtils.getAllElements(process.getFlowElements(), null);
|
648
|
|
-// // 获取当前任务节点元素
|
649
|
|
-// FlowElement source = null;
|
650
|
|
-// // 获取跳转的节点元素
|
651
|
|
-// FlowElement target = null;
|
652
|
|
-// if (allElements != null) {
|
653
|
|
-// for (FlowElement flowElement : allElements) {
|
654
|
|
-// // 当前任务节点元素
|
655
|
|
-// if (flowElement.getId().equals(task.getTaskDefinitionKey())) {
|
656
|
|
-// source = flowElement;
|
657
|
|
-// }
|
658
|
|
-// // 跳转的节点元素
|
659
|
|
-// if (flowElement.getId().equals(flowTaskVo.getTargetKey())) {
|
660
|
|
-// target = flowElement;
|
661
|
|
-// }
|
662
|
|
-// }
|
663
|
|
-// }
|
664
|
|
-//
|
665
|
|
-// // 从当前节点向前扫描
|
666
|
|
-// // 如果存在路线上不存在目标节点,说明目标节点是在网关上或非同一路线上,不可跳转
|
667
|
|
-// // 否则目标节点相对于当前节点,属于串行
|
668
|
|
-// Boolean isSequential = FlowableUtils.iteratorCheckSequentialReferTarget(source, flowTaskVo.getTargetKey(), null, null);
|
669
|
|
-// if (!isSequential) {
|
670
|
|
-// throw new CustomException("当前节点相对于目标节点,不属于串行关系,无法回退");
|
671
|
|
-// }
|
672
|
|
-//
|
673
|
|
-//
|
674
|
|
-// // 获取所有正常进行的任务节点 Key,这些任务不能直接使用,需要找出其中需要撤回的任务
|
675
|
|
-// List<Task> runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list();
|
676
|
|
-// List<String> runTaskKeyList = new ArrayList<>();
|
677
|
|
-// runTaskList.forEach(item -> runTaskKeyList.add(item.getTaskDefinitionKey()));
|
678
|
|
-// // 需退回任务列表
|
679
|
|
-// List<String> currentIds = new ArrayList<>();
|
680
|
|
-// // 通过父级网关的出口连线,结合 runTaskList 比对,获取需要撤回的任务
|
681
|
|
-// List<UserTask> currentUserTaskList = FlowableUtils.iteratorFindChildUserTasks(target, runTaskKeyList, null, null);
|
682
|
|
-// currentUserTaskList.forEach(item -> currentIds.add(item.getId()));
|
683
|
|
-//
|
684
|
|
-// // 循环获取那些需要被撤回的节点的ID,用来设置驳回原因
|
685
|
|
-// List<String> currentTaskIds = new ArrayList<>();
|
686
|
|
-// currentIds.forEach(currentId -> runTaskList.forEach(runTask -> {
|
687
|
|
-// if (currentId.equals(runTask.getTaskDefinitionKey())) {
|
688
|
|
-// currentTaskIds.add(runTask.getId());
|
689
|
|
-// }
|
690
|
|
-// }));
|
691
|
|
-// // 设置回退意见
|
692
|
|
-// currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
|
693
|
|
-//
|
694
|
|
-// try {
|
695
|
|
-// // 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
696
|
|
-// runtimeService.createChangeActivityStateBuilder()
|
697
|
|
-// .processInstanceId(task.getProcessInstanceId())
|
698
|
|
-// .moveActivityIdsToSingleActivityId(currentIds, flowTaskVo.getTargetKey()).changeState();
|
699
|
|
-// } catch (FlowableObjectNotFoundException e) {
|
700
|
|
-// throw new CustomException("未找到流程实例,流程可能已发生变化");
|
701
|
|
-// } catch (FlowableException e) {
|
702
|
|
-// throw new CustomException("无法取消或开始活动");
|
703
|
|
-// }
|
704
|
637
|
Task task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
|
705
|
638
|
if (task == null) {
|
706
|
639
|
throw new CustomException("流程未启动或已执行完成,无法撤回");
|