Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
framework-tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fa2162a8
authored
Jul 03, 2024
by
henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除多余的依赖包
1 parent
6aba3b85
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
30 deletions
arch-base/pom.xml
arch-clouds/log/src/main/java/org/arch/log/aspect/AutoLogConfigAspect.java
arch-clouds/log/src/main/java/org/arch/log/entity/SysEventLog.java
arch-clouds/nacos/pom.xml
arch-gateway/pom.xml
arch-overall/src/main/resources/bootstrap-dev.yml
logs/eadc-architecture_error.log
logs/eadc-architecture_info.log
arch-base/pom.xml
View file @
fa2162a
...
@@ -140,7 +140,10 @@
...
@@ -140,7 +140,10 @@
<groupId>
commons-io
</groupId>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<artifactId>
commons-io
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
<!--velocity代码生成使用模板 -->
<!--velocity代码生成使用模板 -->
<dependency>
<dependency>
<groupId>
org.apache.velocity
</groupId>
<groupId>
org.apache.velocity
</groupId>
...
...
arch-clouds/log/src/main/java/org/arch/log/aspect/AutoLogConfigAspect.java
View file @
fa2162a
...
@@ -2,6 +2,7 @@ package org.arch.log.aspect;
...
@@ -2,6 +2,7 @@ package org.arch.log.aspect;
import
cn.hutool.core.thread.threadlocal.NamedThreadLocal
;
import
cn.hutool.core.thread.threadlocal.NamedThreadLocal
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -18,14 +19,14 @@ import org.springframework.web.context.request.RequestContextHolder;
...
@@ -18,14 +19,14 @@ import org.springframework.web.context.request.RequestContextHolder;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.util.Collection
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.UUID
;
@Slf4j
@Slf4j
@Aspect
@Aspect
...
@@ -72,30 +73,41 @@ public class AutoLogConfigAspect {
...
@@ -72,30 +73,41 @@ public class AutoLogConfigAspect {
protected
void
handleLog
(
final
JoinPoint
joinPoint
,
OperLog
controllerLog
,
final
Exception
e
,
Object
jsonResult
)
{
protected
void
handleLog
(
final
JoinPoint
joinPoint
,
OperLog
controllerLog
,
final
Exception
e
,
Object
jsonResult
)
{
try
{
try
{
MethodSignature
methodSignature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
// 请求的地址
ApiOperation
operation
=
methodSignature
.
getMethod
().
getAnnotation
(
ApiOperation
.
class
);
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
assert
requestAttributes
!=
null
;
HttpServletRequest
request
=
requestAttributes
.
getRequest
();
HttpServletResponse
response
=
requestAttributes
.
getResponse
();
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
ApiOperation
operation
=
signature
.
getMethod
().
getAnnotation
(
ApiOperation
.
class
);
Method
method
=
signature
.
getMethod
();
Object
[]
args
=
joinPoint
.
getArgs
();
Map
<
String
,
String
[]>
parameterMap
=
new
HashMap
<
String
,
String
[]>();
String
requParam
=
""
;
String
requestMethod
=
request
.
getMethod
();
// 获取请求参数集合
requParam
=
getRequParam
(
args
,
requestMethod
,
requParam
,
request
);
String
title
=
null
;
String
title
=
null
;
if
(
ObjectUtils
.
isNotNull
(
operation
)){
if
(
ObjectUtils
.
isNotNull
(
operation
)){
title
=
operation
.
value
();
title
=
operation
.
value
();
}
}
//计算耗时
//计算耗时
long
cost
=
System
.
currentTimeMillis
()
-
TIME_THREADLOCAL
.
get
();
long
cost
=
System
.
currentTimeMillis
()
-
TIME_THREADLOCAL
.
get
();
// 请求的地址
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
assert
requestAttributes
!=
null
;
HttpServletRequest
request
=
requestAttributes
.
getRequest
();
HttpServletResponse
response
=
requestAttributes
.
getResponse
();
String
ip
=
getIpAddr
(
request
);
String
ip
=
getIpAddr
(
request
);
// *========数据库日志=========*//
// *========数据库日志=========*//
SysEventLog
sysEventLog
=
new
SysEventLog
();
SysEventLog
sysEventLog
=
new
SysEventLog
();
String
userName
=
"测试"
;
String
userName
=
"测试"
;
sysEventLog
.
setRequestParams
(
requParam
);
// 操作人
// 操作人
sysEventLog
.
setUsername
(
userName
);
sysEventLog
.
setUsername
(
userName
);
sysEventLog
.
setLogType
(
controllerLog
.
logTypeValue
().
name
());
sysEventLog
.
setLogType
(
controllerLog
.
logTypeValue
().
name
());
sysEventLog
.
setUserCode
(
userName
);
sysEventLog
.
setUserCode
(
userName
);
sysEventLog
.
setUserId
(
userName
);
sysEventLog
.
setUserId
(
userName
);
sysEventLog
.
set
EventContent
(
title
);
sysEventLog
.
set
ModuleName
(
controllerLog
.
moduleName
()
);
sysEventLog
.
setLogId
(
UUID
.
randomUUID
()
+
""
.
replace
(
"-"
,
""
));
sysEventLog
.
setLogId
(
UUID
.
randomUUID
()
+
""
.
replace
(
"-"
,
""
));
sysEventLog
.
setEventType
(
controllerLog
.
value
().
name
());
sysEventLog
.
setEventContent
(
controllerLog
.
operDes
());
// 是否成功标志 1 成功 0 失败
// 是否成功标志 1 成功 0 失败
sysEventLog
.
setResult
(
"1"
);
sysEventLog
.
setResult
(
"1"
);
// 设置ip
// 设置ip
...
@@ -134,6 +146,38 @@ public class AutoLogConfigAspect {
...
@@ -134,6 +146,38 @@ public class AutoLogConfigAspect {
}
}
}
}
private
static
String
getRequParam
(
Object
[]
args
,
String
requestMethod
,
String
requParam
,
HttpServletRequest
request
)
{
Map
<
String
,
String
[]>
parameterMap
;
if
(
args
.
length
>
0
)
{
if
(
"POST"
.
equals
(
requestMethod
))
{
Object
[]
arguments
=
new
Object
[
args
.
length
];
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
args
[
i
]
instanceof
ServletRequest
||
args
[
i
]
instanceof
ServletResponse
||
args
[
i
]
instanceof
MultipartFile
)
{
// ServletRequest不能序列化,从入参里排除,否则报异常:java.lang.IllegalStateException:
// It is illegal to call this method if the current
// request is not in asynchronous mode (i.e.
// isAsyncStarted() returns false)
// ServletResponse不能序列化
// 从入参里排除,否则报异常:java.lang.IllegalStateException:
// getOutputStream() has already been called for
// this
// response
continue
;
}
arguments
[
i
]
=
args
[
i
];
if
(
arguments
!=
null
)
{
requParam
=
JSONObject
.
toJSONString
(
arguments
);
}
}
}
else
if
(
"GET"
.
equals
(
requestMethod
))
{
parameterMap
=
request
.
getParameterMap
();
requParam
=
JSONObject
.
toJSONString
(
parameterMap
);
}
}
return
requParam
;
}
public
static
String
getIpAddr
(
HttpServletRequest
request
)
{
public
static
String
getIpAddr
(
HttpServletRequest
request
)
{
if
(
request
==
null
)
{
if
(
request
==
null
)
{
return
"unknown"
;
return
"unknown"
;
...
...
arch-clouds/log/src/main/java/org/arch/log/entity/SysEventLog.java
View file @
fa2162a
...
@@ -145,6 +145,8 @@ public class SysEventLog {
...
@@ -145,6 +145,8 @@ public class SysEventLog {
@ApiModelProperty
(
value
=
"查询条件时间"
)
@ApiModelProperty
(
value
=
"查询条件时间"
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
time
;
private
String
time
;
@ApiModelProperty
(
value
=
"模块名称"
)
private
String
moduleName
;
public
static
final
String
LOG_ID
=
"log_id"
;
public
static
final
String
LOG_ID
=
"log_id"
;
...
...
arch-clouds/nacos/pom.xml
View file @
fa2162a
...
@@ -28,15 +28,15 @@
...
@@ -28,15 +28,15 @@
</dependency>
</dependency>
<!--openfeign-->
<!--openfeign-->
<dependency>
<
!--<
dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependency>
-->
<!--sentinel依赖-->
<!--sentinel依赖-->
<dependency>
<
!--<
dependency>
<groupId>com.alibaba.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
</dependency>
-->
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
arch-gateway/pom.xml
View file @
fa2162a
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</properties>
</properties>
<dependencies>
<dependencies>
<!--(nacos统一配置中心管理依赖)-->
<!--(nacos统一配置中心管理依赖)-->
<dependency>
<!--
<dependency>
<groupId>com.alibaba.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
</dependency>
...
@@ -26,32 +26,35 @@
...
@@ -26,32 +26,35 @@
<dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependency>
-->
<dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
knife4j-gateway-spring-boot-starter
</artifactId>
<artifactId>
knife4j-gateway-spring-boot-starter
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.arch
</groupId>
<artifactId>
spring-cloud-starter-loadbalancer
</artifactId>
<artifactId>
nacos
</artifactId>
</dependency>
<version>
1.0-SNAPSHOT
</version>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-bootstrap
</artifactId>
</dependency>
</dependency>
<!-- <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>-->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-bootstrap
</artifactId>
</dependency>
<!--gateway依赖-->
<!--gateway依赖-->
<dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-gateway
</artifactId>
<artifactId>
spring-cloud-starter-gateway
</artifactId>
</dependency>
</dependency>
<!--openfeign-->
<!--openfeign-->
<dependency>
<!--
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependency>
-->
<!--jwt-->
<!--jwt-->
<dependency>
<dependency>
...
...
arch-overall/src/main/resources/bootstrap-dev.yml
View file @
fa2162a
...
@@ -27,6 +27,8 @@ spring:
...
@@ -27,6 +27,8 @@ spring:
refresh
:
true
refresh
:
true
-
data-id
:
common-mybatis.${nacos.file-extension}
-
data-id
:
common-mybatis.${nacos.file-extension}
refresh
:
true
refresh
:
true
-
data-id
:
common-redis.${nacos.file-extension}
refresh
:
true
discovery
:
discovery
:
ip
:
localhost
ip
:
localhost
server-addr
:
${nacos.server-addr}
server-addr
:
${nacos.server-addr}
...
...
logs/eadc-architecture_error.log
View file @
fa2162a
This diff could not be displayed because it is too large.
logs/eadc-architecture_info.log
View file @
fa2162a
This diff could not be displayed because it is too large.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment