Skip to content

Commit

Permalink
优化并行任务拿回任务判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
qmdx committed Aug 21, 2024
1 parent 5706fed commit 181e542
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,19 @@ public boolean resolveTask(Long taskId, FlowCreator flowCreator) {
*/
@Override
public Optional<FlwTask> reclaimTask(Long taskId, FlowCreator flowCreator) {
// 当前任务子任务已经执行完成不允许撤回
Assert.isTrue(taskDao.selectCountByParentTaskId(taskId) == 0, "Do not allow reclaim task");

// 下面执行撤回逻辑
Optional<FlwTask> flwTaskOptional = this.undoHisTask(taskId, flowCreator, hisTask -> {
boolean checkReclaim = true;
// 顺序签或会签情况,判断存在未执行并行任务不检查允许拿回
if (PerformType.sort.eq(hisTask.getPerformType()) || PerformType.countersign.eq(hisTask.getPerformType())) {
checkReclaim = taskDao.selectCountByParentTaskId(hisTask.getParentTaskId()) < 1;
}
if (checkReclaim) {
// 当前任务子任务已经执行完成不允许撤回
Assert.isTrue(taskDao.selectCountByParentTaskId(taskId) == 0, "Do not allow reclaim task");
}

List<FlwTask> flwTaskList = taskDao.selectListByInstanceId(hisTask.getInstanceId());
Assert.isEmpty(flwTaskList, "No approval tasks found");
FlwTask existFlwTask = flwTaskList.get(0);
Expand Down

0 comments on commit 181e542

Please sign in to comment.