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
b9f1f019
Commit
b9f1f019
authored
May 11, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
05eb2e45
d94a4f06
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
13 deletions
+48
-13
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+8
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+5
-0
StatusSnapshootThreadRunHelper.java
...om/byit/thread/helper/StatusSnapshootThreadRunHelper.java
+8
-3
JobTaskRunLogMapper.xml
...in-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
+7
-7
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+20
-3
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
b9f1f019
...
...
@@ -765,7 +765,14 @@ public class ApiFlowServiceImpl implements ApiFlowService {
if
(
null
==
flowStatisticData
){
flowStatisticData
=
new
StatisticData
();
flowStatisticData
.
setUnstart
(
flowList
.
size
());
}
else
{
Integer
sum
=
runRecordingMapper
.
findFlowNum
(
new
Date
(
startTime
),
new
Date
(
endTime
),
flowIdList
);
if
(
flowList
.
size
()
>
sum
){
//如果工作流
flowStatisticData
.
setUnstart
(
flowList
.
size
()
-
sum
+
flowStatisticData
.
getUnstart
());
}
}
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
new
Date
(
startTime
),
new
Date
(
endTime
),
flowIdList
);
List
<
Node
>
nodeList
=
nodeMapper
.
findbyFlowIds
(
flowIdList
);
if
(
null
==
nodeStatisticData
){
...
...
@@ -1032,6 +1039,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
BeanUtils
.
copyProperties
(
waitingRecord
,
runRecording
);
runRecording
.
setFlowStatus
(
"1"
);
runRecording
.
setTriggerTime
(
System
.
currentTimeMillis
());
runRecording
.
setWorkspaceId
(
flow
.
getWorkspaceId
());
Integer
waitId
=
waitingRecordMapper
.
insertSelective
(
waitingRecord
);
runRecordingMapper
.
saveRunRecording
(
runRecording
);
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
b9f1f019
...
...
@@ -207,4 +207,8 @@ public interface RunRecordingMapper {
RunRecording
findNewStatus
(
Integer
flowId
);
int
updateState
(
RunRecording
runRecording
);
Integer
findFlowNum
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/StatusSnapshootThreadRunHelper.java
View file @
b9f1f019
...
...
@@ -82,7 +82,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
Long
time
=
LocalDate
.
now
().
atStartOfDay
(
ZoneOffset
.
ofHours
(
8
)).
toInstant
().
toEpochMilli
();
RunRecording
maxRunRecording
=
maxRunRecordingList
.
get
(
0
);
//从凌晨到现在是否有运行实例
if
(
time
.
longValue
()
>
maxRunRecording
.
get
TriggerTime
().
longValu
e
()){
if
(
time
.
longValue
()
>
maxRunRecording
.
get
StartTime
().
getTim
e
()){
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
...
...
@@ -101,8 +101,13 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
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
){
flowStatusSnapshootList
.
addAll
(
preHourFlowStatusSnapshootList
);
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
);
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
View file @
b9f1f019
...
...
@@ -145,14 +145,14 @@
from job_task_run_log
where log_id = #{logId,jdbcType=INTEGER}
</select>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
useCache=
"false"
flushCache=
"true"
>
select sum(case when run_code = '0' then 1 else 0 end) as runIng,
sum(case when run_code = '1' or run_code = '3' then 1 else 0 end) as success,
sum(case when run_code = '2' or run_code = '4' or run_code = '6' then 1 else 0 end) as fail,
sum(case when run_code = '5' then 1 else 0 end) as 'kill'
from job_task_run_log
where
start
_time
>
= #{startTime}
and
end
_time
<
= #{endTime}
where
trigger
_time
>
= #{startTime}
and
trigger
_time
<
= #{endTime}
<if
test=
"flowIdList != null"
>
and flow_id in (
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
...
...
@@ -186,8 +186,8 @@
select
<include
refid=
"Base_Column_List"
/>
from job_task_run_log
where node_id = #{nodeId}
and
start
_time
>
= #{startTime}
and
end
_time
<
= #{endTime}
and
trigger
_time
>
= #{startTime}
and
trigger
_time
<
= #{endTime}
and schedule_type = '5'
order by start_time desc
</select>
...
...
@@ -199,8 +199,8 @@
#{nodeId}
</foreach>
)
and
start
_time
>
= #{startTime}
and
end
_time
<
= #{endTime}
and
trigger
_time
>
= #{startTime}
and
trigger
_time
<
= #{endTime}
and schedule_type = '5'
order by start_time desc
</select>
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
b9f1f019
...
...
@@ -200,7 +200,7 @@
where flow_id = #{flowId}
and flow_status != '4'
</select>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
useCache=
"false"
flushCache=
"true"
>
select sum(case when flow_status = '1' then 1 else 0 end ) unstart,
sum(case when flow_status='2' then 1 else 0 end ) runing,
sum(case when flow_status='3' then 1 else 0 end ) stop,
...
...
@@ -209,7 +209,7 @@
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
from run_recording
where start_time
>
= #{startTime}
and
end
_time
<
= #{endTime}
and
start
_time
<
= #{endTime}
<if
test=
"flowIdList != null"
>
and flow_id in (
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
...
...
@@ -222,7 +222,7 @@
select
<include
refid=
"Base_Column_List"
/>
from run_recording
where flow_id = #{flowId}
and
trigger_time = (select max(trigger
_time)
and
start_time = (select max(start
_time)
from run_recording
where flow_id = #{flowId}
)
...
...
@@ -249,6 +249,23 @@
where flow_id = #{flowId}
)
</select>
<select
id=
"findFlowNum"
resultType=
"java.lang.Integer"
>
select count(1)
from (
select flow_id
from run_recording
where start_time
>
= #{startTime}
and start_time
<
= #{endTime}
<if
test=
"flowIdList != null"
>
and flow_id in (
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
#{flowId}
</foreach>
)
</if>
GROUP BY flow_id
) flow
</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