|
|
@ -65,7 +65,7 @@ public class QuartzJobController {
|
|
|
|
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
|
|
|
|
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
|
|
|
|
Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
|
|
|
|
Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
|
|
|
|
IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
|
|
|
|
IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
|
|
|
|
return Result.ok(pageList);
|
|
|
|
return Result.OK(pageList);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -79,7 +79,7 @@ public class QuartzJobController {
|
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
|
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
|
|
|
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
|
|
|
quartzJobService.saveAndScheduleJob(quartzJob);
|
|
|
|
quartzJobService.saveAndScheduleJob(quartzJob);
|
|
|
|
return Result.ok("创建定时任务成功");
|
|
|
|
return Result.OK("创建定时任务成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -97,7 +97,7 @@ public class QuartzJobController {
|
|
|
|
log.error(e.getMessage(),e);
|
|
|
|
log.error(e.getMessage(),e);
|
|
|
|
return Result.error("更新定时任务失败!");
|
|
|
|
return Result.error("更新定时任务失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Result.ok("更新定时任务成功!");
|
|
|
|
return Result.OK("更新定时任务成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -114,7 +114,7 @@ public class QuartzJobController {
|
|
|
|
return Result.error("未找到对应实体");
|
|
|
|
return Result.error("未找到对应实体");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
quartzJobService.deleteAndStopJob(quartzJob);
|
|
|
|
quartzJobService.deleteAndStopJob(quartzJob);
|
|
|
|
return Result.ok("删除成功!");
|
|
|
|
return Result.OK("删除成功!");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ public class QuartzJobController {
|
|
|
|
QuartzJob job = quartzJobService.getById(id);
|
|
|
|
QuartzJob job = quartzJobService.getById(id);
|
|
|
|
quartzJobService.deleteAndStopJob(job);
|
|
|
|
quartzJobService.deleteAndStopJob(job);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Result.ok("删除定时任务成功!");
|
|
|
|
return Result.OK("删除定时任务成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -152,7 +152,7 @@ public class QuartzJobController {
|
|
|
|
return Result.error("定时任务不存在!");
|
|
|
|
return Result.error("定时任务不存在!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
quartzJobService.pause(job);
|
|
|
|
quartzJobService.pause(job);
|
|
|
|
return Result.ok("暂停定时任务成功");
|
|
|
|
return Result.OK("暂停定时任务成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -171,7 +171,7 @@ public class QuartzJobController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
quartzJobService.resumeJob(job);
|
|
|
|
quartzJobService.resumeJob(job);
|
|
|
|
//scheduler.resumeJob(JobKey.jobKey(job.getJobClassName().trim()));
|
|
|
|
//scheduler.resumeJob(JobKey.jobKey(job.getJobClassName().trim()));
|
|
|
|
return Result.ok("恢复定时任务成功");
|
|
|
|
return Result.OK("恢复定时任务成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -183,7 +183,7 @@ public class QuartzJobController {
|
|
|
|
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
|
|
|
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
|
QuartzJob quartzJob = quartzJobService.getById(id);
|
|
|
|
QuartzJob quartzJob = quartzJobService.getById(id);
|
|
|
|
return Result.ok(quartzJob);
|
|
|
|
return Result.OK(quartzJob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -265,6 +265,6 @@ public class QuartzJobController {
|
|
|
|
log.info("定时任务 立即执行失败>>"+e.getMessage());
|
|
|
|
log.info("定时任务 立即执行失败>>"+e.getMessage());
|
|
|
|
return Result.error("执行失败!");
|
|
|
|
return Result.error("执行失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Result.ok("执行成功!");
|
|
|
|
return Result.OK("执行成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|