Commit 772268ce authored by 张永's avatar 张永

V1.1.7.5

parent ff017898
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
</executions> </executions>
<configuration> <configuration>
<repository>dockerhub.linkfern.com/b2c/shopapi</repository> <repository>dockerhub.linkfern.com/b2c/shopapi</repository>
<tag>V1.1.7.4</tag> <tag>V1.1.7.5</tag>
<buildArgs> <buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE> <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs> </buildArgs>
......
package com.egolm.shop.common.config; package com.egolm.shop.common.config;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
...@@ -12,6 +13,8 @@ import com.egolm.shop.common.interceptor.OpenInterceptor; ...@@ -12,6 +13,8 @@ import com.egolm.shop.common.interceptor.OpenInterceptor;
@Configuration @Configuration
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@Value("${server.isSign:false}")
private boolean isSign;
@Autowired @Autowired
OpenInterceptor openInterceptor; OpenInterceptor openInterceptor;
...@@ -45,6 +48,11 @@ public class WebMvcConfig implements WebMvcConfigurer { ...@@ -45,6 +48,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
InterceptorRegistration logsRegistration = registry.addInterceptor(logInterceptor).addPathPatterns("/**"); InterceptorRegistration logsRegistration = registry.addInterceptor(logInterceptor).addPathPatterns("/**");
logsRegistration.excludePathPatterns("/", "/**.*", "/error"); logsRegistration.excludePathPatterns("/", "/**.*", "/error");
logsRegistration.excludePathPatterns("/csrf", "/swagger-resources/**", "/webjars/**"); logsRegistration.excludePathPatterns("/csrf", "/swagger-resources/**", "/webjars/**");
if(isSign) {
registry.addInterceptor(openInterceptor).addPathPatterns("/**").excludePathPatterns("/pay/**");
}
} }
} }
...@@ -19,7 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; ...@@ -19,7 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.common.GsonUtil; import com.egolm.common.GsonUtil;
import com.egolm.common.MD5Util; import com.egolm.common.MD5Util;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.Util; import com.egolm.common.Util;
import com.egolm.shop.common.XException; import com.egolm.shop.common.XException;
import com.egolm.shop.common.utils.I18NUtils; import com.egolm.shop.common.utils.I18NUtils;
import com.egolm.shop.common.utils.ShopContstrant; import com.egolm.shop.common.utils.ShopContstrant;
...@@ -32,6 +32,9 @@ public class OpenInterceptor extends HandlerInterceptorAdapter { ...@@ -32,6 +32,9 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
@Value("${ignoreTimestamp:false}") @Value("${ignoreTimestamp:false}")
private Boolean ignoreTimestamp; private Boolean ignoreTimestamp;
@Value("${server.md5key:90f49d4bb0216c10816c7dec6bf28c89}")
private String defaultMd5Key;
@Autowired @Autowired
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
...@@ -50,29 +53,32 @@ public class OpenInterceptor extends HandlerInterceptorAdapter { ...@@ -50,29 +53,32 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
if(!StringUtil.isNotBlank(sign,timestamp,langID,terminal)) { if(!StringUtil.isNotBlank(sign,timestamp,langID,terminal)) {
throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ; throw new XException(I18NUtils.getMessage(langID, "Msg_Paramter_Empty","[sign,timestamp,langID,terminal]")) ;
} }
Long timeLong = Util.objTo(timestamp, Long.class, 0L); boolean checkTimstamp = StringUtil.checkTimeStamp_13(5, timestamp);
if(!ignoreTimestamp && Math.abs(timeLong - System.currentTimeMillis()) > (60L*5L)) { if(!checkTimstamp) {
throw new XException("时间戳效"); throw new XException("时间戳错误或失效");
} }
SortedMap<Object,Object> parameters = new TreeMap<Object,Object>(); SortedMap<Object,Object> parameters = new TreeMap<Object,Object>();
Set<String> keys = paramMap.keySet() ; Set<String> keys = paramMap.keySet() ;
for (String key : keys) { for (String key : keys) {
String value = req.getParameter(key); String value = req.getParameter(key);
parameters.put(key,value); parameters.put(key,value);
} }
redisTemplate.opsForHash().put("SystemCtl1111", "test","111"); /* redisTemplate.opsForHash().put("SystemCtl1111", "test","111");
System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test")); System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test"));
Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY); Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY);
System.out.println(map); System.out.println(map);
if(map != null) { if(map != null) {
parameters.put("md5Key", map.get("sValue1")+""); parameters.put("md5Key", defaultMd5Key);
}else { }else {
logger.info("从redis中获取 计算签名用的md5key 获取失败"); logger.info("从redis中获取 计算签名用的md5key 获取失败");
throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure")); throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure"));
} } */
parameters.put("md5Key", defaultMd5Key);
logger.info("request sign >>>>>>"+sign); logger.info("request sign >>>>>>"+sign);
String createSign = MD5Util.createSign(encoding, parameters); String createSign = MD5Util.createSign(encoding, parameters);
......
...@@ -7,6 +7,8 @@ server.session.timeout=90000 ...@@ -7,6 +7,8 @@ server.session.timeout=90000
server.tomcat.uri-encoding=utf-8 server.tomcat.uri-encoding=utf-8
server.shop.name=shop server.shop.name=shop
server.isSign=true
server.md5key=90f49d4bb0216c10816c7dec6bf28c89
spring.http.multipart.maxFileSize=5MB spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB spring.http.multipart.maxRequestSize=5MB
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<el-divider content-position="left">V1.1.7.5 2024-3-13</el-divider>
<p class="title">1.增加接口签名验证及开关</p>
<el-divider content-position="left">V1.1.7.4 2024-3-1</el-divider> <el-divider content-position="left">V1.1.7.4 2024-3-1</el-divider>
<p class="title">1.将日志写入SqlServer LGODB的idcSystemLog,一月一表: idcSystemLog_yyyyMM</p> <p class="title">1.将日志写入SqlServer LGODB的idcSystemLog,一月一表: idcSystemLog_yyyyMM</p>
<p class="title">2.读写分离拆分 需求 #16467</p> <p class="title">2.读写分离拆分 需求 #16467</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment