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
aec307f9
Commit
aec307f9
authored
Apr 02, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计数据接口返回
parent
84f12afb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
70 deletions
+70
-70
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+33
-7
FlowStatusSnapshootMapper.java
.../main/java/com/byit/mapper/FlowStatusSnapshootMapper.java
+9
-0
JobTaskRunLogMapper.java
...re/src/main/java/com/byit/mapper/JobTaskRunLogMapper.java
+1
-2
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+5
-4
StatusPO.java
...-admin-core/src/main/java/com/byit/model/po/StatusPO.java
+0
-21
StatusSnapshootThreadRunHelper.java
...om/byit/thread/helper/StatusSnapshootThreadRunHelper.java
+0
-1
FlowStatusSnapshootMapper.xml
...e/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
+7
-0
JobTaskRunLogMapper.xml
...in-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
+7
-14
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+8
-21
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
aec307f9
...
@@ -16,7 +16,6 @@ import com.byit.mapper.*;
...
@@ -16,7 +16,6 @@ import com.byit.mapper.*;
import
com.byit.model.JobTaskRunLog
;
import
com.byit.model.JobTaskRunLog
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.model.*
;
import
com.byit.model.*
;
import
com.byit.model.po.StatusPO
;
import
com.byit.model.vo.RunRecordingVo
;
import
com.byit.model.vo.RunRecordingVo
;
import
com.byit.service.ApiFlowService
;
import
com.byit.service.ApiFlowService
;
import
com.byit.util.ApiFlowDagCheck
;
import
com.byit.util.ApiFlowDagCheck
;
...
@@ -82,6 +81,9 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -82,6 +81,9 @@ public class ApiFlowServiceImpl implements ApiFlowService {
private
WaitingTaskMapper
waitingTaskMapper
;
private
WaitingTaskMapper
waitingTaskMapper
;
@Resource
@Resource
private
FlowStatusSnapshootMapper
flowStatusSnapshootMapper
;
@Resource
private
CurrentUserUtils
currentUserUtils
;
private
CurrentUserUtils
currentUserUtils
;
private
void
parseParam
(
String
param
,
DeleteDto
deletDto
){
private
void
parseParam
(
String
param
,
DeleteDto
deletDto
){
...
@@ -726,13 +728,37 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -726,13 +728,37 @@ public class ApiFlowServiceImpl implements ApiFlowService {
}
}
}
}
List
<
StatusPO
>
runRecordingList
=
runRecordingMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
StatisticData
flowStatisticData
=
runRecordingMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
List
<
StatusPO
>
runLogList
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
StatisticData
nodeDate
=
new
StatisticData
();
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
flowStatusSnapshootMapper
.
findByTime
(
startTime
,
endTime
);
runLogList
.
forEach
(
statusPO
->
{
Map
<
String
,
StatisticData
>
collectMap
=
new
HashMap
<>();
flowStatusSnapshootList
.
forEach
(
flowStatusSnapshoot
->
{
String
key
=
flowStatusSnapshoot
.
getDay
()
+
" "
+
flowStatusSnapshoot
.
getHour
();
StatisticData
statisticData
=
collectMap
.
get
(
key
);
if
(
null
==
statisticData
){
statisticData
=
new
StatisticData
();
statisticData
.
setUnstart
(
flowStatusSnapshoot
.
getUnstartNode
());
statisticData
.
setRunIng
(
flowStatusSnapshoot
.
getRuningNode
());
statisticData
.
setSuccess
(
flowStatusSnapshoot
.
getSuccessNode
());
statisticData
.
setFail
(
flowStatusSnapshoot
.
getFailNode
());
statisticData
.
setKill
(
flowStatusSnapshoot
.
getKillNode
());
collectMap
.
put
(
key
,
statisticData
);
}
else
{
statisticData
.
setUnstart
(
statisticData
.
getUnstart
()
+
flowStatusSnapshoot
.
getUnstartNode
());
statisticData
.
setRunIng
(
statisticData
.
getRunIng
()
+
flowStatusSnapshoot
.
getRuningNode
());
statisticData
.
setSuccess
(
statisticData
.
getSuccess
()
+
flowStatusSnapshoot
.
getSuccessNode
());
statisticData
.
setFail
(
statisticData
.
getFail
()
+
flowStatusSnapshoot
.
getFailNode
());
statisticData
.
setKill
(
statisticData
.
getKill
()
+
flowStatusSnapshoot
.
getKillNode
());
collectMap
.
put
(
key
,
statisticData
);
}
});
});
return
null
;
CollectData
collectData
=
new
CollectData
();
collectData
.
setFlowData
(
flowStatisticData
);
collectData
.
setNodeData
(
nodeStatisticData
);
collectData
.
setCollectMap
(
collectMap
);
return
collectData
;
}
}
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/FlowStatusSnapshootMapper.java
View file @
aec307f9
...
@@ -38,4 +38,12 @@ public interface FlowStatusSnapshootMapper {
...
@@ -38,4 +38,12 @@ public interface FlowStatusSnapshootMapper {
* @return
* @return
*/
*/
int
deleteOutSnapShoot
(
Long
outTime
);
int
deleteOutSnapShoot
(
Long
outTime
);
/**
* 根据时间范围查询
* @param startTime
* @param endTime
* @return
*/
List
<
FlowStatusSnapshoot
>
findByTime
(
Long
startTime
,
Long
endTime
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/JobTaskRunLogMapper.java
View file @
aec307f9
...
@@ -3,7 +3,6 @@ package com.byit.mapper;
...
@@ -3,7 +3,6 @@ package com.byit.mapper;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.model.JobTaskRunLog
;
import
com.byit.model.JobTaskRunLog
;
import
com.byit.model.JobTaskRunLogWithBLOBs
;
import
com.byit.model.JobTaskRunLogWithBLOBs
;
import
com.byit.model.po.StatusPO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -120,7 +119,7 @@ public interface JobTaskRunLogMapper {
...
@@ -120,7 +119,7 @@ public interface JobTaskRunLogMapper {
* @param flowIdList
* @param flowIdList
* @return
* @return
*/
*/
List
<
StatusPO
>
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
StatisticData
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
aec307f9
package
com
.
byit
.
mapper
;
package
com
.
byit
.
mapper
;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.model.po.StatusPO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -166,9 +166,9 @@ public interface RunRecordingMapper {
...
@@ -166,9 +166,9 @@ public interface RunRecordingMapper {
* @param flowIdList
* @param flowIdList
* @return
* @return
*/
*/
List
<
StatusPO
>
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
StatisticData
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
RunRecording
findMaxByFlowId
(
@Param
(
"flowId"
)
Integer
flowId
);
RunRecording
findMaxByFlowId
(
@Param
(
"flowId"
)
Integer
flowId
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/model/po/StatusPO.java
deleted
100644 → 0
View file @
84f12afb
package
com
.
byit
.
model
.
po
;
import
lombok.Data
;
/**
* @Description
* @Author guo_m
* @Date 2020-04-01
*/
@Data
public
class
StatusPO
{
private
Integer
flowId
;
private
Integer
nodeId
;
private
Integer
status
;
private
Long
startTime
;
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/StatusSnapshootThreadRunHelper.java
View file @
aec307f9
package
com
.
byit
.
thread
.
helper
;
package
com
.
byit
.
thread
.
helper
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.mapper.FlowMapper
;
import
com.byit.mapper.FlowMapper
;
import
com.byit.mapper.FlowStatusSnapshootMapper
;
import
com.byit.mapper.FlowStatusSnapshootMapper
;
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
View file @
aec307f9
...
@@ -198,6 +198,13 @@
...
@@ -198,6 +198,13 @@
from flow_status_snapshoot
from flow_status_snapshoot
where 'day' = #{date} and `hour` = #{hour}
where 'day' = #{date} and `hour` = #{hour}
</select>
</select>
<select
id=
"findByTime"
resultType=
"com.byit.model.FlowStatusSnapshoot"
>
select
<include
refid=
"Base_Column_List"
/>
from flow_status_snapshoot
where snapshoot_time
>
= ${startDate}
and snapshoot_time
<
= ${endDate}
</select>
<delete
id=
"deleteOutSnapShoot"
parameterType=
"java.lang.Long"
>
<delete
id=
"deleteOutSnapShoot"
parameterType=
"java.lang.Long"
>
delete from flow_status_snapshoot
delete from flow_status_snapshoot
where snapshoot_time = #{outTime,jdbcType=BIGINT}
where snapshoot_time = #{outTime,jdbcType=BIGINT}
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
View file @
aec307f9
...
@@ -121,20 +121,13 @@
...
@@ -121,20 +121,13 @@
from job_task_run_log
from job_task_run_log
where log_id = #{logId,jdbcType=INTEGER}
where log_id = #{logId,jdbcType=INTEGER}
</select>
</select>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.model.po.StatusPO"
>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
>
select case run_code
select sum(case when run_code = '0' then 1 else 0 end) as runIng,
when 0 then 2
sum(case when run_code = '1' or run_code = '3' then 1 else 0 end) as success,
when 1 then 3
sum(case when run_code = '2' or run_code = '4' or run_code = '6' then 1 else 0 end) as fail,
when 2 then 4
sum(case when run_code = '5' then 1 else 0 end) as 'kill'
when 3 then 3
from job_task_run_log
when 4 then 4
where start_time
>
= ${startDate}
when 5 then 5
when 5 then 4
else 0
end status,
start_time
from job_task_run_log
where start_time
>
= ${startDate}
and end_time
<
= ${endDate}
and end_time
<
= ${endDate}
<if
test=
"flowIds != null"
>
<if
test=
"flowIds != null"
>
and flow_id in (
and flow_id in (
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
aec307f9
...
@@ -148,26 +148,14 @@
...
@@ -148,26 +148,14 @@
where flow_id = #{flowId}
where flow_id = #{flowId}
and flow_status != '4'
and flow_status != '4'
</select>
</select>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.model.po.StatusPO"
>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
>
select flowStatus + results as status, start_time as startTime, flow_id as flowId
select sum(case when flow_status = '1' then 1 else 0 end ) unstart,
from (
sum(case when flow_status='2' then 1 else 0 end ) runing,
select
sum(case when flow_status='3' then 1 else 0 end ) stop,
case flow_status
sum(case when flow_status='4' and (flow_run_result = '1' or flow_run_result = '3') then 1 else 0 end ) success,
when 1 then 1
sum(case when flow_status='4' and (flow_run_result = '2' or flow_run_result = '4') then 1 else 0 end ) fail,
when 2 then 2
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
else 0
from run_recording
end flowStatus,
case flow_run_result
when 1 then 3
when 2 then 4
when 3 then 3
when 4 then 4
when 5 then 5
else 0
end results,
start_time,
flow_id
from run_recording
where start_time
>
= ${startDate}
where start_time
>
= ${startDate}
and end_time
<
= ${endDate}
and end_time
<
= ${endDate}
<if
test=
"flowIds != null"
>
<if
test=
"flowIds != null"
>
...
@@ -177,7 +165,6 @@
...
@@ -177,7 +165,6 @@
</foreach>
</foreach>
)
)
</if>
</if>
) recording
</select>
</select>
<select
id=
"findMaxByFlowId"
resultType=
"com.byit.model.RunRecording"
>
<select
id=
"findMaxByFlowId"
resultType=
"com.byit.model.RunRecording"
>
select
<include
refid=
"Base_Column_List"
/>
select
<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