Commit 5d163550424d40d0025293a9d8bc78f11b675a7c
1 parent
f45758b8
fix:
1、预测节点审批人查询,如果不存在,则直接返回空,避免类型转换异常 2、如果processVariables不为空,则使用前端传递的参数值
Showing
2 changed files
with
20 additions
and
5 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateStartUserSelectStrategy.java
| @@ -53,8 +53,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | @@ -53,8 +53,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | ||
| 53 | Map<String, List<Long>> startUserSelectAssignees = FlowableUtils.getStartUserSelectAssignees(processInstance); | 53 | Map<String, List<Long>> startUserSelectAssignees = FlowableUtils.getStartUserSelectAssignees(processInstance); |
| 54 | Assert.notNull(startUserSelectAssignees, "流程实例({}) 的发起人自选审批人不能为空", | 54 | Assert.notNull(startUserSelectAssignees, "流程实例({}) 的发起人自选审批人不能为空", |
| 55 | execution.getProcessInstanceId()); | 55 | execution.getProcessInstanceId()); |
| 56 | - // 获得审批人 | 56 | + // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 |
| 57 | List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId()); | 57 | List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId()); |
| 58 | + if (CollUtil.isEmpty(assignees)){ | ||
| 59 | + return null; | ||
| 60 | + } | ||
| 58 | return new LinkedHashSet<>(assignees); | 61 | return new LinkedHashSet<>(assignees); |
| 59 | } | 62 | } |
| 60 | 63 | ||
| @@ -68,8 +71,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | @@ -68,8 +71,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | ||
| 68 | if (startUserSelectAssignees == null) { | 71 | if (startUserSelectAssignees == null) { |
| 69 | return Sets.newLinkedHashSet(); | 72 | return Sets.newLinkedHashSet(); |
| 70 | } | 73 | } |
| 71 | - // 获得审批人 | 74 | + // 获得审批人,如果不存在,则直接返回空,避免类型转换异常 |
| 72 | List<Long> assignees = startUserSelectAssignees.get(activityId); | 75 | List<Long> assignees = startUserSelectAssignees.get(activityId); |
| 76 | + if (CollUtil.isEmpty(assignees)){ | ||
| 77 | + return null; | ||
| 78 | + } | ||
| 73 | return new LinkedHashSet<>(assignees); | 79 | return new LinkedHashSet<>(assignees); |
| 74 | } | 80 | } |
| 75 | 81 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| @@ -173,10 +173,19 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -173,10 +173,19 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 173 | } | 173 | } |
| 174 | startUserId = Long.valueOf(historicProcessInstance.getStartUserId()); | 174 | startUserId = Long.valueOf(historicProcessInstance.getStartUserId()); |
| 175 | processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance); | 175 | processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance); |
| 176 | - // 如果流程变量为空,则使用历史流程变量 | ||
| 177 | - if (null == processVariables) { | ||
| 178 | - processVariables = historicProcessInstance.getProcessVariables(); | 176 | + // 如果流程变量不为空,则用前端传递的新变量值覆盖历史的流程变量 |
| 177 | + Map<String, Object> historicVariables = historicProcessInstance.getProcessVariables(); | ||
| 178 | + if (null != processVariables) { | ||
| 179 | + // 遍历新变量值,仅更新历史变量中存在的键 | ||
| 180 | + for (Map.Entry<String, Object> entry : processVariables.entrySet()) { | ||
| 181 | + String key = entry.getKey(); | ||
| 182 | + if (historicVariables.containsKey(key)) { | ||
| 183 | + // 如果历史变量中存在该键,则用新值覆盖 | ||
| 184 | + historicVariables.put(key, entry.getValue()); | ||
| 185 | + } | ||
| 186 | + } | ||
| 179 | } | 187 | } |
| 188 | + processVariables = historicVariables; | ||
| 180 | } | 189 | } |
| 181 | // 1.3 读取其它相关数据 | 190 | // 1.3 读取其它相关数据 |
| 182 | ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition( | 191 | ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition( |