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
e08ba1e0
Commit
e08ba1e0
authored
Apr 24, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加获取当前工作流状态接口
parent
a32245c5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
1 deletion
+88
-1
ApiFlowController.java
...h-admin/src/main/java/com/byit/api/ApiFlowController.java
+8
-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
+30
-0
FlowMapper.java
...-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
+2
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+8
-0
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+13
-1
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+19
-0
No files found.
byit-myth-admin/src/main/java/com/byit/api/ApiFlowController.java
View file @
e08ba1e0
...
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 工作流操作的API接口
...
...
@@ -185,4 +186,11 @@ public class ApiFlowController {
return
ResponseResult
.
ok
(
collectData
);
}
@PostMapping
(
"/loadCurrentStatus"
)
@ApiOperation
(
"获取当前的工作流运行状态"
)
public
ResponseResult
loadCurrentStatus
(
String
param
){
Map
<
String
,
RunRecording
>
statusMap
=
apiFlowService
.
loadCurrentStatus
(
param
);
return
ResponseResult
.
ok
(
statusMap
);
}
}
byit-myth-admin/src/main/java/com/byit/service/ApiFlowService.java
View file @
e08ba1e0
...
...
@@ -7,6 +7,7 @@ import com.byit.model.vo.RunRecordingVo;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
/**
* @description: 工作流的api请求业务处理接口
...
...
@@ -95,4 +96,11 @@ public interface ApiFlowService {
* @return
*/
CollectData
loadNodeStatisticData
(
String
param
);
/**
* 获取工作流的当前状态
* @param param
* @return
*/
Map
<
String
,
RunRecording
>
loadCurrentStatus
(
String
param
);
}
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
e08ba1e0
...
...
@@ -893,6 +893,36 @@ public class ApiFlowServiceImpl implements ApiFlowService {
return
collectData
;
}
@Override
public
Map
<
String
,
RunRecording
>
loadCurrentStatus
(
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
flowNames
=
jsonObject
.
getString
(
"flowNames"
);
ValidationUtil
.
dataNotBank
(
flowNames
,
"工作流名称不允许为空!"
);
List
<
String
>
flowNameList
=
Arrays
.
asList
(
flowNames
.
split
(
","
));
List
<
Flow
>
flowList
=
new
ArrayList
<>();
flowNameList
.
forEach
(
flowName
->{
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
flowList
.
add
(
flow
);
});
Map
<
String
,
RunRecording
>
statusMap
=
new
HashMap
<>();
flowList
.
forEach
(
flow
->
{
RunRecording
runRecording
=
runRecordingMapper
.
findNewStatus
(
flow
.
getFlowId
());
statusMap
.
put
(
flow
.
getFlowName
(),
runRecording
);
});
return
statusMap
;
}
/**
* runState 补批机制 1 补批当前节点 2 补批当前节点及以下节点
* @param param
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
View file @
e08ba1e0
...
...
@@ -54,4 +54,5 @@ public interface FlowMapper {
* @return
*/
List
<
Flow
>
findAll
();
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
e08ba1e0
...
...
@@ -180,4 +180,11 @@ public interface RunRecordingMapper {
* @return
*/
List
<
RunRecording
>
findByPreTime
(
@Param
(
"preHourDate"
)
Date
preHourDate
,
@Param
(
"flowId"
)
Integer
flowId
);
/**
* 根据flowid获取最新的运行实例
* @param flowId
* @return
*/
RunRecording
findNewStatus
(
Integer
flowId
);
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
e08ba1e0
...
...
@@ -194,7 +194,19 @@
)
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<select
id=
"findNewStatus"
resultMap=
"BaseResultMap"
>
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"
>
<!-- generated @mbg.generated date: 2019-12-25 -->
delete from run_recording
where recording_id = #{recordingId,jdbcType=INTEGER}
...
...
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
e08ba1e0
...
...
@@ -101,6 +101,10 @@ public class JobUtils {
*/
public
static
final
String
REQUEST_LOADNODESTATISTICDATA
=
"/api/flow/loadNodeStatisticData"
;
/**
* 获取当前的工作流运行状态
*/
public
static
final
String
REQUEST_LOADCURRENTSTATUS
=
"/api/flow/loadCurrentStatus"
;
/**
* 补批工作流
*/
public
static
final
String
REQUEST_REPAIRFLOW
=
"/api/flow/repairFlow"
;
...
...
@@ -424,6 +428,21 @@ public class JobUtils {
}
/**
* 获取当前的工作流运行状态
* @param workspaceName 工作空间名称
* @param flowNames 工作流名称,多个以","分割
* @return
*/
public
static
ResponseResult
loadCurrentStatus
(
String
workspaceName
,
String
flowNames
){
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"workspaceName"
,
workspaceName
);
param
.
put
(
"flowNames"
,
flowNames
);
String
response
=
createHttpRequest
(
REQUEST_LOADCURRENTSTATUS
,
"param="
+
JSON
.
toJSONString
(
param
));
log
.
info
(
"--------------------获取当前的工作流运行状态接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
* 补批工作流
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
...
...
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