Commit 71039f07 by huangfu

停止工作流逻辑修改

parent dd42cad1
...@@ -431,6 +431,42 @@ public class FlowServiceImpl implements FlowService { ...@@ -431,6 +431,42 @@ public class FlowServiceImpl implements FlowService {
ValidationUtil.dataNotBank(param, "请求参数不允许为空!"); ValidationUtil.dataNotBank(param, "请求参数不允许为空!");
JSONObject jsonObject = JSON.parseObject(param); JSONObject jsonObject = JSON.parseObject(param);
String runId = jsonObject.getString("runId"); String runId = jsonObject.getString("runId");
//查找到运行批次
List<RunRecording> runRecordingList = runRecordingMapper.findByRunID(runId);
//查看是否存在运行中的实例
List<RunRecording> collect = runRecordingList.stream().filter(runRecording -> {
String flowStatus = runRecording.getFlowStatus();
return ScheduleStatusEnum.STOP.getCode().equals(flowStatus) || ScheduleStatusEnum.STARTING.getCode().equals(flowStatus);
}).collect(Collectors.toList());
ValidationUtil.isTrueValidation(CollectionUtil.isEmpty(collect), "没有正在运行中的实例,请刷新页面后重试!");
//遍历运行批次 将实例更改为快速失败
//释放该工作流下所由暂停的节点
collect.forEach(runRecording -> {
runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode());
runRecording.setFailFast(RunRecordingEnum.FAIL_FAST_YES.getCode());
if (ScheduleStatusEnum.STOP.getCode().equals(runRecording.getFlowStatus())) {
runRecording.setFlowStatus(ScheduleStatusEnum.STARTING.getCode());
}
List<JobTask> byRunId = jobTaskService.findByRunId(runId);
List<JobTask> stopTask = byRunId.stream().filter(task -> JobTriggerStatusEnums.STOP.getCode().equals(task.getTriggerStatus())).collect(Collectors.toList());
stopTask.forEach(task -> {
task.setTriggerStatus(JobTriggerStatusEnums.START.getCode());
jobTaskService.update(task);
});
runRecordingMapper.updateRunRecordingById(runRecording);
});
return new KillDto(true, "操作成功!");
}
@Deprecated
public KillDto killFlow111(String param) throws InterruptedException {
ValidationUtil.dataNotBank(param, "请求参数不允许为空!");
JSONObject jsonObject = JSON.parseObject(param);
String runId = jsonObject.getString("runId");
ValidationUtil.dataNotBank(runId, "运行实例id不允许为空!"); ValidationUtil.dataNotBank(runId, "运行实例id不允许为空!");
String workspaceName = jsonObject.getString("workspaceName"); String workspaceName = jsonObject.getString("workspaceName");
ValidationUtil.dataNotBank(workspaceName, "工作空间名称不允许为空!"); ValidationUtil.dataNotBank(workspaceName, "工作空间名称不允许为空!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment