Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
77e8de6b
Commit
77e8de6b
authored
Jan 25, 2021
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分代码
parent
30c66f80
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
64 deletions
+78
-64
OrganizationManageImpl.java
...n/java/com/jz/dm/service/impl/OrganizationManageImpl.java
+1
-1
ApiQueryService.java
.../main/java/com/jz/dm/service/request/ApiQueryService.java
+43
-33
SystemLogAspect.java
...y/src/main/java/com/jz/dm/web/aspect/SystemLogAspect.java
+34
-30
No files found.
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/OrganizationManageImpl.java
View file @
77e8de6b
...
...
@@ -223,7 +223,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
public
ApiOrg
getAuthOrganization
(
Long
apiOrgId
)
{
QueryWrapper
<
ApiOrg
>
query
=
new
QueryWrapper
<>();
query
.
eq
(
"id"
,
apiOrgId
);
query
.
eq
(
"status"
,
OrgStatusEnum
.
NORMAL
.
name
()
);
query
.
eq
(
"status"
,
1
);
query
.
eq
(
"is_deleted"
,
0
);
return
apiOrgMapper
.
selectOne
(
query
);
}
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryService.java
View file @
77e8de6b
This diff is collapsed.
Click to expand it.
jz-dm-apigateway/src/main/java/com/jz/dm/web/aspect/SystemLogAspect.java
View file @
77e8de6b
...
...
@@ -69,7 +69,6 @@ public class SystemLogAspect {
}
@Around
(
"aroundAspect()"
)
public
void
doAround
(
ProceedingJoinPoint
joinPoint
)
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
...
...
@@ -81,8 +80,9 @@ public class SystemLogAspect {
params
+=
JsonUtils
.
objectToJson
(
joinPoint
.
getArgs
()[
i
])
+
";"
;
}
}
if
(
StringUtils
.
isNotBlank
(
params
)){
params
=
params
.
substring
(
0
,
params
.
length
()-
1
).
split
(
";"
)[
0
];;
if
(
StringUtils
.
isNotBlank
(
params
))
{
params
=
params
.
substring
(
0
,
params
.
length
()
-
1
).
split
(
";"
)[
0
];
;
}
//获取请求路径
String
url
=
UrlUtil
.
getServerUrl
(
request
);
...
...
@@ -95,33 +95,37 @@ public class SystemLogAspect {
String
paramsList
=
jsonObject
.
getString
(
"openApiParams"
);
com
.
alibaba
.
fastjson
.
JSONObject
jsonParamsList
=
com
.
alibaba
.
fastjson
.
JSONObject
.
parseObject
(
paramsList
);
ApiReqLog
reqLog
=
new
ApiReqLog
();
JSONObject
jsonResult
=
null
;
try
{
reqLog
.
setRequestIp
(
ip
);
reqLog
.
setApiKey
(
jsonObject
.
getString
(
"apiKey"
));
reqLog
.
setRequestParams
(
params
);
reqLog
.
setResponseParams
(
""
);
//响应参数
reqLog
.
setRequestUrl
(
url
);
reqLog
.
setRequestMethod
(
contextPath
);
reqLog
.
setEncryMode
(
jsonObject
.
getString
(
"signType"
));
//加密方式:MD5,RSA
reqLog
.
setEncryMode
(
"MD5"
);
//加密方式暂时写死MD5
reqLog
.
setTransMode
(
request
.
getMethod
());
//传输方式 GET POST
reqLog
.
setRequestToken
(
jsonParamsList
.
getString
(
"authCode"
));
reqLog
.
setRequestStartTime
(
new
Date
());
reqLog
.
setRemark
(
getServiceMethodDescription
(
joinPoint
));
log
.
info
(
"请求参数:"
,
reqLog
);
if
(
null
!=
reqLog
)
{
apiReqLogMapper
.
insert
(
reqLog
);
JSONObject
jsonResult
=
null
;
Boolean
isTest
=
jsonParamsList
.
getBoolean
(
"isTest"
);
//不保存测试数据
if
(!
isTest
)
{
try
{
reqLog
.
setRequestIp
(
ip
);
reqLog
.
setApiKey
(
jsonObject
.
getString
(
"apiKey"
));
reqLog
.
setRequestParams
(
params
);
reqLog
.
setResponseParams
(
""
);
//响应参数
reqLog
.
setRequestUrl
(
url
);
reqLog
.
setRequestMethod
(
contextPath
);
reqLog
.
setEncryMode
(
jsonObject
.
getString
(
"signType"
));
//加密方式:MD5,RSA
//reqLog.setEncryMode("MD5"); //加密方式暂时写死MD5
reqLog
.
setTransMode
(
request
.
getMethod
());
//传输方式 GET POST
reqLog
.
setRequestToken
(
jsonParamsList
.
getString
(
"authCode"
));
reqLog
.
setRequestStartTime
(
new
Date
());
reqLog
.
setRemark
(
getServiceMethodDescription
(
joinPoint
));
log
.
info
(
"请求参数:"
,
reqLog
);
if
(
null
!=
reqLog
)
{
apiReqLogMapper
.
insert
(
reqLog
);
}
Object
result
=
joinPoint
.
proceed
(
joinPoint
.
getArgs
());
jsonResult
=
JSONObject
.
fromObject
(
result
);
log
.
info
(
"around响应结果为{}"
,
jsonResult
);
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
GatewayException
ex
)
{
log
.
info
(
"切面处理保存异常信息:{}"
,
ex
.
getMessage
());
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
Object
result
=
joinPoint
.
proceed
(
joinPoint
.
getArgs
());
jsonResult
=
JSONObject
.
fromObject
(
result
);
log
.
info
(
"around响应结果为{}"
,
jsonResult
);
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
GatewayException
ex
)
{
log
.
info
(
"切面处理保存异常信息:{}"
,
ex
.
getMessage
());
apiLogService
.
updateLog
(
reqLog
.
getId
(),
jsonResult
);
}
catch
(
Throwable
throwable
){
throwable
.
printStackTrace
();
}
}
/*@Before("beforeAspect()")
...
...
@@ -204,7 +208,7 @@ public class SystemLogAspect {
// log.error("异常信息{}", e.getMessage());
// }
// }
// }
/**
* 获取注解中对方法的描述信息 用于service层注解
...
...
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