Commit 248127a941cf511d14c3831d079c64abb805fe44
1 parent
642e72ae
review: 代码审查
Showing
2 changed files
with
7 additions
and
32 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
| ... | ... | @@ -778,16 +778,9 @@ public class BpmnModelUtils { |
| 778 | 778 | if (currentElement instanceof ExclusiveGateway) { |
| 779 | 779 | // 查找满足条件的 SequenceFlow 路径 |
| 780 | 780 | Gateway gateway = (Gateway) currentElement; |
| 781 | - SequenceFlow matchSequenceFlow; | |
| 782 | - // 流程首次发起时,variables值一定为空,会导致条件表达式解析错误导致预测节点缺失 | |
| 783 | - if (null == variables) { | |
| 784 | - matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), | |
| 785 | - flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())); | |
| 786 | - } else { | |
| 787 | - matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), | |
| 781 | + SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), | |
| 788 | 782 | flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) |
| 789 | 783 | && (evalConditionExpress(variables, flow.getConditionExpression()))); |
| 790 | - } | |
| 791 | 784 | if (matchSequenceFlow == null) { |
| 792 | 785 | matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), |
| 793 | 786 | flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); |
| ... | ... | @@ -807,16 +800,9 @@ public class BpmnModelUtils { |
| 807 | 800 | if (currentElement instanceof InclusiveGateway) { |
| 808 | 801 | // 查找满足条件的 SequenceFlow 路径 |
| 809 | 802 | Gateway gateway = (Gateway) currentElement; |
| 810 | - Collection<SequenceFlow> matchSequenceFlows; | |
| 811 | - // 流程首次发起时,variables值一定为空,会导致条件表达式解析错误导致预测节点缺失 | |
| 812 | - if (null == variables){ | |
| 813 | - matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), | |
| 814 | - flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())); | |
| 815 | - }else { | |
| 816 | - matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), | |
| 803 | + Collection<SequenceFlow> matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), | |
| 817 | 804 | flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) |
| 818 | 805 | && evalConditionExpress(variables, flow.getConditionExpression())); |
| 819 | - } | |
| 820 | 806 | if (CollUtil.isEmpty(matchSequenceFlows)) { |
| 821 | 807 | matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), |
| 822 | 808 | flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); |
| ... | ... | @@ -851,6 +837,9 @@ public class BpmnModelUtils { |
| 851 | 837 | if (express == null) { |
| 852 | 838 | return Boolean.FALSE; |
| 853 | 839 | } |
| 840 | + if (variables == null) { | |
| 841 | + return Boolean.FALSE; | |
| 842 | + } | |
| 854 | 843 | try { |
| 855 | 844 | Object result = FlowableUtils.getExpressionValue(variables, express); |
| 856 | 845 | return Boolean.TRUE.equals(result); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -808,16 +808,9 @@ public class SimpleModelUtils { |
| 808 | 808 | // 情况:CONDITION_BRANCH_NODE 排它,只有一个满足条件的。如果没有,就走默认的 |
| 809 | 809 | if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) { |
| 810 | 810 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 811 | - BpmSimpleModelNodeVO matchConditionNode; | |
| 812 | - // 流程首次发起时,variables值一定为空,会导致条件表达式解析错误导致预测节点缺失 | |
| 813 | - if(null == variables) { | |
| 814 | - matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), | |
| 815 | - conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); | |
| 816 | - }else { | |
| 817 | - matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), | |
| 811 | + BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), | |
| 818 | 812 | conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) |
| 819 | 813 | && evalConditionExpress(variables, conditionNode.getConditionSetting())); |
| 820 | - } | |
| 821 | 814 | if (matchConditionNode == null) { |
| 822 | 815 | matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), |
| 823 | 816 | conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); |
| ... | ... | @@ -830,16 +823,9 @@ public class SimpleModelUtils { |
| 830 | 823 | // 情况:INCLUSIVE_BRANCH_NODE 包容,多个满足条件的。如果没有,就走默认的 |
| 831 | 824 | if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { |
| 832 | 825 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 833 | - Collection<BpmSimpleModelNodeVO> matchConditionNodes; | |
| 834 | - // 流程首次发起时,variables值一定为空,会导致条件表达式解析错误导致预测节点缺失 | |
| 835 | - if (null == variables) { | |
| 836 | - matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), | |
| 837 | - conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); | |
| 838 | - }else { | |
| 839 | - matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), | |
| 826 | + Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), | |
| 840 | 827 | conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) |
| 841 | 828 | && evalConditionExpress(variables, conditionNode.getConditionSetting())); |
| 842 | - } | |
| 843 | 829 | if (CollUtil.isEmpty(matchConditionNodes)) { |
| 844 | 830 | matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), |
| 845 | 831 | conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); | ... | ... |