|
@@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
|
|
|
-import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
|
|
|
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*;
|
|
|
-import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert;
|
|
|
-import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
|
|
-import cn.iocoder.yudao.module.infra.service.job.InfJobService;
|
|
|
-import cn.iocoder.yudao.module.infra.controller.job.vo.job.*;
|
|
|
+import cn.iocoder.yudao.module.infra.convert.job.JobConvert;
|
|
|
+import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
|
|
+import cn.iocoder.yudao.module.infra.service.job.JobService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -32,19 +30,19 @@ import java.util.List;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
|
-@Api(tags = "定时任务")
|
|
|
+@Api(tags = "管理后台 - 定时任务")
|
|
|
@RestController
|
|
|
@RequestMapping("/infra/job")
|
|
|
@Validated
|
|
|
-public class InfJobController {
|
|
|
+public class JobController {
|
|
|
|
|
|
@Resource
|
|
|
- private InfJobService jobService;
|
|
|
+ private JobService jobService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@ApiOperation("创建定时任务")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:create')")
|
|
|
- public CommonResult<Long> createJob(@Valid @RequestBody InfJobCreateReqVO createReqVO)
|
|
|
+ public CommonResult<Long> createJob(@Valid @RequestBody JobCreateReqVO createReqVO)
|
|
|
throws SchedulerException {
|
|
|
return success(jobService.createJob(createReqVO));
|
|
|
}
|
|
@@ -52,7 +50,7 @@ public class InfJobController {
|
|
|
@PutMapping("/update")
|
|
|
@ApiOperation("更新定时任务")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:update')")
|
|
|
- public CommonResult<Boolean> updateJob(@Valid @RequestBody InfJobUpdateReqVO updateReqVO)
|
|
|
+ public CommonResult<Boolean> updateJob(@Valid @RequestBody JobUpdateReqVO updateReqVO)
|
|
|
throws SchedulerException {
|
|
|
jobService.updateJob(updateReqVO);
|
|
|
return success(true);
|
|
@@ -94,38 +92,38 @@ public class InfJobController {
|
|
|
@ApiOperation("获得定时任务")
|
|
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
|
|
- public CommonResult<InfJobRespVO> getJob(@RequestParam("id") Long id) {
|
|
|
- InfJobDO job = jobService.getJob(id);
|
|
|
- return success(InfJobConvert.INSTANCE.convert(job));
|
|
|
+ public CommonResult<JobRespVO> getJob(@RequestParam("id") Long id) {
|
|
|
+ JobDO job = jobService.getJob(id);
|
|
|
+ return success(JobConvert.INSTANCE.convert(job));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
@ApiOperation("获得定时任务列表")
|
|
|
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class)
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
|
|
- public CommonResult<List<InfJobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) {
|
|
|
- List<InfJobDO> list = jobService.getJobList(ids);
|
|
|
- return success(InfJobConvert.INSTANCE.convertList(list));
|
|
|
+ public CommonResult<List<JobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) {
|
|
|
+ List<JobDO> list = jobService.getJobList(ids);
|
|
|
+ return success(JobConvert.INSTANCE.convertList(list));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
|
@ApiOperation("获得定时任务分页")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
|
|
- public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) {
|
|
|
- PageResult<InfJobDO> pageResult = jobService.getJobPage(pageVO);
|
|
|
- return success(InfJobConvert.INSTANCE.convertPage(pageResult));
|
|
|
+ public CommonResult<PageResult<JobRespVO>> getJobPage(@Valid JobPageReqVO pageVO) {
|
|
|
+ PageResult<JobDO> pageResult = jobService.getJobPage(pageVO);
|
|
|
+ return success(JobConvert.INSTANCE.convertPage(pageResult));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
|
@ApiOperation("导出定时任务 Excel")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:export')")
|
|
|
@OperateLog(type = EXPORT)
|
|
|
- public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO,
|
|
|
+ public void exportJobExcel(@Valid JobExportReqVO exportReqVO,
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
- List<InfJobDO> list = jobService.getJobList(exportReqVO);
|
|
|
+ List<JobDO> list = jobService.getJobList(exportReqVO);
|
|
|
// 导出 Excel
|
|
|
- List<InfJobExcelVO> datas = InfJobConvert.INSTANCE.convertList02(list);
|
|
|
- ExcelUtils.write(response, "定时任务.xls", "数据", InfJobExcelVO.class, datas);
|
|
|
+ List<JobExcelVO> datas = JobConvert.INSTANCE.convertList02(list);
|
|
|
+ ExcelUtils.write(response, "定时任务.xls", "数据", JobExcelVO.class, datas);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get_next_times")
|
|
@@ -137,7 +135,7 @@ public class InfJobController {
|
|
|
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
|
|
public CommonResult<List<Date>> getJobNextTimes(@RequestParam("id") Long id,
|
|
|
@RequestParam(value = "count", required = false, defaultValue = "5") Integer count) {
|
|
|
- InfJobDO job = jobService.getJob(id);
|
|
|
+ JobDO job = jobService.getJob(id);
|
|
|
if (job == null) {
|
|
|
return success(Collections.emptyList());
|
|
|
}
|