Commit 61c9a04f9feb35463bba88fa1ee54499bffc84c4

Authored by jason
1 parent 7886aaf2

【功能修复】 修复表单内用户字段可以多选时的问题

yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/user/BpmTaskCandidateUserFieldOnFormStrategy.java
@@ -2,26 +2,22 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.u @@ -2,26 +2,22 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.u
2 2
3 import cn.hutool.core.convert.Convert; 3 import cn.hutool.core.convert.Convert;
4 import cn.hutool.core.lang.Assert; 4 import cn.hutool.core.lang.Assert;
5 -import cn.hutool.core.map.MapUtil;  
6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; 5 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
7 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
8 import org.flowable.bpmn.model.BpmnModel; 7 import org.flowable.bpmn.model.BpmnModel;
9 import org.flowable.engine.delegate.DelegateExecution; 8 import org.flowable.engine.delegate.DelegateExecution;
10 import org.springframework.stereotype.Component; 9 import org.springframework.stereotype.Component;
11 10
12 -import java.util.HashSet;  
13 import java.util.Map; 11 import java.util.Map;
14 import java.util.Set; 12 import java.util.Set;
15 13
16 -import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;  
17 -  
18 /** 14 /**
19 * 表单内用户字段 {@link BpmTaskCandidateUserStrategy} 实现类 15 * 表单内用户字段 {@link BpmTaskCandidateUserStrategy} 实现类
20 * 16 *
21 * @author jason 17 * @author jason
22 */ 18 */
23 @Component 19 @Component
24 -public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidateStrategy { 20 +public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidateStrategy {
25 21
26 @Override 22 @Override
27 public BpmTaskCandidateStrategyEnum getStrategy() { 23 public BpmTaskCandidateStrategyEnum getStrategy() {
@@ -35,7 +31,7 @@ public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidate @@ -35,7 +31,7 @@ public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidate
35 31
36 @Override 32 @Override
37 public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) { 33 public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
38 - Object result = execution.getVariable(param); 34 + Object result = execution.getVariable(param);
39 return Convert.toSet(Long.class, result); 35 return Convert.toSet(Long.class, result);
40 } 36 }
41 37
@@ -43,8 +39,8 @@ public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidate @@ -43,8 +39,8 @@ public class BpmTaskCandidateUserFieldOnFormStrategy implements BpmTaskCandidate
43 public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, 39 public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
44 String param, Long startUserId, String processDefinitionId, 40 String param, Long startUserId, String processDefinitionId,
45 Map<String, Object> processVariables) { 41 Map<String, Object> processVariables) {
46 - Long result = MapUtil.getLong(processVariables, param);  
47 - return result != null ? asSet(result) : new HashSet<>(); 42 + Object result = processVariables == null ? null : processVariables.get(param);
  43 + return Convert.toSet(Long.class, result);
48 } 44 }
49 45
50 } 46 }