Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
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
曲欣亮
shop
Commits
a5ecf13e
Commit
a5ecf13e
authored
Feb 29, 2024
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1.1.7.4
parent
83e1b04a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
28 deletions
+11
-28
IDCSystemLogAspect.java
...a/com/egolm/shop/common/component/IDCSystemLogAspect.java
+4
-23
DataSourceConfig.java
...n/java/com/egolm/shop/common/config/DataSourceConfig.java
+1
-1
application.properties
src/main/resources/application.properties
+5
-3
redmine.html
src/main/resources/templates/redmine.html
+1
-1
No files found.
src/main/java/com/egolm/shop/common/component/IDCSystemLogAspect.java
View file @
a5ecf13e
...
@@ -99,20 +99,13 @@ public class IDCSystemLogAspect {
...
@@ -99,20 +99,13 @@ public class IDCSystemLogAspect {
@Async
@Async
void
syncSaveLog
(
ProceedingJoinPoint
joinPoint
,
Date
startTime
,
Date
endTime
,
void
syncSaveLog
(
ProceedingJoinPoint
joinPoint
,
Date
startTime
,
Date
endTime
,
String
exception
,
String
result
,
int
statusCode
)
{
String
exception
,
String
result
,
int
statusCode
)
{
//TIdcServicesLogs log = new TIdcServicesLogs();
Map
<
String
,
Object
>
logMap
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
logMap
=
new
HashMap
<
String
,
Object
>();
//log.setsChannel(serverShopName);
logMap
.
put
(
"sChannel"
,
serverShopName
);
logMap
.
put
(
"sChannel"
,
serverShopName
);
try
{
try
{
//获取请求参数,不通过 joinPoint.getArgs() 获取。
//获取请求参数,不通过 joinPoint.getArgs() 获取。
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
if
(
request
!=
null
)
{
if
(
request
!=
null
)
{
/* log.setsUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setsHttpMethod(request.getMethod());
log.setsIp(ShopUtil.getIpAddress(request));
log.setsRequestText(GsonUtil.toJson(ShopUtil.getParameterMap(request)));*/
logMap
.
put
(
"sUserAgent"
,
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
));
logMap
.
put
(
"sUserAgent"
,
request
.
getHeader
(
HttpHeaders
.
USER_AGENT
));
logMap
.
put
(
"sHttpMethod"
,
request
.
getMethod
());
logMap
.
put
(
"sHttpMethod"
,
request
.
getMethod
());
logMap
.
put
(
"sIp"
,
ShopUtil
.
getIpAddress
(
request
));
logMap
.
put
(
"sIp"
,
ShopUtil
.
getIpAddress
(
request
));
...
@@ -124,22 +117,11 @@ public class IDCSystemLogAspect {
...
@@ -124,22 +117,11 @@ public class IDCSystemLogAspect {
Method
method
=
signature
.
getMethod
();
Method
method
=
signature
.
getMethod
();
IDCLogResource
annotation
=
method
.
getAnnotation
(
IDCLogResource
.
class
);
IDCLogResource
annotation
=
method
.
getAnnotation
(
IDCLogResource
.
class
);
if
(
annotation
!=
null
)
{
if
(
annotation
!=
null
)
{
//注解上的描述
//注解上的描述
//log.setsName(annotation.name());
logMap
.
put
(
"sName"
,
annotation
.
name
());
logMap
.
put
(
"sName"
,
annotation
.
name
());
}
}
/* System.out.println("aop 获取目标方法名 "+joinPoint.getSignature().getName());
System.out.println("aop 获取目标方法所属类的简单类名 "+joinPoint.getSignature().getDeclaringType().getName());
System.out.println("aop 返回 "+result);*/
/* log.setsClassName(joinPoint.getSignature().getDeclaringType().getName());
log.setsFunctionName(joinPoint.getSignature().getName());
log.setdStartTime(startTime);
log.setdEndTime(endTime);
log.setsCreateUser("aop");*/
logMap
.
put
(
"sClassName"
,
joinPoint
.
getSignature
().
getDeclaringType
().
getName
());
logMap
.
put
(
"sClassName"
,
joinPoint
.
getSignature
().
getDeclaringType
().
getName
());
logMap
.
put
(
"sFunctionName"
,
joinPoint
.
getSignature
().
getName
());
logMap
.
put
(
"sFunctionName"
,
joinPoint
.
getSignature
().
getName
());
...
@@ -149,11 +131,9 @@ public class IDCSystemLogAspect {
...
@@ -149,11 +131,9 @@ public class IDCSystemLogAspect {
//入参
//入参
Long
cost
=
endTime
.
getTime
()
-
startTime
.
getTime
();
Long
cost
=
endTime
.
getTime
()
-
startTime
.
getTime
();
/* log.setnCost(cost.intValue());
log.setsResponseText(result);*/
logMap
.
put
(
"nCost"
,
cost
.
intValue
());
logMap
.
put
(
"nCost"
,
cost
.
intValue
());
logMap
.
put
(
"sResponseText"
,
result
);
logMap
.
put
(
"sResponseText"
,
result
);
// jdbcTemplate.saveOrUpdate(log);
logMap
.
put
(
"nTag"
,
0
);
logMap
.
put
(
"nTag"
,
0
);
logMap
.
put
(
"dCreateDate"
,
new
Date
());
logMap
.
put
(
"dCreateDate"
,
new
Date
());
logMap
.
put
(
"dLastUpdateTime"
,
new
Date
());
logMap
.
put
(
"dLastUpdateTime"
,
new
Date
());
...
@@ -163,5 +143,6 @@ public class IDCSystemLogAspect {
...
@@ -163,5 +143,6 @@ public class IDCSystemLogAspect {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"aop 保存日志异常:"
,
e
);
logger
.
info
(
"aop 保存日志异常:"
,
e
);
}
}
}
}
}
}
src/main/java/com/egolm/shop/common/config/DataSourceConfig.java
View file @
a5ecf13e
...
@@ -71,7 +71,7 @@ public class DataSourceConfig {
...
@@ -71,7 +71,7 @@ public class DataSourceConfig {
public
JdbcTemplate
getLogJdbcTemplate
(
@Qualifier
(
"log"
)
DataSource
dataSource
)
{
public
JdbcTemplate
getLogJdbcTemplate
(
@Qualifier
(
"log"
)
DataSource
dataSource
)
{
JdbcTemplate
jdbcTemplate
=
new
JdbcTemplate
();
JdbcTemplate
jdbcTemplate
=
new
JdbcTemplate
();
jdbcTemplate
.
setDataSource
(
dataSource
);
jdbcTemplate
.
setDataSource
(
dataSource
);
jdbcTemplate
.
setDialect
(
new
MySql
Dialect
());
jdbcTemplate
.
setDialect
(
new
SqlServer
Dialect
());
jdbcTemplate
.
setSql_level
(
3
);
jdbcTemplate
.
setSql_level
(
3
);
return
jdbcTemplate
;
return
jdbcTemplate
;
}
}
...
...
src/main/resources/application.properties
View file @
a5ecf13e
...
@@ -40,11 +40,13 @@ spring.datasource.filters=stat,log4j
...
@@ -40,11 +40,13 @@ spring.datasource.filters=stat,log4j
log.isOpen
=
true
log.isOpen
=
true
log.datasource.username
=
ERP
log.datasource.username
=
ERP
log.datasource.password
=
qiyang@2013
log.datasource.password
=
qiyang@2013
log.datasource.url
=
jdbc:
mysql://10.10.0.21:3306/shopLog?useSSL=false&useUnicode=true&characterEncoding=utf8
log.datasource.url
=
jdbc:
sqlserver://10.10.0.22:1433;instanceName=SQLSERVER;DatabaseName=LOGDB;allowMultiQueries=true
log.datasource.driver-class-name
=
com.m
ysql.cj.jdbc.
Driver
log.datasource.driver-class-name
=
com.m
icrosoft.sqlserver.jdbc.SQLServer
Driver
log.datasource.testWhileIdle
=
true
log.datasource.testWhileIdle
=
true
log.datasource.validationQueryTimeout
=
5
log.datasource.validationQueryTimeout
=
5
log.datasource.validationQuery
=
SELECT 1 FROM DUAL
log.datasource.validationQuery
=
SELECT 1
log.datasource.timeBetweenEvictionRunsMillis
=
3600000
log.datasource.filters
=
stat,log4j
opt.express.url
=
https://service-5ptj62bx-1257101137.ap-shanghai.apigateway.myqcloud.com/release/express/query
opt.express.url
=
https://service-5ptj62bx-1257101137.ap-shanghai.apigateway.myqcloud.com/release/express/query
opt.express.secretId
=
AKID3dJ0MqWwN23oZ8xt4GFB0s8My1rEfUW2diLU
opt.express.secretId
=
AKID3dJ0MqWwN23oZ8xt4GFB0s8My1rEfUW2diLU
...
...
src/main/resources/templates/redmine.html
View file @
a5ecf13e
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<body>
<body>
<div
id=
"app"
>
<div
id=
"app"
>
<el-divider
content-position=
"left"
>
V1.1.7.4 2024-2-28
</el-divider>
<el-divider
content-position=
"left"
>
V1.1.7.4 2024-2-28
</el-divider>
<p
class=
"title"
>
1.将日志写入
mysql
的idcSystemLog,一天一表: idcSystemLog_yyyyMMdd
</p>
<p
class=
"title"
>
1.将日志写入
SqlServer LGODB
的idcSystemLog,一天一表: idcSystemLog_yyyyMMdd
</p>
<el-divider
content-position=
"left"
>
V1.1.7.3 2024-2-27
</el-divider>
<el-divider
content-position=
"left"
>
V1.1.7.3 2024-2-27
</el-divider>
<p
class=
"title"
>
1.增加开关,是否写idcSystemLog表
</p>
<p
class=
"title"
>
1.增加开关,是否写idcSystemLog表
</p>
<el-divider
content-position=
"left"
>
V1.1.7.2 2024-1-29
</el-divider>
<el-divider
content-position=
"left"
>
V1.1.7.2 2024-1-29
</el-divider>
...
...
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