Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1764602d
authored
Sep 15, 2023
by
tiger
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updateJob without date
1 parent
3bd38d56
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
57 deletions
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/SopXxlJobUtil.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/XxlJobInfo.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/XxlJobUtil.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstNodeExecuteJobHandler.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/SopXxlJobUtil.java
View file @
1764602
...
@@ -55,15 +55,12 @@ public class SopXxlJobUtil {
...
@@ -55,15 +55,12 @@ public class SopXxlJobUtil {
public
static
void
initLoadJob
()
{
public
static
void
initLoadJob
()
{
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
SOP_LOAD_JOB_ID
);
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
SOP_LOAD_JOB_ID
);
if
(
job
!=
null
)
{
if
(
job
.
getTriggerStatus
()
==
1
)
{
return
;
}
else
{
XxlJobUtil
.
remove
(
SOP_LOAD_JOB_ID
);
}
}
job
=
new
XxlJobInfo
();
boolean
exists
=
job
!=
null
;
if
(
job
==
null
)
{
job
=
new
XxlJobInfo
();
}
job
.
setExecutorParam
(
""
);
job
.
setExecutorParam
(
""
);
job
.
setJobDesc
(
"加载所有SOP实例任务"
);
job
.
setJobDesc
(
"加载所有SOP实例任务"
);
job
.
setAuthor
(
"admin"
);
job
.
setAuthor
(
"admin"
);
...
@@ -71,20 +68,27 @@ public class SopXxlJobUtil {
...
@@ -71,20 +68,27 @@ public class SopXxlJobUtil {
job
.
setExecutorHandler
(
SOP_LOAD_JOB_ID
);
job
.
setExecutorHandler
(
SOP_LOAD_JOB_ID
);
job
.
setBusKey
(
SOP_LOAD_JOB_ID
);
job
.
setBusKey
(
SOP_LOAD_JOB_ID
);
job
.
setTriggerStatus
(
1
);
job
.
setTriggerStatus
(
1
);
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】任务启动,cron:{},result:{}"
,
SOP_LOAD_JOB_ID
,
job
.
getScheduleConf
(),
add
);
if
(
exists
)
{
String
update
=
XxlJobUtil
.
update
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】任务更新,cron:{},result:{}"
,
SOP_LOAD_JOB_ID
,
job
.
getScheduleConf
(),
update
);
}
else
{
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】任务启动,cron:{},result:{}"
,
SOP_LOAD_JOB_ID
,
job
.
getScheduleConf
(),
add
);
}
}
}
public
static
void
initSopJob
(
SopInst
inst
)
{
public
static
void
initSopJob
(
SopInst
inst
)
{
String
jobBusId
=
jobBusId
(
inst
);
String
jobBusId
=
jobBusId
(
inst
);
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
jobBusId
);
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
jobBusId
);
if
(
job
!=
null
)
{
XxlJobUtil
.
remove
(
jobBusId
);
boolean
exists
=
job
!=
null
;
if
(
job
==
null
)
{
job
=
new
XxlJobInfo
();
}
}
// 重建job
// 重建job
job
=
new
XxlJobInfo
();
job
.
setExecutorParam
(
inst
.
getInstId
());
job
.
setExecutorParam
(
inst
.
getInstId
());
job
.
setJobDesc
(
inst
.
getInstName
());
job
.
setJobDesc
(
inst
.
getInstName
());
job
.
setAuthor
(
"admin"
);
job
.
setAuthor
(
"admin"
);
...
@@ -92,9 +96,14 @@ public class SopXxlJobUtil {
...
@@ -92,9 +96,14 @@ public class SopXxlJobUtil {
job
.
setExecutorHandler
(
SopXxlJobUtil
.
SOP_EXECUTE_JOB_ID
);
job
.
setExecutorHandler
(
SopXxlJobUtil
.
SOP_EXECUTE_JOB_ID
);
job
.
setBusKey
(
jobBusId
);
job
.
setBusKey
(
jobBusId
);
job
.
setTriggerStatus
(
1
);
job
.
setTriggerStatus
(
1
);
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop任务启动,cron:{},result:{}"
,
inst
.
getInstId
(),
job
.
getScheduleConf
(),
add
);
if
(
exists
)
{
String
update
=
XxlJobUtil
.
update
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop任务更新,cron:{},result:{}"
,
jobBusId
,
job
.
getScheduleConf
(),
update
);
}
else
{
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop任务启动,cron:{},result:{}"
,
jobBusId
,
job
.
getScheduleConf
(),
add
);
}
}
}
public
static
void
initSopNodesJob
(
SopStruct
sop
)
{
public
static
void
initSopNodesJob
(
SopStruct
sop
)
{
...
@@ -115,8 +124,10 @@ public class SopXxlJobUtil {
...
@@ -115,8 +124,10 @@ public class SopXxlJobUtil {
public
static
void
initSopNodeJob
(
SopStruct
sop
,
SopInstNode
node
)
{
public
static
void
initSopNodeJob
(
SopStruct
sop
,
SopInstNode
node
)
{
String
jobBusId
=
jobBusId
(
sop
.
getInst
(),
node
);
String
jobBusId
=
jobBusId
(
sop
.
getInst
(),
node
);
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
jobBusId
);
XxlJobInfo
job
=
XxlJobUtil
.
findByBusKey
(
jobBusId
);
if
(
job
!=
null
)
{
XxlJobUtil
.
remove
(
jobBusId
);
boolean
exists
=
job
!=
null
;
if
(
job
==
null
)
{
job
=
new
XxlJobInfo
();
}
}
// 15 2/3 * * * ?
// 15 2/3 * * * ?
...
@@ -128,7 +139,6 @@ public class SopXxlJobUtil {
...
@@ -128,7 +139,6 @@ public class SopXxlJobUtil {
// 前置节点,后置节点
// 前置节点,后置节点
Pair
<
Set
<
Integer
>,
Set
<
Integer
>>
linkPair
=
sop
.
getInstLinkMap
().
get
(
node
.
getNodeId
());
Pair
<
Set
<
Integer
>,
Set
<
Integer
>>
linkPair
=
sop
.
getInstLinkMap
().
get
(
node
.
getNodeId
());
boolean
enabled
=
linkPair
==
null
||
linkPair
.
getKey
().
isEmpty
();
SopInstNodeParam
params
=
new
SopInstNodeParam
();
SopInstNodeParam
params
=
new
SopInstNodeParam
();
params
.
setInstNodeId
(
node
.
getInstNodeId
());
params
.
setInstNodeId
(
node
.
getInstNodeId
());
params
.
setPreIds
(
linkPair
.
getKey
());
params
.
setPreIds
(
linkPair
.
getKey
());
...
@@ -136,7 +146,6 @@ public class SopXxlJobUtil {
...
@@ -136,7 +146,6 @@ public class SopXxlJobUtil {
String
paramJson
=
JSONUtil
.
toJsonStr
(
params
);
String
paramJson
=
JSONUtil
.
toJsonStr
(
params
);
// 重建job
// 重建job
job
=
new
XxlJobInfo
();
job
.
setExecutorParam
(
paramJson
);
job
.
setExecutorParam
(
paramJson
);
job
.
setJobDesc
(
sop
.
getInst
().
getInstName
()
+
"-"
+
node
.
getNodeName
());
job
.
setJobDesc
(
sop
.
getInst
().
getInstName
()
+
"-"
+
node
.
getNodeName
());
job
.
setAuthor
(
"admin"
);
job
.
setAuthor
(
"admin"
);
...
@@ -144,8 +153,15 @@ public class SopXxlJobUtil {
...
@@ -144,8 +153,15 @@ public class SopXxlJobUtil {
job
.
setExecutorHandler
(
SopXxlJobUtil
.
SOP_NODE_EXECUTE_JOB_ID
);
job
.
setExecutorHandler
(
SopXxlJobUtil
.
SOP_NODE_EXECUTE_JOB_ID
);
job
.
setBusKey
(
jobBusId
);
job
.
setBusKey
(
jobBusId
);
job
.
setTriggerStatus
(
1
);
job
.
setTriggerStatus
(
1
);
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop节点任务启动,cron:{},result:{}"
,
jobBusId
,
job
.
getScheduleConf
(),
add
);
if
(
exists
)
{
String
update
=
XxlJobUtil
.
update
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop节点任务更新,cron:{},result:{}"
,
jobBusId
,
job
.
getScheduleConf
(),
update
);
}
else
{
String
add
=
XxlJobUtil
.
add
(
job
);
SopXxlJobUtil
.
log
(
log
,
"【{}】Sop节点任务启动,cron:{},result:{}"
,
jobBusId
,
job
.
getScheduleConf
(),
add
);
}
}
}
public
static
String
jobBusId
(
SopInst
inst
)
{
public
static
String
jobBusId
(
SopInst
inst
)
{
...
...
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/XxlJobInfo.java
View file @
1764602
package
cn
.
com
.
glsx
.
process
.
job
.
xxljob
.
core
;
package
cn
.
com
.
glsx
.
process
.
job
.
xxljob
.
core
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.Date
;
public
class
XxlJobInfo
{
public
class
XxlJobInfo
{
private
int
id
;
// 主键ID
private
int
id
;
// 主键ID
private
int
jobGroup
;
// 执行器主键ID
private
int
jobGroup
;
// 执行器主键ID
private
String
jobDesc
;
private
String
jobDesc
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+08:00"
)
private
Date
addTime
;
private
Date
addTime
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+08:00"
)
private
Date
updateTime
;
private
Date
updateTime
;
private
String
author
;
// 负责人
private
String
alarmEmail
;
// 报警邮件
private
String
scheduleType
;
// 调度类型
private
String
author
;
// 负责人
private
String
scheduleConf
;
// 调度配置,值含义取决于调度类型
private
String
alarmEmail
;
// 报警邮件
private
String
misfireStrategy
;
// 调度过期策略 MisfireStrategyEnum
private
String
scheduleType
;
// 调度类型
private
String
scheduleConf
;
// 调度配置,值含义取决于调度类型
private
String
misfireStrategy
;
// 调度过期策略 MisfireStrategyEnum
private
String
executorRouteStrategy
;
// 执行器路由策略
private
String
executorRouteStrategy
;
// 执行器路由策略
private
String
executorHandler
;
// 执行器,任务Handler名称
private
String
executorHandler
;
// 执行器,任务Handler名称
private
String
executorParam
;
// 执行器,任务参数
private
String
executorParam
;
// 执行器,任务参数
private
String
executorBlockStrategy
;
// 阻塞处理策略 ExecutorBlockStrategyEnum
private
String
executorBlockStrategy
;
// 阻塞处理策略 ExecutorBlockStrategyEnum
private
int
executorTimeout
;
// 任务执行超时时间,单位秒
private
int
executorTimeout
;
// 任务执行超时时间,单位秒
private
int
executorFailRetryCount
;
// 失败重试次数
private
int
executorFailRetryCount
;
// 失败重试次数
private
String
glueType
;
// GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
private
String
glueSource
;
// GLUE源代码
private
String
glueRemark
;
// GLUE备注
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
String
glueType
;
// GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+08:00"
)
private
String
glueSource
;
// GLUE源代码
private
Date
glueUpdatetime
;
// GLUE更新时间
private
String
glueRemark
;
// GLUE备注
private
String
childJobId
;
// 子任务ID,多个逗号分隔
private
Date
glueUpdatetime
;
// GLUE更新时间
private
int
triggerStatus
;
// 调度状态:0-停止,1-运行
private
String
childJobId
;
// 子任务ID,多个逗号分隔
private
long
triggerLastTime
;
// 上次调度时间
private
long
triggerNextTime
;
// 下次调度时间
private
int
triggerStatus
;
// 调度状态:0-停止,1-运行
private
long
triggerLastTime
;
// 上次调度时间
private
long
triggerNextTime
;
// 下次调度时间
private
String
busKey
;
//业务标识
private
String
busKey
;
//
业务标识
public
int
getId
()
{
public
int
getId
()
{
return
id
;
return
id
;
...
...
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/core/XxlJobUtil.java
View file @
1764602
This diff is collapsed.
Click to expand it.
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstNodeExecuteJobHandler.java
View file @
1764602
...
@@ -9,6 +9,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
...
@@ -9,6 +9,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import
cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil
;
import
cn.com.glsx.process.job.xxljob.core.SopXxlJobUtil
;
import
cn.com.glsx.process.job.xxljob.param.SopInstNodeParam
;
import
cn.com.glsx.process.job.xxljob.param.SopInstNodeParam
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
cn.com.glsx.process.modules.model.SopStruct
;
import
cn.com.glsx.process.modules.model.SopStruct
;
import
cn.com.glsx.process.modules.service.SopService
;
import
cn.com.glsx.process.modules.service.SopService
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
...
@@ -18,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -18,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
@Component
@Component
public
class
SopInstNodeExecuteJobHandler
{
public
class
SopInstNodeExecuteJobHandler
{
@Resource
@Resource
private
SopService
sopService
;
private
SopService
sopService
;
...
@@ -30,8 +30,16 @@ public class SopInstNodeExecuteJobHandler {
...
@@ -30,8 +30,16 @@ public class SopInstNodeExecuteJobHandler {
SopXxlJobUtil
.
log
(
log
,
"【执行Sop节点】{}"
,
param
);
SopXxlJobUtil
.
log
(
log
,
"【执行Sop节点】{}"
,
param
);
SopStruct
sop
=
sopService
.
loadSopByInstNodeId
(
param
.
getInstNodeId
());
SopStruct
sop
=
sopService
.
loadSopByInstNodeId
(
param
.
getInstNodeId
());
// TODO 执行sop里面的instNodeId节点。
// TODO 执行sop里面的instNodeId节点。
SopInstNode
node
=
sop
.
getInstNodeMap
().
get
(
param
.
getInstNodeId
());
{
// 节点执行
}
// TODO 处理节点流程
// 创建所有节点任务
// 创建所有节点任务
// SopXxlJobUtil.initSopNodeJob(sop);
// SopXxlJobUtil.initSopNodeJob(sop);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment