Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
00d5f8cf
Commit
00d5f8cf
authored
Nov 09, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公共参数参与脚本替换
parent
94a62174
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
1 deletion
+51
-1
ApiFlowOperatingServiceImpl.java
...va/com/byit/service/impl/ApiFlowOperatingServiceImpl.java
+51
-1
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowOperatingServiceImpl.java
View file @
00d5f8cf
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.dto.NodeRelyDto
;
import
com.byit.dto.NodeRelyDto
;
import
com.byit.dto.executor.RunParamWrapped
;
import
com.byit.dto.executor.RunParamWrapped
;
import
com.byit.dto.executor.ScriptParamAndPlaceholderDto
;
import
com.byit.dto.specials.MakeUpReturn
;
import
com.byit.dto.specials.MakeUpReturn
;
import
com.byit.dto.specials.RepairFlow
;
import
com.byit.dto.specials.RepairFlow
;
import
com.byit.dto.specials.RepairTimeParam
;
import
com.byit.dto.specials.RepairTimeParam
;
...
@@ -120,6 +121,55 @@ public class ApiFlowOperatingServiceImpl implements ApiFlowOperatingService {
...
@@ -120,6 +121,55 @@ public class ApiFlowOperatingServiceImpl implements ApiFlowOperatingService {
//循环所有的结果集
//循环所有的结果集
nodeRelyDtoSet
.
forEach
(
nodeWrapped
->
{
nodeRelyDtoSet
.
forEach
(
nodeWrapped
->
{
Node
node
=
nodeWrapped
.
getNode
();
Node
node
=
nodeWrapped
.
getNode
();
String
runCommand
=
node
.
getRunCommand
();
//将公共参数放到替换参数里面
if
(
CollectionUtil
.
isNotEmpty
(
publicParam
)
&&
!
runCommand
.
startsWith
(
"java"
)){
//获取运行参数
String
runParam
=
node
.
getRunParam
();
//创建包装参数
RunParamWrapped
runParamWrapped
=
new
RunParamWrapped
();
//如果运行参数不为空
if
(
StringUtils
.
isNoneBlank
(
runParam
)){
//json化运行参数
runParamWrapped
=
JSON
.
parseObject
(
runParam
,
RunParamWrapped
.
class
);
//获取私有参数
String
privateParam
=
runParamWrapped
.
getPrivateParam
();
//如果私有参数不为空
if
(
StringUtils
.
isNoneBlank
(
privateParam
))
{
//转换成参数对象
ScriptParamAndPlaceholderDto
paramAndPlaceholderDto
=
JSON
.
parseObject
(
runParamWrapped
.
getPrivateParam
(),
ScriptParamAndPlaceholderDto
.
class
);
//获取替换参数
Map
<
String
,
String
>
placeholder
=
paramAndPlaceholderDto
.
getPlaceholder
();
if
(
placeholder
==
null
){
placeholder
=
new
HashMap
<>(
8
);
}
//将公共参数放到替换参数
for
(
Map
.
Entry
<
String
,
String
>
stringStringEntry
:
publicParam
.
entrySet
())
{
placeholder
.
put
(
stringStringEntry
.
getKey
(),
stringStringEntry
.
getValue
());
}
paramAndPlaceholderDto
.
setPlaceholder
(
placeholder
);
//重新设置包装对象
runParamWrapped
.
setPrivateParam
(
JSON
.
toJSONString
(
paramAndPlaceholderDto
));
//如果运行参数为空
}
else
{
//创建一个参数对象
ScriptParamAndPlaceholderDto
paramAndPlaceholderDto
=
new
ScriptParamAndPlaceholderDto
();
//设置替换参数
paramAndPlaceholderDto
.
setPlaceholder
(
publicParam
);
//设置参数包装对象的私有参数
runParamWrapped
.
setPrivateParam
(
JSON
.
toJSONString
(
paramAndPlaceholderDto
));
}
//运行参数为空
}
else
{
//重复上述步骤
ScriptParamAndPlaceholderDto
paramAndPlaceholderDto
=
new
ScriptParamAndPlaceholderDto
();
paramAndPlaceholderDto
.
setPlaceholder
(
publicParam
);
runParamWrapped
.
setPrivateParam
(
JSON
.
toJSONString
(
paramAndPlaceholderDto
));
}
}
String
nodeName
=
node
.
getNodeName
();
String
nodeName
=
node
.
getNodeName
();
//基于节点名称替换参数
//基于节点名称替换参数
String
param
=
parseParam
(
paramCarrier
,
nodeName
);
String
param
=
parseParam
(
paramCarrier
,
nodeName
);
...
@@ -141,7 +191,7 @@ public class ApiFlowOperatingServiceImpl implements ApiFlowOperatingService {
...
@@ -141,7 +191,7 @@ public class ApiFlowOperatingServiceImpl implements ApiFlowOperatingService {
node
.
setRunParam
(
JSON
.
toJSONString
(
runParamWrapped
));
node
.
setRunParam
(
JSON
.
toJSONString
(
runParamWrapped
));
}
}
String
runCommand
=
node
.
getRunCommand
();
if
(
StringUtils
.
isNoneBlank
(
runCommand
)){
if
(
StringUtils
.
isNoneBlank
(
runCommand
)){
if
(
runCommand
.
startsWith
(
JAVA_TYPE
)
&&
CollectionUtil
.
isNotEmpty
(
publicParam
)){
if
(
runCommand
.
startsWith
(
JAVA_TYPE
)
&&
CollectionUtil
.
isNotEmpty
(
publicParam
)){
for
(
Map
.
Entry
<
String
,
String
>
stringStringEntry
:
publicParam
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
stringStringEntry
:
publicParam
.
entrySet
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment