Commit 04426090 by huangfusuper

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

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