mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-22 20:48:09 +08:00
feature #I4GYV2 script节点支持从文件中获取脚本
This commit is contained in:
@@ -0,0 +1 @@
|
||||
liteflow.rule-source=json-script-file/flow.json
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"flow": {
|
||||
"nodes": {
|
||||
"node": [
|
||||
{
|
||||
"id": "s1",
|
||||
"name": "普通脚本",
|
||||
"type": "script",
|
||||
"file": "json-script-file/s1.groovy"
|
||||
},
|
||||
{
|
||||
"id": "s2",
|
||||
"name": "条件脚本",
|
||||
"type": "cond_script",
|
||||
"file": "json-script-file/s2.groovy"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chain": [
|
||||
{
|
||||
"name": "chain1",
|
||||
"condition": [
|
||||
{"type": "then", "value": "a,b,c,s1"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chain2",
|
||||
"condition": [
|
||||
{"type": "then", "value": "d,s2(a|b)"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"flow": {
|
||||
"nodes": {
|
||||
"node": [
|
||||
{
|
||||
"id": "s1",
|
||||
"name": "普通脚本",
|
||||
"type": "script",
|
||||
"file": "json-script-file/s1.groovy"
|
||||
},
|
||||
{
|
||||
"id": "s2",
|
||||
"name": "条件脚本_改",
|
||||
"type": "cond_script",
|
||||
"file": "json-script-file/s2_update.groovy"
|
||||
},
|
||||
{
|
||||
"id": "s3",
|
||||
"name": "普通脚本_新增",
|
||||
"type": "script",
|
||||
"file": "json-script-file/s2_update.groovy"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chain": [
|
||||
{
|
||||
"name": "chain1",
|
||||
"condition": [
|
||||
{"type": "then", "value": "a,b,c,s1"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chain2",
|
||||
"condition": [
|
||||
{"type": "then", "value": "d,s2(a|b),s3"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Integer a=3
|
||||
Integer b=2
|
||||
slot.setData("s1",a*b)
|
||||
@@ -0,0 +1,6 @@
|
||||
Integer count = slot.getData("count")
|
||||
if(count > 100){
|
||||
return "a"
|
||||
}else{
|
||||
return "b"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Integer count = slot.getData("count")
|
||||
if(count > 150){
|
||||
return "b"
|
||||
}else{
|
||||
return "a"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Integer a=3
|
||||
Integer b=2
|
||||
Integer c=10
|
||||
slot.setData("s1",a*b+c)
|
||||
@@ -0,0 +1 @@
|
||||
liteflow.rule-source=xml-script-file/flow.xml
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="s1" name="普通脚本" type="script" file="xml-script-file/s1.groovy"/>
|
||||
<node id="s2" name="条件脚本" type="cond_script" file="xml-script-file/s2.groovy"/>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
<then value="a,b,c,s1"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain2">
|
||||
<then value="d,s2(a|b)"/>
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="s1" name="普通脚本" type="script" file="xml-script-file/s1.groovy"/>
|
||||
<node id="s2" name="条件脚本_改" type="cond_script" file="xml-script-file/s2_update.groovy"/>
|
||||
<node id="s3" name="普通脚本_新增" type="script" file="xml-script-file/s3.groovy"/>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
<then value="a,b,c,s1"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain2">
|
||||
<then value="d,s2(a|b),s3"/>
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -0,0 +1,3 @@
|
||||
Integer a=3
|
||||
Integer b=2
|
||||
slot.setData("s1",a*b)
|
||||
@@ -0,0 +1,6 @@
|
||||
Integer count = slot.getData("count")
|
||||
if(count > 100){
|
||||
return "a"
|
||||
}else{
|
||||
return "b"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Integer count = slot.getData("count")
|
||||
if(count > 150){
|
||||
return "b"
|
||||
}else{
|
||||
return "a"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Integer a=3
|
||||
Integer b=2
|
||||
Integer c=10
|
||||
slot.setData("s1",a*b+c);
|
||||
Reference in New Issue
Block a user