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
fb4752af
Commit
fb4752af
authored
May 13, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计方式
parent
d896cd3d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
40 deletions
+7
-40
StatusSnapshootThreadRunHelper.java
...om/byit/thread/helper/StatusSnapshootThreadRunHelper.java
+6
-40
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+1
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/StatusSnapshootThreadRunHelper.java
View file @
fb4752af
...
@@ -66,7 +66,10 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
...
@@ -66,7 +66,10 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
new
ArrayList
<>();
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
new
ArrayList
<>();
flowList
.
forEach
(
flow
->
{
flowList
.
forEach
(
flow
->
{
List
<
RunRecording
>
maxRunRecordingList
=
runRecordingMapper
.
findMaxByFlowId
(
flow
.
getFlowId
());
//获取今天凌晨的时间戳
Long
time
=
LocalDate
.
now
().
atStartOfDay
(
ZoneOffset
.
ofHours
(
8
)).
toInstant
().
toEpochMilli
();
//获取今天的运行实例
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
findByPreTime
(
new
Date
(
time
),
flow
.
getFlowId
());
FlowStatusSnapshoot
flowStatusSnapshoot
=
new
FlowStatusSnapshoot
();
FlowStatusSnapshoot
flowStatusSnapshoot
=
new
FlowStatusSnapshoot
();
flowStatusSnapshoot
.
setDay
(
date
);
flowStatusSnapshoot
.
setDay
(
date
);
flowStatusSnapshoot
.
setFlowId
(
flow
.
getFlowId
());
flowStatusSnapshoot
.
setFlowId
(
flow
.
getFlowId
());
...
@@ -77,46 +80,9 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
...
@@ -77,46 +80,9 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
//统计运行实例的数据
//统计运行实例的数据
//如果存在实例
//如果存在实例
if
(
null
!=
maxRunRecordingList
&&
maxRunRecordingList
.
size
()
>
0
){
if
(
null
!=
runRecordingList
&&
runRecordingList
.
size
()
>
0
){
//获取今天凌晨的时间戳
Long
time
=
LocalDate
.
now
().
atStartOfDay
(
ZoneOffset
.
ofHours
(
8
)).
toInstant
().
toEpochMilli
();
RunRecording
maxRunRecording
=
maxRunRecordingList
.
get
(
0
);
//从凌晨到现在是否有运行实例
if
(
time
.
longValue
()
>
maxRunRecording
.
getStartTime
().
getTime
()){
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
}
else
{
//从凌晨到现在存在工作流的运行实例
//获取上一个小时的时间戳
Long
preHourTime
=
hourDateTime
.
minusHours
(
1
).
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
//查询过去一个小时的和未完成的工作流实例
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
findByPreTime
(
new
Date
(
preHourTime
),
flow
.
getFlowId
());
//判断是否存在过去一个小时的和未完成的工作流实例
if
(
null
!=
runRecordingList
&&
runRecordingList
.
size
()
>
0
){
//处理未完成和过去一个小时的工作流实例
buildUnFinish
(
runRecordingList
,
flowStatusSnapshootList
,
flowStatusSnapshoot
,
flow
);
buildUnFinish
(
runRecordingList
,
flowStatusSnapshootList
,
flowStatusSnapshoot
,
flow
);
}
else
{
}
else
{
//如果不存在实例,获取上一个小时的运行快照保存
LocalDateTime
preHourLocalDateTime
=
localDateTime
.
minusHours
(
1
);
String
preHourDate
=
preHourLocalDateTime
.
format
(
DATE_FORMATTER
);
String
preHourHour
=
String
.
valueOf
(
preHourLocalDateTime
.
getHour
());
List
<
FlowStatusSnapshoot
>
preHourFlowStatusSnapshootList
=
flowStatusSnapshootMapper
.
findByDateAndHourAndFlowId
(
preHourDate
,
preHourHour
,
flow
.
getFlowId
());
if
(
null
!=
preHourFlowStatusSnapshootList
&&
preHourFlowStatusSnapshootList
.
size
()
>
0
){
preHourFlowStatusSnapshootList
.
forEach
(
preHourFlowStatusSnapshoot
->{
preHourFlowStatusSnapshoot
.
setDay
(
date
);
preHourFlowStatusSnapshoot
.
setHour
(
hour
);
preHourFlowStatusSnapshoot
.
setSnapshootTime
(
hourTime
);
flowStatusSnapshootList
.
add
(
preHourFlowStatusSnapshoot
);
});
}
else
{
//如果上个小时也没有,就设置为未运行
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
}
}
}
}
else
{
//如果不存在运行实例
//如果不存在运行实例
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
...
@@ -137,7 +103,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
...
@@ -137,7 +103,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
}
}
/**
/**
* 功能描述
处理过去一小时
和未完成的工作流的快照
* 功能描述
当天的
和未完成的工作流的快照
* @author gml
* @author gml
* @date 2020-05-08 10:20
* @date 2020-05-08 10:20
* @param runRecordingList
* @param runRecordingList
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
fb4752af
...
@@ -234,6 +234,7 @@
...
@@ -234,6 +234,7 @@
where flow_id = #{flowId}
where flow_id = #{flowId}
and (
and (
start_time
>
= #{preHourDate}
start_time
>
= #{preHourDate}
or end_time
>
= #{preHourDate}
or flow_status != '4'
or flow_status != '4'
)
)
</select>
</select>
...
...
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