Commit e124cbe9 by guominglei

插件端开启调度和撤销调度

parent 8bb1ef64
......@@ -18,7 +18,7 @@ public interface JobTaskRunLogMapper {
* @param nodIds
* @return
*/
int findJobTaskRunLogNotEndNodeByRunCodeCount(@Param("nodIds") List<Integer> nodIds);
int findJobTaskRunLogNotEndNodeByRunCodeCount(@Param("nodeIds") List<Integer> nodeIds);
/**
* 查根据flowId和RunId查询一批节点
......
......@@ -2,21 +2,16 @@ package com.byit.thread;
import cn.hutool.core.collection.CollectionUtil;
import com.byit.model.Flow;
import com.byit.model.JobTask;
import com.byit.model.Node;
import com.byit.model.RunRecording;
import com.byit.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
......@@ -81,7 +76,7 @@ public class FlowScanHelper {
Integer flowId = flow.getFlowId();
List<Node> nodeByFlowIdAndVersionName = nodeService.findNodeByFlowIdAndVersionName(flowId, versionName);
runNodeServer.saveRunRecAndTask(flow,nodeByFlowIdAndVersionName);
flow.setRepeatCount(flow.getRepeatCount()-1);
flow.setRemainingCount(flow.getRemainingCount()-1);
flowService.updateByIdSelective(flow);
});
......
......@@ -138,7 +138,10 @@ public class JobScheduleHelper{
//根据 map_flow_id查询当前的版本的工作流 使用祝工作流的runId 保存到执行记录表和任务表
}else{
List<Integer> dependIdByNodeId = nodeDependencyService.findDependIdByNodeId(jobTask.getNodeId());
int jobTaskRunLogNotEndNodeByRunCodeCount = jobTaskRunLogService.findJobTaskRunLogNotEndNodeByRunCodeCount(dependIdByNodeId);
int jobTaskRunLogNotEndNodeByRunCodeCount = 0;
if (CollectionUtil.isNotEmpty(dependIdByNodeId)){
jobTaskRunLogNotEndNodeByRunCodeCount = jobTaskRunLogService.findJobTaskRunLogNotEndNodeByRunCodeCount(dependIdByNodeId);
}
if("start".equals(jobTask.getNodeName()) || (jobTaskRunLogNotEndNodeByRunCodeCount==0)){
log.debug("任务:{}", jobTask);
......
......@@ -37,7 +37,7 @@
<select id="findHalfAnHourFlow" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from flow where trigger_next_time <![CDATA[ <= ]]> #{triggerNextTime,jdbcType=BIGINT} and remaining_count <![CDATA[ <> ]]> 0
from flow where trigger_next_time <![CDATA[ <= ]]> #{triggerNextTime,jdbcType=BIGINT} and remaining_count != 0
</select>
<select id="getById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
......
......@@ -41,11 +41,13 @@
</sql>
<select id="findJobTaskRunLogNotEndNodeByRunCodeCount" resultType="java.lang.Integer">
select count(id) from job_task_run_log where node_id in
<foreach item="nodeId" collection="nodIds" open="(" separator="," close=")">
select count(*)
from job_task_run_log
where (run_code = '0' or run_code = '5')
and node_id in
<foreach item="nodeId" collection="nodeIds" open="(" separator="," close=")">
#{nodeId}
</foreach>
and (run_code = '0' or run_code = '5')
</select>
<select id="findJobTaskRunLogWithBLOBsByFlowIdAndRunId" resultMap="ResultMapWithBLOBs">
......
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