Commit 248127a941cf511d14c3831d079c64abb805fe44

Authored by smallNorthLee
1 parent 642e72ae

review: 代码审查

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,16 +778,9 @@ public class BpmnModelUtils {
778 if (currentElement instanceof ExclusiveGateway) { 778 if (currentElement instanceof ExclusiveGateway) {
779 // 查找满足条件的 SequenceFlow 路径 779 // 查找满足条件的 SequenceFlow 路径
780 Gateway gateway = (Gateway) currentElement; 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 flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) 782 flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
789 && (evalConditionExpress(variables, flow.getConditionExpression()))); 783 && (evalConditionExpress(variables, flow.getConditionExpression())));
790 - }  
791 if (matchSequenceFlow == null) { 784 if (matchSequenceFlow == null) {
792 matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), 785 matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
793 flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); 786 flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
@@ -807,16 +800,9 @@ public class BpmnModelUtils { @@ -807,16 +800,9 @@ public class BpmnModelUtils {
807 if (currentElement instanceof InclusiveGateway) { 800 if (currentElement instanceof InclusiveGateway) {
808 // 查找满足条件的 SequenceFlow 路径 801 // 查找满足条件的 SequenceFlow 路径
809 Gateway gateway = (Gateway) currentElement; 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 flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) 804 flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
818 && evalConditionExpress(variables, flow.getConditionExpression())); 805 && evalConditionExpress(variables, flow.getConditionExpression()));
819 - }  
820 if (CollUtil.isEmpty(matchSequenceFlows)) { 806 if (CollUtil.isEmpty(matchSequenceFlows)) {
821 matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(), 807 matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
822 flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); 808 flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
@@ -851,6 +837,9 @@ public class BpmnModelUtils { @@ -851,6 +837,9 @@ public class BpmnModelUtils {
851 if (express == null) { 837 if (express == null) {
852 return Boolean.FALSE; 838 return Boolean.FALSE;
853 } 839 }
  840 + if (variables == null) {
  841 + return Boolean.FALSE;
  842 + }
854 try { 843 try {
855 Object result = FlowableUtils.getExpressionValue(variables, express); 844 Object result = FlowableUtils.getExpressionValue(variables, express);
856 return Boolean.TRUE.equals(result); 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,16 +808,9 @@ public class SimpleModelUtils {
808 // 情况:CONDITION_BRANCH_NODE 排它,只有一个满足条件的。如果没有,就走默认的 808 // 情况:CONDITION_BRANCH_NODE 排它,只有一个满足条件的。如果没有,就走默认的
809 if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) { 809 if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) {
810 // 查找满足条件的 BpmSimpleModelNodeVO 节点 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 conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) 812 conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
819 && evalConditionExpress(variables, conditionNode.getConditionSetting())); 813 && evalConditionExpress(variables, conditionNode.getConditionSetting()));
820 - }  
821 if (matchConditionNode == null) { 814 if (matchConditionNode == null) {
822 matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), 815 matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
823 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); 816 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
@@ -830,16 +823,9 @@ public class SimpleModelUtils { @@ -830,16 +823,9 @@ public class SimpleModelUtils {
830 // 情况:INCLUSIVE_BRANCH_NODE 包容,多个满足条件的。如果没有,就走默认的 823 // 情况:INCLUSIVE_BRANCH_NODE 包容,多个满足条件的。如果没有,就走默认的
831 if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { 824 if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) {
832 // 查找满足条件的 BpmSimpleModelNodeVO 节点 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 conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) 827 conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
841 && evalConditionExpress(variables, conditionNode.getConditionSetting())); 828 && evalConditionExpress(variables, conditionNode.getConditionSetting()));
842 - }  
843 if (CollUtil.isEmpty(matchConditionNodes)) { 829 if (CollUtil.isEmpty(matchConditionNodes)) {
844 matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), 830 matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
845 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); 831 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));