review: 代码审查

This commit is contained in:
smallNorthLee 2025-02-19 20:01:38 +08:00
parent 642e72ae7a
commit 248127a941
2 changed files with 7 additions and 32 deletions

View File

@ -778,16 +778,9 @@ public class BpmnModelUtils {
if (currentElement instanceof ExclusiveGateway) {
// 查找满足条件的 SequenceFlow 路径
Gateway gateway = (Gateway) currentElement;
SequenceFlow matchSequenceFlow;
// 流程首次发起时variables值一定为空会导致条件表达式解析错误导致预测节点缺失
if (null == variables) {
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()));
} else {
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
&& (evalConditionExpress(variables, flow.getConditionExpression())));
}
if (matchSequenceFlow == null) {
matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
@ -807,16 +800,9 @@ public class BpmnModelUtils {
if (currentElement instanceof InclusiveGateway) {
// 查找满足条件的 SequenceFlow 路径
Gateway gateway = (Gateway) currentElement;
Collection<SequenceFlow> matchSequenceFlows;
// 流程首次发起时variables值一定为空会导致条件表达式解析错误导致预测节点缺失
if (null == variables){
matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()));
}else {
matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
Collection<SequenceFlow> matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
&& evalConditionExpress(variables, flow.getConditionExpression()));
}
if (CollUtil.isEmpty(matchSequenceFlows)) {
matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
@ -851,6 +837,9 @@ public class BpmnModelUtils {
if (express == null) {
return Boolean.FALSE;
}
if (variables == null) {
return Boolean.FALSE;
}
try {
Object result = FlowableUtils.getExpressionValue(variables, express);
return Boolean.TRUE.equals(result);

View File

@ -808,16 +808,9 @@ public class SimpleModelUtils {
// 情况CONDITION_BRANCH_NODE 排它只有一个满足条件的如果没有就走默认的
if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) {
// 查找满足条件的 BpmSimpleModelNodeVO 节点
BpmSimpleModelNodeVO matchConditionNode;
// 流程首次发起时variables值一定为空会导致条件表达式解析错误导致预测节点缺失
if(null == variables) {
matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
}else {
matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
&& evalConditionExpress(variables, conditionNode.getConditionSetting()));
}
if (matchConditionNode == null) {
matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
@ -830,16 +823,9 @@ public class SimpleModelUtils {
// 情况INCLUSIVE_BRANCH_NODE 包容多个满足条件的如果没有就走默认的
if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) {
// 查找满足条件的 BpmSimpleModelNodeVO 节点
Collection<BpmSimpleModelNodeVO> matchConditionNodes;
// 流程首次发起时variables值一定为空会导致条件表达式解析错误导致预测节点缺失
if (null == variables) {
matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
}else {
matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
&& evalConditionExpress(variables, conditionNode.getConditionSetting()));
}
if (CollUtil.isEmpty(matchConditionNodes)) {
matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));