From ed8fc5f674544d3af63c6f68093ffc038385c493 Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期一, 16 十二月 2024 09:30:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java index d176e42..3b36c24 100644 --- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java +++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java @@ -1,5 +1,7 @@ package com.iailab.module.bpm.framework.flowable.core.behavior; +import cn.hutool.core.collection.CollUtil; +import com.iailab.framework.common.util.collection.SetUtils; import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker; import com.iailab.module.bpm.framework.flowable.core.util.FlowableUtils; import lombok.Setter; @@ -48,9 +50,20 @@ super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); // 第二步,获取任务的所有处理人 - Set<Long> assigneeUserIds = taskCandidateInvoker.calculateUsers(execution); - execution.setVariable(super.collectionVariable, assigneeUserIds); + @SuppressWarnings("unchecked") + Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class); + if (assigneeUserIds == null) { + assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution); + execution.setVariable(super.collectionVariable, assigneeUserIds); + if (CollUtil.isEmpty(assigneeUserIds)) { + // 特殊:如果没有处理人的情况下,至少有一个 null 空元素,避免自动通过! + // 这样,保证在 BpmUserTaskActivityBehavior 至少创建出一个 Task 任务 + // 用途:1)审批人为空时;2)审批类型为自动通过、自动拒绝时 + assigneeUserIds = SetUtils.asSet((Long) null); + } + } return assigneeUserIds.size(); } + } -- Gitblit v1.9.3