Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
lei
fzm-joying
Commits
ed3a2504
Commit
ed3a2504
authored
Sep 02, 2022
by
33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新OBS配置
parent
9fd32f46
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
44 deletions
+42
-44
application-dev.yml
joying-admin/src/main/resources/application-dev.yml
+3
-3
application.yml
joying-admin/src/main/resources/application.yml
+3
-3
LogAop.java
joying-portal/src/main/java/com/fzm/portal/aop/LogAop.java
+30
-32
application-dev.yml
joying-portal/src/main/resources/application-dev.yml
+3
-3
application.yml
joying-portal/src/main/resources/application.yml
+3
-3
No files found.
joying-admin/src/main/resources/application-dev.yml
View file @
ed3a2504
...
@@ -106,10 +106,10 @@ copyright:
...
@@ -106,10 +106,10 @@ copyright:
huaweiyun
:
huaweiyun
:
obs
:
obs
:
app-key
:
HIULSHJZJOTWB72Z38ZB
app-key
:
CYEVMBJZJA1EXTNOOIGQ
app-secret
:
GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
app-secret
:
L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point
:
obs.cn-east-3.myhuaweicloud.com
end-point
:
obs.cn-east-3.myhuaweicloud.com
bucket
:
filmchain-file
bucket
:
inmvo-obs
wx-pay
:
wx-pay
:
app-id
:
wxbdddd81913c795e9
app-id
:
wxbdddd81913c795e9
...
...
joying-admin/src/main/resources/application.yml
View file @
ed3a2504
...
@@ -106,10 +106,10 @@ copyright:
...
@@ -106,10 +106,10 @@ copyright:
huaweiyun
:
huaweiyun
:
obs
:
obs
:
app-key
:
HIULSHJZJOTWB72Z38ZB
app-key
:
CYEVMBJZJA1EXTNOOIGQ
app-secret
:
GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
app-secret
:
L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point
:
obs.cn-east-3.myhuaweicloud.com
end-point
:
obs.cn-east-3.myhuaweicloud.com
bucket
:
filmchain-file
bucket
:
inmvo-obs
wx-pay
:
wx-pay
:
app-id
:
wxbdddd81913c795e9
app-id
:
wxbdddd81913c795e9
...
...
joying-portal/src/main/java/com/fzm/portal/aop/LogAop.java
View file @
ed3a2504
package
com
.
fzm
.
portal
.
aop
;
package
com
.
fzm
.
portal
.
aop
;
import
com.alibaba.fastjson.JSON
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.After
;
import
org.aspectj.lang.annotation.*
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
...
@@ -20,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -20,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Parameter
;
import
java.lang.reflect.Parameter
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,7 +37,7 @@ public class LogAop {
...
@@ -38,7 +37,7 @@ public class LogAop {
private
final
HttpServletRequest
request
;
private
final
HttpServletRequest
request
;
private
static
final
ThreadLocal
<
Long
>
threadL
ocal
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Long
>
l
ocal
=
new
ThreadLocal
<>();
@Pointcut
(
value
=
"execution(public * com.fzm.portal.controller..*.*(..))"
)
@Pointcut
(
value
=
"execution(public * com.fzm.portal.controller..*.*(..))"
)
public
void
pointCut
()
{
public
void
pointCut
()
{
...
@@ -52,41 +51,42 @@ public class LogAop {
...
@@ -52,41 +51,42 @@ public class LogAop {
*/
*/
@Before
(
"pointCut()"
)
@Before
(
"pointCut()"
)
public
void
deBefore
(
JoinPoint
joinPoint
)
{
public
void
deBefore
(
JoinPoint
joinPoint
)
{
// 记录此次请求的开始时间
long
start
=
Instant
.
now
().
toEpochMilli
();
long
start
=
System
.
currentTimeMillis
();
local
.
set
(
start
);
threadLocal
.
set
(
start
);
}
// 获取请求路径
@AfterReturning
(
pointcut
=
"pointCut()"
)
public
void
logAfterReturning
(
JoinPoint
joinPoint
)
{
log
(
joinPoint
,
null
);
}
@AfterThrowing
(
pointcut
=
"pointCut()"
,
throwing
=
"e"
)
public
void
logAfterThrowing
(
JoinPoint
joinPoint
,
Throwable
e
)
{
log
(
joinPoint
,
e
);
}
private
void
log
(
JoinPoint
joinPoint
,
Throwable
e
)
{
String
requestURI
=
request
.
getRequestURI
();
String
requestURI
=
request
.
getRequestURI
();
// 获取请求参数
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
Method
method
=
signature
.
getMethod
();
Method
method
=
signature
.
getMethod
();
List
<
Object
>
parameter
=
getParameter
(
method
,
joinPoint
.
getArgs
());
List
<
Object
>
parameter
=
getParameter
(
method
,
joinPoint
.
getArgs
());
log
.
info
(
"请求路径: {},请求参数:{}"
,
requestURI
,
parameter
);
}
long
duration
=
Instant
.
now
().
toEpochMilli
()
-
local
.
get
();
/**
String
msg
=
duration
+
"ms "
* 后置通知
+
request
.
getMethod
()
+
" "
*
+
requestURI
+
" "
* @param joinPoint
+
JSON
.
toJSONString
(
parameter
)
+
(
e
==
null
?
""
:
" "
+
e
.
getMessage
());
*/
@After
(
"pointCut()"
)
log
.
info
(
msg
);
public
void
doAfter
(
JoinPoint
joinPoint
)
{
long
end
=
System
.
currentTimeMillis
();
Long
start
=
threadLocal
.
get
();
long
l
=
end
-
start
;
String
requestURI
=
request
.
getRequestURI
();
log
.
info
(
"请求路径:{},接口耗时:{}ms"
,
requestURI
,
l
);
}
}
/**
* 根据方法和传入的参数获取请求参数
*/
private
List
<
Object
>
getParameter
(
Method
method
,
Object
[]
args
)
{
private
List
<
Object
>
getParameter
(
Method
method
,
Object
[]
args
)
{
List
<
Object
>
argList
=
new
ArrayList
<>();
List
<
Object
>
argList
=
new
ArrayList
<>(
args
.
length
);
Parameter
[]
parameters
=
method
.
getParameters
();
Parameter
[]
parameters
=
method
.
getParameters
();
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
//将RequestBody注解修饰的参数作为请求参数
RequestBody
requestBody
=
parameters
[
i
].
getAnnotation
(
RequestBody
.
class
);
RequestBody
requestBody
=
parameters
[
i
].
getAnnotation
(
RequestBody
.
class
);
if
(
requestBody
!=
null
)
{
if
(
requestBody
!=
null
)
{
argList
.
add
(
args
[
i
]);
argList
.
add
(
args
[
i
]);
...
@@ -95,18 +95,16 @@ public class LogAop {
...
@@ -95,18 +95,16 @@ public class LogAop {
if
(
modelAttribute
!=
null
)
{
if
(
modelAttribute
!=
null
)
{
argList
.
add
(
args
[
i
]);
argList
.
add
(
args
[
i
]);
}
}
//将RequestParam注解修饰的参数作为请求参数
RequestParam
requestParam
=
parameters
[
i
].
getAnnotation
(
RequestParam
.
class
);
RequestParam
requestParam
=
parameters
[
i
].
getAnnotation
(
RequestParam
.
class
);
if
(
requestParam
!=
null
)
{
if
(
requestParam
!=
null
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
key
=
parameters
[
i
].
getName
();
String
key
=
parameters
[
i
].
getName
();
if
(
!
StringUtils
.
isEmpty
(
requestParam
.
value
()))
{
if
(
StringUtils
.
isNotBlank
(
requestParam
.
value
()))
{
key
=
requestParam
.
value
();
key
=
requestParam
.
value
();
}
}
map
.
put
(
key
,
args
[
i
]);
map
.
put
(
key
,
args
[
i
]);
argList
.
add
(
map
);
argList
.
add
(
map
);
}
}
// PathVariable修饰的请求参数
PathVariable
pathVariable
=
parameters
[
i
].
getAnnotation
(
PathVariable
.
class
);
PathVariable
pathVariable
=
parameters
[
i
].
getAnnotation
(
PathVariable
.
class
);
if
(
pathVariable
!=
null
)
{
if
(
pathVariable
!=
null
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
joying-portal/src/main/resources/application-dev.yml
View file @
ed3a2504
...
@@ -120,10 +120,10 @@ chain:
...
@@ -120,10 +120,10 @@ chain:
huaweiyun
:
huaweiyun
:
obs
:
obs
:
app-key
:
HIULSHJZJOTWB72Z38ZB
app-key
:
CYEVMBJZJA1EXTNOOIGQ
app-secret
:
GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
app-secret
:
L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point
:
obs.cn-east-3.myhuaweicloud.com
end-point
:
obs.cn-east-3.myhuaweicloud.com
bucket
:
filmchain-file
bucket
:
inmvo-obs
wx-pay
:
wx-pay
:
app-id
:
wxbdddd81913c795e9
app-id
:
wxbdddd81913c795e9
...
...
joying-portal/src/main/resources/application.yml
View file @
ed3a2504
...
@@ -120,10 +120,10 @@ chain:
...
@@ -120,10 +120,10 @@ chain:
huaweiyun
:
huaweiyun
:
obs
:
obs
:
app-key
:
HIULSHJZJOTWB72Z38ZB
app-key
:
CYEVMBJZJA1EXTNOOIGQ
app-secret
:
GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
app-secret
:
L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point
:
obs.cn-east-3.myhuaweicloud.com
end-point
:
obs.cn-east-3.myhuaweicloud.com
bucket
:
filmchain-file
bucket
:
inmvo-obs
wx-pay
:
wx-pay
:
app-id
:
wxbdddd81913c795e9
app-id
:
wxbdddd81913c795e9
...
...
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