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 7c5ad90b
authored
Sep 25, 2023
by
tiger
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
记录节点执行次数
1 parent
b40620a7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
522 additions
and
444 deletions
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopTplNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstNodeMapper.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstExecuteJobHandler.java
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstNodeExecuteJobHandler.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopService.java
platform-process/src/main/resources/mapper/SopInstNodeMapper.xml
platform-process/src/main/resources/mapper/SopTplNodeMapper.xml
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
View file @
7c5ad90
package
cn
.
com
.
glsx
.
process
.
modules
.
entity
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
java.util.List
;
@Table
(
name
=
"sop_inst_node"
)
public
class
SopInstNode
{
public
static
final
byte
NODE_SKIP_FALSE
=
0
;
public
static
final
byte
NODE_SKIP_TRUE
=
1
;
public
static
final
int
NODE_STATUS_DELETED
=
0
;
public
static
final
int
NODE_STATUS_NORMAL
=
1
;
/**
* 实例节点id
*/
@Id
@Column
(
name
=
"inst_node_id"
)
private
Integer
instNodeId
;
@Column
(
name
=
"inst_id"
)
private
String
instId
;
/**
* 节点id
*/
@Column
(
name
=
"node_id"
)
private
Integer
nodeId
;
/**
* 节点任务名
*/
@Column
(
name
=
"node_name"
)
private
String
nodeName
;
/**
* 节点类型:可扩展,包括:start,end,java,python,js,
*/
@Column
(
name
=
"node_type"
)
private
String
nodeType
;
/**
* 节点标签:Java、Js脚本、Sql查询等
*/
@Column
(
name
=
"node_label"
)
private
String
nodeLabel
;
/**
* 节点的访问key
*/
@Column
(
name
=
"node_key"
)
private
String
nodeKey
;
/**
* Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
@Column
(
name
=
"node_show"
)
private
String
nodeShow
;
/**
* 输入参数格式:Json,开始节点的输入参数全局共用
*/
@Column
(
name
=
"node_param"
)
private
String
nodeParam
;
/**
* 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
@Column
(
name
=
"node_content"
)
private
String
nodeContent
;
/**
* 节点可见状态
*/
@Column
(
name
=
"node_visible"
)
private
Byte
nodeVisible
;
/**
* 是否跳过节点
*/
@Column
(
name
=
"node_skip"
)
private
Byte
nodeSkip
;
public
static
final
byte
NODE_SKIP_FALSE
=
0
;
public
static
final
byte
NODE_SKIP_TRUE
=
1
;
public
static
final
int
NODE_STATUS_DELETED
=
0
;
public
static
final
int
NODE_STATUS_NORMAL
=
1
;
/**
* 实例节点id
*/
@Id
@Column
(
name
=
"inst_node_id"
)
private
Integer
instNodeId
;
@Column
(
name
=
"inst_id"
)
private
String
instId
;
/**
* 节点id
*/
@Column
(
name
=
"node_id"
)
private
Integer
nodeId
;
/**
* 节点任务名
*/
@Column
(
name
=
"node_name"
)
private
String
nodeName
;
/**
* 节点类型:可扩展,包括:start,end,java,python,js,
*/
@Column
(
name
=
"node_type"
)
private
String
nodeType
;
/**
* 节点标签:Java、Js脚本、Sql查询等
*/
@Column
(
name
=
"node_label"
)
private
String
nodeLabel
;
/**
* 节点的访问key
*/
@Column
(
name
=
"node_key"
)
private
String
nodeKey
;
/**
* Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
@Column
(
name
=
"node_show"
)
private
String
nodeShow
;
/**
* 输入参数格式:Json,开始节点的输入参数全局共用
*/
@Column
(
name
=
"node_param"
)
private
String
nodeParam
;
/**
* 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
@Column
(
name
=
"node_content"
)
private
String
nodeContent
;
/**
* 节点可见状态
*/
@Column
(
name
=
"node_visible"
)
private
Byte
nodeVisible
;
/**
* 是否跳过节点
*/
@Column
(
name
=
"node_skip"
)
private
Byte
nodeSkip
;
@Column
(
name
=
"node_async"
)
private
Byte
nodeAsync
;
/**
* 节点调度表达式
*/
@Column
(
name
=
"node_cron"
)
private
String
nodeCron
;
/**
* 节点终止调度
*/
@Column
(
name
=
"node_expire_cron"
)
private
String
nodeExpireCron
;
/**
* 节点状态:0,停用;1,启用;
*/
@Column
(
name
=
"node_status"
)
private
Integer
nodeStatus
;
@Transient
private
List
<
SopInstNode
>
sopInstNodeList
;
public
List
<
SopInstNode
>
getSopInstNodeList
()
{
return
sopInstNodeList
;
}
public
void
setSopInstNodeList
(
List
<
SopInstNode
>
sopInstNodeList
)
{
this
.
sopInstNodeList
=
sopInstNodeList
;
}
/**
* 获取实例节点id
*
* @return inst_node_id - 实例节点id
*/
public
Integer
getInstNodeId
()
{
return
instNodeId
;
}
/**
* 设置实例节点id
*
* @param instNodeId 实例节点id
*/
public
void
setInstNodeId
(
Integer
instNodeId
)
{
this
.
instNodeId
=
instNodeId
;
}
/**
* @return inst_id
*/
public
String
getInstId
()
{
return
instId
;
}
/**
* @param instId
*/
public
void
setInstId
(
String
instId
)
{
this
.
instId
=
instId
==
null
?
null
:
instId
.
trim
();
}
/**
* 获取节点id
*
* @return node_id - 节点id
*/
public
Integer
getNodeId
()
{
return
nodeId
;
}
/**
* 设置节点id
*
* @param nodeId 节点id
*/
public
void
setNodeId
(
Integer
nodeId
)
{
this
.
nodeId
=
nodeId
;
}
/**
* 获取节点任务名
*
* @return node_name - 节点任务名
*/
public
String
getNodeName
()
{
return
nodeName
;
}
/**
* 设置节点任务名
*
* @param nodeName 节点任务名
*/
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
==
null
?
null
:
nodeName
.
trim
();
}
/**
* 获取节点类型:可扩展,包括:start,end,java,python,js,
*
* @return node_type - 节点类型:可扩展,包括:start,end,java,python,js,
*/
public
String
getNodeType
()
{
return
nodeType
;
}
/**
* 设置节点类型:可扩展,包括:start,end,java,python,js,
*
* @param nodeType 节点类型:可扩展,包括:start,end,java,python,js,
*/
public
void
setNodeType
(
String
nodeType
)
{
this
.
nodeType
=
nodeType
==
null
?
null
:
nodeType
.
trim
();
}
/**
* 获取节点标签:Java、Js脚本、Sql查询等
*
* @return node_label - 节点标签:Java、Js脚本、Sql查询等
*/
public
String
getNodeLabel
()
{
return
nodeLabel
;
}
/**
* 设置节点标签:Java、Js脚本、Sql查询等
*
* @param nodeLabel 节点标签:Java、Js脚本、Sql查询等
*/
public
void
setNodeLabel
(
String
nodeLabel
)
{
this
.
nodeLabel
=
nodeLabel
==
null
?
null
:
nodeLabel
.
trim
();
}
/**
* 获取节点的访问key
*
* @return node_key - 节点的访问key
*/
public
String
getNodeKey
()
{
return
nodeKey
;
}
/**
* 设置节点的访问key
*
* @param nodeKey 节点的访问key
*/
public
void
setNodeKey
(
String
nodeKey
)
{
this
.
nodeKey
=
nodeKey
==
null
?
null
:
nodeKey
.
trim
();
}
/**
* 获取Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*
* @return node_show - Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
public
String
getNodeShow
()
{
return
nodeShow
;
}
/**
* 设置Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*
* @param nodeShow Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
public
void
setNodeShow
(
String
nodeShow
)
{
this
.
nodeShow
=
nodeShow
==
null
?
null
:
nodeShow
.
trim
();
}
/**
* 获取输入参数格式:Json,开始节点的输入参数全局共用
*
* @return node_param - 输入参数格式:Json,开始节点的输入参数全局共用
*/
public
String
getNodeParam
()
{
return
nodeParam
;
}
/**
* 设置输入参数格式:Json,开始节点的输入参数全局共用
*
* @param nodeParam 输入参数格式:Json,开始节点的输入参数全局共用
*/
public
void
setNodeParam
(
String
nodeParam
)
{
this
.
nodeParam
=
nodeParam
==
null
?
null
:
nodeParam
.
trim
();
}
/**
* 获取节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*
* @return node_content - 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
public
String
getNodeContent
()
{
return
nodeContent
;
}
/**
* 设置节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*
* @param nodeContent 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
public
void
setNodeContent
(
String
nodeContent
)
{
this
.
nodeContent
=
nodeContent
==
null
?
null
:
nodeContent
.
trim
();
}
/**
* 获取节点可见状态
*
* @return node_visible - 节点可见状态
*/
public
Byte
getNodeVisible
()
{
return
nodeVisible
;
}
/**
* 设置节点可见状态
*
* @param nodeVisible 节点可见状态
*/
public
void
setNodeVisible
(
Byte
nodeVisible
)
{
this
.
nodeVisible
=
nodeVisible
;
}
/**
* 获取是否跳过节点
*
* @return node_skip - 是否跳过节点
*/
public
Byte
getNodeSkip
()
{
return
nodeSkip
;
}
/**
* 设置是否跳过节点
*
* @param nodeSkip 是否跳过节点
*/
public
void
setNodeSkip
(
Byte
nodeSkip
)
{
this
.
nodeSkip
=
nodeSkip
;
}
/**
* 获取节点调度表达式
*
* @return node_cron - 节点调度表达式
*/
public
String
getNodeCron
()
{
return
nodeCron
;
}
/**
* 设置节点调度表达式
*
* @param nodeCron 节点调度表达式
*/
public
void
setNodeCron
(
String
nodeCron
)
{
this
.
nodeCron
=
nodeCron
==
null
?
null
:
nodeCron
.
trim
();
}
/**
* 获取节点终止调度
*
* @return node_expire_cron - 节点终止调度
*/
public
String
getNodeExpireCron
()
{
return
nodeExpireCron
;
}
/**
* 设置节点终止调度
*
* @param nodeExpireCron 节点终止调度
*/
public
void
setNodeExpireCron
(
String
nodeExpireCron
)
{
this
.
nodeExpireCron
=
nodeExpireCron
==
null
?
null
:
nodeExpireCron
.
trim
();
}
/**
* 获取节点状态:0,停用;1,启用;
*
* @return node_status - 节点状态:0,停用;1,启用;
*/
public
Integer
getNodeStatus
()
{
return
nodeStatus
;
}
/**
* 设置节点状态:0,停用;1,启用;
*
* @param nodeStatus 节点状态:0,停用;1,启用;
*/
public
void
setNodeStatus
(
Integer
nodeStatus
)
{
this
.
nodeStatus
=
nodeStatus
;
}
/**
* 节点调度表达式
*/
@Column
(
name
=
"node_cron"
)
private
String
nodeCron
;
/**
* 节点终止调度
*/
@Column
(
name
=
"node_expire_cron"
)
private
String
nodeExpireCron
;
/**
* 节点状态:0,停用;1,启用;
*/
@Column
(
name
=
"node_status"
)
private
Integer
nodeStatus
;
/**
* 每日执行次数限制,0表示不限制。
*/
@Column
(
name
=
"daily_limit"
)
private
Integer
dailyLimit
;
/**
* 每日执行次数限制,0表示不限制。
*/
@Column
(
name
=
"daily_count"
)
private
Integer
dailyCount
;
@Transient
private
List
<
SopInstNode
>
sopInstNodeList
;
public
List
<
SopInstNode
>
getSopInstNodeList
()
{
return
sopInstNodeList
;
}
public
void
setSopInstNodeList
(
List
<
SopInstNode
>
sopInstNodeList
)
{
this
.
sopInstNodeList
=
sopInstNodeList
;
}
/**
* 获取实例节点id
*
* @return inst_node_id - 实例节点id
*/
public
Integer
getInstNodeId
()
{
return
instNodeId
;
}
/**
* 设置实例节点id
*
* @param instNodeId 实例节点id
*/
public
void
setInstNodeId
(
Integer
instNodeId
)
{
this
.
instNodeId
=
instNodeId
;
}
/**
* @return inst_id
*/
public
String
getInstId
()
{
return
instId
;
}
/**
* @param instId
*/
public
void
setInstId
(
String
instId
)
{
this
.
instId
=
instId
==
null
?
null
:
instId
.
trim
();
}
/**
* 获取节点id
*
* @return node_id - 节点id
*/
public
Integer
getNodeId
()
{
return
nodeId
;
}
/**
* 设置节点id
*
* @param nodeId 节点id
*/
public
void
setNodeId
(
Integer
nodeId
)
{
this
.
nodeId
=
nodeId
;
}
/**
* 获取节点任务名
*
* @return node_name - 节点任务名
*/
public
String
getNodeName
()
{
return
nodeName
;
}
/**
* 设置节点任务名
*
* @param nodeName 节点任务名
*/
public
void
setNodeName
(
String
nodeName
)
{
this
.
nodeName
=
nodeName
==
null
?
null
:
nodeName
.
trim
();
}
/**
* 获取节点类型:可扩展,包括:start,end,java,python,js,
*
* @return node_type - 节点类型:可扩展,包括:start,end,java,python,js,
*/
public
String
getNodeType
()
{
return
nodeType
;
}
/**
* 设置节点类型:可扩展,包括:start,end,java,python,js,
*
* @param nodeType 节点类型:可扩展,包括:start,end,java,python,js,
*/
public
void
setNodeType
(
String
nodeType
)
{
this
.
nodeType
=
nodeType
==
null
?
null
:
nodeType
.
trim
();
}
/**
* 获取节点标签:Java、Js脚本、Sql查询等
*
* @return node_label - 节点标签:Java、Js脚本、Sql查询等
*/
public
String
getNodeLabel
()
{
return
nodeLabel
;
}
/**
* 设置节点标签:Java、Js脚本、Sql查询等
*
* @param nodeLabel 节点标签:Java、Js脚本、Sql查询等
*/
public
void
setNodeLabel
(
String
nodeLabel
)
{
this
.
nodeLabel
=
nodeLabel
==
null
?
null
:
nodeLabel
.
trim
();
}
/**
* 获取节点的访问key
*
* @return node_key - 节点的访问key
*/
public
String
getNodeKey
()
{
return
nodeKey
;
}
/**
* 设置节点的访问key
*
* @param nodeKey 节点的访问key
*/
public
void
setNodeKey
(
String
nodeKey
)
{
this
.
nodeKey
=
nodeKey
==
null
?
null
:
nodeKey
.
trim
();
}
/**
* 获取Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*
* @return node_show - Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
public
String
getNodeShow
()
{
return
nodeShow
;
}
/**
* 设置Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*
* @param nodeShow Json结构,记录节点位置和展示样式,提供给前端使用。包括top,left,class
*/
public
void
setNodeShow
(
String
nodeShow
)
{
this
.
nodeShow
=
nodeShow
==
null
?
null
:
nodeShow
.
trim
();
}
/**
* 获取输入参数格式:Json,开始节点的输入参数全局共用
*
* @return node_param - 输入参数格式:Json,开始节点的输入参数全局共用
*/
public
String
getNodeParam
()
{
return
nodeParam
;
}
/**
* 设置输入参数格式:Json,开始节点的输入参数全局共用
*
* @param nodeParam 输入参数格式:Json,开始节点的输入参数全局共用
*/
public
void
setNodeParam
(
String
nodeParam
)
{
this
.
nodeParam
=
nodeParam
==
null
?
null
:
nodeParam
.
trim
();
}
/**
* 获取节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*
* @return node_content - 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
public
String
getNodeContent
()
{
return
nodeContent
;
}
/**
* 设置节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*
* @param nodeContent 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
public
void
setNodeContent
(
String
nodeContent
)
{
this
.
nodeContent
=
nodeContent
==
null
?
null
:
nodeContent
.
trim
();
}
/**
* 获取节点可见状态
*
* @return node_visible - 节点可见状态
*/
public
Byte
getNodeVisible
()
{
return
nodeVisible
;
}
/**
* 设置节点可见状态
*
* @param nodeVisible 节点可见状态
*/
public
void
setNodeVisible
(
Byte
nodeVisible
)
{
this
.
nodeVisible
=
nodeVisible
;
}
/**
* 获取是否跳过节点
*
* @return node_skip - 是否跳过节点
*/
public
Byte
getNodeSkip
()
{
return
nodeSkip
;
}
/**
* 设置是否跳过节点
*
* @param nodeSkip 是否跳过节点
*/
public
void
setNodeSkip
(
Byte
nodeSkip
)
{
this
.
nodeSkip
=
nodeSkip
;
}
/**
* 获取节点调度表达式
*
* @return node_cron - 节点调度表达式
*/
public
String
getNodeCron
()
{
return
nodeCron
;
}
/**
* 设置节点调度表达式
*
* @param nodeCron 节点调度表达式
*/
public
void
setNodeCron
(
String
nodeCron
)
{
this
.
nodeCron
=
nodeCron
==
null
?
null
:
nodeCron
.
trim
();
}
/**
* 获取节点终止调度
*
* @return node_expire_cron - 节点终止调度
*/
public
String
getNodeExpireCron
()
{
return
nodeExpireCron
;
}
/**
* 设置节点终止调度
*
* @param nodeExpireCron 节点终止调度
*/
public
void
setNodeExpireCron
(
String
nodeExpireCron
)
{
this
.
nodeExpireCron
=
nodeExpireCron
==
null
?
null
:
nodeExpireCron
.
trim
();
}
/**
* 获取节点状态:0,停用;1,启用;
*
* @return node_status - 节点状态:0,停用;1,启用;
*/
public
Integer
getNodeStatus
()
{
return
nodeStatus
;
}
/**
* 设置节点状态:0,停用;1,启用;
*
* @param nodeStatus 节点状态:0,停用;1,启用;
*/
public
void
setNodeStatus
(
Integer
nodeStatus
)
{
this
.
nodeStatus
=
nodeStatus
;
}
public
Byte
getNodeAsync
()
{
return
nodeAsync
;
...
...
@@ -391,4 +404,20 @@ public class SopInstNode {
this
.
nodeAsync
=
nodeAsync
;
}
public
Integer
getDailyLimit
()
{
return
dailyLimit
;
}
public
void
setDailyLimit
(
Integer
dailyLimit
)
{
this
.
dailyLimit
=
dailyLimit
;
}
public
Integer
getDailyCount
()
{
return
dailyCount
;
}
public
void
setDailyCount
(
Integer
dailyCount
)
{
this
.
dailyCount
=
dailyCount
;
}
}
\ No newline at end of file
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopTplNode.java
View file @
7c5ad90
package
cn
.
com
.
glsx
.
process
.
modules
.
entity
;
import
javax.persistence.*
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
@Table
(
name
=
"sop_tpl_node"
)
public
class
SopTplNode
{
...
...
@@ -95,6 +97,18 @@ public class SopTplNode {
@Column
(
name
=
"node_async"
)
private
Byte
nodeAsync
;
/**
* 节点状态:0,停用;1,启用;
*/
@Column
(
name
=
"node_status"
)
private
Integer
nodeStatus
;
/**
* 每日执行次数限制,0表示不限制。
*/
@Column
(
name
=
"daily_limit"
)
private
Integer
dailyLimit
;
/**
* 获取节点id
*
...
...
@@ -354,4 +368,21 @@ public class SopTplNode {
public
void
setNodeAsync
(
Byte
nodeAsync
)
{
this
.
nodeAsync
=
nodeAsync
;
}
public
Integer
getNodeStatus
()
{
return
nodeStatus
;
}
public
void
setNodeStatus
(
Integer
nodeStatus
)
{
this
.
nodeStatus
=
nodeStatus
;
}
public
Integer
getDailyLimit
()
{
return
dailyLimit
;
}
public
void
setDailyLimit
(
Integer
dailyLimit
)
{
this
.
dailyLimit
=
dailyLimit
;
}
}
\ No newline at end of file
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstNodeMapper.java
View file @
7c5ad90
package
cn
.
com
.
glsx
.
process
.
modules
.
mapper
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
@Mapper
public
interface
SopInstNodeMapper
extends
CommonBaseMapper
<
SopInstNode
>
{
List
<
SopInstNode
>
findByInstId
(
@Param
(
"instId"
)
String
instId
);
int
resetInstNodeDailyCount
(
@Param
(
"instId"
)
String
instId
);
}
\ No newline at end of file
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstExecuteJobHandler.java
View file @
7c5ad90
...
...
@@ -34,6 +34,9 @@ public class SopInstExecuteJobHandler {
SopInstBatch
batch
=
sopService
.
createBatch
(
sop
.
getInst
());
sop
.
setBatch
(
batch
);
// 重置节点执行次数
sopService
.
resetNodeDailyCount
(
sop
);
// 创建所有节点任务
SopXxlJobUtil
.
initSopNodesJob
(
sop
);
}
...
...
platform-process/src/main/java/cn/com/glsx/process/job/xxljob/impl/SopInstNodeExecuteJobHandler.java
View file @
7c5ad90
...
...
@@ -25,6 +25,7 @@ import cn.com.glsx.process.modules.sop.execute.SopNodeExecutorFactory;
import
cn.com.glsx.process.modules.sop.execute.SopNodeType
;
import
cn.com.glsx.process.util.JacksonUtils
;
import
cn.hutool.core.lang.Pair
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -111,18 +112,22 @@ public class SopInstNodeExecuteJobHandler {
if
(
node
.
getNodeSkip
()
!=
1
)
{
// 重新加载sop
sop
=
reloadAndCreateNodeBatch
(
sop
,
node
);
node
=
sop
.
getInstNodeMap
().
get
(
node
.
getNodeId
());
// 预备执行参数
SnapshotStruct
snapshotStruct
=
instance
.
prepare
(
sop
,
node
);
// 没超执行次数限制
if
(
node
.
getDailyLimit
()
==
0
||
node
.
getDailyCount
()
<
node
.
getDailyLimit
())
{
// 预备执行参数
SnapshotStruct
snapshotStruct
=
instance
.
prepare
(
sop
,
node
);
// 执行sop节点
Object
result
=
instance
.
execute
(
sop
,
node
,
snapshotStruct
);
// 执行sop节点
Object
result
=
instance
.
execute
(
sop
,
node
,
snapshotStruct
);
// 处理执行结果
snapshotStruct
=
instance
.
handleResult
(
sop
,
node
,
snapshotStruct
,
result
);
// 处理执行结果
snapshotStruct
=
instance
.
handleResult
(
sop
,
node
,
snapshotStruct
,
result
);
// 保存快照
updateBatch
(
sop
,
node
,
snapshotStruct
);
// 保存快照
updateBatch
(
sop
,
node
,
snapshotStruct
);
}
}
// 更新后续节点状态
...
...
@@ -149,6 +154,7 @@ public class SopInstNodeExecuteJobHandler {
// 刷新实例快照
SopInst
inst
=
sop
.
getInst
();
inst
.
setInstSnapshot
(
snapshot
);
node
.
setDailyCount
(
ObjectUtil
.
defaultIfNull
(
node
.
getDailyCount
(),
0
)
+
1
);
// 刷新实例批次快照
SopInstBatch
batch
=
sop
.
getBatch
();
...
...
@@ -163,7 +169,7 @@ public class SopInstNodeExecuteJobHandler {
nodeBatch
.
setSnapshot
(
snapshot
);
nodeBatch
.
setUpdateTime
(
new
Date
());
}
sopService
.
updateNodeBatch
(
inst
,
batch
,
nodeBatch
);
sopService
.
updateNodeBatch
(
inst
,
node
,
batch
,
nodeBatch
);
}
private
SopStruct
reloadAndCreateNodeBatch
(
SopStruct
sop
,
SopInstNode
node
)
{
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopService.java
View file @
7c5ad90
...
...
@@ -182,7 +182,7 @@ public class SopService {
return
curBatch
;
}
public
void
updateNodeBatch
(
SopInst
sopInst
,
SopInstBatch
batch
,
SopInstNodeBatch
nodeBatch
)
{
public
void
updateNodeBatch
(
SopInst
sopInst
,
SopInst
Node
node
,
SopInst
Batch
batch
,
SopInstNodeBatch
nodeBatch
)
{
if
(
nodeBatch
!=
null
)
{
instNodeBatchMapper
.
updateByPrimaryKey
(
nodeBatch
);
}
...
...
@@ -191,7 +191,12 @@ public class SopService {
instBatchMapper
.
updateByPrimaryKey
(
batch
);
}
instMapper
.
updateByPrimaryKey
(
sopInst
);
instMapper
.
updateByPrimaryKey
(
sopInst
);
// 更新快照
instNodeMapper
.
updateByPrimaryKey
(
node
);
// 更新执行次数
}
public
void
resetNodeDailyCount
(
SopStruct
sop
)
{
instNodeMapper
.
resetInstNodeDailyCount
(
sop
.
getInst
().
getInstId
());
}
}
platform-process/src/main/resources/mapper/SopInstNodeMapper.xml
View file @
7c5ad90
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.com.glsx.process.modules.mapper.SopInstNodeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.process.modules.entity.SopInstNode"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"inst_node_id"
jdbcType=
"INTEGER"
property=
"instNodeId"
/>
<result
column=
"inst_id"
jdbcType=
"VARCHAR"
property=
"instId"
/>
<result
column=
"node_id"
jdbcType=
"INTEGER"
property=
"nodeId"
/>
<result
column=
"node_name"
jdbcType=
"VARCHAR"
property=
"nodeName"
/>
<result
column=
"node_type"
jdbcType=
"VARCHAR"
property=
"nodeType"
/>
<result
column=
"node_label"
jdbcType=
"VARCHAR"
property=
"nodeLabel"
/>
<result
column=
"node_key"
jdbcType=
"VARCHAR"
property=
"nodeKey"
/>
<result
column=
"node_show"
jdbcType=
"VARCHAR"
property=
"nodeShow"
/>
<result
column=
"node_param"
jdbcType=
"VARCHAR"
property=
"nodeParam"
/>
<result
column=
"node_content"
jdbcType=
"VARCHAR"
property=
"nodeContent"
/>
<result
column=
"node_visible"
jdbcType=
"TINYINT"
property=
"nodeVisible"
/>
<result
column=
"node_skip"
jdbcType=
"TINYINT"
property=
"nodeSkip"
/>
<result
column=
"node_cron"
jdbcType=
"VARCHAR"
property=
"nodeCron"
/>
<result
column=
"node_expire_cron"
jdbcType=
"VARCHAR"
property=
"nodeExpireCron"
/>
<result
column=
"node_status"
jdbcType=
"INTEGER"
property=
"nodeStatus"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
-->
inst_node_id, inst_id, node_id, node_name, node_type, node_label, node_key, node_show,
node_param, node_content, node_visible, node_skip, node_cron, node_expire_cron, node_status
</sql>
<select
id=
"findByInstId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.process.modules.entity.SopInstNode"
>
<!-- WARNING - @mbg.generated -->
<id
column=
"inst_node_id"
jdbcType=
"INTEGER"
property=
"instNodeId"
/>
<result
column=
"inst_id"
jdbcType=
"VARCHAR"
property=
"instId"
/>
<result
column=
"node_id"
jdbcType=
"INTEGER"
property=
"nodeId"
/>
<result
column=
"node_name"
jdbcType=
"VARCHAR"
property=
"nodeName"
/>
<result
column=
"node_type"
jdbcType=
"VARCHAR"
property=
"nodeType"
/>
<result
column=
"node_label"
jdbcType=
"VARCHAR"
property=
"nodeLabel"
/>
<result
column=
"node_key"
jdbcType=
"VARCHAR"
property=
"nodeKey"
/>
<result
column=
"node_show"
jdbcType=
"VARCHAR"
property=
"nodeShow"
/>
<result
column=
"node_param"
jdbcType=
"VARCHAR"
property=
"nodeParam"
/>
<result
column=
"node_content"
jdbcType=
"VARCHAR"
property=
"nodeContent"
/>
<result
column=
"node_visible"
jdbcType=
"TINYINT"
property=
"nodeVisible"
/>
<result
column=
"node_skip"
jdbcType=
"TINYINT"
property=
"nodeSkip"
/>
<result
column=
"node_cron"
jdbcType=
"VARCHAR"
property=
"nodeCron"
/>
<result
column=
"node_expire_cron"
jdbcType=
"VARCHAR"
property=
"nodeExpireCron"
/>
<result
column=
"node_status"
jdbcType=
"INTEGER"
property=
"nodeStatus"
/>
<result
column=
"daily_limit"
jdbcType=
"INTEGER"
property=
"dailyLimit"
/>
<result
column=
"daily_count"
jdbcType=
"INTEGER"
property=
"dailyCount"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!-- WARNING - @mbg.generated -->
inst_node_id, inst_id, node_id, node_name, node_type, node_label, node_key, node_show,
node_param, node_content, node_visible, node_skip, node_cron, node_expire_cron, node_status, daily_limit, daily_count
</sql>
<select
id=
"findByInstId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
SELECT
node_id, node_name,node_type
FROM sop_inst_node WHERE inst_id=#{instId}
</select>
<update
id=
"resetInstNodeDailyCount"
>
update sop_inst_node set daily_count=0 where inst_id=#{instId}
</update>
SELECT
node_id, node_name,node_type
FROM sop_inst_node WHERE inst_id=#{instId}
</select>
</mapper>
\ No newline at end of file
platform-process/src/main/resources/mapper/SopTplNodeMapper.xml
View file @
7c5ad90
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.com.glsx.process.modules.mapper.SopTplNodeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.process.modules.entity.SopTplNode"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"node_id"
jdbcType=
"INTEGER"
property=
"nodeId"
/>
<result
column=
"tpl_id"
jdbcType=
"VARCHAR"
property=
"tplId"
/>
<result
column=
"node_name"
jdbcType=
"VARCHAR"
property=
"nodeName"
/>
<result
column=
"node_type"
jdbcType=
"VARCHAR"
property=
"nodeType"
/>
<result
column=
"node_label"
jdbcType=
"VARCHAR"
property=
"nodeLabel"
/>
<result
column=
"node_show"
jdbcType=
"VARCHAR"
property=
"nodeShow"
/>
<result
column=
"node_param_def"
jdbcType=
"VARCHAR"
property=
"nodeParamDef"
/>
<result
column=
"node_content_def"
jdbcType=
"VARCHAR"
property=
"nodeContentDef"
/>
<result
column=
"node_key"
jdbcType=
"VARCHAR"
property=
"nodeKey"
/>
<result
column=
"node_result_def"
jdbcType=
"VARCHAR"
property=
"nodeResultDef"
/>
<result
column=
"node_visible"
jdbcType=
"TINYINT"
property=
"nodeVisible"
/>
<result
column=
"node_cron"
jdbcType=
"VARCHAR"
property=
"nodeCron"
/>
<result
column=
"node_expire_cron"
jdbcType=
"VARCHAR"
property=
"nodeExpireCron"
/>
<result
column=
"node_skipable"
jdbcType=
"TINYINT"
property=
"nodeSkipable"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--
WARNING - @mbg.generated
-->
node_id, tpl_id, node_name, node_type, node_label, node_show, node_param_def, node_content_def,
node_key, node_result_def, node_visible, node_cron, node_expire_cron, node_skipable
</sql>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.process.modules.entity.SopTplNode"
>
<!-- WARNING - @mbg.generated -->
<id
column=
"node_id"
jdbcType=
"INTEGER"
property=
"nodeId"
/>
<result
column=
"tpl_id"
jdbcType=
"VARCHAR"
property=
"tplId"
/>
<result
column=
"node_name"
jdbcType=
"VARCHAR"
property=
"nodeName"
/>
<result
column=
"node_type"
jdbcType=
"VARCHAR"
property=
"nodeType"
/>
<result
column=
"node_label"
jdbcType=
"VARCHAR"
property=
"nodeLabel"
/>
<result
column=
"node_show"
jdbcType=
"VARCHAR"
property=
"nodeShow"
/>
<result
column=
"node_param_def"
jdbcType=
"VARCHAR"
property=
"nodeParamDef"
/>
<result
column=
"node_content_def"
jdbcType=
"VARCHAR"
property=
"nodeContentDef"
/>
<result
column=
"node_key"
jdbcType=
"VARCHAR"
property=
"nodeKey"
/>
<result
column=
"node_result_def"
jdbcType=
"VARCHAR"
property=
"nodeResultDef"
/>
<result
column=
"node_visible"
jdbcType=
"TINYINT"
property=
"nodeVisible"
/>
<result
column=
"node_cron"
jdbcType=
"VARCHAR"
property=
"nodeCron"
/>
<result
column=
"node_expire_cron"
jdbcType=
"VARCHAR"
property=
"nodeExpireCron"
/>
<result
column=
"node_skipable"
jdbcType=
"TINYINT"
property=
"nodeSkipable"
/>
<result
column=
"daily_limit"
jdbcType=
"INTEGER"
property=
"dailyLimit"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!-- WARNING - @mbg.generated -->
node_id, tpl_id, node_name, node_type, node_label, node_show, node_param_def, node_content_def,
node_key, node_result_def, node_visible, node_cron, node_expire_cron, node_skipable, daily_limit
</sql>
</mapper>
\ No newline at end of file
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