mirror of https://gitee.com/stylefeng/roses
【timer-business】修改方法名称
parent
891e7fe460
commit
af732f0362
|
@ -58,8 +58,8 @@ public class SysTimersController {
|
||||||
* @date 2020/6/30 18:26
|
* @date 2020/6/30 18:26
|
||||||
*/
|
*/
|
||||||
@PostResource(name = "删除定时任务", path = "/sysTimers/delete")
|
@PostResource(name = "删除定时任务", path = "/sysTimers/delete")
|
||||||
public ResponseData delete(@RequestBody @Validated(SysTimersParam.delete.class) SysTimersParam sysTimersParam) {
|
public ResponseData del(@RequestBody @Validated(SysTimersParam.delete.class) SysTimersParam sysTimersParam) {
|
||||||
sysTimersService.delete(sysTimersParam);
|
sysTimersService.del(sysTimersParam);
|
||||||
return new SuccessResponseData();
|
return new SuccessResponseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class SysTimersController {
|
||||||
*/
|
*/
|
||||||
@GetResource(name = "分页查询定时任务", path = "/sysTimers/page")
|
@GetResource(name = "分页查询定时任务", path = "/sysTimers/page")
|
||||||
public ResponseData page(SysTimersParam sysTimersParam) {
|
public ResponseData page(SysTimersParam sysTimersParam) {
|
||||||
return new SuccessResponseData(sysTimersService.page(sysTimersParam));
|
return new SuccessResponseData(sysTimersService.findPage(sysTimersParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +117,7 @@ public class SysTimersController {
|
||||||
*/
|
*/
|
||||||
@GetResource(name = "获取全部定时任务", path = "/sysTimers/list")
|
@GetResource(name = "获取全部定时任务", path = "/sysTimers/list")
|
||||||
public ResponseData list(SysTimersParam sysTimersParam) {
|
public ResponseData list(SysTimersParam sysTimersParam) {
|
||||||
return new SuccessResponseData(sysTimersService.list(sysTimersParam));
|
return new SuccessResponseData(sysTimersService.findList(sysTimersParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ public interface SysTimersService extends IService<SysTimers> {
|
||||||
* @author stylefeng
|
* @author stylefeng
|
||||||
* @date 2020/6/30 18:26
|
* @date 2020/6/30 18:26
|
||||||
*/
|
*/
|
||||||
void delete(SysTimersParam sysTimersParam);
|
void del(SysTimersParam sysTimersParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动任务
|
* 启动任务
|
||||||
|
@ -78,7 +78,7 @@ public interface SysTimersService extends IService<SysTimers> {
|
||||||
* @author stylefeng
|
* @author stylefeng
|
||||||
* @date 2020/6/30 18:26
|
* @date 2020/6/30 18:26
|
||||||
*/
|
*/
|
||||||
PageResult<SysTimers> page(SysTimersParam sysTimersParam);
|
PageResult<SysTimers> findPage(SysTimersParam sysTimersParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有定时任务
|
* 查询所有定时任务
|
||||||
|
@ -88,7 +88,7 @@ public interface SysTimersService extends IService<SysTimers> {
|
||||||
* @author stylefeng
|
* @author stylefeng
|
||||||
* @date 2020/6/30 18:26
|
* @date 2020/6/30 18:26
|
||||||
*/
|
*/
|
||||||
List<SysTimers> list(SysTimersParam sysTimersParam);
|
List<SysTimers> findList(SysTimersParam sysTimersParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有可执行的任务列表
|
* 获取所有可执行的任务列表
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -81,7 +83,7 @@ public class SysTimersServiceImpl extends ServiceImpl<SysTimersMapper, SysTimers
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(SysTimersParam sysTimersParam) {
|
public void del(SysTimersParam sysTimersParam) {
|
||||||
|
|
||||||
// 先停止id为参数id的定时器
|
// 先停止id为参数id的定时器
|
||||||
CronUtil.remove(String.valueOf(sysTimersParam.getTimerId()));
|
CronUtil.remove(String.valueOf(sysTimersParam.getTimerId()));
|
||||||
|
@ -129,7 +131,7 @@ public class SysTimersServiceImpl extends ServiceImpl<SysTimersMapper, SysTimers
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysTimers> page(SysTimersParam sysTimersParam) {
|
public PageResult<SysTimers> findPage(SysTimersParam sysTimersParam) {
|
||||||
|
|
||||||
// 构造条件
|
// 构造条件
|
||||||
LambdaQueryWrapper<SysTimers> queryWrapper = createWrapper(sysTimersParam);
|
LambdaQueryWrapper<SysTimers> queryWrapper = createWrapper(sysTimersParam);
|
||||||
|
@ -140,7 +142,7 @@ public class SysTimersServiceImpl extends ServiceImpl<SysTimersMapper, SysTimers
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysTimers> list(SysTimersParam sysTimersParam) {
|
public List<SysTimers> findList(SysTimersParam sysTimersParam) {
|
||||||
LambdaQueryWrapper<SysTimers> queryWrapper = createWrapper(sysTimersParam);
|
LambdaQueryWrapper<SysTimers> queryWrapper = createWrapper(sysTimersParam);
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
@ -184,14 +186,18 @@ public class SysTimersServiceImpl extends ServiceImpl<SysTimersMapper, SysTimers
|
||||||
LambdaQueryWrapper<SysTimers> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysTimers> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(sysTimersParam)) {
|
if (ObjectUtil.isNotNull(sysTimersParam)) {
|
||||||
|
String timerName = sysTimersParam.getTimerName();
|
||||||
|
Integer jobStatus = sysTimersParam.getJobStatus();
|
||||||
|
String actionClass = sysTimersParam.getActionClass();
|
||||||
|
|
||||||
// 拼接查询条件-任务名称
|
// 拼接查询条件-任务名称
|
||||||
if (ObjectUtil.isNotEmpty(sysTimersParam.getTimerName())) {
|
queryWrapper.like(ObjectUtil.isNotEmpty(timerName), SysTimers::getTimerName, timerName);
|
||||||
queryWrapper.like(SysTimers::getTimerName, sysTimersParam.getTimerName());
|
|
||||||
}
|
|
||||||
// 拼接查询条件-状态(字典 1运行 2停止)
|
// 拼接查询条件-状态(字典 1运行 2停止)
|
||||||
if (ObjectUtil.isNotEmpty(sysTimersParam.getJobStatus())) {
|
queryWrapper.like(ObjectUtil.isNotNull(jobStatus), SysTimers::getJobStatus, jobStatus);
|
||||||
queryWrapper.like(SysTimers::getJobStatus, sysTimersParam.getJobStatus());
|
|
||||||
}
|
// 拼接查询条件-类名
|
||||||
|
queryWrapper.like(ObjectUtil.isNotEmpty(actionClass), SysTimers::getActionClass, actionClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询未删除的
|
// 查询未删除的
|
||||||
|
|
Loading…
Reference in New Issue