Commit e540db31 by guominglei

暂停工作流修改

parent c4948aea
......@@ -3,7 +3,6 @@ package com.byit.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.ConsistentHash;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.byit.dto.StatisticsConditionDto;
......@@ -26,7 +25,6 @@ import com.byit.util.IDGenerationStrategy;
import com.byit.util.lock.RedissLockUtil;
import com.byit.utils.ValidationUtil;
import com.google.common.base.Joiner;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -38,7 +36,7 @@ import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
......@@ -1173,9 +1171,16 @@ public class ApiFlowServiceImpl implements ApiFlowService {
@Override
public Boolean stopScheduleByRunId(String runId) {
RunRecording recording = runRecordingMapper.findAllByRunID(runId);
ValidationUtil.dataNotNull(recording , "查无此运行实例!");
ValidationUtil.isTrueValidation("3".equals(recording.getFlowStatus()) || "4".equals(recording.getFlowStatus()) , "该运行实例没有在运行中!");
List<RunRecording> recordingList = runRecordingMapper.findByRunID(runId);
ValidationUtil.dataNotNull(recordingList , "查无此运行实例!");
AtomicReference<Boolean> result = new AtomicReference<>(true);
recordingList.forEach(runRecording -> {
if (("3".equals(runRecording.getFlowStatus()) || "4".equals(runRecording.getFlowStatus())) //如果不是正在运行
&& FlowPropertyEnum.ISNOT_INNER.getCode().equals(runRecording.getIsInner())){ //并且不是内嵌工作流
result.set(false);
}
});
ValidationUtil.isTrueValidation(!result.get(), "该运行实例没有在运行中!");
//暂停工作流调度
runRecordingMapper.stopByRunId(runId);
......
......@@ -54,6 +54,13 @@ public interface RunRecordingMapper {
* @return
*/
RunRecording findAllByRunID(String runId);
/**
*根据运行标识查询对应的运行实例
* @param runId
* @return
*/
List<RunRecording> findByRunID(String runId);
/**
* 查询运行中的运行实例
* @return
......
......@@ -105,6 +105,14 @@
from run_recording
where run_id=#{runId,jdbcType=VARCHAR} and schedule_type != 4
</select>
<select id="findByRunID" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording
where run_id=#{runId,jdbcType=VARCHAR} and schedule_type != 4
</select>
<!--查询运行中的-->
<select id="findRunningRunRecording" resultMap="BaseResultMap">
select
......
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