Commit d860ca2c8ca08b38ce388b149e1a2ae303e1ea76
1 parent
cc53b9c4
fix:【bpm】“refactor(bpm): 优化多实例行为初始化逻辑”导致的问题,对应 https://gitee.com/zhijiantianya/r…
…uoyi-vue-pro/pulls/1483/files
Showing
2 changed files
with
16 additions
and
2 deletions
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java
| ... | ... | @@ -56,7 +56,14 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav |
| 56 | 56 | protected int resolveNrOfInstances(DelegateExecution execution) { |
| 57 | 57 | // 情况一:UserTask 节点 |
| 58 | 58 | if (execution.getCurrentFlowElement() instanceof UserTask) { |
| 59 | - // 获取任务的所有处理人 | |
| 59 | + // 第一步,设置 collectionVariable 和 CollectionVariable | |
| 60 | + // 从 execution.getVariable() 读取所有任务处理人的 key | |
| 61 | + super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的 | |
| 62 | + super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId()); | |
| 63 | + // 从 execution.getVariable() 读取当前所有任务处理的人的 key | |
| 64 | + super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); | |
| 65 | + | |
| 66 | + // 第二步,获取任务的所有处理人 | |
| 60 | 67 | @SuppressWarnings("unchecked") |
| 61 | 68 | Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class); |
| 62 | 69 | if (assigneeUserIds == null) { | ... | ... |
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmSequentialMultiInstanceBehavior.java
| ... | ... | @@ -47,7 +47,14 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB |
| 47 | 47 | protected int resolveNrOfInstances(DelegateExecution execution) { |
| 48 | 48 | // 情况一:UserTask 节点 |
| 49 | 49 | if (execution.getCurrentFlowElement() instanceof UserTask) { |
| 50 | - // 获取任务的所有处理人 | |
| 50 | + // 第一步,设置 collectionVariable 和 CollectionVariable | |
| 51 | + // 从 execution.getVariable() 读取所有任务处理人的 key | |
| 52 | + super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的 | |
| 53 | + super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId()); | |
| 54 | + // 从 execution.getVariable() 读取当前所有任务处理的人的 key | |
| 55 | + super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); | |
| 56 | + | |
| 57 | + // 第二步,获取任务的所有处理人 | |
| 51 | 58 | // 不使用 execution.getVariable 原因:目前依次审批任务回退后 collectionVariable 变量没有清理, 如果重新进入该任务不会重新分配审批人 |
| 52 | 59 | @SuppressWarnings("unchecked") |
| 53 | 60 | Set<Long> assigneeUserIds = (Set<Long>) execution.getVariableLocal(super.collectionVariable, Set.class); | ... | ... |