Browse Source

去掉接口开始时间校验

master
liuchen864 6 months ago
parent
commit
76062a9023
  1. 2
      win-admin/src/main/java/com/win/web/controller/base/CommandController.java
  2. 2
      win-admin/src/main/resources/logback-spring.xml
  3. 4
      win-common/src/main/java/com/win/common/constant/Constants.java
  4. 24
      win-quartz/src/main/java/com/win/quartz/task/RyTask.java
  5. 56
      win-quartz/src/main/java/com/win/quartz/task/WinTask.java

2
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 tenTimestamp = timestamp + (10 * 60 * 1000); // 计算10分钟后的时间戳
long currentTimestamp = System.currentTimeMillis(); // 获取当前时间戳 long currentTimestamp = System.currentTimeMillis(); // 获取当前时间戳
//过期 //过期
if(timestamp > currentTimestamp || tenTimestamp < currentTimestamp) { if(tenTimestamp < currentTimestamp) {
return AjaxResult.error(HttpStatus.EXPIRE_ERROR, "请求已过期"); return AjaxResult.error(HttpStatus.EXPIRE_ERROR, "请求已过期");
} }
List<String> activeProfile = ProfileUtil.getActiveProfile(); List<String> activeProfile = ProfileUtil.getActiveProfile();

2
win-admin/src/main/resources/logback-spring.xml

@ -139,7 +139,7 @@
</springProfile> </springProfile>
<!-- prod环境 --> <!-- prod环境 -->
<springProfile name="prod"> <springProfile name="prod">
<root level="INFO"> <root level="ERROR">
<appender-ref ref="file_info"/> <appender-ref ref="file_info"/>
<appender-ref ref="file_warn"/> <appender-ref ref="file_warn"/>
<appender-ref ref="file_error"/> <appender-ref ref="file_error"/>

4
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", 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 * 登录用户编号 redis key

24
win-quartz/src/main/java/com/win/quartz/task/RyTask.java

@ -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("执行无参方法");
}
}

56
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("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
// requestData.append("<soapenv:Envelope xmlns:soapenv=\"http://根据实际情况配置\" xmlns:esb=\"http://根据实际情况配置\">");
// requestData.append("<soapenv:Header/>");
// requestData.append("<soapenv:Body>");
//
// // 请求参数,根据实际情况进行配置,以下仅作为示例
// requestData.append("<ESB_USER>").append("zhangsan").append("</ESB_USER>");
// requestData.append("<ESB_PWD>").append("123456").append("</ESB_PWD>");
//
// requestData.append("</soapenv:Body>");
// requestData.append("</soapenv:Envelope>");
//
// log.info("请求报文为:" + requestData.toString());
// log.info("url:" + url);
// try {
// // 创建请求
// HttpEntity<String> 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);
// }
}
}
Loading…
Cancel
Save