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
9f31706a
Commit
9f31706a
authored
Mar 12, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
be7f205a
65b5ae9a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
2 deletions
+48
-2
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+7
-0
RunRecordingService.java
...e/src/main/java/com/byit/service/RunRecordingService.java
+7
-0
RunRecordingServiceImpl.java
...n/java/com/byit/service/impl/RunRecordingServiceImpl.java
+17
-0
FlowThreadRunHelper.java
...main/java/com/byit/thread/helper/FlowThreadRunHelper.java
+11
-2
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+6
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
9f31706a
...
@@ -22,6 +22,13 @@ public interface RunRecordingMapper {
...
@@ -22,6 +22,13 @@ public interface RunRecordingMapper {
* @return
* @return
*/
*/
List
<
RunRecording
>
findRunningRunRecording
();
List
<
RunRecording
>
findRunningRunRecording
();
/**
* 根据工作流查询对应的实例
* @param flowId
* @return
*/
List
<
RunRecording
>
findRunRecordingByFlowId
(
Integer
flowId
);
/**
/**
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* @param flowId
* @param flowId
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/RunRecordingService.java
View file @
9f31706a
...
@@ -22,6 +22,13 @@ public interface RunRecordingService {
...
@@ -22,6 +22,13 @@ public interface RunRecordingService {
List
<
RunRecording
>
findRunningRunRecording
();
List
<
RunRecording
>
findRunningRunRecording
();
/**
/**
* 根据工作流ID查询 是否有正在运行中的实例
* @param flowId
* @return
*/
boolean
findRunRecordingIsRunning
(
Integer
flowId
);
/**
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* @param flowId
* @param flowId
* @param runId
* @param runId
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/RunRecordingServiceImpl.java
View file @
9f31706a
package
com
.
byit
.
service
.
impl
;
package
com
.
byit
.
service
.
impl
;
import
com.byit.enums.RunRecordingEnum
;
import
com.byit.mapper.RunRecordingMapper
;
import
com.byit.mapper.RunRecordingMapper
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.service.RunRecordingService
;
import
com.byit.service.RunRecordingService
;
...
@@ -33,6 +34,22 @@ public class RunRecordingServiceImpl implements RunRecordingService {
...
@@ -33,6 +34,22 @@ public class RunRecordingServiceImpl implements RunRecordingService {
return
runRecordingMapper
.
findRunningRunRecording
();
return
runRecordingMapper
.
findRunningRunRecording
();
}
}
/**
* 是否存在运行的工作流实例
* @param flowId 工作流ID
* @return 是否在正在运行中
*/
@Override
public
boolean
findRunRecordingIsRunning
(
Integer
flowId
)
{
List
<
RunRecording
>
runRecordings
=
runRecordingMapper
.
findRunRecordingByFlowId
(
flowId
);
for
(
RunRecording
runRecording
:
runRecordings
)
{
if
(!
RunRecordingEnum
.
FLOW_STATUS_IS_END
.
getCode
().
equals
(
runRecording
.
getFlowStatus
()))
{
return
true
;
}
}
return
false
;
}
@Override
@Override
public
RunRecording
findRunRecordingByFlowIdAndRunId
(
Integer
flowId
,
String
runId
)
{
public
RunRecording
findRunRecordingByFlowIdAndRunId
(
Integer
flowId
,
String
runId
)
{
return
runRecordingMapper
.
findRunRecordingByFlowIdAndRunId
(
flowId
,
runId
);
return
runRecordingMapper
.
findRunRecordingByFlowIdAndRunId
(
flowId
,
runId
);
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/FlowThreadRunHelper.java
View file @
9f31706a
...
@@ -7,6 +7,7 @@ import com.byit.model.Node;
...
@@ -7,6 +7,7 @@ import com.byit.model.Node;
import
com.byit.service.FlowService
;
import
com.byit.service.FlowService
;
import
com.byit.service.NodeService
;
import
com.byit.service.NodeService
;
import
com.byit.service.RunNodeServer
;
import
com.byit.service.RunNodeServer
;
import
com.byit.service.RunRecordingService
;
import
com.byit.thread.BaseThreadRunHelper
;
import
com.byit.thread.BaseThreadRunHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -30,12 +31,15 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper {
...
@@ -30,12 +31,15 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper {
private
final
FlowService
flowService
;
private
final
FlowService
flowService
;
private
final
NodeService
nodeService
;
private
final
NodeService
nodeService
;
private
final
RunNodeServer
runNodeServer
;
private
final
RunNodeServer
runNodeServer
;
private
final
RunRecordingService
runRecordingService
;
public
FlowThreadRunHelper
(
DataSource
dataSource
,
FlowService
flowService
,
NodeService
nodeService
,
RunNodeServer
runNodeServer
)
{
public
FlowThreadRunHelper
(
DataSource
dataSource
,
FlowService
flowService
,
NodeService
nodeService
,
RunNodeServer
runNodeServer
,
RunRecordingService
runRecordingService
)
{
this
.
dataSource
=
dataSource
;
this
.
dataSource
=
dataSource
;
this
.
flowService
=
flowService
;
this
.
flowService
=
flowService
;
this
.
nodeService
=
nodeService
;
this
.
nodeService
=
nodeService
;
this
.
runNodeServer
=
runNodeServer
;
this
.
runNodeServer
=
runNodeServer
;
this
.
runRecordingService
=
runRecordingService
;
}
}
@Override
@Override
...
@@ -45,7 +49,12 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper {
...
@@ -45,7 +49,12 @@ public class FlowThreadRunHelper extends BaseThreadRunHelper {
List
<
Flow
>
halfAnHourFlow
=
flowService
.
findHalfAnHourFlow
(
preTestTime
);
List
<
Flow
>
halfAnHourFlow
=
flowService
.
findHalfAnHourFlow
(
preTestTime
);
if
(
CollectionUtil
.
isNotEmpty
(
halfAnHourFlow
))
{
if
(
CollectionUtil
.
isNotEmpty
(
halfAnHourFlow
))
{
for
(
Flow
flow
:
halfAnHourFlow
){
for
(
Flow
flow
:
halfAnHourFlow
){
log
.
debug
(
"-----------------【工作流{}的执行次数大于0,放行】-------------------------"
,
flow
.
getFlowName
());
log
.
debug
(
"-----------------【工作流{}的执行次数不等于0,放行】-------------------------"
,
flow
.
getFlowName
());
if
(
runRecordingService
.
findRunRecordingIsRunning
(
flow
.
getFlowId
()))
{
//TODO 是否可以使用事件通知机制,由完结的工作流实例通知通过流可以运行了
log
.
info
(
"-----工作流{},有正在运行中的实例,跳过等待------"
,
flow
);
continue
;
}
//String versionName = flow.getVersionName()
//String versionName = flow.getVersionName()
Integer
flowId
=
flow
.
getFlowId
();
Integer
flowId
=
flow
.
getFlowId
();
//根据工作流查询工作流下所有的节点
//根据工作流查询工作流下所有的节点
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
9f31706a
...
@@ -46,6 +46,12 @@
...
@@ -46,6 +46,12 @@
where flow_status = '2'
where flow_status = '2'
</select>
</select>
<select
id=
"findRunRecordingByFlowId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from run_recording where flow_id = #{flowId,jdbcType=INTEGER}
</select>
<select
id=
"findRunRecordingByFlowIdAndRunId"
resultMap=
"BaseResultMap"
>
<select
id=
"findRunRecordingByFlowIdAndRunId"
resultMap=
"BaseResultMap"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
...
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