publish 1.0.6
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<version>1.0.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.tiesheng.core.config.operation;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||
import com.tiesheng.annotation.operation.OperationLog;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
@@ -74,11 +76,11 @@ public class OperationAspect {
|
||||
insertKey = operationLog.insertKey();
|
||||
}
|
||||
|
||||
Object reqObj = null;
|
||||
Map<String, Object> reqMaps = null;
|
||||
ConcurrentHashMap<String, Object> allParams = new ConcurrentHashMap<>(16);
|
||||
if (joinPoint.getArgs().length > 0) {
|
||||
reqObj = joinPoint.getArgs()[0];
|
||||
allParams.putAll(BeanUtil.beanToMap(reqObj, false, true));
|
||||
reqMaps = BeanUtil.beanToMap(joinPoint.getArgs()[0], false, true);
|
||||
allParams.putAll(reqMaps);
|
||||
}
|
||||
|
||||
Object response = joinPoint.proceed(joinPoint.getArgs());
|
||||
@@ -98,7 +100,15 @@ public class OperationAspect {
|
||||
subject = ServletKit.getRequest().getRequestURI();
|
||||
}
|
||||
|
||||
coreLogService.addOperationLog(title, subject, reqObj);
|
||||
// 指定字段脱敏
|
||||
if (reqMaps != null && operationLog != null
|
||||
&& ArrayUtil.isNotEmpty(operationLog.desensitize())) {
|
||||
for (String key : operationLog.desensitize()) {
|
||||
reqMaps.put(key, "******");
|
||||
}
|
||||
}
|
||||
|
||||
coreLogService.addOperationLog(title, subject, reqMaps);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user