publish 1.0.6

This commit is contained in:
曾文豪
2023-05-26 13:23:17 +08:00
parent 659deb6132
commit 458d118d85
15 changed files with 52 additions and 29 deletions

View File

@@ -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>

View File

@@ -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;
}