修复quartz 任务启停
This commit is contained in:
@ -63,4 +63,5 @@ public interface QuartzJobService extends BaseService<QuartzJob>{
|
||||
* @return List
|
||||
*/
|
||||
List<QuartzJob> findByIsPauseIsFalse();
|
||||
void removeByIds(List<Integer> idList);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
|
||||
*/
|
||||
package co.yixiang.modules.quartz.service.impl;
|
||||
|
||||
@ -25,10 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
// 默认不使用缓存
|
||||
//import org.springframework.cache.annotation.CacheConfig;
|
||||
@ -123,19 +119,13 @@ public class QuartzJobServiceImpl extends BaseServiceImpl<QuartzJobMapper, Quart
|
||||
|
||||
@Override
|
||||
public boolean save(QuartzJob quartzJob) {
|
||||
if (quartzJob.getIsPause()) {
|
||||
quartzManage.pauseJob(quartzJob);
|
||||
}
|
||||
quartzManage.addJob(quartzJob);
|
||||
return retBool(baseMapper.insert(quartzJob));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(QuartzJob quartzJob) {
|
||||
if (quartzJob.getIsPause()) {
|
||||
quartzManage.pauseJob(quartzJob);
|
||||
} else {
|
||||
quartzManage.resumeJob(quartzJob);
|
||||
}
|
||||
quartzManage.updateJobCron(quartzJob);
|
||||
return retBool(baseMapper.updateById(quartzJob));
|
||||
}
|
||||
|
||||
@ -163,4 +153,13 @@ public class QuartzJobServiceImpl extends BaseServiceImpl<QuartzJobMapper, Quart
|
||||
criteria.setIsPause(false);
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(QuartzJob.class, criteria));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeByIds(List<Integer> idList) {
|
||||
idList.forEach(id -> {
|
||||
QuartzJob quartzJob = baseMapper.selectById(id);
|
||||
quartzManage.deleteJob(quartzJob);
|
||||
});
|
||||
baseMapper.deleteBatchIds(idList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user