From 76062a9023dc554b41940a2c3837009effb1dbb3 Mon Sep 17 00:00:00 2001 From: liuchen864 <23082234@qq.com> Date: Sun, 12 May 2024 18:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=8E=A5=E5=8F=A3=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E9=97=B4=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/base/CommandController.java | 2 +- .../src/main/resources/logback-spring.xml | 2 +- .../com/win/common/constant/Constants.java | 4 +- .../main/java/com/win/quartz/task/RyTask.java | 24 -------- .../java/com/win/quartz/task/WinTask.java | 56 +++++++++++++++++++ 5 files changed, 60 insertions(+), 28 deletions(-) delete mode 100644 win-quartz/src/main/java/com/win/quartz/task/RyTask.java create mode 100644 win-quartz/src/main/java/com/win/quartz/task/WinTask.java diff --git a/win-admin/src/main/java/com/win/web/controller/base/CommandController.java b/win-admin/src/main/java/com/win/web/controller/base/CommandController.java index e1766ee..15755ca 100644 --- a/win-admin/src/main/java/com/win/web/controller/base/CommandController.java +++ b/win-admin/src/main/java/com/win/web/controller/base/CommandController.java @@ -65,7 +65,7 @@ public class CommandController { long tenTimestamp = timestamp + (10 * 60 * 1000); // 计算10分钟后的时间戳 long currentTimestamp = System.currentTimeMillis(); // 获取当前时间戳 //过期 - if(timestamp > currentTimestamp || tenTimestamp < currentTimestamp) { + if(tenTimestamp < currentTimestamp) { return AjaxResult.error(HttpStatus.EXPIRE_ERROR, "请求已过期"); } List activeProfile = ProfileUtil.getActiveProfile(); diff --git a/win-admin/src/main/resources/logback-spring.xml b/win-admin/src/main/resources/logback-spring.xml index 52957b7..0bf72a3 100644 --- a/win-admin/src/main/resources/logback-spring.xml +++ b/win-admin/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + diff --git a/win-common/src/main/java/com/win/common/constant/Constants.java b/win-common/src/main/java/com/win/common/constant/Constants.java index 39d4eef..fd89cd2 100644 --- a/win-common/src/main/java/com/win/common/constant/Constants.java +++ b/win-common/src/main/java/com/win/common/constant/Constants.java @@ -132,13 +132,13 @@ public class Constants /** * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) */ - public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; + public static final String[] JOB_WHITELIST_STR = { "com.win" }; /** * 定时任务违规的字符 */ public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", - "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" }; + "org.springframework", "org.apache", "com.win.common.utils.file", "com.win.common.config" }; /** * 登录用户编号 redis key diff --git a/win-quartz/src/main/java/com/win/quartz/task/RyTask.java b/win-quartz/src/main/java/com/win/quartz/task/RyTask.java deleted file mode 100644 index 3f72d08..0000000 --- a/win-quartz/src/main/java/com/win/quartz/task/RyTask.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.win.quartz.task; - -import com.win.common.utils.StringUtils; -import org.springframework.stereotype.Component; - -/** - * 定时任务调度测试 - * - * @author win - */ -@Component("ryTask") -public class RyTask { - public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { - System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); - } - - public void ryParams(String params) { - System.out.println("执行有参方法:" + params); - } - - public void ryNoParams() { - System.out.println("执行无参方法"); - } -} diff --git a/win-quartz/src/main/java/com/win/quartz/task/WinTask.java b/win-quartz/src/main/java/com/win/quartz/task/WinTask.java new file mode 100644 index 0000000..f9a2fc9 --- /dev/null +++ b/win-quartz/src/main/java/com/win/quartz/task/WinTask.java @@ -0,0 +1,56 @@ +package com.win.quartz.task; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +/** + * 定时任务调度 + * + * @author win + */ +@Slf4j +@Component("winTask") +public class WinTask { + + @Autowired + private RestTemplate restTemplate; + + public void haveParams(String params) { +// // 创建一个请求头对象 +// HttpHeaders headers = new HttpHeaders(); +// // 设置请求头对象contentTyp的为text/xml;charset=UTF-8 +// MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8"); +// headers.setContentType(type); +// +// // 将请求参数进行封装并进行远程接口服务调用 +// // 构造webservice请求参数 +// // 请求参数,根据实际情况进行配置,以下仅作为示例 +// StringBuilder requestData = new StringBuilder(); +// requestData.append(""); +// requestData.append(""); +// requestData.append(""); +// requestData.append(""); +// +// // 请求参数,根据实际情况进行配置,以下仅作为示例 +// requestData.append("").append("zhangsan").append(""); +// requestData.append("").append("123456").append(""); +// +// requestData.append(""); +// requestData.append(""); +// +// log.info("请求报文为:" + requestData.toString()); +// log.info("url:" + url); +// try { +// // 创建请求 +// HttpEntity request = new HttpEntity<>(requestData.toString(), headers); +// // 发送post请求并获取到响应结果 +// String str = restTemplate.postForObject(url, request, String.class); +// log.info("-----------Response content-----------: " + str); +// } catch (Exception e) { +// log.error("baseWebServiceRequest出现异常:" + e.getMessage(), e); +// } + } + +}