tianwu.sun hai 9 meses
pai
achega
bc872ab4a7
Modificáronse 1 ficheiros con 18 adicións e 6 borrados
  1. 18 6
      src/main/java/com/bootdo/common/aspect/LogAspect.java

+ 18 - 6
src/main/java/com/bootdo/common/aspect/LogAspect.java

@@ -7,7 +7,9 @@ import java.util.Map;
 
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson.JSONObject;
 import com.bootdo.common.service.LogService;
 import com.bootdo.common.utils.*;
 
@@ -66,13 +68,23 @@ public class LogAspect {
         sysLog.setMethod(className + "." + methodName + "()");
         sysLog.setSysFlag(1);
 
-        // 请求的参数
-        Object[] args = joinPoint.getArgs();
-        Map<String, Object> params = new HashMap<>();
-        for (int i = 0, len = args.length; i < len; ++i) {
-            params.put("p" + (i + 1), args[i]);
+        try {
+            if(!"ajaxLogin".equals(methodName)){
+                // 请求的参数
+                Object[] args = joinPoint.getArgs();
+                Map<String, Object> params = new HashMap<>();
+                for (int i = 0, len = args.length; i < len; ++i) {
+                    if ((args[i] instanceof HttpServletRequest) || args[i] instanceof HttpServletResponse) {
+                        continue;
+                    }
+                    params.put("p" + (i + 1), args[i]);
+                }
+                sysLog.setParams(JSONObject.toJSONString(params));
+            }
+
+        } catch (Exception e){
+            logger.error(e.toString());
         }
-        sysLog.setParams(JsonUtil.toJson(params));
 
         // 获取request
         HttpServletRequest request = HttpContextUtils.getHttpServletRequest();