| | |
| | | package com.ruoyi.quartz.controller; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.quartz.domain.SysJob; |
| | | import com.ruoyi.quartz.service.ISysJobService; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 调度任务信息操作处理 |
| | | * |
| | | * @deprecated 3.5.0删除 迁移至xxl-job |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SysJob sysJob) |
| | | public void export(SysJob sysJob, HttpServletResponse response) |
| | | { |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class); |
| | | return util.exportExcel(list, "定时任务"); |
| | | ExcelUtil.exportExcel(list, "定时任务", SysJob.class, response); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) |
| | | { |
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap://'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用"); |
| | | } |
| | | job.setCreateBy(SecurityUtils.getUsername()); |
| | | job.setCreateBy(getUsername()); |
| | | return toAjax(jobService.insertJob(job)); |
| | | } |
| | | |
| | |
| | | { |
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) |
| | | { |
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap://'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用"); |
| | | } |
| | | job.setUpdateBy(SecurityUtils.getUsername()); |
| | | job.setUpdateBy(getUsername()); |
| | | return toAjax(jobService.updateJob(job)); |
| | | } |
| | | |