From 9dcddc787628b8dde5b64d66047bb512c8a4bf5d Mon Sep 17 00:00:00 2001
From: 刘元博 <1553592282@qq.com>
Date: 星期四, 20 十月 2022 19:18:10 +0800
Subject: [PATCH] 修复小屏幕上修改头像界面布局错位的问题
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java | 51 ++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
index 4d37ee9..3cd7ced 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
@@ -1,6 +1,7 @@
package com.ruoyi.quartz.controller;
import java.util.List;
+import javax.servlet.http.HttpServletResponse;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -19,12 +20,12 @@
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 com.ruoyi.quartz.util.CronUtils;
+import com.ruoyi.quartz.util.ScheduleUtils;
/**
* 调度任务信息操作处理
@@ -55,12 +56,12 @@
*/
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(SysJob sysJob)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, SysJob sysJob)
{
List<SysJob> list = jobService.selectJobList(sysJob);
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
- return util.exportExcel(list, "定时任务");
+ util.exportExcel(response, list, "定时任务");
}
/**
@@ -87,13 +88,25 @@
}
else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
{
- return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用");
+ return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
+ {
+ return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
}
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
{
- return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
+ return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
}
- job.setCreateBy(SecurityUtils.getUsername());
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
+ {
+ return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
+ }
+ else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+ {
+ return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
+ }
+ job.setCreateBy(getUsername());
return toAjax(jobService.insertJob(job));
}
@@ -111,13 +124,25 @@
}
else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
{
- return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用");
+ return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
+ }
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
+ {
+ return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
}
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
{
- return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)//'调用");
+ return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
}
- job.setUpdateBy(SecurityUtils.getUsername());
+ else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
+ {
+ return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
+ }
+ else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+ {
+ return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
+ }
+ job.setUpdateBy(getUsername());
return toAjax(jobService.updateJob(job));
}
@@ -142,8 +167,8 @@
@PutMapping("/run")
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
{
- jobService.run(job);
- return AjaxResult.success();
+ boolean result = jobService.run(job);
+ return result ? success() : error("任务不存在或已过期!");
}
/**
@@ -155,6 +180,6 @@
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
{
jobService.deleteJobByIds(jobIds);
- return AjaxResult.success();
+ return success();
}
}
--
Gitblit v1.9.2