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
fb235064
Commit
fb235064
authored
Apr 08, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改快照
parent
4367a109
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
24 deletions
+47
-24
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+1
-1
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+9
-0
StatusSnapshootThreadRunHelper.java
...om/byit/thread/helper/StatusSnapshootThreadRunHelper.java
+30
-23
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+7
-0
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
fb235064
...
...
@@ -866,7 +866,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
Map
<
String
,
StatisticData
>
nodeCollectMap
=
new
HashMap
<>();
flowStatusSnapshootList
.
forEach
(
flowStatusSnapshoot
->
{
String
key
=
flowStatusSnapshoot
.
getDay
()
+
"
"
+
flowStatusSnapshoot
.
getHour
();
String
key
=
flowStatusSnapshoot
.
getDay
()
+
"
/
"
+
flowStatusSnapshoot
.
getHour
();
StatisticData
nodeHourStatisticData
=
nodeCollectMap
.
get
(
key
);
if
(
null
==
nodeHourStatisticData
){
nodeHourStatisticData
=
new
StatisticData
();
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
fb235064
...
...
@@ -172,4 +172,12 @@ public interface RunRecordingMapper {
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
RunRecording
findMaxByFlowId
(
@Param
(
"flowId"
)
Integer
flowId
);
/**
* 查询过去一小时的运行实例
* @param preHourDate
* @param flowId
* @return
*/
List
<
RunRecording
>
findByPreTime
(
@Param
(
"preHourDate"
)
Date
preHourDate
,
@Param
(
"flowId"
)
Integer
flowId
);
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/StatusSnapshootThreadRunHelper.java
View file @
fb235064
...
...
@@ -5,6 +5,7 @@ import com.byit.mapper.*;
import
com.byit.model.*
;
import
com.byit.thread.BaseThreadRunHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -13,6 +14,7 @@ import javax.sql.DataSource;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -64,7 +66,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
new
ArrayList
<>();
flowList
.
forEach
(
flow
->
{
RunRecording
r
unRecording
=
runRecordingMapper
.
findMaxByFlowId
(
flow
.
getFlowId
());
RunRecording
maxR
unRecording
=
runRecordingMapper
.
findMaxByFlowId
(
flow
.
getFlowId
());
FlowStatusSnapshoot
flowStatusSnapshoot
=
new
FlowStatusSnapshoot
();
flowStatusSnapshoot
.
setDay
(
date
);
flowStatusSnapshoot
.
setFlowId
(
flow
.
getFlowId
());
...
...
@@ -75,25 +77,31 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
//统计运行实例的数据
//如果存在实例
if
(
r
unRecording
!=
null
){
if
(
maxR
unRecording
!=
null
){
//获取上一个时间
Long
preHourTime
=
hourDateTime
.
minusHours
(
1
).
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
//从凌晨到现在是否有运行实例
if
(
preHourTime
.
longValue
()
>
r
unRecording
.
getTriggerTime
().
longValue
()){
if
(
preHourTime
.
longValue
()
>
maxR
unRecording
.
getTriggerTime
().
longValue
()){
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
}
else
{
//存在工作流的运行实例
//判断运行状态
if
(
runRecording
.
getFlowStatus
().
equals
(
"1"
)
||
runRecording
.
getFlowStatus
().
equals
(
"2"
)
||
runRecording
.
getFlowStatus
().
equals
(
"3"
)){
flowStatusSnapshoot
.
setFlowStatus
(
Integer
.
valueOf
(
runRecording
.
getFlowStatus
()));
}
else
{
switch
(
runRecording
.
getFlowRunResult
()){
case
"1"
:
case
"3"
:
flowStatusSnapshoot
.
setFlowStatus
(
4
);
break
;
case
"2"
:
case
"4"
:
flowStatusSnapshoot
.
setFlowStatus
(
5
);
break
;
case
"5"
:
flowStatusSnapshoot
.
setFlowStatus
(
6
);
break
;
default
:
flowStatusSnapshoot
.
setFlowStatus
(
5
);
break
;
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
findByPreTime
(
new
Date
(
preHourTime
),
flow
.
getFlowId
());
runRecordingList
.
forEach
(
runRecording
->
{
FlowStatusSnapshoot
hourFlowStatusSnapshoot
=
new
FlowStatusSnapshoot
();
BeanUtils
.
copyProperties
(
flowStatusSnapshoot
,
hourFlowStatusSnapshoot
);
//判断运行状态
if
(
runRecording
.
getFlowStatus
().
equals
(
"1"
)
||
runRecording
.
getFlowStatus
().
equals
(
"2"
)
||
runRecording
.
getFlowStatus
().
equals
(
"3"
)){
hourFlowStatusSnapshoot
.
setFlowStatus
(
Integer
.
valueOf
(
runRecording
.
getFlowStatus
()));
}
else
{
switch
(
runRecording
.
getFlowRunResult
()){
case
"1"
:
case
"3"
:
hourFlowStatusSnapshoot
.
setFlowStatus
(
4
);
break
;
case
"2"
:
case
"4"
:
hourFlowStatusSnapshoot
.
setFlowStatus
(
5
);
break
;
case
"5"
:
hourFlowStatusSnapshoot
.
setFlowStatus
(
6
);
break
;
default
:
hourFlowStatusSnapshoot
.
setFlowStatus
(
5
);
break
;
}
}
//获取运行实例下各类状态的节点数目
StatisticData
nodeStatistic
=
jobTaskRunLogMapper
.
findStatisticDataByRunIdAndFlowId
(
runRecording
.
getRunId
(),
flow
.
getFlowId
());
...
...
@@ -101,18 +109,17 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
//存在节点运行日志
if
(
nodeStatistic
!=
null
){
int
sum
=
nodeStatistic
.
getFail
()
+
nodeStatistic
.
getSuccess
()
+
nodeStatistic
.
getRunIng
()
+
nodeStatistic
.
getKill
();
f
lowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
()
-
sum
);
f
lowStatusSnapshoot
.
setRuningNode
(
nodeStatistic
.
getRunIng
());
f
lowStatusSnapshoot
.
setSuccessNode
(
nodeStatistic
.
getSuccess
());
f
lowStatusSnapshoot
.
setFailNode
(
nodeStatistic
.
getFail
());
f
lowStatusSnapshoot
.
setKillNode
(
nodeStatistic
.
getKill
());
hourF
lowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
()
-
sum
);
hourF
lowStatusSnapshoot
.
setRuningNode
(
nodeStatistic
.
getRunIng
());
hourF
lowStatusSnapshoot
.
setSuccessNode
(
nodeStatistic
.
getSuccess
());
hourF
lowStatusSnapshoot
.
setFailNode
(
nodeStatistic
.
getFail
());
hourF
lowStatusSnapshoot
.
setKillNode
(
nodeStatistic
.
getKill
());
}
else
{
//不存在节点的运行日志
f
lowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
hourF
lowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
}
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
}
flowStatusSnapshootList
.
add
(
hourFlowStatusSnapshoot
);
});
}
}
else
{
//如果不存在运行实例
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
fb235064
...
...
@@ -176,6 +176,13 @@
where flow_id = #{flowId}
)
</select>
<select
id=
"findByPreTime"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from run_recording
where flow_id = #{flowId}
and start_time
>
= #{preHourDate}
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<!-- generated @mbg.generated date: 2019-12-25 -->
...
...
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