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
fc2bff87
Commit
fc2bff87
authored
Mar 14, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发等待工作流扫描任务
parent
f8911063
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
MakeUpFlowThreadRunHelper.java
...ava/com/byit/thread/helper/MakeUpFlowThreadRunHelper.java
+34
-2
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/MakeUpFlowThreadRunHelper.java
View file @
fc2bff87
package
com
.
byit
.
thread
.
helper
;
package
com
.
byit
.
thread
.
helper
;
import
com.byit.model.WaitingRecord
;
import
com.byit.service.WaitingRecordService
;
import
com.byit.service.mapservice.RunRecordingAndJobTaskService
;
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
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.BinaryOperator
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
* 补批工作流扫描
* 补批工作流扫描
* 作用:补批 重跑之类的工作流等待进程
* @author huangfu
* @author huangfu
*/
*/
@Component
@Component
@Slf4j
@Slf4j
public
class
MakeUpFlowThreadRunHelper
extends
BaseThreadRunHelper
{
public
class
MakeUpFlowThreadRunHelper
extends
BaseThreadRunHelper
{
private
final
int
PRE_TIME
=
30
;
private
static
final
String
LOCK_NAME
=
"make_up_lock"
;
private
static
final
String
LOCK_NAME
=
"make_up_lock"
;
private
final
DataSource
dataSource
;
private
final
DataSource
dataSource
;
private
final
WaitingRecordService
waitingRecordService
;
private
final
RunRecordingAndJobTaskService
runRecordingAndJobTaskService
;
public
MakeUpFlowThreadRunHelper
(
DataSource
dataSource
)
{
public
MakeUpFlowThreadRunHelper
(
DataSource
dataSource
,
WaitingRecordService
waitingRecordService
,
RunRecordingAndJobTaskService
runRecordingAndJobTaskService
)
{
this
.
dataSource
=
dataSource
;
this
.
dataSource
=
dataSource
;
this
.
waitingRecordService
=
waitingRecordService
;
this
.
runRecordingAndJobTaskService
=
runRecordingAndJobTaskService
;
}
}
@Override
@Override
public
Long
start
()
{
public
Long
start
()
{
return
null
;
/**
* 30分钟的预读时间
*/
long
preTestTime
=
System
.
currentTimeMillis
()+
TimeUnit
.
HOURS
.
toMillis
(
PRE_TIME
);
List
<
WaitingRecord
>
allByTriggerTime
=
waitingRecordService
.
findAllByTriggerTime
(
preTestTime
);
/**
* 筛选数据,筛选出一组工作流上最小的任务流
*/
Map
<
Integer
,
WaitingRecord
>
nextRunFlow
=
allByTriggerTime
.
stream
()
.
collect
(
Collectors
.
toMap
(
WaitingRecord:
:
getFlowId
,
Function
.
identity
(),
BinaryOperator
.
minBy
(
Comparator
.
comparingInt
(
WaitingRecord:
:
getWaitOrder
))));
nextRunFlow
.
forEach
((
key
,
value
)
->{
runRecordingAndJobTaskService
.
updateRunRecordingAndTask
(
value
);
});
return
UNIVERSAL_WAIT_TIME
;
}
}
@Override
@Override
...
@@ -37,3 +68,4 @@ public class MakeUpFlowThreadRunHelper extends BaseThreadRunHelper {
...
@@ -37,3 +68,4 @@ public class MakeUpFlowThreadRunHelper extends BaseThreadRunHelper {
return
LOCK_NAME
;
return
LOCK_NAME
;
}
}
}
}
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