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
30b39e3e
Commit
30b39e3e
authored
May 13, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取节点的运行状态时同时也获取工作流的运行状态
parent
01ee08de
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
43 deletions
+15
-43
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+15
-43
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
30b39e3e
...
...
@@ -761,19 +761,28 @@ public class ApiFlowServiceImpl implements ApiFlowService {
}
//如果工作空间下面有数据
if
(
flowIdList
.
size
()
>
0
){
StatisticData
flowStatisticData
=
runRecordingMapper
.
findStatusByStartAndEndTime
(
new
Date
(
startTime
),
new
Date
(
endTime
),
flowIdList
);
return
buildStatisticDate
(
startTime
,
endTime
,
flowIdList
);
}
return
null
;
}
private
CollectData
buildStatisticDate
(
Long
startTime
,
Long
endTime
,
List
<
Integer
>
flowIdList
){
Date
startDate
=
new
Date
(
startTime
);
Date
endDate
=
new
Date
(
endTime
);
StatisticData
flowStatisticData
=
runRecordingMapper
.
findStatusByStartAndEndTime
(
startDate
,
endDate
,
flowIdList
);
if
(
null
==
flowStatisticData
){
flowStatisticData
=
new
StatisticData
();
flowStatisticData
.
setUnstart
(
flow
List
.
size
());
flowStatisticData
.
setUnstart
(
flowId
List
.
size
());
}
else
{
Integer
sum
=
runRecordingMapper
.
findFlowNum
(
new
Date
(
startTime
),
new
Date
(
endTime
),
flowIdList
);
if
(
flow
List
.
size
()
>
sum
){
if
(
flowId
List
.
size
()
>
sum
){
//如果工作流
flowStatisticData
.
setUnstart
(
flow
List
.
size
()
-
sum
+
flowStatisticData
.
getUnstart
());
flowStatisticData
.
setUnstart
(
flowId
List
.
size
()
-
sum
+
flowStatisticData
.
getUnstart
());
}
}
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
new
Date
(
startTime
),
new
Date
(
endTime
)
,
flowIdList
);
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
startDate
,
endDate
,
flowIdList
);
List
<
Node
>
nodeList
=
nodeMapper
.
findbyFlowIds
(
flowIdList
);
if
(
null
==
nodeStatisticData
){
nodeStatisticData
=
new
StatisticData
();
...
...
@@ -818,8 +827,6 @@ public class ApiFlowServiceImpl implements ApiFlowService {
collectData
.
setFlowCollectMap
(
flowCollectMap
);
return
collectData
;
}
return
null
;
}
/**
* 构建统计数据
...
...
@@ -875,42 +882,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
}
}
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
new
Date
(
startTime
),
new
Date
(
endTime
),
flowIdList
);
List
<
Node
>
nodeList
=
nodeMapper
.
findbyFlowIds
(
flowIdList
);
if
(
null
==
nodeStatisticData
){
nodeStatisticData
=
new
StatisticData
();
nodeStatisticData
.
setUnstart
(
nodeList
.
size
());
}
else
{
int
sum
=
nodeStatisticData
.
getFail
()
+
nodeStatisticData
.
getStop
()
+
nodeStatisticData
.
getRunIng
()
+
nodeStatisticData
.
getSuccess
()
+
nodeStatisticData
.
getKill
();
nodeStatisticData
.
setUnstart
(
nodeList
.
size
()
>
sum
?
nodeList
.
size
()-
sum
:
0
);
}
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
flowStatusSnapshootMapper
.
findByTime
(
flowIdList
,
startTime
,
endTime
);
Map
<
String
,
StatisticData
>
nodeCollectMap
=
new
HashMap
<>();
flowStatusSnapshootList
.
forEach
(
flowStatusSnapshoot
->
{
String
key
=
flowStatusSnapshoot
.
getDay
()
+
"/"
+
flowStatusSnapshoot
.
getHour
();
StatisticData
nodeHourStatisticData
=
nodeCollectMap
.
get
(
key
);
if
(
null
==
nodeHourStatisticData
){
nodeHourStatisticData
=
new
StatisticData
();
nodeHourStatisticData
.
setUnstart
(
flowStatusSnapshoot
.
getUnstartNode
());
nodeHourStatisticData
.
setRunIng
(
flowStatusSnapshoot
.
getRuningNode
());
nodeHourStatisticData
.
setSuccess
(
flowStatusSnapshoot
.
getSuccessNode
());
nodeHourStatisticData
.
setFail
(
flowStatusSnapshoot
.
getFailNode
());
nodeHourStatisticData
.
setKill
(
flowStatusSnapshoot
.
getKillNode
());
}
else
{
nodeHourStatisticData
.
setUnstart
(
nodeHourStatisticData
.
getUnstart
()
+
flowStatusSnapshoot
.
getUnstartNode
());
nodeHourStatisticData
.
setRunIng
(
nodeHourStatisticData
.
getRunIng
()
+
flowStatusSnapshoot
.
getRuningNode
());
nodeHourStatisticData
.
setSuccess
(
nodeHourStatisticData
.
getSuccess
()
+
flowStatusSnapshoot
.
getSuccessNode
());
nodeHourStatisticData
.
setFail
(
nodeHourStatisticData
.
getFail
()
+
flowStatusSnapshoot
.
getFailNode
());
nodeHourStatisticData
.
setKill
(
nodeHourStatisticData
.
getKill
()
+
flowStatusSnapshoot
.
getKillNode
());
}
nodeCollectMap
.
put
(
key
,
nodeHourStatisticData
);
});
CollectData
collectData
=
new
CollectData
();
collectData
.
setNodeData
(
nodeStatisticData
);
collectData
.
setNodeCollectMap
(
nodeCollectMap
);
return
collectData
;
return
buildStatisticDate
(
startTime
,
endTime
,
flowIdList
);
}
@Override
...
...
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