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
313d2ce8
Commit
313d2ce8
authored
Apr 03, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
40bf03ee
aec307f9
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
809 additions
and
23 deletions
+809
-23
ApiFlowController.java
...h-admin/src/main/java/com/byit/api/ApiFlowController.java
+6
-0
ApiFlowService.java
...-admin/src/main/java/com/byit/service/ApiFlowService.java
+8
-0
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+81
-0
application-dev.yml
byit-myth-admin/src/main/resources/application-dev.yml
+1
-1
application-local.yml
byit-myth-admin/src/main/resources/application-local.yml
+3
-0
application-pro.yml
byit-myth-admin/src/main/resources/application-pro.yml
+2
-0
application-test.yml
byit-myth-admin/src/main/resources/application-test.yml
+2
-0
ExecuteStatusEnum.java
...-core/src/main/java/com/byit/enums/ExecuteStatusEnum.java
+6
-8
ScheduleStatusEnum.java
...core/src/main/java/com/byit/enums/ScheduleStatusEnum.java
+8
-6
DaemonScanThreadRunHelper.java
...main/java/com/byit/factory/DaemonScanThreadRunHelper.java
+4
-4
FlowMapper.java
...-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
+7
-0
FlowStatusSnapshootMapper.java
.../main/java/com/byit/mapper/FlowStatusSnapshootMapper.java
+50
-0
JobTaskRunLogMapper.java
...re/src/main/java/com/byit/mapper/JobTaskRunLogMapper.java
+15
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+15
-0
FlowStatusSnapshoot.java
...ore/src/main/java/com/byit/model/FlowStatusSnapshoot.java
+96
-0
StatusSnapshootThreadRunHelper.java
...om/byit/thread/helper/StatusSnapshootThreadRunHelper.java
+134
-0
Generator-config.xml
...e/myth-admin-core/src/main/resources/Generator-config.xml
+1
-1
FlowMapper.xml
.../myth-admin-core/src/main/resources/mapper/FlowMapper.xml
+9
-3
FlowStatusSnapshootMapper.xml
...e/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
+242
-0
JobTaskRunLogMapper.xml
...in-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
+25
-0
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+27
-0
CollectData.java
...o-core/src/main/java/com/byit/dto/plugin/CollectData.java
+29
-0
StatisticData.java
...core/src/main/java/com/byit/dto/plugin/StatisticData.java
+38
-0
No files found.
byit-myth-admin/src/main/java/com/byit/api/ApiFlowController.java
View file @
313d2ce8
package
com
.
byit
.
api
;
package
com
.
byit
.
api
;
import
com.byit.dto.plugin.CollectData
;
import
com.byit.dto.web.ResponseResult
;
import
com.byit.dto.web.ResponseResult
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.model.vo.RunRecordingVo
;
import
com.byit.model.vo.RunRecordingVo
;
...
@@ -160,4 +161,9 @@ public class ApiFlowController {
...
@@ -160,4 +161,9 @@ public class ApiFlowController {
return
ResponseResult
.
ok
(
"SUCCESS"
);
return
ResponseResult
.
ok
(
"SUCCESS"
);
}
}
public
ResponseResult
loadStatisticData
(
String
param
){
CollectData
collectData
=
apiFlowService
.
loadStatisticData
(
param
);
return
ResponseResult
.
ok
(
collectData
);
}
}
}
byit-myth-admin/src/main/java/com/byit/service/ApiFlowService.java
View file @
313d2ce8
package
com
.
byit
.
service
;
package
com
.
byit
.
service
;
import
com.byit.dto.plugin.CollectData
;
import
com.byit.dto.plugin.PluginFlow
;
import
com.byit.dto.plugin.PluginFlow
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.model.vo.RunRecordingVo
;
import
com.byit.model.vo.RunRecordingVo
;
...
@@ -80,4 +81,11 @@ public interface ApiFlowService {
...
@@ -80,4 +81,11 @@ public interface ApiFlowService {
* @return
* @return
*/
*/
RunRecordingVo
loadScheduleLog
(
String
param
);
RunRecordingVo
loadScheduleLog
(
String
param
);
/**
* 统计汇总数据
* @param param
* @return
*/
CollectData
loadStatisticData
(
String
param
);
}
}
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
313d2ce8
...
@@ -81,6 +81,9 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -81,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
){
...
@@ -688,6 +691,84 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -688,6 +691,84 @@ public class ApiFlowServiceImpl implements ApiFlowService {
return
runRecordingVo
;
return
runRecordingVo
;
}
}
@Override
public
CollectData
loadStatisticData
(
String
param
){
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
//获取工作空间名称
String
workspaceName
=
jsonObject
.
getString
(
"workspaceName"
);
ValidationUtil
.
dataNotBank
(
workspaceName
,
"工作空间名称不允许为空!"
);
//开始校验
Workspace
workspace
=
workspaceMapper
.
getByName
(
workspaceName
);
ValidationUtil
.
dataNotNull
(
workspace
,
workspaceName
+
"工作空间不存在"
);
//获取时间间隔
Long
startTime
=
jsonObject
.
getLong
(
"startTime"
);
ValidationUtil
.
dataNotNull
(
startTime
,
"开始时间不允许为空!"
);
Long
endTime
=
jsonObject
.
getLong
(
"endTime"
);
ValidationUtil
.
dataNotNull
(
endTime
,
"结束时间不允许为空!"
);
ValidationUtil
.
isTrueValidation
(
String
.
valueOf
(
startTime
).
length
()
<
13
||
String
.
valueOf
(
endTime
).
length
()
<
13
,
"时间格式必须是毫秒"
);
//获取工作流名称
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
List
<
Integer
>
flowIdList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
flowName
)){
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
ValidationUtil
.
dataNotNull
(
flow
,
"工作流不存在!"
);
flowIdList
.
add
(
flow
.
getFlowId
());
if
(
FlowPropertyEnum
.
IS_INNER
.
getCode
().
equals
(
flow
.
getIsInner
())){
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
findByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
,
null
,
null
);
flowIdList
.
clear
();
runRecordingList
.
forEach
(
runRecording
->
flowIdList
.
add
(
runRecording
.
getFlowId
()));
}
}
else
{
List
<
Flow
>
flowList
=
flowMapper
.
findByWorkspace
(
workspace
.
getWorkspaceId
());
if
(
flowList
!=
null
&&
flowList
.
size
()
>
0
){
flowList
.
forEach
(
flow
->
flowIdList
.
add
(
flow
.
getFlowId
()));
}
}
StatisticData
flowStatisticData
=
runRecordingMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
StatisticData
nodeStatisticData
=
jobTaskRunLogMapper
.
findStatusByStartAndEndTime
(
startTime
,
endTime
,
flowIdList
);
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
flowStatusSnapshootMapper
.
findByTime
(
startTime
,
endTime
);
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
);
}
});
CollectData
collectData
=
new
CollectData
();
collectData
.
setFlowData
(
flowStatisticData
);
collectData
.
setNodeData
(
nodeStatisticData
);
collectData
.
setCollectMap
(
collectMap
);
return
collectData
;
}
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
String
str
=
"20200401"
;
SimpleDateFormat
ssss
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh"
);
Date
date
=
new
Date
();
System
.
out
.
println
(
ssss
.
format
(
date
));
System
.
out
.
println
(
sdf
.
parse
(
str
));
}
/**
/**
* runState 补批机制 1 补批当前节点 2 补批当前节点及以下节点
* runState 补批机制 1 补批当前节点 2 补批当前节点及以下节点
* @param param
* @param param
...
...
byit-myth-admin/src/main/resources/application-dev.yml
View file @
313d2ce8
...
@@ -55,5 +55,5 @@ file:
...
@@ -55,5 +55,5 @@ file:
myth-job
:
myth-job
:
filestystem
:
FASTDFS
filestystem
:
FASTDFS
snapshoot-date
:
60
#快照的保存时间 单位天
byit-myth-admin/src/main/resources/application-local.yml
View file @
313d2ce8
...
@@ -38,6 +38,7 @@ authentication:
...
@@ -38,6 +38,7 @@ authentication:
expire
:
43200
# 外部token有效期为12小时
expire
:
43200
# 外部token有效期为12小时
pub-key
:
client/pub.key
# 解密
pub-key
:
client/pub.key
# 解密
file
:
file
:
system
:
system
:
ip
:
10.0.120.2
ip
:
10.0.120.2
...
@@ -45,3 +46,4 @@ file:
...
@@ -45,3 +46,4 @@ file:
myth-job
:
myth-job
:
filestystem
:
FASTDFS
filestystem
:
FASTDFS
snapshoot-date
:
60
#快照的保存时间 单位天
\ No newline at end of file
byit-myth-admin/src/main/resources/application-pro.yml
View file @
313d2ce8
...
@@ -45,3 +45,4 @@ file:
...
@@ -45,3 +45,4 @@ file:
myth-job
:
myth-job
:
filestystem
:
FASTDFS
filestystem
:
FASTDFS
snapshoot-date
:
60
#快照的保存时间 单位天
\ No newline at end of file
byit-myth-admin/src/main/resources/application-test.yml
View file @
313d2ce8
...
@@ -46,3 +46,4 @@ file:
...
@@ -46,3 +46,4 @@ file:
myth-job
:
myth-job
:
filestystem
:
FASTDFS
filestystem
:
FASTDFS
snapshoot-date
:
60
#快照的保存时间 单位天
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/enums/ExecuteStatusEnum.java
View file @
313d2ce8
package
com
.
byit
.
enums
;
package
com
.
byit
.
enums
;
/**
/**
* @Description
* @Description
调度状态
* @Author guo_m
* @Author guo_m
* @Date 2020-03-31
* @Date 2020-03-31
*/
*/
public
enum
ExecuteStatusEnum
{
public
enum
ExecuteStatusEnum
{
SUCCESS
(
1
,
"成功"
),
UN_START
(
1
,
"未运行
"
),
FAIL
(
2
,
"失败
"
),
STARTING
(
2
,
"运行中
"
),
REPAIR_SUCCESS
(
3
,
"补批成功
"
),
FINISH
(
3
,
"暂停
"
),
REPAIR_FAIL
(
4
,
"补批失败
"
),
STOP
(
4
,
"完成"
),
KILL
(
5
,
"杀死"
)
;
;
private
Integer
code
;
private
Integer
code
;
private
String
msg
;
private
String
msg
;
...
@@ -28,5 +27,4 @@ public enum ExecuteStatusEnum {
...
@@ -28,5 +27,4 @@ public enum ExecuteStatusEnum {
public
String
getMsg
(){
public
String
getMsg
(){
return
this
.
msg
;
return
this
.
msg
;
}
}
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/enums/ScheduleStatusEnum.java
View file @
313d2ce8
package
com
.
byit
.
enums
;
package
com
.
byit
.
enums
;
/**
/**
* @Description
调度状态
* @Description
* @Author guo_m
* @Author guo_m
* @Date 2020-03-31
* @Date 2020-03-31
*/
*/
public
enum
ScheduleStatusEnum
{
public
enum
ScheduleStatusEnum
{
SUCCESS
(
1
,
"成功"
),
FAIL
(
2
,
"失败
"
),
UN_START
(
1
,
"未运行
"
),
REPAIR_SUCCESS
(
3
,
"补批成功
"
),
STARTING
(
2
,
"运行中
"
),
REPAIR_FAIL
(
4
,
"补批失败
"
),
FINISH
(
3
,
"暂停
"
),
KILL
(
5
,
"杀死"
)
STOP
(
4
,
"完成"
),
;
;
private
Integer
code
;
private
Integer
code
;
private
String
msg
;
private
String
msg
;
...
@@ -27,4 +28,5 @@ public enum ScheduleStatusEnum {
...
@@ -27,4 +28,5 @@ public enum ScheduleStatusEnum {
public
String
getMsg
(){
public
String
getMsg
(){
return
this
.
msg
;
return
this
.
msg
;
}
}
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/factory/DaemonScanThreadRunHelper.java
View file @
313d2ce8
...
@@ -25,15 +25,15 @@ public class DaemonScanThreadRunHelper {
...
@@ -25,15 +25,15 @@ public class DaemonScanThreadRunHelper {
private
volatile
static
boolean
THREAD_GROUP_STOP
=
false
;
private
volatile
static
boolean
THREAD_GROUP_STOP
=
false
;
/**
/**
* 初始睡眠时间
* 初始睡眠时间
单位毫秒
*/
*/
private
static
final
Long
INIT_SLEEP_DATE
=
10000L
;
private
static
final
Long
INIT_SLEEP_DATE
=
10000L
;
/**
/**
* 关闭等待时间
* 关闭等待时间
单位毫秒
*/
*/
private
static
final
Long
CLOSE_WAIT_TIME
=
1000L
;
private
static
final
Long
CLOSE_WAIT_TIME
=
1000L
;
/**
/**
* 循环间隔
* 循环间隔
单位毫秒
*/
*/
private
static
final
Long
CYCLE_INTERVAL
=
1000L
;
private
static
final
Long
CYCLE_INTERVAL
=
1000L
;
...
@@ -196,7 +196,7 @@ public class DaemonScanThreadRunHelper {
...
@@ -196,7 +196,7 @@ public class DaemonScanThreadRunHelper {
private
static
void
dateAligned
(
long
waitTime
,
String
threadName
){
private
static
void
dateAligned
(
long
waitTime
,
String
threadName
){
try
{
try
{
log
.
debug
(
"-----------线程{}开始休眠,休眠时间{}---------"
,
threadName
,
waitTime
);
log
.
debug
(
"-----------线程{}开始休眠,休眠时间{}---------"
,
threadName
,
waitTime
);
TimeUnit
.
MILLISECONDS
.
sleep
(
waitTime
-
System
.
currentTimeMillis
()
%
1000
);
TimeUnit
.
MILLISECONDS
.
sleep
(
waitTime
-
System
.
currentTimeMillis
()
%
1000
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
log
.
warn
(
"----------------【{}线程被中断】-----------------------"
,
threadName
);
log
.
warn
(
"----------------【{}线程被中断】-----------------------"
,
threadName
);
}
}
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
View file @
313d2ce8
...
@@ -42,4 +42,10 @@ public interface FlowMapper {
...
@@ -42,4 +42,10 @@ public interface FlowMapper {
* @return
* @return
*/
*/
List
<
Flow
>
findByWorkspace
(
Integer
workspaceId
);
List
<
Flow
>
findByWorkspace
(
Integer
workspaceId
);
/**
* 获取已经启动的工作流
* @return
*/
List
<
Flow
>
findONStartUp
();
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/FlowStatusSnapshootMapper.java
0 → 100644
View file @
313d2ce8
package
com
.
byit
.
mapper
;
import
com.byit.model.FlowStatusSnapshoot
;
import
java.util.List
;
public
interface
FlowStatusSnapshootMapper
{
int
deleteById
(
Integer
statusId
);
int
insert
(
FlowStatusSnapshoot
record
);
int
insertSelective
(
FlowStatusSnapshoot
record
);
FlowStatusSnapshoot
getById
(
Integer
statusId
);
int
updateByIdSelective
(
FlowStatusSnapshoot
record
);
int
updateById
(
FlowStatusSnapshoot
record
);
/**
* 判断快照是否存在
* @param date
* @param hour
* @return
*/
Integer
exist
(
String
date
,
String
hour
);
/**
* 批量保存
* @param flowStatusSnapshootList
* @return
*/
int
saveList
(
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
);
/**
* 删除太长时间的快照
* @param outTime
* @return
*/
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 @
313d2ce8
package
com
.
byit
.
mapper
;
package
com
.
byit
.
mapper
;
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
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -110,4 +111,17 @@ public interface JobTaskRunLogMapper {
...
@@ -110,4 +111,17 @@ public interface JobTaskRunLogMapper {
* @return
* @return
*/
*/
List
<
JobTaskRunLog
>
findByRunId
(
String
runId
);
List
<
JobTaskRunLog
>
findByRunId
(
String
runId
);
/**
* 查询运行汇总
* @param startTime
* @param endTime
* @param flowIdList
* @return
*/
StatisticData
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
StatisticData
findStatisticDataByRunIdAndFlowId
(
@Param
(
"runId"
)
String
runId
,
@Param
(
"flowId"
)
Integer
flowId
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
313d2ce8
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
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -157,4 +158,17 @@ public interface RunRecordingMapper {
...
@@ -157,4 +158,17 @@ public interface RunRecordingMapper {
* @return
* @return
*/
*/
List
<
RunRecording
>
findUnFinishByFlowId
(
Integer
flowId
);
List
<
RunRecording
>
findUnFinishByFlowId
(
Integer
flowId
);
/**
* 查询运行汇总
* @param startTime
* @param endTime
* @param flowIdList
* @return
*/
StatisticData
findStatusByStartAndEndTime
(
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
RunRecording
findMaxByFlowId
(
@Param
(
"flowId"
)
Integer
flowId
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/model/FlowStatusSnapshoot.java
0 → 100644
View file @
313d2ce8
package
com
.
byit
.
model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
*
*/
@ApiModel
@Data
public
class
FlowStatusSnapshoot
implements
Serializable
{
/**
* 主键
*/
@ApiModelProperty
(
"主键"
)
private
Integer
statusId
;
/**
* 工作空间主键
*/
@ApiModelProperty
(
"工作空间主键"
)
private
Integer
workspaceId
;
/**
* 工作流主键
*/
@ApiModelProperty
(
"工作流主键"
)
private
Integer
flowId
;
/**
* 工作流名称
*/
@ApiModelProperty
(
"工作流名称"
)
private
String
flowName
;
/**
* 快照日期
*/
@ApiModelProperty
(
"快照日期"
)
private
String
day
;
/**
* 快照小时
*/
@ApiModelProperty
(
"快照小时"
)
private
String
hour
;
/**
* 工作流状态(1 未运行 2 运行中 3 暂停 4 成功 5 失败 6 kill)
*/
@ApiModelProperty
(
"工作流状态(1 未运行 2 运行中 3 暂停 4 成功 5 失败 6 kill)"
)
private
Integer
flowStatus
;
/**
* 快照的时间戳
*/
@ApiModelProperty
(
"快照的时间戳"
)
private
Long
snapshootTime
;
/**
* 未开始节点数目
*/
@ApiModelProperty
(
"未开始节点数目"
)
private
int
unstartNode
;
/**
* 运行中节点数目
*/
@ApiModelProperty
(
"运行中节点数目"
)
private
int
runingNode
;
/**
* 成功节点数目
*/
@ApiModelProperty
(
"成功节点数目"
)
private
int
successNode
;
/**
* 失败节点数目
*/
@ApiModelProperty
(
"失败节点数目"
)
private
int
failNode
;
/**
* 杀死的节点数目
*/
@ApiModelProperty
(
"杀死的节点数目"
)
private
int
killNode
;
/**
*/
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/StatusSnapshootThreadRunHelper.java
0 → 100644
View file @
313d2ce8
package
com
.
byit
.
thread
.
helper
;
import
com.byit.dto.plugin.StatisticData
;
import
com.byit.mapper.FlowMapper
;
import
com.byit.mapper.FlowStatusSnapshootMapper
;
import
com.byit.mapper.JobTaskRunLogMapper
;
import
com.byit.mapper.RunRecordingMapper
;
import
com.byit.model.Flow
;
import
com.byit.model.FlowStatusSnapshoot
;
import
com.byit.model.RunRecording
;
import
com.byit.thread.BaseThreadRunHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.sql.DataSource
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Description 扫描状态并保存快照的线程类
* @Author guo_m
* @Date 2020-04-02
*/
@Component
@Slf4j
public
class
StatusSnapshootThreadRunHelper
extends
BaseThreadRunHelper
{
private
static
final
String
LOCK_NAME
=
"flow_status_snapshoot_lock"
;
@Resource
private
FlowMapper
flowMapper
;
@Resource
private
FlowStatusSnapshootMapper
flowStatusSnapshootMapper
;
@Resource
private
RunRecordingMapper
runRecordingMapper
;
@Resource
private
JobTaskRunLogMapper
jobTaskRunLogMapper
;
@Resource
private
DataSource
dataSource
;
@Value
(
"${myth-job.snapshoot-date}"
)
private
Integer
snapshootDate
;
private
static
final
DateTimeFormatter
DATE_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
@Override
public
Long
start
()
{
LocalDateTime
localDateTime
=
LocalDateTime
.
now
();
String
date
=
localDateTime
.
format
(
DATE_FORMATTER
);
String
hour
=
String
.
valueOf
(
localDateTime
.
getHour
());
Integer
num
=
flowStatusSnapshootMapper
.
exist
(
date
,
hour
);
//判断是否存储过快照
if
(
num
!=
null
&&
num
>=
1
){
return
(
60
-
LocalDateTime
.
now
().
getMinute
())
*
60
*
1000L
;
}
else
{
//获取所有在调度上的工作流
List
<
Flow
>
flowList
=
flowMapper
.
findONStartUp
();
if
(
flowList
!=
null
&&
flowList
.
size
()
>
0
){
LocalDateTime
hourDateTime
=
localDateTime
.
minusMinutes
(
localDateTime
.
getMinute
())
//减去分钟
.
minusSeconds
(
localDateTime
.
getSecond
())
//减去秒
.
minusNanos
(
localDateTime
.
getNano
());
//减去纳秒
Long
hourTime
=
hourDateTime
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
//转换时间戳
List
<
FlowStatusSnapshoot
>
flowStatusSnapshootList
=
new
ArrayList
<>();
flowList
.
forEach
(
flow
->
{
RunRecording
runRecording
=
runRecordingMapper
.
findMaxByFlowId
(
flow
.
getFlowId
());
if
(
runRecording
!=
null
){
//获取凌晨的时间戳
Long
time
=
LocalDate
.
now
().
atStartOfDay
(
ZoneOffset
.
ofHours
(
8
)).
toInstant
().
toEpochMilli
();
FlowStatusSnapshoot
flowStatusSnapshoot
=
new
FlowStatusSnapshoot
();
flowStatusSnapshoot
.
setDay
(
date
);
flowStatusSnapshoot
.
setFlowId
(
flow
.
getFlowId
());
flowStatusSnapshoot
.
setHour
(
hour
);
flowStatusSnapshoot
.
setFlowName
(
flow
.
getFlowName
());
flowStatusSnapshoot
.
setWorkspaceId
(
flow
.
getWorkspaceId
());
flowStatusSnapshoot
.
setSnapshootTime
(
hourTime
);
if
(
time
.
longValue
()
>
runRecording
.
getTriggerTime
().
longValue
()){
flowStatusSnapshoot
.
setFlowStatus
(
1
);
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
());
}
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
;
}
}
//获取运行实例下各类状态的节点数目
StatisticData
nodeStatistic
=
jobTaskRunLogMapper
.
findStatisticDataByRunIdAndFlowId
(
runRecording
.
getRunId
(),
flow
.
getFlowId
());
if
(
nodeStatistic
!=
null
){
int
sum
=
nodeStatistic
.
getFail
()
+
nodeStatistic
.
getSuccess
()
+
nodeStatistic
.
getRunIng
()
+
nodeStatistic
.
getKill
();
flowStatusSnapshoot
.
setUnstartNode
(
flow
.
getFlowNodeCount
()
-
sum
);
flowStatusSnapshoot
.
setRuningNode
(
nodeStatistic
.
getRunIng
());
flowStatusSnapshoot
.
setSuccessNode
(
nodeStatistic
.
getSuccess
());
flowStatusSnapshoot
.
setFailNode
(
nodeStatistic
.
getFail
());
flowStatusSnapshoot
.
setKillNode
(
nodeStatistic
.
getKill
());
}
else
{
nodeStatistic
.
setUnstart
(
flow
.
getFlowNodeCount
());
}
}
flowStatusSnapshootList
.
add
(
flowStatusSnapshoot
);
}
});
if
(
flowList
!=
null
&&
flowList
.
size
()
>
0
){
flowStatusSnapshootMapper
.
saveList
(
flowStatusSnapshootList
);
}
//获取过期的时间戳
Long
outTime
=
hourDateTime
.
minusDays
(
snapshootDate
).
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
//转换时间戳;
//删除超过期限的快照
flowStatusSnapshootMapper
.
deleteOutSnapShoot
(
outTime
);
}
}
return
(
60
-
LocalTime
.
now
().
getMinute
())
*
60
*
1000L
;
}
@Override
public
DataSource
getDataSource
()
{
return
dataSource
;
}
@Override
public
String
getLockName
()
{
return
LOCK_NAME
;
}
}
byit-myth-core/myth-admin-core/src/main/resources/Generator-config.xml
View file @
313d2ce8
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
type=
"XMLMAPPER"
>
type=
"XMLMAPPER"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"enableSubPackages"
value=
"false"
/>
</javaClientGenerator>
</javaClientGenerator>
<table
tableName=
"
waiting_task"
domainObjectName=
"WaitingTask
"
/>
<table
tableName=
"
flow_status_snapshoot"
domainObjectName=
"FlowStatusSnapshoot
"
/>
</context>
</context>
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/FlowMapper.xml
View file @
313d2ce8
...
@@ -61,18 +61,24 @@
...
@@ -61,18 +61,24 @@
where workspace_id = #{workspaceId}
where workspace_id = #{workspaceId}
and flow_name = #{flowName}
and flow_name = #{flowName}
</select>
</select>
<select
id=
"findFlowById"
result
Type=
"com.byit.model.Flow
"
>
<select
id=
"findFlowById"
result
Map=
"BaseResultMap
"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from flow
from flow
where flow_id = #{id,jdbcType=INTEGER}
where flow_id = #{id,jdbcType=INTEGER}
</select>
</select>
<select
id=
"findByWorkspace"
result
Type=
"com.byit.model.Flow
"
>
<select
id=
"findByWorkspace"
result
Map=
"BaseResultMap
"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from flow
from flow
where false = #{workspaceId,jdbcType=INTEGER}
where workspace_id = #{workspaceId,jdbcType=INTEGER}
</select>
<select
id=
"findONStartUp"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from flow
where start_up = '0'
</select>
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
0 → 100644
View file @
313d2ce8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.byit.mapper.FlowStatusSnapshootMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.byit.model.FlowStatusSnapshoot"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
<id
column=
"status_id"
jdbcType=
"INTEGER"
property=
"statusId"
/>
<result
column=
"workspace_id"
jdbcType=
"INTEGER"
property=
"workspaceId"
/>
<result
column=
"flow_id"
jdbcType=
"INTEGER"
property=
"flowId"
/>
<result
column=
"flow_name"
jdbcType=
"VARCHAR"
property=
"flowName"
/>
<result
column=
"day"
jdbcType=
"VARCHAR"
property=
"day"
/>
<result
column=
"hour"
jdbcType=
"VARCHAR"
property=
"hour"
/>
<result
column=
"flow_status"
jdbcType=
"INTEGER"
property=
"flowStatus"
/>
<result
column=
"snapshoot_time"
jdbcType=
"BIGINT"
property=
"snapshootTime"
/>
<result
column=
"unstart_node"
jdbcType=
"INTEGER"
property=
"unstartNode"
/>
<result
column=
"runing_node"
jdbcType=
"INTEGER"
property=
"runingNode"
/>
<result
column=
"success_node"
jdbcType=
"INTEGER"
property=
"successNode"
/>
<result
column=
"fail_node"
jdbcType=
"INTEGER"
property=
"failNode"
/>
<result
column=
"kill_node"
jdbcType=
"INTEGER"
property=
"killNode"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
status_id, workspace_id, flow_id, flow_name, `day`, `hour`, flow_status, snapshoot_time,
unstart_node, runing_node, success_node, fail_node, kill_node
</sql>
<select
id=
"getById"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
select
<include
refid=
"Base_Column_List"
/>
from flow_status_snapshoot
where status_id = #{statusId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
delete from flow_status_snapshoot
where status_id = #{statusId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
insert into flow_status_snapshoot (status_id, workspace_id, flow_id,
flow_name, `day`, `hour`,
flow_status, snapshoot_time, unstart_node,
runing_node, success_node, fail_node,
kill_node)
values (#{statusId,jdbcType=INTEGER}, #{workspaceId,jdbcType=INTEGER}, #{flowId,jdbcType=INTEGER},
#{flowName,jdbcType=VARCHAR}, #{day,jdbcType=VARCHAR}, #{hour,jdbcType=VARCHAR},
#{flowStatus,jdbcType=INTEGER}, #{snapshootTime,jdbcType=BIGINT}, #{unstartNode,jdbcType=INTEGER},
#{runingNode,jdbcType=INTEGER}, #{successNode,jdbcType=INTEGER}, #{failNode,jdbcType=INTEGER},
#{killNode,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
insert into flow_status_snapshoot
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"statusId != null"
>
status_id,
</if>
<if
test=
"workspaceId != null"
>
workspace_id,
</if>
<if
test=
"flowId != null"
>
flow_id,
</if>
<if
test=
"flowName != null"
>
flow_name,
</if>
<if
test=
"day != null"
>
`day`,
</if>
<if
test=
"hour != null"
>
`hour`,
</if>
<if
test=
"flowStatus != null"
>
flow_status,
</if>
<if
test=
"snapshootTime != null"
>
snapshoot_time,
</if>
<if
test=
"unstartNode != null"
>
unstart_node,
</if>
<if
test=
"runingNode != null"
>
runing_node,
</if>
<if
test=
"successNode != null"
>
success_node,
</if>
<if
test=
"failNode != null"
>
fail_node,
</if>
<if
test=
"killNode != null"
>
kill_node,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"statusId != null"
>
#{statusId,jdbcType=INTEGER},
</if>
<if
test=
"workspaceId != null"
>
#{workspaceId,jdbcType=INTEGER},
</if>
<if
test=
"flowId != null"
>
#{flowId,jdbcType=INTEGER},
</if>
<if
test=
"flowName != null"
>
#{flowName,jdbcType=VARCHAR},
</if>
<if
test=
"day != null"
>
#{day,jdbcType=VARCHAR},
</if>
<if
test=
"hour != null"
>
#{hour,jdbcType=VARCHAR},
</if>
<if
test=
"flowStatus != null"
>
#{flowStatus,jdbcType=INTEGER},
</if>
<if
test=
"snapshootTime != null"
>
#{snapshootTime,jdbcType=BIGINT},
</if>
<if
test=
"unstartNode != null"
>
#{unstartNode,jdbcType=INTEGER},
</if>
<if
test=
"runingNode != null"
>
#{runingNode,jdbcType=INTEGER},
</if>
<if
test=
"successNode != null"
>
#{successNode,jdbcType=INTEGER},
</if>
<if
test=
"failNode != null"
>
#{failNode,jdbcType=INTEGER},
</if>
<if
test=
"killNode != null"
>
#{killNode,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByIdSelective"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
update flow_status_snapshoot
<set>
<if
test=
"workspaceId != null"
>
workspace_id = #{workspaceId,jdbcType=INTEGER},
</if>
<if
test=
"flowId != null"
>
flow_id = #{flowId,jdbcType=INTEGER},
</if>
<if
test=
"flowName != null"
>
flow_name = #{flowName,jdbcType=VARCHAR},
</if>
<if
test=
"day != null"
>
`day` = #{day,jdbcType=VARCHAR},
</if>
<if
test=
"hour != null"
>
`hour` = #{hour,jdbcType=VARCHAR},
</if>
<if
test=
"flowStatus != null"
>
flow_status = #{flowStatus,jdbcType=INTEGER},
</if>
<if
test=
"snapshootTime != null"
>
snapshoot_time = #{snapshootTime,jdbcType=BIGINT},
</if>
<if
test=
"unstartNode != null"
>
unstart_node = #{unstartNode,jdbcType=INTEGER},
</if>
<if
test=
"runingNode != null"
>
runing_node = #{runingNode,jdbcType=INTEGER},
</if>
<if
test=
"successNode != null"
>
success_node = #{successNode,jdbcType=INTEGER},
</if>
<if
test=
"failNode != null"
>
fail_node = #{failNode,jdbcType=INTEGER},
</if>
<if
test=
"killNode != null"
>
kill_node = #{killNode,jdbcType=INTEGER},
</if>
</set>
where status_id = #{statusId,jdbcType=INTEGER}
</update>
<update
id=
"updateById"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
<!-- generated @mbg.generated date: 2020-04-02 -->
update flow_status_snapshoot
set workspace_id = #{workspaceId,jdbcType=INTEGER},
flow_id = #{flowId,jdbcType=INTEGER},
flow_name = #{flowName,jdbcType=VARCHAR},
`day` = #{day,jdbcType=VARCHAR},
`hour` = #{hour,jdbcType=VARCHAR},
flow_status = #{flowStatus,jdbcType=INTEGER},
snapshoot_time = #{snapshootTime,jdbcType=BIGINT},
unstart_node = #{unstartNode,jdbcType=INTEGER},
runing_node = #{runingNode,jdbcType=INTEGER},
success_node = #{successNode,jdbcType=INTEGER},
fail_node = #{failNode,jdbcType=INTEGER},
kill_node = #{killNode,jdbcType=INTEGER}
where status_id = #{statusId,jdbcType=INTEGER}
</update>
<select
id=
"exist"
resultType=
"java.lang.Integer"
>
select count(1)
from flow_status_snapshoot
where 'day' = #{date} and `hour` = #{hour}
</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 from flow_status_snapshoot
where snapshoot_time = #{outTime,jdbcType=BIGINT}
</delete>
<insert
id=
"saveList"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
INSERT INTO flow_status_snapshoot
(
status_id, workspace_id, flow_id,
flow_name, `day`, `hour`,
flow_status, snapshoot_time, unstart_node,
runing_node, success_node, fail_node,
kill_node
)
VALUES
<foreach
collection=
"flowStatusSnapshootList"
item=
"flowStatusSnapshoot"
separator=
","
>
(
#{flowStatusSnapshoot.statusId,jdbcType=INTEGER},
#{flowStatusSnapshoot.workspaceId,jdbcType=INTEGER},
#{flowStatusSnapshoot.flowId,jdbcType=INTEGER},
#{flowStatusSnapshoot.flowName,jdbcType=VARCHAR},
#{flowStatusSnapshoot.day,jdbcType=VARCHAR},
#{flowStatusSnapshoot.hour,jdbcType=VARCHAR},
#{flowStatusSnapshoot.flowStatus,jdbcType=INTEGER},
#{flowStatusSnapshoot.snapshootTime,jdbcType=BIGINT},
#{flowStatusSnapshoot.unstartNode,jdbcType=INTEGER},
#{flowStatusSnapshoot.runingNode,jdbcType=INTEGER},
#{flowStatusSnapshoot.successNode,jdbcType=INTEGER},
#{flowStatusSnapshoot.failNode,jdbcType=INTEGER},
#{flowStatusSnapshoot.killNode,jdbcType=INTEGER},
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
View file @
313d2ce8
...
@@ -121,6 +121,31 @@
...
@@ -121,6 +121,31 @@
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.dto.plugin.StatisticData"
>
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
>
= ${startDate}
and end_time
<
= ${endDate}
<if
test=
"flowIds != null"
>
and flow_id in (
<foreach
collection=
"flowIds"
item=
"flowId"
separator=
","
>
#{flowId}
</foreach>
)
</if>
</select>
<select
id=
"findStatisticDataByRunIdAndFlowId"
resultType=
"com.byit.dto.plugin.StatisticData"
>
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 run_id = #{runId}
and flow_id = #{flowId}
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
delete from job_task_run_log
delete from job_task_run_log
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
313d2ce8
...
@@ -148,6 +148,33 @@
...
@@ -148,6 +148,33 @@
where flow_id = #{flowId}
where flow_id = #{flowId}
and flow_status != '4'
and flow_status != '4'
</select>
</select>
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
>
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,
sum(case when flow_status='4' and (flow_run_result = '1' or flow_run_result = '3') then 1 else 0 end ) success,
sum(case when flow_status='4' and (flow_run_result = '2' or flow_run_result = '4') then 1 else 0 end ) fail,
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
from run_recording
where start_time
>
= ${startDate}
and end_time
<
= ${endDate}
<if
test=
"flowIds != null"
>
and flow_id in (
<foreach
collection=
"flowIds"
item=
"flowId"
separator=
","
>
#{flowId}
</foreach>
)
</if>
</select>
<select
id=
"findMaxByFlowId"
resultType=
"com.byit.model.RunRecording"
>
select
<include
refid=
"Base_Column_List"
/>
from run_recording
where flow_id = #{flowId}
and trigger_time = (select max(trigger_time)
from run_recording
where flow_id = #{flowId}
)
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<!-- generated @mbg.generated date: 2019-12-25 -->
<!-- generated @mbg.generated date: 2019-12-25 -->
...
...
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/plugin/CollectData.java
0 → 100644
View file @
313d2ce8
package
com
.
byit
.
dto
.
plugin
;
import
lombok.Data
;
import
java.util.Map
;
/**
* @Description 汇总数据
* @Author guo_m
* @Date 2020-04-01
*/
@Data
public
class
CollectData
{
/**
* 工作流的汇总
*/
private
StatisticData
flowData
;
/**
* 节点的汇总
*/
private
StatisticData
nodeData
;
/**
* 按时间段的汇总
*/
private
Map
<
String
,
StatisticData
>
collectMap
;
}
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/plugin/StatisticData.java
0 → 100644
View file @
313d2ce8
package
com
.
byit
.
dto
.
plugin
;
import
lombok.Data
;
/**
* @Description 统计数据
* @Author guo_m
* @Date 2020-04-01
*/
@Data
public
class
StatisticData
{
/**
* 未开始
*/
private
int
unstart
;
/**
* 运行中
*/
private
int
runIng
;
/**
* 停止的
*/
private
int
stop
;
/**
* 成功
*/
private
int
success
;
/**
* 失败
*/
private
int
fail
;
/**
* 杀死
*/
private
int
kill
;
}
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