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
0031b938
Commit
0031b938
authored
Aug 10, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
446dce4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
MqAspect.java
...oud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
+11
-7
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/MqAspect.java
View file @
0031b938
package
com
.
yanzuoguang
.
cloud
.
aop
;
import
com.yanzuoguang.mq.plan.YzgMqConsumer
;
import
com.yanzuoguang.mq.service.MessageLogService
;
import
com.yanzuoguang.util.exception.ExceptionHelper
;
import
com.yanzuoguang.util.vo.LogVo
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
...
@@ -10,6 +11,7 @@ import org.aspectj.lang.annotation.Pointcut;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Method
;
...
...
@@ -26,6 +28,9 @@ public class MqAspect extends BaseRequestAspect {
private
static
final
String
TAG
=
MqAspect
.
class
.
getSimpleName
();
@Autowired
private
MessageLogService
logService
;
/**
* exec aop point aspect
*/
...
...
@@ -63,6 +68,7 @@ public class MqAspect extends BaseRequestAspect {
ex
=
e
;
throw
e
;
}
finally
{
logService
.
logCurrentRemove
();
responseLog
(
declaringType
,
TAG
,
url
,
clear
,
start
,
getRequestBody
(
joinPoint
),
result
,
ex
,
log
);
}
}
...
...
@@ -74,19 +80,17 @@ public class MqAspect extends BaseRequestAspect {
}
MethodSignature
methodSignature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
targetMethod
=
methodSignature
.
getMethod
();
Message
message
=
getMessage
(
joinPoint
.
getArgs
());
if
(
message
!=
null
)
{
logService
.
logCurrent
(
message
);
}
if
(
YzgMqConsumer
.
class
.
equals
(
targetMethod
.
getDeclaringClass
()))
{
ret
=
false
;
}
else
{
RabbitListener
annotation
=
targetMethod
.
getAnnotation
(
RabbitListener
.
class
);
if
(
annotation
!=
null
)
{
if
(
annotation
!=
null
||
message
!=
null
)
{
ret
=
true
;
}
if
(!
ret
)
{
Message
message
=
getMessage
(
joinPoint
.
getArgs
());
if
(
message
!=
null
)
{
ret
=
true
;
}
}
}
return
ret
;
}
...
...
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