Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
Overview
Overview
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
base_platform_enterprise
gic-platform-enterprise
Commits
e6b31e15
Commit
e6b31e15
authored
Sep 25, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打印参数
parent
ef662b36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
ParamAOP.java
...ice/src/main/java/com/gic/enterprise/config/ParamAOP.java
+61
-0
No files found.
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/config/ParamAOP.java
0 → 100644
View file @
e6b31e15
package
com
.
gic
.
enterprise
.
config
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.context.annotation.Configuration
;
/**
* 采集GIC系统操作日志
*
* @author leeon
* @date 2019年6月28日
*/
@Aspect
@Configuration
public
class
ParamAOP
{
private
Logger
logger
=
LogManager
.
getLogger
(
ParamAOP
.
class
);
/**
* 环绕通知
*
* @param joinPoint
* @return
* @throws Throwable
*/
@Around
(
value
=
"execution(* com.gic.*.service..*(..))"
)
public
Object
around
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
try
{
// 当前方法
String
currentMethodName
=
getMethodName
(
joinPoint
);
// 当前方法参数列表
Object
[]
args
=
joinPoint
.
getArgs
();
logger
.
info
(
"请求方法:{}, 参数:{}"
,
currentMethodName
,
args
);
// 执行当前方法
return
joinPoint
.
proceed
();
}
catch
(
Throwable
throwable
)
{
logger
.
warn
(
"拦截器错误"
,
throwable
);
throw
throwable
;
}
}
/**
* 获取当前方法
*
* @param joinPoint
* @return
* @throws
*/
private
String
getMethodName
(
ProceedingJoinPoint
joinPoint
)
throws
NoSuchMethodException
{
Signature
signature
=
joinPoint
.
getSignature
();
MethodSignature
methodSignature
=
(
MethodSignature
)
signature
;
Object
target
=
joinPoint
.
getTarget
();
return
target
.
getClass
().
getName
()
+
"."
+
methodSignature
.
getName
();
}
}
\ No newline at end of file
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