|
@@ -92,9 +92,6 @@ public class LogAspect |
|
@@ -92,9 +92,6 @@ public class LogAspect |
|
92
|
// 请求的地址
|
92
|
// 请求的地址
|
|
93
|
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
93
|
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
|
94
|
operLog.setOperIp(ip);
|
94
|
operLog.setOperIp(ip);
|
|
95
|
- // 返回参数
|
|
|
|
96
|
- operLog.setJsonResult(JSON.toJSONString(jsonResult));
|
|
|
|
97
|
-
|
|
|
|
98
|
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
95
|
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
|
99
|
if (loginUser != null)
|
96
|
if (loginUser != null)
|
|
100
|
{
|
97
|
{
|
|
@@ -113,7 +110,7 @@ public class LogAspect |
|
@@ -113,7 +110,7 @@ public class LogAspect |
|
113
|
// 设置请求方式
|
110
|
// 设置请求方式
|
|
114
|
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
111
|
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
|
115
|
// 处理设置注解上的参数
|
112
|
// 处理设置注解上的参数
|
|
116
|
- getControllerMethodDescription(joinPoint, controllerLog, operLog);
|
113
|
+ getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
|
|
117
|
// 保存数据库
|
114
|
// 保存数据库
|
|
118
|
AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
115
|
AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
|
|
119
|
}
|
116
|
}
|
|
@@ -133,7 +130,7 @@ public class LogAspect |
|
@@ -133,7 +130,7 @@ public class LogAspect |
|
133
|
* @param operLog 操作日志
|
130
|
* @param operLog 操作日志
|
|
134
|
* @throws Exception
|
131
|
* @throws Exception
|
|
135
|
*/
|
132
|
*/
|
|
136
|
- public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception
|
133
|
+ public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception
|
|
137
|
{
|
134
|
{
|
|
138
|
// 设置action动作
|
135
|
// 设置action动作
|
|
139
|
operLog.setBusinessType(log.businessType().ordinal());
|
136
|
operLog.setBusinessType(log.businessType().ordinal());
|
|
@@ -147,6 +144,11 @@ public class LogAspect |
|
@@ -147,6 +144,11 @@ public class LogAspect |
|
147
|
// 获取参数的信息,传入到数据库中。
|
144
|
// 获取参数的信息,传入到数据库中。
|
|
148
|
setRequestValue(joinPoint, operLog);
|
145
|
setRequestValue(joinPoint, operLog);
|
|
149
|
}
|
146
|
}
|
|
|
|
147
|
+ // 是否需要保存response,参数和值
|
|
|
|
148
|
+ if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
|
|
|
|
149
|
+ {
|
|
|
|
150
|
+ operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000));
|
|
|
|
151
|
+ }
|
|
150
|
}
|
152
|
}
|
|
151
|
|
153
|
|
|
152
|
/**
|
154
|
/**
|