fix:【BPM】修复多实例使用 LinkedHashSet 保持顺序

This commit is contained in:
YunaiV
2025-04-26 11:19:31 +08:00
parent a9bb55340b
commit cf3a13d4ff
3 changed files with 20 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.form;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
@@ -33,7 +33,7 @@ public class BpmTaskCandidateFormUserStrategy implements BpmTaskCandidateStrateg
@Override
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
Object result = execution.getVariable(param);
return Convert.toSet(Long.class, result);
return CollectionUtils.toLinkedHashSet(Long.class, result);
}
@Override
@@ -41,7 +41,7 @@ public class BpmTaskCandidateFormUserStrategy implements BpmTaskCandidateStrateg
String param, Long startUserId, String processDefinitionId,
Map<String, Object> processVariables) {
Object result = processVariables == null ? null : processVariables.get(param);
return Convert.toSet(Long.class, result);
return CollectionUtils.toLinkedHashSet(Long.class, result);
}
}

View File

@@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.other;
import cn.hutool.core.convert.Convert;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
@@ -37,7 +37,7 @@ public class BpmTaskCandidateExpressionStrategy implements BpmTaskCandidateStrat
@Override
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
Object result = FlowableUtils.getExpressionValue(execution, param);
return Convert.toSet(Long.class, result);
return CollectionUtils.toLinkedHashSet(Long.class, result);
}
@Override
@@ -46,7 +46,7 @@ public class BpmTaskCandidateExpressionStrategy implements BpmTaskCandidateStrat
Map<String, Object> variables = processVariables == null ? new HashMap<>() : processVariables;
try {
Object result = FlowableUtils.getExpressionValue(variables, param);
return Convert.toSet(Long.class, result);
return CollectionUtils.toLinkedHashSet(Long.class, result);
} catch (FlowableException ex) {
// 预测未运行的节点时候,表达式如果包含 execution 或者不存在的流程变量会抛异常,
log.warn("[calculateUsersByActivity][表达式({}) 变量({}) 解析报错", param, variables, ex);