fix:
1、预测节点审批人查询,如果不存在,则直接返回空,避免类型转换异常 2、如果processVariables不为空,则使用前端传递的参数值
This commit is contained in:
parent
f45758b8fd
commit
5d16355042
|
@ -53,8 +53,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
|
||||||
Map<String, List<Long>> startUserSelectAssignees = FlowableUtils.getStartUserSelectAssignees(processInstance);
|
Map<String, List<Long>> startUserSelectAssignees = FlowableUtils.getStartUserSelectAssignees(processInstance);
|
||||||
Assert.notNull(startUserSelectAssignees, "流程实例({}) 的发起人自选审批人不能为空",
|
Assert.notNull(startUserSelectAssignees, "流程实例({}) 的发起人自选审批人不能为空",
|
||||||
execution.getProcessInstanceId());
|
execution.getProcessInstanceId());
|
||||||
// 获得审批人
|
// 获得审批人,如果不存在,则直接返回空,避免类型转换异常
|
||||||
List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId());
|
List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId());
|
||||||
|
if (CollUtil.isEmpty(assignees)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new LinkedHashSet<>(assignees);
|
return new LinkedHashSet<>(assignees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +71,11 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
|
||||||
if (startUserSelectAssignees == null) {
|
if (startUserSelectAssignees == null) {
|
||||||
return Sets.newLinkedHashSet();
|
return Sets.newLinkedHashSet();
|
||||||
}
|
}
|
||||||
// 获得审批人
|
// 获得审批人,如果不存在,则直接返回空,避免类型转换异常
|
||||||
List<Long> assignees = startUserSelectAssignees.get(activityId);
|
List<Long> assignees = startUserSelectAssignees.get(activityId);
|
||||||
|
if (CollUtil.isEmpty(assignees)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new LinkedHashSet<>(assignees);
|
return new LinkedHashSet<>(assignees);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,10 +173,19 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
||||||
}
|
}
|
||||||
startUserId = Long.valueOf(historicProcessInstance.getStartUserId());
|
startUserId = Long.valueOf(historicProcessInstance.getStartUserId());
|
||||||
processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance);
|
processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance);
|
||||||
// 如果流程变量为空,则使用历史流程变量
|
// 如果流程变量不为空,则用前端传递的新变量值覆盖历史的流程变量
|
||||||
if (null == processVariables) {
|
Map<String, Object> historicVariables = historicProcessInstance.getProcessVariables();
|
||||||
processVariables = historicProcessInstance.getProcessVariables();
|
if (null != processVariables) {
|
||||||
|
// 遍历新变量值,仅更新历史变量中存在的键
|
||||||
|
for (Map.Entry<String, Object> entry : processVariables.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
if (historicVariables.containsKey(key)) {
|
||||||
|
// 如果历史变量中存在该键,则用新值覆盖
|
||||||
|
historicVariables.put(key, entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
processVariables = historicVariables;
|
||||||
}
|
}
|
||||||
// 1.3 读取其它相关数据
|
// 1.3 读取其它相关数据
|
||||||
ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition(
|
ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition(
|
||||||
|
|
Loading…
Reference in New Issue