From c2cf7ba16a0f352f5db3f91ebf6d66d1cbc2a367 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期日, 13 六月 2021 15:38:40 +0800
Subject: [PATCH] update 优化 jackson 序列化配置

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

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
index e73fc9e..280a60c 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
@@ -1,5 +1,6 @@
 package com.ruoyi.framework.aspectj;
 
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.annotation.Log;
@@ -7,10 +8,8 @@
 import com.ruoyi.common.enums.BusinessStatus;
 import com.ruoyi.common.enums.HttpMethod;
 import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.common.utils.ip.IpUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
-import com.ruoyi.framework.manager.AsyncManager;
-import com.ruoyi.framework.manager.factory.AsyncFactory;
+import com.ruoyi.framework.web.service.AsyncService;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.domain.SysOperLog;
 import org.aspectj.lang.JoinPoint;
@@ -23,6 +22,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
+import org.springframework.validation.BindingResult;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.HandlerMapping;
 
@@ -35,7 +35,7 @@
 
 /**
  * 鎿嶄綔鏃ュ織璁板綍澶勭悊
- * 
+ *
  * @author ruoyi
  */
 @Aspect
@@ -63,7 +63,7 @@
 
     /**
      * 鎷︽埅寮傚父鎿嶄綔
-     * 
+     *
      * @param joinPoint 鍒囩偣
      * @param e 寮傚父
      */
@@ -91,7 +91,7 @@
             SysOperLog operLog = new SysOperLog();
             operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
             // 璇锋眰鐨勫湴鍧�
-            String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
+            String ip = ServletUtils.getClientIP();
             operLog.setOperIp(ip);
             // 杩斿洖鍙傛暟
             operLog.setJsonResult(JSON.toJSONString(jsonResult));
@@ -116,7 +116,7 @@
             // 澶勭悊璁剧疆娉ㄨВ涓婄殑鍙傛暟
             getControllerMethodDescription(joinPoint, controllerLog, operLog);
             // 淇濆瓨鏁版嵁搴�
-            AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
+			SpringUtils.getBean(AsyncService.class).recordOper(operLog);
         }
         catch (Exception exp)
         {
@@ -129,7 +129,7 @@
 
     /**
      * 鑾峰彇娉ㄨВ涓鏂规硶鐨勬弿杩颁俊鎭� 鐢ㄤ簬Controller灞傛敞瑙�
-     * 
+     *
      * @param log 鏃ュ織
      * @param operLog 鎿嶄綔鏃ュ織
      * @throws Exception
@@ -152,7 +152,7 @@
 
     /**
      * 鑾峰彇璇锋眰鐨勫弬鏁帮紝鏀惧埌log涓�
-     * 
+     *
      * @param operLog 鎿嶄綔鏃ュ織
      * @throws Exception 寮傚父
      */
@@ -197,7 +197,7 @@
         {
             for (int i = 0; i < paramsArray.length; i++)
             {
-                if (!isFilterObject(paramsArray[i]))
+                if (Validator.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i]))
                 {
                     Object jsonObj = JSON.toJSON(paramsArray[i]);
                     params += jsonObj.toString() + " ";
@@ -209,7 +209,7 @@
 
     /**
      * 鍒ゆ柇鏄惁闇�瑕佽繃婊ょ殑瀵硅薄銆�
-     * 
+     *
      * @param o 瀵硅薄淇℃伅銆�
      * @return 濡傛灉鏄渶瑕佽繃婊ょ殑瀵硅薄锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆�
      */
@@ -238,6 +238,7 @@
                 return entry.getValue() instanceof MultipartFile;
             }
         }
-        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse;
+        return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
+                || o instanceof BindingResult;
     }
 }

--
Gitblit v1.9.3