Commit 682d3166 by huangfusuper

Merge remote-tracking branch 'origin/developer' into developer

parents 7fde4806 d562c7bb
......@@ -1161,7 +1161,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
ValidationUtil.isTrueValidation(FlowPropertyEnum.IS_INNER.getCode().equals(flow.getIsInner()), "内嵌工作流不允许删除!");
//判断是否在调度中
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());
//删除对应的task记录
unStartRecordingList.forEach(runRecording -> {
......@@ -1232,7 +1232,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
ValidationUtil.isTrueValidation(FlowPropertyEnum.IS_INNER.getCode().equals(flow.getIsInner()), "内嵌工作流不允许撤销调度!");
//判断是否在调度中
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());
//删除对应的task记录
unStartRecordingList.forEach(runRecording -> {
......
......@@ -6,6 +6,7 @@ import com.byit.mapper.*;
import com.byit.model.*;
import com.byit.thread.BaseThreadRunHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -94,9 +95,12 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
FlowStatusSnapshoot hourFlowStatusSnapshoot = new FlowStatusSnapshoot();
BeanUtils.copyProperties(flowStatusSnapshoot, hourFlowStatusSnapshoot);
//判断运行状态
if (runRecording.getFlowStatus().equals("1") || runRecording.getFlowStatus().equals("2") || runRecording.getFlowStatus().equals("3")){
if(StringUtils.isEmpty(runRecording.getFlowStatus())){
//如果为空设置为未运行
hourFlowStatusSnapshoot.setFlowStatus(1);
}else if (runRecording.getFlowStatus().equals("1") || runRecording.getFlowStatus().equals("2") || runRecording.getFlowStatus().equals("3")){
hourFlowStatusSnapshoot.setFlowStatus(Integer.valueOf(runRecording.getFlowStatus()));
}else {
}else if (runRecording.getFlowStatus().equals("4")){
switch (runRecording.getFlowRunResult()){
case "1" :
case "3" : hourFlowStatusSnapshoot.setFlowStatus(4); break;
......@@ -105,6 +109,9 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
case "5" : hourFlowStatusSnapshoot.setFlowStatus(6); break;
default : hourFlowStatusSnapshoot.setFlowStatus(5); break;
}
}else {
//如果没在判断之内,设置为未运行
hourFlowStatusSnapshoot.setFlowStatus(1);
}
//获取运行实例下各类状态的节点数目
StatisticData nodeStatistic = jobTaskRunLogMapper.findStatisticDataByRunIdAndFlowId(runRecording.getRunId(), flow.getFlowId());
......@@ -112,7 +119,11 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
//存在节点运行日志
if (nodeStatistic != null){
int sum = nodeStatistic.getFail() + nodeStatistic.getSuccess() + nodeStatistic.getRunIng() + nodeStatistic.getKill();
if(flow.getFlowNodeCount() > sum){
hourFlowStatusSnapshoot.setUnstartNode(flow.getFlowNodeCount() - sum);
}else {
hourFlowStatusSnapshoot.setUnstartNode(0);
}
hourFlowStatusSnapshoot.setRuningNode(nodeStatistic.getRunIng());
hourFlowStatusSnapshoot.setSuccessNode(nodeStatistic.getSuccess());
hourFlowStatusSnapshoot.setFailNode(nodeStatistic.getFail());
......@@ -133,6 +144,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
flowStatusSnapshootList.addAll(preHourFlowStatusSnapshootList);
}else {
//如果上个小时也没有,就设置为未运行
flowStatusSnapshoot.setFlowStatus(1);
flowStatusSnapshoot.setUnstartNode(flow.getFlowNodeCount());
flowStatusSnapshootList.add(flowStatusSnapshoot);
}
......@@ -140,6 +152,7 @@ public class StatusSnapshootThreadRunHelper extends BaseThreadRunHelper {
}
}else {
//如果不存在运行实例
flowStatusSnapshoot.setFlowStatus(1);
flowStatusSnapshoot.setUnstartNode(flow.getFlowNodeCount());
flowStatusSnapshootList.add(flowStatusSnapshoot);
}
......
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