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