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
40467a8b
Commit
40467a8b
authored
Mar 18, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实时运行任务节点
parent
d2c8977f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
ApiNodeServiceImpl.java
...c/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
+23
-1
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
View file @
40467a8b
package
com
.
byit
.
service
.
impl
;
package
com
.
byit
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.byit.enums.NodePropertyEnum
;
import
com.byit.mapper.JobTaskScheduleMapper
;
import
com.byit.model.JobTaskSchedule
;
import
com.byit.model.JobTaskSchedule
;
import
com.byit.service.ApiNodeService
;
import
com.byit.service.ApiNodeService
;
import
com.byit.utils.ValidationUtil
;
import
com.byit.utils.ValidationUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
@Service
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ApiNodeServiceImpl
implements
ApiNodeService
{
public
class
ApiNodeServiceImpl
implements
ApiNodeService
{
@Resource
private
JobTaskScheduleMapper
jobTaskScheduleMapper
;
@Override
@Override
public
String
runNode
(
String
param
)
{
public
String
runNode
(
String
param
)
{
...
@@ -18,6 +25,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
...
@@ -18,6 +25,7 @@ public class ApiNodeServiceImpl implements ApiNodeService {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
param
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
param
);
String
nodeId
=
jsonObject
.
getString
(
"nodeId"
);
String
nodeId
=
jsonObject
.
getString
(
"nodeId"
);
ValidationUtil
.
dataNotBank
(
nodeId
,
"节点id不允许为空!"
);
ValidationUtil
.
dataNotBank
(
nodeId
,
"节点id不允许为空!"
);
String
runId
=
"REAL-EXEC-"
+
nodeId
;
String
nodeName
=
jsonObject
.
getString
(
"nodeName"
);
String
nodeName
=
jsonObject
.
getString
(
"nodeName"
);
ValidationUtil
.
dataNotBank
(
nodeName
,
"节点名称不允许为空!"
);
ValidationUtil
.
dataNotBank
(
nodeName
,
"节点名称不允许为空!"
);
String
runCmd
=
jsonObject
.
getString
(
"runCmd"
);
String
runCmd
=
jsonObject
.
getString
(
"runCmd"
);
...
@@ -27,8 +35,22 @@ public class ApiNodeServiceImpl implements ApiNodeService {
...
@@ -27,8 +35,22 @@ public class ApiNodeServiceImpl implements ApiNodeService {
String
runSource
=
jsonObject
.
getString
(
"runSource"
);
String
runSource
=
jsonObject
.
getString
(
"runSource"
);
String
jobType
=
jsonObject
.
getString
(
"jobType"
);
String
jobType
=
jsonObject
.
getString
(
"jobType"
);
ValidationUtil
.
dataNotBank
(
jobType
,
"节点类型不允许为空!"
);
ValidationUtil
.
dataNotBank
(
jobType
,
"节点类型不允许为空!"
);
JobTaskSchedule
schedule
=
new
JobTaskSchedule
();
JobTaskSchedule
schedule
=
new
JobTaskSchedule
();
return
null
;
schedule
.
setNodeId
(
Integer
.
valueOf
(
nodeId
));
schedule
.
setRunId
(
runId
);
schedule
.
setNodeName
(
nodeName
);
schedule
.
setIsVirtual
(
NodePropertyEnum
.
ISNOT_VIRTUAL
.
getCode
());
schedule
.
setRunParam
(
runParam
);
schedule
.
setRunCommand
(
runCmd
);
schedule
.
setRunSource
(
runSource
);
schedule
.
setScriptUrls
(
scriptUrl
);
schedule
.
setJobType
(
jobType
);
schedule
.
setTriggerTime
(
System
.
currentTimeMillis
());
jobTaskScheduleMapper
.
saveJobTaskSchedule
(
schedule
);
return
runId
;
}
}
}
}
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