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
bfc919f6
Commit
bfc919f6
authored
Sep 25, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用工作流名称开启工作流
parent
e5167cde
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
7 deletions
+59
-7
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
+2
-0
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+23
-1
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+1
-1
RunRecordingService.java
...e/src/main/java/com/byit/service/RunRecordingService.java
+1
-1
RunRecordingServiceImpl.java
...n/java/com/byit/service/impl/RunRecordingServiceImpl.java
+2
-2
JavaFlowFreeTaskCallbackThread.java
.../java/com/byit/thread/JavaFlowFreeTaskCallbackThread.java
+9
-1
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+1
-1
SpecialJavaNode.java
.../src/main/java/com/byit/dto/specials/SpecialJavaNode.java
+2
-0
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+11
-0
No files found.
byit-myth-admin/src/main/java/com/byit/api/ApiFlowController.java
View file @
bfc919f6
...
@@ -55,6 +55,13 @@ public class ApiFlowController {
...
@@ -55,6 +55,13 @@ public class ApiFlowController {
return
ResponseResult
.
ok
(
"SUCCESS"
);
return
ResponseResult
.
ok
(
"SUCCESS"
);
}
}
@PostMapping
(
"unsuspendFlow"
)
@ApiOperation
(
"开始工作流的调度,将工作流启用调度"
)
public
ResponseResult
unsuspendFlow
(
String
param
)
throws
ParseException
{
apiFlowService
.
unsuspendFlow
(
param
);
return
ResponseResult
.
ok
(
"SUCCESS"
);
}
@PostMapping
(
"exist"
)
@PostMapping
(
"exist"
)
@ApiOperation
(
"判断工作流是否存在"
)
@ApiOperation
(
"判断工作流是否存在"
)
public
ResponseResult
exist
(
String
param
)
throws
ParseException
{
public
ResponseResult
exist
(
String
param
)
throws
ParseException
{
...
...
byit-myth-admin/src/main/java/com/byit/service/ApiFlowService.java
View file @
bfc919f6
...
@@ -18,6 +18,8 @@ public interface ApiFlowService {
...
@@ -18,6 +18,8 @@ public interface ApiFlowService {
void
deleteFlow
(
String
param
);
void
deleteFlow
(
String
param
);
void
unsuspendFlow
(
String
param
);
void
start
(
String
param
)
throws
ParseException
;
void
start
(
String
param
)
throws
ParseException
;
void
repealSchedule
(
String
param
)
throws
ParseException
;
void
repealSchedule
(
String
param
)
throws
ParseException
;
...
...
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
bfc919f6
...
@@ -186,7 +186,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -186,7 +186,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
if
(
StringUtils
.
isBlank
(
versionName
))
{
if
(
StringUtils
.
isBlank
(
versionName
))
{
String
version
=
oldFlow
.
getVersionName
();
String
version
=
oldFlow
.
getVersionName
();
Integer
versionTag
=
JobVersionGenUtil
.
parsingVersionName
(
version
);
Integer
versionTag
=
JobVersionGenUtil
.
parsingVersionName
(
version
);
flow
.
setVersionName
(
JobVersionGenUtil
.
generateVersionName
(
versionTag
+
1
));
flow
.
setVersionName
(
JobVersionGenUtil
.
generateVersionName
(
versionTag
+
1
));
}
else
{
}
else
{
flow
.
setVersionName
(
versionName
);
flow
.
setVersionName
(
versionName
);
...
@@ -1509,6 +1509,28 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -1509,6 +1509,28 @@ public class ApiFlowServiceImpl implements ApiFlowService {
deleteFlowAndNode
(
flow
);
deleteFlowAndNode
(
flow
);
}
}
@Override
public
void
unsuspendFlow
(
String
param
)
{
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
//获取工作空间名称
String
workspaceName
=
jsonObject
.
getString
(
"workspaceName"
);
ValidationUtil
.
dataNotBank
(
workspaceName
,
"工作空间名称不允许为空!"
);
//获取工作流名称
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
Workspace
byName
=
workspaceMapper
.
getByName
(
flowName
);
ValidationUtil
.
isTrueValidation
(
byName
==
null
,
"没有此工作空间"
);
RunRecording
runRecording
=
runRecordingMapper
.
runIngRunRecording
(
flowName
,
byName
.
getWorkspaceId
());
ValidationUtil
.
isTrueValidation
(
runRecording
==
null
,
"没有正在运行中的实例!"
);
if
(
"3"
.
equals
(
runRecording
.
getFlowStatus
()))
{
reStartSchedule
(
runRecording
.
getRunId
());
}
else
{
log
.
warn
(
"{},不是出于暂停状态"
,
runRecording
);
}
}
/**
/**
* 删除工作流及下属节点
* 删除工作流及下属节点
*
*
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
bfc919f6
...
@@ -26,7 +26,7 @@ public interface RunRecordingMapper {
...
@@ -26,7 +26,7 @@ public interface RunRecordingMapper {
*/
*/
List
<
RunRecording
>
findThisDayRunRecording
(
StatisticsConditionDto
statisticsConditionDto
);
List
<
RunRecording
>
findThisDayRunRecording
(
StatisticsConditionDto
statisticsConditionDto
);
RunRecording
runIngRunRecording
(
String
flowName
);
RunRecording
runIngRunRecording
(
@Param
(
"flowName"
)
String
flowName
,
@Param
(
"workspaceId"
)
Integer
workspaceId
);
/**
/**
* 查询全部的数据
* 查询全部的数据
* @return
* @return
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/RunRecordingService.java
View file @
bfc919f6
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
*/
*/
public
interface
RunRecordingService
{
public
interface
RunRecordingService
{
RunRecording
runIngRunRecording
(
String
flowName
);
RunRecording
runIngRunRecording
(
String
flowName
,
Integer
workspaceId
);
/**
/**
* 查询当天的实例 查询一个时间段的范围
* 查询当天的实例 查询一个时间段的范围
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/RunRecordingServiceImpl.java
View file @
bfc919f6
...
@@ -36,8 +36,8 @@ public class RunRecordingServiceImpl implements RunRecordingService {
...
@@ -36,8 +36,8 @@ public class RunRecordingServiceImpl implements RunRecordingService {
}
}
@Override
@Override
public
RunRecording
runIngRunRecording
(
String
flowName
)
{
public
RunRecording
runIngRunRecording
(
String
flowName
,
Integer
workspaceId
)
{
return
runRecordingMapper
.
runIngRunRecording
(
flowName
);
return
runRecordingMapper
.
runIngRunRecording
(
flowName
,
workspaceId
);
}
}
/**
/**
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/JavaFlowFreeTaskCallbackThread.java
View file @
bfc919f6
...
@@ -8,9 +8,11 @@ import com.byit.enums.task.RunResultEnum;
...
@@ -8,9 +8,11 @@ import com.byit.enums.task.RunResultEnum;
import
com.byit.filesystem.FileSystem
;
import
com.byit.filesystem.FileSystem
;
import
com.byit.model.JobTaskRunLogWithBLOBs
;
import
com.byit.model.JobTaskRunLogWithBLOBs
;
import
com.byit.model.RunRecording
;
import
com.byit.model.RunRecording
;
import
com.byit.model.Workspace
;
import
com.byit.model.vo.RunLogVo
;
import
com.byit.model.vo.RunLogVo
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
import
com.byit.packet.response.PluginRpcResponsePacket
;
import
com.byit.service.RunRecordingService
;
import
com.byit.service.RunRecordingService
;
import
com.byit.service.WorkspaceService
;
import
com.byit.service.impl.JobTaskRunLogServiceImpl
;
import
com.byit.service.impl.JobTaskRunLogServiceImpl
;
import
com.byit.util.SpringUtil
;
import
com.byit.util.SpringUtil
;
import
com.byit.utils.ValidationUtil
;
import
com.byit.utils.ValidationUtil
;
...
@@ -111,8 +113,14 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable {
...
@@ -111,8 +113,14 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable {
RunRecordingService
bean
=
SpringUtil
.
getBean
(
RunRecordingService
.
class
);
RunRecordingService
bean
=
SpringUtil
.
getBean
(
RunRecordingService
.
class
);
JobTaskRunLogServiceImpl
mythJobTaskRunLogService
=
SpringUtil
.
getBean
(
JobTaskRunLogServiceImpl
.
class
);
JobTaskRunLogServiceImpl
mythJobTaskRunLogService
=
SpringUtil
.
getBean
(
JobTaskRunLogServiceImpl
.
class
);
String
flowName
=
specialJavaNode
.
getFlowName
();
String
flowName
=
specialJavaNode
.
getFlowName
();
String
workspaceName
=
specialJavaNode
.
getWorkspaceName
();
WorkspaceService
workspaceService
=
SpringUtil
.
getBean
(
WorkspaceService
.
class
);
Workspace
byName
=
workspaceService
.
getByName
(
workspaceName
);
if
(
byName
==
null
)
{
return
null
;
}
RunRecording
runRecording
=
bean
.
runIngRunRecording
(
flowName
);
RunRecording
runRecording
=
bean
.
runIngRunRecording
(
flowName
,
byName
.
getWorkspaceId
()
);
List
<
JobTaskRunLogWithBLOBs
>
jobTaskRunLogWithBLOBsByFlowIdAndRunId
=
mythJobTaskRunLogService
.
findJobTaskRunLogWithBLOBsByFlowIdAndRunId
(
runRecording
.
getFlowId
(),
runRecording
.
getRunId
());
List
<
JobTaskRunLogWithBLOBs
>
jobTaskRunLogWithBLOBsByFlowIdAndRunId
=
mythJobTaskRunLogService
.
findJobTaskRunLogWithBLOBsByFlowIdAndRunId
(
runRecording
.
getFlowId
(),
runRecording
.
getRunId
());
JobTaskRunLogWithBLOBs
jobTaskRunLogWithBLOBs
=
jobTaskRunLogWithBLOBsByFlowIdAndRunId
.
stream
().
filter
(
log
->
log
.
getNodeName
().
equals
(
specialJavaNode
.
getNodeName
())).
findFirst
().
orElse
(
null
);
JobTaskRunLogWithBLOBs
jobTaskRunLogWithBLOBs
=
jobTaskRunLogWithBLOBsByFlowIdAndRunId
.
stream
().
filter
(
log
->
log
.
getNodeName
().
equals
(
specialJavaNode
.
getNodeName
())).
findFirst
().
orElse
(
null
);
if
(
jobTaskRunLogWithBLOBs
!=
null
)
{
if
(
jobTaskRunLogWithBLOBs
!=
null
)
{
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
bfc919f6
...
@@ -320,7 +320,7 @@
...
@@ -320,7 +320,7 @@
select
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from run_recording
from run_recording
where (flow_status = '2' or flow_status = '3') and schedule_type != 4 and flow_name = #{flowName}
where (flow_status = '2' or flow_status = '3') and schedule_type != 4 and flow_name = #{flowName}
and workspace_id = #{workspaceId}
</select>
</select>
<delete
id=
"deleteById"
>
<delete
id=
"deleteById"
>
...
...
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/specials/SpecialJavaNode.java
View file @
bfc919f6
...
@@ -30,4 +30,6 @@ public class SpecialJavaNode implements Serializable {
...
@@ -30,4 +30,6 @@ public class SpecialJavaNode implements Serializable {
* 当前执行的日志的url
* 当前执行的日志的url
*/
*/
private
String
thisLogUrlPath
;
private
String
thisLogUrlPath
;
private
String
workspaceName
;
}
}
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
bfc919f6
...
@@ -55,6 +55,7 @@ public class JobUtils {
...
@@ -55,6 +55,7 @@ public class JobUtils {
* 开始工作流
* 开始工作流
*/
*/
private
static
final
String
REQUEST_FLOW_START
=
"/api/flow/start"
;
private
static
final
String
REQUEST_FLOW_START
=
"/api/flow/start"
;
private
static
final
String
REQUEST_FLOW_START_UNSUSPENDFLOW
=
"/api/flow/unsuspendFlow"
;
/**
/**
* 校验工作流是否存在
* 校验工作流是否存在
*/
*/
...
@@ -287,6 +288,16 @@ public class JobUtils {
...
@@ -287,6 +288,16 @@ public class JobUtils {
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
}
public
static
ResponseResult
unsuspendFlow
(
String
flowName
,
String
workspaceName
){
Map
<
String
,
String
>
map
=
new
HashMap
<>(
5
);
map
.
put
(
"flowName"
,
flowName
);
map
.
put
(
"workspaceName"
,
workspaceName
);
//发送请求 添加任务
String
response
=
createHttpRequest
(
REQUEST_FLOW_START_UNSUSPENDFLOW
,
"param="
+
JSON
.
toJSONString
(
map
,
WriteClassName
));
log
.
debug
(
"--------------------开始接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
/**
* 开始工作流
* 开始工作流
*
*
...
...
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