Commit 04426090 by huangfusuper

修改虚节点不跟随祝工作流BUG

parent b4c6aa31
......@@ -149,7 +149,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
flow.setFlowCron(pluginFlow.getConfig().getFlowCron());
flow.setTriggerNextTime(StringUtils.isEmpty(pluginFlow.getConfig().getFlowCron()) ? null : new CronExpression(pluginFlow.getConfig().getFlowCron()).getNextValidTimeAfter(new Date()).getTime());
//设置超时时间,未设置默认30分钟
flow.setFlowTimeout(null == pluginFlow.getConfig().getFlowTimeout() ? 1000 * 60 * 30 : pluginFlow.getConfig().getFlowTimeout());
flow.setFlowTimeout(null == pluginFlow.getConfig().getFlowTimeout() ? 1000 * 60 * 120 : pluginFlow.getConfig().getFlowTimeout());
//判断是否是重发
if (pluginFlow.isRePublish()){
......
......@@ -2,6 +2,7 @@ package com.byit.service.mapservice.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.enums.*;
import com.byit.job.utils.CronExpression;
import com.byit.job.utils.DateUtil;
import com.byit.model.*;
import com.byit.service.*;
......@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -59,7 +61,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
* @throws Exception
*/
@Override
public void saveRunRecordingAndTask(JobTask jobTask) throws UnknownHostException {
public void saveRunRecordingAndTask(JobTask jobTask) throws UnknownHostException, ParseException {
log.info("-----------saveRunRecordingAndTask start【虚节点保存服务】--------------");
//根据 map_flow_id查询当前的版本的工作流 使用祝工作流的runId 保存到执行记录表和任务表
Integer mapFlowId = jobTask.getMapFlowId();
......@@ -67,6 +69,8 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
Flow mainFlow = flowService.findFlowById(jobTask.getFlowId());
//内嵌工作流
Flow virFlow = flowService.findFlowById(mapFlowId);
RunRecording mainRecording = runRecordingService.findRunRecordingByFlowIdAndRunId(jobTask.getFlowId(), jobTask.getRunId());
//查看是否跟随工作流
boolean equals = "1".equals(mainFlow.getScheduleFollow());
boolean virFlag = "1".equals(virFlow.getScheduleFollow());
......@@ -92,6 +96,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
jobTaskRunLogService.saveJobTaskRunLog(jobTaskRunLog);
log.info("-----------【虚节点保存运行记录】--------------");
//保存进运行记录表
Long triggerNextTime = virFlow.getTriggerNextTime();
RunRecording runRecording = RunRecording.builder()
.runId(jobTask.getRunId())
.flowId(mapFlowId)
......@@ -103,7 +108,7 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
.alarmEmail(virFlow.getAlarmEmail())
.alarmlAction(virFlow.getAlarmlAction())
.priority(virFlow.getPriority())
.triggerTime(equals?mainFlow.getTriggerNextTime():virFlow.getTriggerNextTime())
.triggerTime(equals?mainRecording.getTriggerTime(): triggerNextTime)
.principal(virFlow.getPrincipal())
.startTime(new Date())
.flowNodeCount(virFlow.getFlowNodeCount())
......@@ -127,9 +132,9 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
BeanUtils.copyProperties(node, task);
if (equals) {
task.setTriggerTime(mainFlow.getTriggerNextTime());
task.setTriggerTime(mainRecording.getTriggerTime());
} else if (virFlag) {
task.setTriggerTime(virFlow.getTriggerNextTime());
task.setTriggerTime(triggerNextTime);
}
task.setRunId(jobTask.getRunId());
task.setTriggerStatus("1");
......@@ -140,6 +145,11 @@ public class RunRecordingAndJobTaskServiceImpl implements RunRecordingAndJobTask
log.info("----------------【虚节点保存成功,删除虚节点】--------------------");
jobTaskService.removeMythJobTaskById(jobTask.getId());
log.info("-----------saveRunRecordingAndTask end【虚节点保存服务】--------------");
if(StringUtils.isNotBlank(virFlow.getFlowCron())){
virFlow.setTriggerNextTime(new CronExpression(virFlow.getFlowCron()).getNextValidTimeAfter(new Date(virFlow.getTriggerNextTime())).getTime());
}
flowService.updateByIdSelective(virFlow);
}
......
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