Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
shop
Commits
772268ce
Commit
772268ce
authored
Mar 13, 2024
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1.1.7.5
parent
ff017898
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
9 deletions
+27
-9
pom.xml
pom.xml
+1
-1
WebMvcConfig.java
src/main/java/com/egolm/shop/common/config/WebMvcConfig.java
+8
-0
OpenInterceptor.java
...va/com/egolm/shop/common/interceptor/OpenInterceptor.java
+14
-8
application.properties
src/main/resources/application.properties
+2
-0
redmine.html
src/main/resources/templates/redmine.html
+2
-0
No files found.
pom.xml
View file @
772268ce
...
...
@@ -209,7 +209,7 @@
</executions>
<configuration>
<repository>
dockerhub.linkfern.com/b2c/shopapi
</repository>
<tag>
V1.1.7.
4
</tag>
<tag>
V1.1.7.
5
</tag>
<buildArgs>
<JAR_FILE>
${project.build.finalName}.jar
</JAR_FILE>
</buildArgs>
...
...
src/main/java/com/egolm/shop/common/config/WebMvcConfig.java
View file @
772268ce
package
com
.
egolm
.
shop
.
common
.
config
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistration
;
...
...
@@ -12,6 +13,8 @@ import com.egolm.shop.common.interceptor.OpenInterceptor;
@Configuration
public
class
WebMvcConfig
implements
WebMvcConfigurer
{
@Value
(
"${server.isSign:false}"
)
private
boolean
isSign
;
@Autowired
OpenInterceptor
openInterceptor
;
...
...
@@ -45,6 +48,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
InterceptorRegistration
logsRegistration
=
registry
.
addInterceptor
(
logInterceptor
).
addPathPatterns
(
"/**"
);
logsRegistration
.
excludePathPatterns
(
"/"
,
"/**.*"
,
"/error"
);
logsRegistration
.
excludePathPatterns
(
"/csrf"
,
"/swagger-resources/**"
,
"/webjars/**"
);
if
(
isSign
)
{
registry
.
addInterceptor
(
openInterceptor
).
addPathPatterns
(
"/**"
).
excludePathPatterns
(
"/pay/**"
);
}
}
}
src/main/java/com/egolm/shop/common/interceptor/OpenInterceptor.java
View file @
772268ce
...
...
@@ -19,7 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.MD5Util
;
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.utils.I18NUtils
;
import
com.egolm.shop.common.utils.ShopContstrant
;
...
...
@@ -32,6 +32,9 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
@Value
(
"${ignoreTimestamp:false}"
)
private
Boolean
ignoreTimestamp
;
@Value
(
"${server.md5key:90f49d4bb0216c10816c7dec6bf28c89}"
)
private
String
defaultMd5Key
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
...
...
@@ -50,29 +53,32 @@ public class OpenInterceptor extends HandlerInterceptorAdapter {
if
(!
StringUtil
.
isNotBlank
(
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
);
if
(!
ignoreTimestamp
&&
Math
.
abs
(
timeLong
-
System
.
currentTimeMillis
())
>
(
60L
*
5L
)
)
{
throw
new
XException
(
"时间戳
无
效"
);
boolean
checkTimstamp
=
StringUtil
.
checkTimeStamp_13
(
5
,
timestamp
);
if
(!
checkTimstamp
)
{
throw
new
XException
(
"时间戳
错误或失
效"
);
}
SortedMap
<
Object
,
Object
>
parameters
=
new
TreeMap
<
Object
,
Object
>();
Set
<
String
>
keys
=
paramMap
.
keySet
()
;
for
(
String
key
:
keys
)
{
String
value
=
req
.
getParameter
(
key
);
parameters
.
put
(
key
,
value
);
}
redisTemplate
.
opsForHash
().
put
(
"SystemCtl1111"
,
"test"
,
"111"
);
/*
redisTemplate.opsForHash().put("SystemCtl1111", "test","111");
System.out.println(redisTemplate.opsForHash().get("SystemCtl1111", "test"));
Map<?, ?> map = (Map<?, ?>)redisTemplate.opsForHash().get(ShopContstrant.SystemCtl_Redis_Base_Key, ShopContstrant.CLIENT_MD5KEY);
System.out.println(map);
if(map != null) {
parameters
.
put
(
"md5Key"
,
map
.
get
(
"sValue1"
)+
""
);
parameters.put("md5Key",
defaultMd5Key
);
}else {
logger.info("从redis中获取 计算签名用的md5key 获取失败");
throw new XException(I18NUtils.getMessage(langID, "Msg_Sign_failure"));
}
} */
parameters
.
put
(
"md5Key"
,
defaultMd5Key
);
logger
.
info
(
"request sign >>>>>>"
+
sign
);
String
createSign
=
MD5Util
.
createSign
(
encoding
,
parameters
);
...
...
src/main/resources/application.properties
View file @
772268ce
...
...
@@ -7,6 +7,8 @@ server.session.timeout=90000
server.tomcat.uri-encoding
=
utf-8
server.shop.name
=
shop
server.isSign
=
true
server.md5key
=
90f49d4bb0216c10816c7dec6bf28c89
spring.http.multipart.maxFileSize
=
5MB
spring.http.multipart.maxRequestSize
=
5MB
...
...
src/main/resources/templates/redmine.html
View file @
772268ce
...
...
@@ -24,6 +24,8 @@
</head>
<body>
<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>
<p
class=
"title"
>
1.将日志写入SqlServer LGODB的idcSystemLog,一月一表: idcSystemLog_yyyyMM
</p>
<p
class=
"title"
>
2.读写分离拆分 需求 #16467
</p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment