调整部分包路径
This commit is contained in:
@ -10,7 +10,6 @@ import java.util.Properties;
|
||||
* 定时任务配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ScheduleConfig
|
||||
|
@ -0,0 +1,171 @@
|
||||
package com.ruoyi.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.quartz.domain.SysJob;
|
||||
import com.ruoyi.quartz.service.ISysJobService;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/job")
|
||||
public class SysJobController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/job";
|
||||
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
|
||||
@RequiresPermissions("monitor:job:view")
|
||||
@GetMapping()
|
||||
public String job()
|
||||
{
|
||||
return prefix + "/job";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysJob job)
|
||||
{
|
||||
startPage();
|
||||
List<SysJob> list = jobService.selectJobList(job);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysJob job)
|
||||
{
|
||||
List<SysJob> list = jobService.selectJobList(job);
|
||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||
return util.exportExcel(list, "定时任务");
|
||||
}
|
||||
|
||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
jobService.deleteJobByIds(ids);
|
||||
return success();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:detail")
|
||||
@GetMapping("/detail/{jobId}")
|
||||
public String detail(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("name", "job");
|
||||
mmap.put("job", jobService.selectJobById(jobId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysJob job)
|
||||
{
|
||||
return toAjax(jobService.changeStatus(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度立即执行一次
|
||||
*/
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/run")
|
||||
@ResponseBody
|
||||
public AjaxResult run(SysJob job)
|
||||
{
|
||||
return toAjax(jobService.run(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增调度
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存调度
|
||||
* @throws Exception
|
||||
*/
|
||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("monitor:job:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysJob job) throws Exception
|
||||
{
|
||||
return toAjax(jobService.insertJobCron(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改调度
|
||||
*/
|
||||
@GetMapping("/edit/{jobId}")
|
||||
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("job", jobService.selectJobById(jobId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存调度
|
||||
* @throws Exception
|
||||
*/
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysJob job ) throws Exception
|
||||
{
|
||||
return toAjax(jobService.updateJobCron(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*/
|
||||
@PostMapping("/checkCronExpressionIsValid")
|
||||
@ResponseBody
|
||||
public boolean checkCronExpressionIsValid(SysJob job)
|
||||
{
|
||||
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.ruoyi.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.quartz.domain.SysJobLog;
|
||||
import com.ruoyi.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 调度日志操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/jobLog")
|
||||
public class SysJobLogController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/job";
|
||||
|
||||
@Autowired
|
||||
private ISysJobLogService jobLogService;
|
||||
|
||||
@RequiresPermissions("monitor:job:view")
|
||||
@GetMapping()
|
||||
public String jobLog()
|
||||
{
|
||||
return prefix + "/jobLog";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysJobLog jobLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysJobLog jobLog)
|
||||
{
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||
return util.exportExcel(list, "调度日志");
|
||||
}
|
||||
|
||||
@Log(title = "调度日志", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:detail")
|
||||
@GetMapping("/detail/{jobLogId}")
|
||||
public String detail(@PathVariable("jobLogId") Long jobLogId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("name", "jobLog");
|
||||
mmap.put("jobLog", jobLogService.selectJobLogById(jobLogId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
jobLogService.cleanJobLog();
|
||||
return success();
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ import java.util.Date;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quartz.util.CronUtils;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.ruoyi.quartz.domain;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志表 sys_job_log
|
||||
|
Reference in New Issue
Block a user