diff --git a/spider-flow-core/src/main/java/org/spiderflow/core/mapper/SpiderFlowMapper.java b/spider-flow-core/src/main/java/org/spiderflow/core/mapper/SpiderFlowMapper.java index d125d22..bbe240c 100644 --- a/spider-flow-core/src/main/java/org/spiderflow/core/mapper/SpiderFlowMapper.java +++ b/spider-flow-core/src/main/java/org/spiderflow/core/mapper/SpiderFlowMapper.java @@ -59,7 +59,7 @@ public interface SpiderFlowMapper extends BaseMapper{ int resetNextExecuteTime(@Param("id") String id); @Update("update sp_flow set next_execute_time = null") - int resetNextExecuteTime(); + int resetNextExecuteTimeAll(); @Select("select id,name from sp_flow") List selectFlows(); diff --git a/spider-flow-core/src/main/java/org/spiderflow/core/service/SpiderFlowService.java b/spider-flow-core/src/main/java/org/spiderflow/core/service/SpiderFlowService.java index 9a0aba7..976bed7 100644 --- a/spider-flow-core/src/main/java/org/spiderflow/core/service/SpiderFlowService.java +++ b/spider-flow-core/src/main/java/org/spiderflow/core/service/SpiderFlowService.java @@ -54,7 +54,7 @@ public class SpiderFlowService extends ServiceImpl @PostConstruct private void initJobs(){ //清空所有任务下次执行时间 - sfMapper.resetNextExecuteTime(); + sfMapper.resetNextExecuteTimeAll(); //获取启用corn的任务 List spiderFlows = sfMapper.selectList(new QueryWrapper().eq("enabled", "1")); if(spiderFlows != null && !spiderFlows.isEmpty()){ @@ -139,12 +139,12 @@ public class SpiderFlowService extends ServiceImpl public void start(String id){ spiderJobManager.remove(id); + sfMapper.resetSpiderStatus(id, "1"); SpiderFlow spiderFlow = getById(id); Date nextExecuteTime = spiderJobManager.addJob(spiderFlow); if (nextExecuteTime != null) { spiderFlow.setNextExecuteTime(nextExecuteTime); sfMapper.updateById(spiderFlow); - sfMapper.resetSpiderStatus(id, "1"); } }