提交 5fcbe9bc authored 作者: inroi's avatar inroi

微调

上级 42e22007
......@@ -10,7 +10,6 @@ import com.nzwz.quartz.transfer.*;
import com.nzwz.utils.StringUtil;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -108,7 +107,7 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
return temp01;
}
quartzJobMapper.updateStatusByJobClassName(records.getJobClassName(), 0);
quartzJobMapper.updateStatusByJobClassName(records.getJobClassName(), 1);
return RestResponse.success();
}
......@@ -129,7 +128,7 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
return temp02;
}
quartzJobMapper.updateStatusByJobClassName(inVo.getJobClassName(), 1);
quartzJobMapper.updateStatusByJobClassName(inVo.getJobClassName(), 0);
return RestResponse.success();
}
......@@ -148,9 +147,9 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
// 按新的cronExpression表达式构建一个新的trigger
CronTrigger trigger = (CronTrigger) TriggerBuilder.newTrigger().withIdentity(jobClassName).withSchedule(scheduleBuilder).build();
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(jobClassName).withSchedule(scheduleBuilder).build();
scheduler.scheduleJob(jobDetail, (Trigger) trigger);
scheduler.scheduleJob(jobDetail, trigger);
} catch (SchedulerException e) {
e.printStackTrace();
return RestResponse.fail("创建定时任务失败");
......
......@@ -54,7 +54,7 @@ public class SynchronizationServiceImpl implements ISynchronizationService {
QuartzJob quartzJob = quartzJobService.getBaseMapper().selectById("1");
if (StringUtil.isNotNull(quartzJob)) {
if (quartzJob.getStatus() == 0) {
if (quartzJob.getStatus() == 1) {
quartzJobService.quartzJobResume(new QuartzJobResumeInVo(quartzJob.getJobClassName()));
return RestResponse.success();
}
......@@ -70,7 +70,7 @@ public class SynchronizationServiceImpl implements ISynchronizationService {
QuartzJob quartzJob = quartzJobService.getBaseMapper().selectById("1");
if (StringUtil.isNotNull(quartzJob)) {
if (quartzJob.getStatus() == 1) {
if (quartzJob.getStatus() == 0) {
quartzJobService.quartzJobPause(new QuartzJobPauseInVo(quartzJob.getJobClassName()));
return RestResponse.success();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论