Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuyifan
2025-04-15 11:40:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
30f81e1359e128486fdad0987855938e7d0d82ac
30f81e13
1 parent
3a38d61c
升级版本
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
build.gradle
src/main/java/com/infoloop/tianting/aspect/RepeatSubmitAspect.java
build.gradle
View file @
30f81e1
...
...
@@ -61,8 +61,8 @@ dependencies {
// compileOnly 'org.projectlombok:lombok'
// annotationProcessor 'org.projectlombok:lombok'
compileOnly
'org.projectlombok:lombok:1.18.2
0
'
annotationProcessor
'org.projectlombok:lombok:1.18.2
0
'
compileOnly
'org.projectlombok:lombok:1.18.2
4
'
annotationProcessor
'org.projectlombok:lombok:1.18.2
4
'
testImplementation
'org.springframework.boot:spring-boot-starter-test'
}
...
...
src/main/java/com/infoloop/tianting/aspect/RepeatSubmitAspect.java
View file @
30f81e1
...
...
@@ -58,7 +58,6 @@ public class RepeatSubmitAspect {
* 获取LockKey
*
* @param joinPoint 切入点
* @return
*/
public
static
String
getLockKey
(
ProceedingJoinPoint
joinPoint
)
{
//获取连接点的方法签名对象
...
...
@@ -79,13 +78,13 @@ public class RepeatSubmitAspect {
continue
;
}
//如果属性是RequestKeyParam注解,则拼接 连接符 "& + RequestKeyParam"
if
(
sb
.
length
()
>
0
)
{
if
(
!
sb
.
isEmpty
()
)
{
sb
.
append
(
requestLock
.
delimiter
());
}
sb
.
append
(
args
[
i
]);
}
//如果方法上没有加RequestKeyParam注解
if
(
StringUtils
.
isEmpty
(
sb
.
toString
(
)))
{
if
(
!
StringUtils
.
hasText
((
sb
.
toString
()
)))
{
//获取方法上的多个注解(为什么是两层数组:因为第二层数组是只有一个元素的数组)
final
var
parameterAnnotations
=
method
.
getParameterAnnotations
();
//循环注解
...
...
@@ -103,7 +102,7 @@ public class RepeatSubmitAspect {
//如果有,设置Accessible为true(为true时可以使用反射访问私有变量,否则不能访问私有变量)
field
.
setAccessible
(
true
);
//如果属性是RequestKeyParam注解,则拼接 连接符" & + RequestKeyParam"
if
(
sb
.
length
()
>
0
)
{
if
(
!
sb
.
isEmpty
()
)
{
sb
.
append
(
requestLock
.
delimiter
());
}
sb
.
append
(
ReflectionUtils
.
getField
(
field
,
object
));
...
...
@@ -112,9 +111,9 @@ public class RepeatSubmitAspect {
}
if
(
requestLock
.
isLockByLoginUser
())
{
final
var
operatorId
=
LoginContextHolder
.
hasLogin
()
?
LoginContextHolder
.
getId
()
:
null
;
return
requestLock
.
prefix
()
+
(
operatorId
!=
null
?
CommonConstants
.
COLON
+
operatorId
:
""
)
+
(
sb
.
length
()
>
0
?
CommonConstants
.
UNDERLINE
+
sb
:
""
);
return
requestLock
.
prefix
()
+
(
operatorId
!=
null
?
CommonConstants
.
COLON
+
operatorId
:
""
)
+
(
!
sb
.
isEmpty
()
?
CommonConstants
.
UNDERLINE
+
sb
:
""
);
}
else
{
return
requestLock
.
prefix
()
+
(
sb
.
length
()
>
0
?
CommonConstants
.
UNDERLINE
+
sb
:
""
);
return
requestLock
.
prefix
()
+
(
!
sb
.
isEmpty
()
?
CommonConstants
.
UNDERLINE
+
sb
:
""
);
}
}
}
...
...
Please
register
or
login
to post a comment