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
2f91a636
Commit
2f91a636
authored
May 28, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
00765861
c0d36ed8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
26 deletions
+67
-26
ApiFlowController.java
...h-admin/src/main/java/com/byit/api/ApiFlowController.java
+7
-0
ApiFlowService.java
...-admin/src/main/java/com/byit/service/ApiFlowService.java
+9
-0
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+30
-8
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+21
-18
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+0
-0
No files found.
byit-myth-admin/src/main/java/com/byit/api/ApiFlowController.java
View file @
2f91a636
...
@@ -55,6 +55,13 @@ public class ApiFlowController {
...
@@ -55,6 +55,13 @@ public class ApiFlowController {
return
ResponseResult
.
ok
(
"SUCCESS"
);
return
ResponseResult
.
ok
(
"SUCCESS"
);
}
}
@PostMapping
(
"exist"
)
@ApiOperation
(
"判断工作流是否存在"
)
public
ResponseResult
exist
(
String
param
)
throws
ParseException
{
Boolean
result
=
apiFlowService
.
exist
(
param
);
return
ResponseResult
.
ok
(
result
);
}
@PostMapping
(
"repealSchedule"
)
@PostMapping
(
"repealSchedule"
)
@ApiOperation
(
"撤销工作流调度,只可以撤销总工作流,若为内嵌工作流不允许撤销"
)
@ApiOperation
(
"撤销工作流调度,只可以撤销总工作流,若为内嵌工作流不允许撤销"
)
public
ResponseResult
repealSchedule
(
String
param
)
throws
ParseException
{
public
ResponseResult
repealSchedule
(
String
param
)
throws
ParseException
{
...
...
byit-myth-admin/src/main/java/com/byit/service/ApiFlowService.java
View file @
2f91a636
...
@@ -103,4 +103,13 @@ public interface ApiFlowService {
...
@@ -103,4 +103,13 @@ public interface ApiFlowService {
* @return
* @return
*/
*/
Map
<
String
,
RunRecording
>
loadCurrentStatus
(
String
param
);
Map
<
String
,
RunRecording
>
loadCurrentStatus
(
String
param
);
/**
* 功能描述 判断工作流是否存在
* @author gml
* @date 2020-05-27 10:12
* @param param
* @return java.lang.Boolean
*/
Boolean
exist
(
String
param
);
}
}
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
2f91a636
...
@@ -1090,6 +1090,25 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -1090,6 +1090,25 @@ public class ApiFlowServiceImpl implements ApiFlowService {
return
statusMap
;
return
statusMap
;
}
}
@Override
public
Boolean
exist
(
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
+
"工作空间不存在"
);
//获取工作流名称
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
if
(
null
==
flow
){
return
false
;
}
return
true
;
}
/**
/**
* runState 补批机制 1 补批当前节点 2 补批当前节点及以下节点
* runState 补批机制 1 补批当前节点 2 补批当前节点及以下节点
* @param param
* @param param
...
@@ -1412,12 +1431,15 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -1412,12 +1431,15 @@ public class ApiFlowServiceImpl implements ApiFlowService {
List
<
RunRecording
>
recordingList
=
runRecordingMapper
.
findOnScheduleByFlowId
(
flow
.
getFlowId
());
List
<
RunRecording
>
recordingList
=
runRecordingMapper
.
findOnScheduleByFlowId
(
flow
.
getFlowId
());
ValidationUtil
.
isTrueValidation
(
null
!=
recordingList
&&
recordingList
.
size
()
>
0
,
"工作流已在调度中不允许撤销调度!"
);
ValidationUtil
.
isTrueValidation
(
null
!=
recordingList
&&
recordingList
.
size
()
>
0
,
"工作流已在调度中不允许撤销调度!"
);
List
<
RunRecording
>
unStartRecordingList
=
runRecordingMapper
.
findUnStartByFlowId
(
flow
.
getFlowId
());
List
<
RunRecording
>
unStartRecordingList
=
runRecordingMapper
.
findUnStartByFlowId
(
flow
.
getFlowId
());
//删除对应的task记录
if
(
null
!=
unStartRecordingList
&&
unStartRecordingList
.
size
()
>
0
){
unStartRecordingList
.
forEach
(
runRecording
->
{
//删除对应的task记录
ValidationUtil
.
isTrueValidation
((
runRecording
.
getTriggerTime
()
-
System
.
currentTimeMillis
())
<
10000
,
"工作流已在调度中不允许撤销调度"
);
unStartRecordingList
.
forEach
(
runRecording
->
{
runRecordingMapper
.
deleteByRunId
(
runRecording
.
getRunId
());
ValidationUtil
.
isTrueValidation
((
runRecording
.
getTriggerTime
()
-
System
.
currentTimeMillis
())
<
10000
,
"工作流已在调度中不允许撤销调度"
);
jobTaskMapper
.
deleteByRunId
(
runRecording
.
getRunId
());
runRecordingMapper
.
deleteByRunId
(
runRecording
.
getRunId
());
});
jobTaskMapper
.
deleteByRunId
(
runRecording
.
getRunId
());
});
}
//撤销工作流调度
//撤销工作流调度
updateFlowStart
(
flow
,
false
);
updateFlowStart
(
flow
,
false
);
...
@@ -1434,10 +1456,10 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -1434,10 +1456,10 @@ public class ApiFlowServiceImpl implements ApiFlowService {
flow
.
setStartUp
(
FlowPropertyEnum
.
IS_START
.
getCode
());
flow
.
setStartUp
(
FlowPropertyEnum
.
IS_START
.
getCode
());
//如果是周期调度修改下次执行时间
//如果是周期调度修改下次执行时间
if
(
FlowPropertyEnum
.
SCHEDULE_MODE
.
getCode
().
equals
(
flow
.
getExecType
())){
if
(
FlowPropertyEnum
.
SCHEDULE_MODE
.
getCode
().
equals
(
flow
.
getExecType
())){
flow
.
setTriggerNextTime
(
new
CronExpression
(
flow
.
getFlowCron
()).
getNextValidTimeAfter
(
new
Date
()).
getTime
());
}
}
}
else
{
}
else
{
flow
.
setStartUp
(
FlowPropertyEnum
.
NO_START
.
getCode
());
flow
.
setStartUp
(
FlowPropertyEnum
.
NO_START
.
getCode
());
flow
.
setTriggerNextTime
(
new
CronExpression
(
flow
.
getFlowCron
()).
getNextValidTimeAfter
(
new
Date
()).
getTime
());
}
}
flowMapper
.
updateByIdSelective
(
flow
);
flowMapper
.
updateByIdSelective
(
flow
);
List
<
Node
>
nodeList
=
nodeMapper
.
findVirtualByFlowId
(
flow
.
getFlowId
());
List
<
Node
>
nodeList
=
nodeMapper
.
findVirtualByFlowId
(
flow
.
getFlowId
());
...
@@ -1468,7 +1490,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -1468,7 +1490,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
ValidationUtil
.
isTrueValidation
(
FlowPropertyEnum
.
IS_INNER
.
getCode
().
equals
(
flow
.
getIsInner
()),
"内嵌工作流不允许停止调度!"
);
ValidationUtil
.
isTrueValidation
(
FlowPropertyEnum
.
IS_INNER
.
getCode
().
equals
(
flow
.
getIsInner
()),
"内嵌工作流不允许停止调度!"
);
//判断是否在调度中
//判断是否在调度中
List
<
RunRecording
>
recordingList
=
runRecordingMapper
.
find
OnSchedule
ByFlowId
(
flow
.
getFlowId
());
List
<
RunRecording
>
recordingList
=
runRecordingMapper
.
find
UnFinish
ByFlowId
(
flow
.
getFlowId
());
ValidationUtil
.
isTrueValidation
(
null
==
recordingList
||
recordingList
.
size
()
==
0
,
flowName
+
"工作流没有正在运行的调度!"
);
ValidationUtil
.
isTrueValidation
(
null
==
recordingList
||
recordingList
.
size
()
==
0
,
flowName
+
"工作流没有正在运行的调度!"
);
StringBuffer
runids
=
new
StringBuffer
();
StringBuffer
runids
=
new
StringBuffer
();
//暂停工作流调度
//暂停工作流调度
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
2f91a636
...
@@ -209,6 +209,7 @@
...
@@ -209,6 +209,7 @@
from run_recording
from run_recording
where run_id = #{runId,jdbcType=VARCHAR} and flow_name = #{flowName,jdbcType=VARCHAR} and schedule_type != 4
where run_id = #{runId,jdbcType=VARCHAR} and flow_name = #{flowName,jdbcType=VARCHAR} and schedule_type != 4
</select>
</select>
<select
id=
"findUnFinishByFlowId"
resultMap=
"BaseResultMap"
>
<select
id=
"findUnFinishByFlowId"
resultMap=
"BaseResultMap"
>
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
@@ -216,24 +217,26 @@
...
@@ -216,24 +217,26 @@
where flow_id = #{flowId}
where flow_id = #{flowId}
and flow_status != '4' and schedule_type != 4
and flow_status != '4' and schedule_type != 4
</select>
</select>
<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,
<select
id=
"findStatusByStartAndEndTime"
resultType=
"com.byit.dto.plugin.StatisticData"
useCache=
"false"
flushCache=
"true"
>
sum(case when flow_status='2' then 1 else 0 end ) runIng,
select sum(case when flow_status = '1' then 1 else 0 end ) unstart,
sum(case when flow_status='3' then 1 else 0 end ) stop,
sum(case when flow_status='2' then 1 else 0 end ) runIng,
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='3' then 1 else 0 end ) stop,
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_status='4' and (flow_run_result = '1' or flow_run_result = '3') then 1 else 0 end ) success,
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
sum(case when flow_status='4' and (flow_run_result = '2' or flow_run_result = '4') then 1 else 0 end ) fail,
from run_recording
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
where (end_time
<
= #{endTime} or start_time
<
= #{endTime})
from run_recording
and start_time
>
= #{startTime} and schedule_type != 4
where (end_time
<
= #{endTime} or start_time
<
= #{endTime})
<if
test=
"flowIdList != null"
>
and start_time
>
= #{startTime} and schedule_type != 4
and flow_id in (
<if
test=
"flowIdList != null"
>
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
and flow_id in (
#{flowId}
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
</foreach>
#{flowId}
)
</foreach>
</if>
)
</select>
</if>
</select>
<select
id=
"findMaxByFlowId"
resultMap=
"BaseResultMap"
>
<select
id=
"findMaxByFlowId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
select
<include
refid=
"Base_Column_List"
/>
from run_recording
from run_recording
...
...
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
2f91a636
This diff is collapsed.
Click to expand it.
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