|
|
package com.aurora.controller;
|
|
|
|
|
|
import com.aurora.annotation.OptLog;
|
|
|
import com.aurora.model.dto.JobLogDTO;
|
|
|
import com.aurora.model.vo.ResultVO;
|
|
|
import com.aurora.service.JobLogService;
|
|
|
import com.aurora.model.vo.JobLogSearchVO;
|
|
|
import com.aurora.model.dto.PageResultDTO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import static com.aurora.constant.OptTypeConstant.DELETE;
|
|
|
|
|
|
@Api(tags = "定时任务日志模块")
|
|
|
@RestController
|
|
|
public class JobLogController {
|
|
|
|
|
|
@Autowired
|
|
|
private JobLogService jobLogService;//调用Service层的日志业务方法
|
|
|
|
|
|
@ApiOperation("获取定时任务的日志列表")
|
|
|
@GetMapping("/admin/jobLogs")
|
|
|
public ResultVO<PageResultDTO<JobLogDTO>> listJobLogs(JobLogSearchVO jobLogSearchVO) {
|
|
|
//JobLogSearchVO jobLogSearchVO:封装日志的查询条件(比如任务ID、执行状态、时间范围等)
|
|
|
return ResultVO.ok(jobLogService.listJobLogs(jobLogSearchVO));
|
|
|
}
|
|
|
|
|
|
@OptLog(optType = DELETE)
|
|
|
@ApiOperation("删除定时任务的日志")
|
|
|
@DeleteMapping("/admin/jobLogs")
|
|
|
public ResultVO<?> deleteJobLogs(@RequestBody List<Integer> ids) {
|
|
|
jobLogService.deleteJobLogs(ids);
|
|
|
return ResultVO.ok();
|
|
|
}
|
|
|
|
|
|
@OptLog(optType = DELETE)
|
|
|
@ApiOperation("清除定时任务的日志")
|
|
|
@DeleteMapping("/admin/jobLogs/clean")
|
|
|
//返回值ResultVO<?>:仅返回操作成功的状态,无具体业务数据
|
|
|
public ResultVO<?> cleanJobLogs() {
|
|
|
jobLogService.cleanJobLogs();
|
|
|
return ResultVO.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取定时任务日志的所有组名")//用于后台查询日志时筛选分组
|
|
|
@GetMapping("/admin/jobLogs/jobGroups")
|
|
|
//返回值ResultVO<?>:返回包含所有日志关联任务分组名称的结果(通常是字符串列表)
|
|
|
public ResultVO<?> listJobLogGroups() {
|
|
|
return ResultVO.ok(jobLogService.listJobLogGroups());
|
|
|
}
|
|
|
}
|