|
|
@@ -21,6 +21,7 @@ import com.ruoyi.common.core.utils.StringUtils;
|
|
21
|
21
|
import com.ruoyi.common.core.utils.ip.IpUtils;
|
|
22
|
22
|
import com.ruoyi.common.log.annotation.Log;
|
|
23
|
23
|
import com.ruoyi.common.log.enums.BusinessStatus;
|
|
|
24
|
+import com.ruoyi.common.log.filter.PropertyPreExcludeFilter;
|
|
24
|
25
|
import com.ruoyi.common.log.service.AsyncLogService;
|
|
25
|
26
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
26
|
27
|
import com.ruoyi.system.api.domain.SysOperLog;
|
|
|
@@ -35,7 +36,10 @@ import com.ruoyi.system.api.domain.SysOperLog;
|
|
35
|
36
|
public class LogAspect
|
|
36
|
37
|
{
|
|
37
|
38
|
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
|
38
|
|
-
|
|
|
39
|
+
|
|
|
40
|
+ /** 排除敏感属性字段 */
|
|
|
41
|
+ public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
|
|
|
42
|
+
|
|
39
|
43
|
@Autowired
|
|
40
|
44
|
private AsyncLogService asyncLogService;
|
|
41
|
45
|
|
|
|
@@ -162,7 +166,7 @@ public class LogAspect
|
|
162
|
166
|
{
|
|
163
|
167
|
try
|
|
164
|
168
|
{
|
|
165
|
|
- Object jsonObj = JSON.toJSON(o);
|
|
|
169
|
+ String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter());
|
|
166
|
170
|
params += jsonObj.toString() + " ";
|
|
167
|
171
|
}
|
|
168
|
172
|
catch (Exception e)
|
|
|
@@ -175,6 +179,14 @@ public class LogAspect
|
|
175
|
179
|
}
|
|
176
|
180
|
|
|
177
|
181
|
/**
|
|
|
182
|
+ * 忽略敏感属性
|
|
|
183
|
+ */
|
|
|
184
|
+ public PropertyPreExcludeFilter excludePropertyPreFilter()
|
|
|
185
|
+ {
|
|
|
186
|
+ return new PropertyPreExcludeFilter().addExcludes(EXCLUDE_PROPERTIES);
|
|
|
187
|
+ }
|
|
|
188
|
+
|
|
|
189
|
+ /**
|
|
178
|
190
|
* 判断是否需要过滤的对象。
|
|
179
|
191
|
*
|
|
180
|
192
|
* @param o 对象信息。
|