From c7f64068788f9537220344fbba164f5b26218524 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期四, 11 八月 2022 13:22:21 +0800
Subject: [PATCH] 优化修改资料头像被覆盖的问题(I5LK04)

---
 src/main/java/com/ruoyi/framework/aspectj/LogAspect.java |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
index d8dcf59..25f702c 100644
--- a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+++ b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
@@ -14,8 +14,9 @@
 import org.springframework.validation.BindingResult;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.HandlerMapping;
-import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSON;
 import com.ruoyi.common.enums.HttpMethod;
+import com.ruoyi.common.filter.PropertyPreExcludeFilter;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.StringUtils;
@@ -37,6 +38,9 @@
 public class LogAspect
 {
     private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
+
+    /** 鎺掗櫎鏁忔劅灞炴�у瓧娈� */
+    public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
 
     /**
      * 澶勭悊瀹岃姹傚悗鎵ц
@@ -65,7 +69,6 @@
     {
         try
         {
-
             // 鑾峰彇褰撳墠鐨勭敤鎴�
             LoginUser loginUser = SecurityUtils.getLoginUser();
 
@@ -167,8 +170,14 @@
             {
                 if (StringUtils.isNotNull(o) && !isFilterObject(o))
                 {
-                    Object jsonObj = JSON.toJSON(o);
-                    params += jsonObj.toString() + " ";
+                    try
+                    {
+                        String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter());
+                        params += jsonObj.toString() + " ";
+                    }
+                    catch (Exception e)
+                    {
+                    }
                 }
             }
         }
@@ -176,6 +185,14 @@
     }
 
     /**
+     * 蹇界暐鏁忔劅灞炴��
+     */
+    public PropertyPreExcludeFilter excludePropertyPreFilter()
+    {
+        return new PropertyPreExcludeFilter().addExcludes(EXCLUDE_PROPERTIES);
+    }
+
+    /**
      * 鍒ゆ柇鏄惁闇�瑕佽繃婊ょ殑瀵硅薄銆�
      * 
      * @param o 瀵硅薄淇℃伅銆�

--
Gitblit v1.9.3