Commit 6d08ed46 by huangfusuper

工作流实例是否正在运行中校验

parent 7593c888
...@@ -22,6 +22,13 @@ public interface RunRecordingMapper { ...@@ -22,6 +22,13 @@ public interface RunRecordingMapper {
* @return * @return
*/ */
List<RunRecording> findRunningRunRecording(); List<RunRecording> findRunningRunRecording();
/**
* 根据工作流查询对应的实例
* @param flowId
* @return
*/
List<RunRecording> findRunRecordingByFlowId(Integer flowId);
/** /**
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点 * 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* @param flowId * @param flowId
......
...@@ -22,6 +22,13 @@ public interface RunRecordingService { ...@@ -22,6 +22,13 @@ public interface RunRecordingService {
List<RunRecording> findRunningRunRecording(); List<RunRecording> findRunningRunRecording();
/** /**
* 根据工作流ID查询 是否有正在运行中的实例
* @param flowId
* @return
*/
boolean findRunRecordingIsRunning(Integer flowId);
/**
* 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点 * 这个方法是会根据任务流的id和运行标识找到唯一对应的一个任务流,这个任务流就是一个虚拟节点
* @param flowId * @param flowId
* @param runId * @param runId
......
package com.byit.service.impl; package com.byit.service.impl;
import com.byit.enums.RunRecordingEnum;
import com.byit.mapper.RunRecordingMapper; import com.byit.mapper.RunRecordingMapper;
import com.byit.model.RunRecording; import com.byit.model.RunRecording;
import com.byit.service.RunRecordingService; import com.byit.service.RunRecordingService;
...@@ -33,6 +34,22 @@ public class RunRecordingServiceImpl implements RunRecordingService { ...@@ -33,6 +34,22 @@ public class RunRecordingServiceImpl implements RunRecordingService {
return runRecordingMapper.findRunningRunRecording(); return runRecordingMapper.findRunningRunRecording();
} }
/**
* 是否存在运行的工作流实例
* @param flowId 工作流ID
* @return 是否在正在运行中
*/
@Override
public boolean findRunRecordingIsRunning(Integer flowId) {
List<RunRecording> runRecordings = runRecordingMapper.findRunRecordingByFlowId(flowId);
for (RunRecording runRecording : runRecordings) {
if (!RunRecordingEnum.FLOW_STATUS_IS_END.getCode().equals(runRecording.getFlowStatus())) {
return true;
}
}
return false;
}
@Override @Override
public RunRecording findRunRecordingByFlowIdAndRunId(Integer flowId, String runId) { public RunRecording findRunRecordingByFlowIdAndRunId(Integer flowId, String runId) {
return runRecordingMapper.findRunRecordingByFlowIdAndRunId(flowId,runId); return runRecordingMapper.findRunRecordingByFlowIdAndRunId(flowId,runId);
......
...@@ -46,6 +46,12 @@ ...@@ -46,6 +46,12 @@
where flow_status = '2' where flow_status = '2'
</select> </select>
<select id="findRunRecordingByFlowId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from run_recording where flow_id = #{flowId,jdbcType=INTEGER}
</select>
<select id="findRunRecordingByFlowIdAndRunId" resultMap="BaseResultMap" > <select id="findRunRecordingByFlowIdAndRunId" resultMap="BaseResultMap" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
......
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