review: 优化审批时,校验选择的下一个节点的审批人,是否合法
This commit is contained in:
parent
26dd8b6670
commit
494b80d1eb
|
@ -907,9 +907,16 @@ public class BpmnModelUtils {
|
|||
* @return 符合条件的路径
|
||||
*/
|
||||
private static SequenceFlow findMatchSequenceFlowByExclusiveGateway(Gateway gateway, Map<String, Object> variables) {
|
||||
SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
|
||||
&& (evalConditionExpress(variables, flow.getConditionExpression())));
|
||||
// TODO 表单无可编辑字段时variables为空,流程走向会出现问题,比如流程审批过程中无需要修改的字段值,
|
||||
SequenceFlow matchSequenceFlow;
|
||||
if (CollUtil.isNotEmpty(variables)){
|
||||
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
|
||||
&& (evalConditionExpress(variables, flow.getConditionExpression())));
|
||||
}else {
|
||||
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()));
|
||||
}
|
||||
if (matchSequenceFlow == null) {
|
||||
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
|
||||
flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
|
||||
|
|
|
@ -194,7 +194,7 @@ public class FlowableUtils {
|
|||
@SuppressWarnings("unchecked")
|
||||
public static Map<String, List<Long>> getStartUserSelectAssignees(Map<String, Object> processVariables) {
|
||||
if (processVariables == null) {
|
||||
return new HashMap<>();
|
||||
return null;
|
||||
}
|
||||
return (Map<String, List<Long>>) processVariables.get(
|
||||
BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES);
|
||||
|
@ -214,12 +214,12 @@ public class FlowableUtils {
|
|||
* 获得流程实例的审批用户选择的下一个节点的审批人 Map
|
||||
*
|
||||
* @param processVariables 流程变量
|
||||
* @return 审批用户选择的下一个节点的审批人Map
|
||||
* @return 审批用户选择的下一个节点的审批人Map Map
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<String, List<Long>> getApproveUserSelectAssignees(Map<String, Object> processVariables) {
|
||||
if (processVariables == null) {
|
||||
return new HashMap<>();
|
||||
return null;
|
||||
}
|
||||
return (Map<String, List<Long>>) processVariables.get(
|
||||
BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES);
|
||||
|
|
|
@ -600,7 +600,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName());
|
||||
}
|
||||
processVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables());
|
||||
if (CollUtil.isNotEmpty(processVariables)) {
|
||||
if (processVariables == null){
|
||||
processVariables = new HashMap<>();
|
||||
}else {
|
||||
List<Long> startUserSelectAssignee = processVariables.get(nextFlowNode.getId());
|
||||
// 特殊:如果当前节点已经存在审批人,则不允许覆盖
|
||||
if (CollUtil.isNotEmpty(startUserSelectAssignee)) {
|
||||
|
@ -619,7 +621,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||
throw exception(PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName());
|
||||
}
|
||||
processVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables());
|
||||
if (CollUtil.isNotEmpty(processVariables)) {
|
||||
if (processVariables == null){
|
||||
processVariables = new HashMap<>();
|
||||
}else {
|
||||
List<Long> approveUserSelectAssignee = processVariables.get(nextFlowNode.getId());
|
||||
// 特殊:如果当前节点已经存在审批人,则不允许覆盖
|
||||
if (CollUtil.isNotEmpty(approveUserSelectAssignee)) {
|
||||
|
|
Loading…
Reference in New Issue