Commit 0f1e69bf by guominglei

修改工作流状态

parent d74ca318
...@@ -1431,12 +1431,15 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -1431,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());
if (null != unStartRecordingList && unStartRecordingList.size() > 0){
//删除对应的task记录 //删除对应的task记录
unStartRecordingList.forEach(runRecording -> { unStartRecordingList.forEach(runRecording -> {
ValidationUtil.isTrueValidation((runRecording.getTriggerTime() - System.currentTimeMillis()) < 10000 , "工作流已在调度中不允许撤销调度"); ValidationUtil.isTrueValidation((runRecording.getTriggerTime() - System.currentTimeMillis()) < 10000 , "工作流已在调度中不允许撤销调度");
runRecordingMapper.deleteByRunId(runRecording.getRunId()); runRecordingMapper.deleteByRunId(runRecording.getRunId());
jobTaskMapper.deleteByRunId(runRecording.getRunId()); jobTaskMapper.deleteByRunId(runRecording.getRunId());
}); });
}
//撤销工作流调度 //撤销工作流调度
updateFlowStart(flow, false); updateFlowStart(flow, false);
...@@ -1453,10 +1456,10 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -1453,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());
......
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