Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
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
shenjunjie
brandkbs2
Commits
22600ff9
Commit
22600ff9
authored
May 04, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beforeLog异常日志调整
parent
d62f5506
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/main/java/com/zhiwei/brandkbs2/aop/AopLogRecord.java
+7
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/aop/AopLogRecord.java
View file @
22600ff9
...
...
@@ -62,6 +62,7 @@ public class AopLogRecord {
@AfterReturning
(
value
=
"execution(public * com..controller..admin..*Controller.*(..)) || execution(* com..controller..app..*Controller.*(..)) || execution(* com..controller..LoginController.checkBind())"
,
returning
=
"ResponseResult"
)
private
void
beforeLog
(
JoinPoint
joinPoint
,
ResponseResult
ResponseResult
){
String
pid
=
null
;
try
{
long
now
=
System
.
currentTimeMillis
();
// RequestContextHolder 顾名思义 持有 request 上下文的容器
...
...
@@ -85,8 +86,12 @@ public class AopLogRecord {
String
method
=
methodSignature
.
getMethod
().
getAnnotation
(
ApiOperation
.
class
).
value
();
// 前后台,false:前台,true:后台
boolean
backstage
=
uri
.
contains
(
"admin"
);
if
(!(
Tools
.
isNullOrUndefined
(
request
.
getHeader
(
jwtKey
))
||
Tools
.
isNullOrUndefined
(
request
.
getHeader
(
"pid"
))))
{
String
token
=
request
.
getHeader
(
jwtKey
);
pid
=
request
.
getHeader
(
"pid"
);
// 任意有一个不为空
if
(!(
Tools
.
isNullOrUndefined
(
token
)
||
Tools
.
isNullOrUndefined
(
pid
)))
{
Map
<
String
,
Object
>
map
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
);
// 排除token过期或其他组合的可能性
if
(
null
==
map
)
{
return
;
}
...
...
@@ -116,7 +121,7 @@ public class AopLogRecord {
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"beforeLog
"
,
e
);
log
.
error
(
"beforeLog
,pid:{}"
,
pid
,
e
);
}
}
...
...
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