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
a4e09c98
Commit
a4e09c98
authored
Oct 29, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加查询运行实例状态的节接口
parent
19288267
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
272 additions
and
3 deletions
+272
-3
ApiFlowFindController.java
...min/src/main/java/com/byit/api/ApiFlowFindController.java
+30
-0
ApiFlowFindService.java
...in/src/main/java/com/byit/service/ApiFlowFindService.java
+18
-0
ApiFlowFindServiceImpl.java
...in/java/com/byit/service/impl/ApiFlowFindServiceImpl.java
+89
-0
RunRecordingEnum.java
...n-core/src/main/java/com/byit/enums/RunRecordingEnum.java
+5
-1
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+13
-0
RunRecordingService.java
...e/src/main/java/com/byit/service/RunRecordingService.java
+7
-0
RunRecordingServiceImpl.java
...n/java/com/byit/service/impl/RunRecordingServiceImpl.java
+5
-0
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+15
-0
RunRecordingStatusDto.java
...in/java/com/byit/dto/recording/RunRecordingStatusDto.java
+43
-0
SelectRecordingStatusCondition.java
...om/byit/dto/recording/SelectRecordingStatusCondition.java
+21
-0
MakeUpReturn.java
...ore/src/main/java/com/byit/dto/specials/MakeUpReturn.java
+4
-1
SpecialJobParam.java
.../src/main/java/com/byit/dto/specials/SpecialJobParam.java
+3
-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/ApiFlowFindController.java
0 → 100644
View file @
a4e09c98
package
com
.
byit
.
api
;
import
com.byit.dto.recording.RunRecordingStatusDto
;
import
com.byit.dto.recording.SelectRecordingStatusCondition
;
import
com.byit.service.ApiFlowFindService
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @author huangfu
*/
@Api
(
tags
=
"工作流查询api"
)
@RestController
@RequestMapping
(
"api/find/flow/"
)
public
class
ApiFlowFindController
{
private
final
ApiFlowFindService
apiFlowFindService
;
public
ApiFlowFindController
(
ApiFlowFindService
apiFlowFindService
)
{
this
.
apiFlowFindService
=
apiFlowFindService
;
}
@RequestMapping
(
"findRunRecordingStatusByRunId"
)
public
List
<
RunRecordingStatusDto
>
findRunRecordingStatusByRunId
(
@RequestBody
SelectRecordingStatusCondition
selectRecordingStatusCondition
){
return
apiFlowFindService
.
findRunRecordingStatusByRunId
(
selectRecordingStatusCondition
);
}
}
byit-myth-admin/src/main/java/com/byit/service/ApiFlowFindService.java
0 → 100644
View file @
a4e09c98
package
com
.
byit
.
service
;
import
com.byit.dto.recording.RunRecordingStatusDto
;
import
com.byit.dto.recording.SelectRecordingStatusCondition
;
import
java.util.List
;
/**
* @author huangfu
*/
public
interface
ApiFlowFindService
{
/**
* 查询实例状态 基于RunId
* @param selectRecordingStatusCondition 查询条件
* @return 对应的实例状态信息
*/
List
<
RunRecordingStatusDto
>
findRunRecordingStatusByRunId
(
SelectRecordingStatusCondition
selectRecordingStatusCondition
);
}
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowFindServiceImpl.java
0 → 100644
View file @
a4e09c98
package
com
.
byit
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.byit.dto.recording.RunRecordingStatusDto
;
import
com.byit.dto.recording.SelectRecordingStatusCondition
;
import
com.byit.enums.RunRecordingEnum
;
import
com.byit.mapper.RunRecordingMapper
;
import
com.byit.model.RunRecording
;
import
com.byit.service.ApiFlowFindService
;
import
com.byit.utils.ValidationUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 工作流查询实例
*
* @author huangfu
* @date 2020年10月29日18:01:40
*/
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Slf4j
public
class
ApiFlowFindServiceImpl
implements
ApiFlowFindService
{
private
final
RunRecordingMapper
runRecordingMapper
;
public
ApiFlowFindServiceImpl
(
RunRecordingMapper
runRecordingMapper
)
{
this
.
runRecordingMapper
=
runRecordingMapper
;
}
@Override
public
List
<
RunRecordingStatusDto
>
findRunRecordingStatusByRunId
(
SelectRecordingStatusCondition
selectRecordingStatusCondition
)
{
ValidationUtil
.
dataNotNull
(
selectRecordingStatusCondition
,
"查询条件不允许为空!"
);
List
<
String
>
runIds
=
selectRecordingStatusCondition
.
getRunIds
();
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
runIds
),
"运行标识不允许为空!"
);
//获取对应的工作流实例
List
<
RunRecording
>
allRunRecordingByRunIds
=
runRecordingMapper
.
findAllRunRecordingByRunIds
(
runIds
);
log
.
debug
(
"---------查询到有{}个实例-------"
,
allRunRecordingByRunIds
);
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
allRunRecordingByRunIds
),
"没有找到运行标识对应的运行实例!"
);
return
buildRunRecordingStatus
(
allRunRecordingByRunIds
);
}
/**
* 构建运行实例
* @param allRunRecordingByRunIds 所有的实例表
* @return 对应实例的状态
*/
private
List
<
RunRecordingStatusDto
>
buildRunRecordingStatus
(
List
<
RunRecording
>
allRunRecordingByRunIds
){
return
allRunRecordingByRunIds
.
stream
().
map
(
runRecording
->
{
RunRecordingStatusDto
runRecordingStatusDto
=
new
RunRecordingStatusDto
();
runRecordingStatusDto
.
setFlowName
(
runRecording
.
getFlowName
());
runRecordingStatusDto
.
setRunId
(
runRecording
.
getRunId
());
//工作流实例处于未开始的状态
if
(
RunRecordingEnum
.
FLOW_STATUS_NOT_RUN
.
getCode
().
equals
(
runRecording
.
getFlowStatus
())){
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
QUEUE_ING
);
}
else
if
(
RunRecordingEnum
.
FLOW_STATUS_RUN_ING
.
getCode
().
equals
(
runRecording
.
getFlowStatus
()))
{
//运行中
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
RUN_ING
);
}
else
if
(
RunRecordingEnum
.
FLOW_STATUS_IS_STOP
.
getCode
().
equals
(
RunRecordingStatusDto
.
RUN_ING
)){
//运行中
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
RUN_ING
);
}
else
if
(
RunRecordingEnum
.
FLOW_STATUS_IS_END
.
getCode
().
equals
(
runRecording
.
getFlowStatus
())){
//完结状态
//成功状态 正常成功
if
(
RunRecordingEnum
.
RUN_FLOW_SUCCESS
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())){
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
SUCCESS
);
}
else
if
(
RunRecordingEnum
.
RUN_FLOW_RE_SUCCESS
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())){
//补批成功
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
SUCCESS
);
}
else
if
(
RunRecordingEnum
.
RUN_FLOW_FAILURE
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())){
//补批失败
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
FAILURE
);
}
else
if
(
RunRecordingEnum
.
RUN_FLOW_RE_FAILURE
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())){
//补批失败
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
FAILURE
);
}
else
if
(
RunRecordingEnum
.
RUN_FLOW_KILL
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())){
//补批失败
runRecordingStatusDto
.
setStatus
(
RunRecordingStatusDto
.
FAILURE
);
}
}
return
runRecordingStatusDto
;
}).
collect
(
Collectors
.
toList
());
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/enums/RunRecordingEnum.java
View file @
a4e09c98
package
com
.
byit
.
enums
;
/**
* @description: 运行记录的枚举类
* @description: 运行记录
状态
的枚举类
* @author huangfu
*/
...
...
@@ -11,10 +11,14 @@ public enum RunRecordingEnum {
,
RUN_FLOW_RE_SUCCESS
(
"3"
,
"补批成功"
)
,
RUN_FLOW_RE_FAILURE
(
"4"
,
"补批失败"
)
,
RUN_FLOW_KILL
(
"5"
,
"工作流进程被杀死"
)
,
FLOW_STATUS_NOT_RUN
(
"1"
,
"工作流未开始"
)
,
FLOW_STATUS_RUN_ING
(
"2"
,
"工作流运行中"
)
,
FLOW_STATUS_IS_STOP
(
"3"
,
"工作流被暂停"
)
,
FLOW_STATUS_IS_END
(
"4"
,
"工作流已经完结"
)
,
FAIL_FAST_NO
(
"0"
,
"不快速失败"
)
,
FAIL_FAST_YES
(
"1"
,
"快速失败"
)
;
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
a4e09c98
...
...
@@ -26,6 +26,19 @@ public interface RunRecordingMapper {
*/
List
<
RunRecording
>
findThisDayRunRecording
(
StatisticsConditionDto
statisticsConditionDto
);
/**
* 基于运行标识的集合查询运行实例
* @param runIds
* @return
*/
List
<
RunRecording
>
findAllRunRecordingByRunIds
(
@Param
(
"runIds"
)
List
<
String
>
runIds
);
/**
* 查询该工作流中运行中的数据
* @param flowName
* @param workspaceId
* @return
*/
RunRecording
runIngRunRecording
(
@Param
(
"flowName"
)
String
flowName
,
@Param
(
"workspaceId"
)
Integer
workspaceId
);
/**
* 查询全部的数据
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/RunRecordingService.java
View file @
a4e09c98
...
...
@@ -34,6 +34,13 @@ public interface RunRecordingService {
List
<
RunRecording
>
findAll
(
FlowConditionDto
flowConditionDto
);
/**
* 查询运行实例,基于RunId
* @param runIds 运行标识
* @return 对应的运行状态
*/
List
<
RunRecording
>
findAllById
(
List
<
String
>
runIds
);
/**
*
* @param runRecordingStatus
* @return
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/RunRecordingServiceImpl.java
View file @
a4e09c98
...
...
@@ -79,6 +79,11 @@ public class RunRecordingServiceImpl implements RunRecordingService {
}
@Override
public
List
<
RunRecording
>
findAllById
(
List
<
String
>
runIds
)
{
return
null
;
}
@Override
public
boolean
findNoEnd
(
RunRecordingStatus
runRecordingStatus
)
{
ValidationUtil
.
dataNotNull
(
runRecordingStatus
,
"查询实体不能为Null"
);
ValidationUtil
.
dataNotBank
(
runRecordingStatus
.
getFlowName
(),
"工作流名称不能为null"
);
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
a4e09c98
...
...
@@ -51,6 +51,21 @@
</if>
</select>
<select
id=
"findAllRunRecordingByRunIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
run_recording
where
run_id in (
<foreach
collection=
"runIds"
item=
"runId"
separator=
","
>
#{runId}
</foreach>
)
</select>
<select
id=
"findAll"
parameterType=
"com.byit.dto.FlowConditionDto"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/recording/RunRecordingStatusDto.java
0 → 100644
View file @
a4e09c98
package
com
.
byit
.
dto
.
recording
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @author huangfu
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
RunRecordingStatusDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7290004508246344162L
;
/**
* 排队中
*/
public
static
final
String
QUEUE_ING
=
"1"
;
/**
* 运行中
*/
public
static
final
String
RUN_ING
=
"2"
;
/**
* 成功
*/
public
static
final
String
SUCCESS
=
"3"
;
/**
* 失败
*/
public
static
final
String
FAILURE
=
"4"
;
private
String
flowName
;
private
String
runId
;
/**
* 对应DDMP的质检状态: 1:排队中; 2:质检中; 3:质检完成; 4:质检失败
* 对应调度的运行状态: 1:未开始; 2:运行中/暂停中 4-1|4-3:成功 4-2|4-4|4-5:失败
*/
private
String
status
;
private
String
statusDetails
=
"1:排队中; 2:质检中; 3:质检完成; 4:质检失败"
;
}
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/recording/SelectRecordingStatusCondition.java
0 → 100644
View file @
a4e09c98
package
com
.
byit
.
dto
.
recording
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 查询实例状态的的参数列表
*
* @author huangfu
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
SelectRecordingStatusCondition
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8489569647307394582L
;
List
<
String
>
runIds
;
}
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/specials/MakeUpReturn.java
View file @
a4e09c98
...
...
@@ -4,13 +4,16 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @author huangfu
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
MakeUpReturn
{
public
class
MakeUpReturn
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2055527438048313575L
;
private
String
flowName
;
private
String
runId
;
}
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/specials/SpecialJobParam.java
View file @
a4e09c98
...
...
@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -18,7 +19,8 @@ import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
SpecialJobParam
{
public
class
SpecialJobParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3500449584024580678L
;
/**
* 工作空间名称
*/
...
...
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
a4e09c98
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.byit.dto.api.JavaCallbackLogDto
;
import
com.byit.dto.executor.PluginBeanJobInfo
;
import
com.byit.dto.plugin.*
;
import
com.byit.dto.recording.SelectRecordingStatusCondition
;
import
com.byit.dto.specials.RepairFlow
;
import
com.byit.dto.specials.SpecialJobParam
;
import
com.byit.dto.web.ResponseResult
;
...
...
@@ -41,6 +42,11 @@ public class JobUtils {
private
static
final
String
REQUEST_ADD_JOB_RESOURCES_SUFFIX
=
"/job/addJob"
;
/**
* 根据运行标识查询工作流的状态
*/
private
static
final
String
FIND_RUNRECORDING_STATUS_BY_RUNID
=
"/api/find/flow/findRunRecordingStatusByRunId"
;
private
static
final
String
KILL_NODE_RUN_ING
=
"/api/node/killNode"
;
...
...
@@ -273,6 +279,19 @@ public class JobUtils {
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
* 查询工作流实例的状态
*
* @return
*/
public
static
ResponseResult
findRunRecordingStatusByRunId
(
SelectRecordingStatusCondition
selectRecordingStatusCondition
)
{
log
.
debug
(
"-------------查询工作流实例的状态{}----------------------"
,
selectRecordingStatusCondition
);
String
response
=
createHttpRequest
(
FIND_RUNRECORDING_STATUS_BY_RUNID
,
JSON
.
toJSONString
(
selectRecordingStatusCondition
,
WriteClassName
));
log
.
debug
(
"-------------查询工作流实例的状态:{}----------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
public
static
ResponseResult
findNoeEnd
(
RunRecordingStatus
runRecordingStatus
)
{
log
.
debug
(
"-------------查询工作流实例是否全部完结{}----------------------"
,
runRecordingStatus
);
...
...
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