From b93358c05f00725b4c93c99e5f6b86cb416a272f Mon Sep 17 00:00:00 2001 From: zy <953725892@qq.com> Date: Mon, 9 Oct 2023 00:08:33 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#I7SVZF=20=E4=BF=AE=E6=AD=A3yml=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E7=A9=BA=E5=80=BC=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=A4=84=E7=90=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yomahub/liteflow/parser/helper/ParserHelper.java | 5 +++-- .../src/test/resources/abstractChain/flow.el.json | 2 -- .../src/test/resources/abstractChain/flow.el.xml | 6 +++--- .../src/test/resources/abstractChain/flow.el.yml | 2 -- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java index ce9d5843c..bd4adcc40 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/helper/ParserHelper.java @@ -252,7 +252,8 @@ public class ParserHelper { //首先需要对继承自抽象Chain的chain进行字符串替换 parseImplChain(abstratChainMap, implChainSet, chainNode); //如果一个chain不为抽象chain,则进行解析 - String chainName = Optional.ofNullable(chainNode).map(JsonNode::textValue).orElse(null); + JsonNode chainNameJsonNode = Optional.ofNullable(chainNode.get(ID)).orElse(chainNode.get(NAME)); + String chainName = Optional.ofNullable(chainNameJsonNode).map(JsonNode::textValue).orElse(null); if(!abstratChainMap.containsKey(chainName)){ parseOneChainConsumer.accept(chainNode); } @@ -321,7 +322,7 @@ public class ParserHelper { * @param implChainSet 已经解析过的实现Chain */ private static void parseImplChain(Map abstratChainMap, Set implChainSet, JsonNode chainNode) { - if(ObjectUtil.isNotNull(chainNode.hasNonNull(EXTENDS))){ + if(chainNode.hasNonNull(EXTENDS)){ String baseChainId = chainNode.get(EXTENDS).textValue(); JsonNode baseChain= abstratChainMap.get(baseChainId); if(baseChain!=null) { diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json index 453bda2d9..ea1c3d127 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.json @@ -13,7 +13,6 @@ }, { "id": "base", - "abstract": true, "value": "THEN(a, b, {0}, {1});" }, { @@ -24,7 +23,6 @@ { "id": "base2", "extends": "base", - "abstract": true, "value": "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);" } ] diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml index 1b1ded112..d8dd470cc 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.xml @@ -10,7 +10,7 @@ {4}=THEN(a,b).id("j"); - + THEN(a, b, {0}, {1}) @@ -19,12 +19,12 @@ {1}=SWITCH(f).to(j,k); - + {0}=THEN(a,b,{3}); {1}=SWITCH(f).to({4},k); - + THEN({_pre},{mainChain}, {subChain1},{subChain2},{end_chain}) diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml index b79e458fe..21b5fe2bb 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/resources/abstractChain/flow.el.yml @@ -7,12 +7,10 @@ flow: extends: base2 value: "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");" - id: base - abstract: true value: "THEN(a, b, {0}, {1});" - id: implA extends: base value: "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);" - id: base2 extends: base - abstract: true value: "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"