Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
ee2e14c8
Commit
ee2e14c8
authored
Aug 14, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
默认日期格式的支持
parent
386061e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
MqAspect.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
+25
-1
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
View file @
ee2e14c8
...
...
@@ -2,13 +2,18 @@ package com.yanzuoguang.cloud.aop;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.log.Log
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Method
;
/**
* LogsAspect(接口请求日志切面)
*
...
...
@@ -39,7 +44,12 @@ public class MqAspect extends BaseRequestAspect {
*/
@Around
(
value
=
"mqAspect()"
)
public
Object
requestWebAround
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
boolean
clear
=
requestLogInit
();
boolean
clear
=
isRabbit
(
joinPoint
);
if
(
clear
)
{
Log
.
threadBegin
();
}
else
{
clear
=
requestLogInit
();
}
long
start
=
requestLog
(
TAG
,
joinPoint
);
Object
result
=
null
;
Exception
ex
=
null
;
...
...
@@ -58,6 +68,20 @@ public class MqAspect extends BaseRequestAspect {
}
}
private
boolean
isRabbit
(
ProceedingJoinPoint
joinPoint
)
{
if
(
joinPoint
.
getSignature
()
instanceof
MethodSignature
)
{
MethodSignature
methodSignature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
targetMethod
=
methodSignature
.
getMethod
();
Annotation
[]
annotations
=
targetMethod
.
getAnnotations
();
for
(
Annotation
annotation
:
annotations
)
{
if
(
annotation
.
getClass
().
getSimpleName
().
indexOf
(
"RabbitListener"
)
>=
0
)
{
return
true
;
}
}
}
return
false
;
}
private
Object
executeMethod
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
return
joinPoint
.
proceed
();
}
...
...
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