在RUOYI-ADMIN模块中删除RUOYI-QUARTZ依赖,不想部署RUOYI-QUARTZ模块,则SysJobController和SysJobLogController编译错误,将这两个类移到RUOYI-QUARTZ模块中解决。
This commit is contained in:
parent
bcb7ba19f9
commit
e3f6c9d544
|
|
@ -1,41 +1,51 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.0</version>
|
<version>3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>ruoyi-quartz</artifactId>
|
<artifactId>ruoyi-quartz</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
quartz定时任务
|
quartz定时任务
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- 定时任务 -->
|
<!-- 定时任务 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
<artifactId>quartz</artifactId>
|
<artifactId>quartz</artifactId>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.mchange</groupId>
|
<groupId>com.mchange</groupId>
|
||||||
<artifactId>c3p0</artifactId>
|
<artifactId>c3p0</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 通用工具-->
|
<!-- 通用工具-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
</dependencies>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
<version>3.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,162 +1,159 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.quartz.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import org.springframework.stereotype.Controller;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import org.springframework.ui.ModelMap;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.ruoyi.quartz.service.ISysJobService;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import org.springframework.stereotype.Controller;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import org.springframework.ui.ModelMap;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import java.util.List;
|
||||||
import com.ruoyi.quartz.domain.SysJob;
|
|
||||||
import com.ruoyi.quartz.service.ISysJobService;
|
/**
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
* 调度任务信息操作处理
|
||||||
|
*
|
||||||
/**
|
* @author ruoyi
|
||||||
* 调度任务信息操作处理
|
*/
|
||||||
*
|
@Controller
|
||||||
* @author ruoyi
|
@RequestMapping("/monitor/job")
|
||||||
*/
|
public class SysJobController extends BaseController
|
||||||
@Controller
|
{
|
||||||
@RequestMapping("/monitor/job")
|
private String prefix = "monitor/job";
|
||||||
public class SysJobController extends BaseController
|
|
||||||
{
|
@Autowired
|
||||||
private String prefix = "monitor/job";
|
private ISysJobService jobService;
|
||||||
|
|
||||||
@Autowired
|
@RequiresPermissions("monitor:job:view")
|
||||||
private ISysJobService jobService;
|
@GetMapping()
|
||||||
|
public String job()
|
||||||
@RequiresPermissions("monitor:job:view")
|
{
|
||||||
@GetMapping()
|
return prefix + "/job";
|
||||||
public String job()
|
}
|
||||||
{
|
|
||||||
return prefix + "/job";
|
@RequiresPermissions("monitor:job:list")
|
||||||
}
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:list")
|
public TableDataInfo list(SysJob job)
|
||||||
@PostMapping("/list")
|
{
|
||||||
@ResponseBody
|
startPage();
|
||||||
public TableDataInfo list(SysJob job)
|
List<SysJob> list = jobService.selectJobList(job);
|
||||||
{
|
return getDataTable(list);
|
||||||
startPage();
|
}
|
||||||
List<SysJob> list = jobService.selectJobList(job);
|
|
||||||
return getDataTable(list);
|
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||||
}
|
@RequiresPermissions("monitor:job:export")
|
||||||
|
@PostMapping("/export")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:export")
|
public AjaxResult export(SysJob job)
|
||||||
@PostMapping("/export")
|
{
|
||||||
@ResponseBody
|
List<SysJob> list = jobService.selectJobList(job);
|
||||||
public AjaxResult export(SysJob job)
|
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||||
{
|
return util.exportExcel(list, "job");
|
||||||
List<SysJob> list = jobService.selectJobList(job);
|
}
|
||||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
|
||||||
return util.exportExcel(list, "job");
|
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||||
}
|
@RequiresPermissions("monitor:job:remove")
|
||||||
|
@PostMapping("/remove")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:remove")
|
public AjaxResult remove(String ids)
|
||||||
@PostMapping("/remove")
|
{
|
||||||
@ResponseBody
|
try
|
||||||
public AjaxResult remove(String ids)
|
{
|
||||||
{
|
jobService.deleteJobByIds(ids);
|
||||||
try
|
return success();
|
||||||
{
|
}
|
||||||
jobService.deleteJobByIds(ids);
|
catch (Exception e)
|
||||||
return success();
|
{
|
||||||
}
|
e.printStackTrace();
|
||||||
catch (Exception e)
|
return error(e.getMessage());
|
||||||
{
|
}
|
||||||
e.printStackTrace();
|
}
|
||||||
return error(e.getMessage());
|
|
||||||
}
|
/**
|
||||||
}
|
* 任务调度状态修改
|
||||||
|
*/
|
||||||
/**
|
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||||
* 任务调度状态修改
|
@RequiresPermissions("monitor:job:changeStatus")
|
||||||
*/
|
@PostMapping("/changeStatus")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:changeStatus")
|
public AjaxResult changeStatus(SysJob job)
|
||||||
@PostMapping("/changeStatus")
|
{
|
||||||
@ResponseBody
|
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
public AjaxResult changeStatus(SysJob job)
|
return toAjax(jobService.changeStatus(job));
|
||||||
{
|
}
|
||||||
job.setUpdateBy(ShiroUtils.getLoginName());
|
|
||||||
return toAjax(jobService.changeStatus(job));
|
/**
|
||||||
}
|
* 任务调度立即执行一次
|
||||||
|
*/
|
||||||
/**
|
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||||
* 任务调度立即执行一次
|
@RequiresPermissions("monitor:job:changeStatus")
|
||||||
*/
|
@PostMapping("/run")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:changeStatus")
|
public AjaxResult run(SysJob job)
|
||||||
@PostMapping("/run")
|
{
|
||||||
@ResponseBody
|
return toAjax(jobService.run(job));
|
||||||
public AjaxResult run(SysJob job)
|
}
|
||||||
{
|
|
||||||
return toAjax(jobService.run(job));
|
/**
|
||||||
}
|
* 新增调度
|
||||||
|
*/
|
||||||
/**
|
@GetMapping("/add")
|
||||||
* 新增调度
|
public String add()
|
||||||
*/
|
{
|
||||||
@GetMapping("/add")
|
return prefix + "/add";
|
||||||
public String add()
|
}
|
||||||
{
|
|
||||||
return prefix + "/add";
|
/**
|
||||||
}
|
* 新增保存调度
|
||||||
|
*/
|
||||||
/**
|
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||||
* 新增保存调度
|
@RequiresPermissions("monitor:job:add")
|
||||||
*/
|
@PostMapping("/add")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:add")
|
public AjaxResult addSave(SysJob job)
|
||||||
@PostMapping("/add")
|
{
|
||||||
@ResponseBody
|
job.setCreateBy(ShiroUtils.getLoginName());
|
||||||
public AjaxResult addSave(SysJob job)
|
return toAjax(jobService.insertJobCron(job));
|
||||||
{
|
}
|
||||||
job.setCreateBy(ShiroUtils.getLoginName());
|
|
||||||
return toAjax(jobService.insertJobCron(job));
|
/**
|
||||||
}
|
* 修改调度
|
||||||
|
*/
|
||||||
/**
|
@GetMapping("/edit/{jobId}")
|
||||||
* 修改调度
|
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||||
*/
|
{
|
||||||
@GetMapping("/edit/{jobId}")
|
mmap.put("job", jobService.selectJobById(jobId));
|
||||||
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
return prefix + "/edit";
|
||||||
{
|
}
|
||||||
mmap.put("job", jobService.selectJobById(jobId));
|
|
||||||
return prefix + "/edit";
|
/**
|
||||||
}
|
* 修改保存调度
|
||||||
|
*/
|
||||||
/**
|
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||||
* 修改保存调度
|
@RequiresPermissions("monitor:job:edit")
|
||||||
*/
|
@PostMapping("/edit")
|
||||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
@ResponseBody
|
||||||
@RequiresPermissions("monitor:job:edit")
|
public AjaxResult editSave(SysJob job)
|
||||||
@PostMapping("/edit")
|
{
|
||||||
@ResponseBody
|
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
public AjaxResult editSave(SysJob job)
|
return toAjax(jobService.updateJobCron(job));
|
||||||
{
|
}
|
||||||
job.setUpdateBy(ShiroUtils.getLoginName());
|
|
||||||
return toAjax(jobService.updateJobCron(job));
|
/**
|
||||||
}
|
* 校验cron表达式是否有效
|
||||||
|
*/
|
||||||
/**
|
@PostMapping("/checkCronExpressionIsValid")
|
||||||
* 校验cron表达式是否有效
|
@ResponseBody
|
||||||
*/
|
public boolean checkCronExpressionIsValid(SysJob job)
|
||||||
@PostMapping("/checkCronExpressionIsValid")
|
{
|
||||||
@ResponseBody
|
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
||||||
public boolean checkCronExpressionIsValid(SysJob job)
|
}
|
||||||
{
|
}
|
||||||
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,80 +1,80 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.quartz.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
import com.ruoyi.quartz.domain.SysJobLog;
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
import com.ruoyi.quartz.service.ISysJobLogService;
|
import com.ruoyi.quartz.service.ISysJobLogService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调度日志操作处理
|
* 调度日志操作处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/jobLog")
|
@RequestMapping("/monitor/jobLog")
|
||||||
public class SysJobLogController extends BaseController
|
public class SysJobLogController extends BaseController
|
||||||
{
|
{
|
||||||
private String prefix = "monitor/job";
|
private String prefix = "monitor/job";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysJobLogService jobLogService;
|
private ISysJobLogService jobLogService;
|
||||||
|
|
||||||
@RequiresPermissions("monitor:job:view")
|
@RequiresPermissions("monitor:job:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String jobLog()
|
public String jobLog()
|
||||||
{
|
{
|
||||||
return prefix + "/jobLog";
|
return prefix + "/jobLog";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:job:list")
|
@RequiresPermissions("monitor:job:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysJobLog jobLog)
|
public TableDataInfo list(SysJobLog jobLog)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
|
@Log(title = "调度日志", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("monitor:job:export")
|
@RequiresPermissions("monitor:job:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysJobLog jobLog)
|
public AjaxResult export(SysJobLog jobLog)
|
||||||
{
|
{
|
||||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||||
return util.exportExcel(list, "jobLog");
|
return util.exportExcel(list, "jobLog");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "调度日志", businessType = BusinessType.DELETE)
|
@Log(title = "调度日志", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("monitor:job:remove")
|
@RequiresPermissions("monitor:job:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids)
|
||||||
{
|
{
|
||||||
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
||||||
@RequiresPermissions("monitor:job:remove")
|
@RequiresPermissions("monitor:job:remove")
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean()
|
||||||
{
|
{
|
||||||
jobLogService.cleanJobLog();
|
jobLogService.cleanJobLog();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue