| | |
| | | import cn.hutool.extra.servlet.ServletUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alibaba.fastjson2.JSONWriter; |
| | | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; |
| | | import com.gkhy.exam.common.annotation.Log; |
| | | import com.gkhy.exam.common.domain.entity.SysUser; |
| | |
| | | webLog.put("method",request.getMethod()); |
| | | Object params=getParameter(method, joinPoint.getArgs()); |
| | | |
| | | webLog.put("parameter",params); |
| | | if (params != null) { |
| | | if (params instanceof MultipartFile || params.toString().contains("MultipartFile")) { |
| | | webLog.put("parameter", "文件上传接口,参数不打印"); |
| | | } else { |
| | | webLog.put("parameter", params); |
| | | } |
| | | } else { |
| | | webLog.put("parameter", params); |
| | | } |
| | | webLog.put("uri",request.getRequestURI()); |
| | | webLog.put("url",requestURL.toString()); |
| | | if(user!=null) { |
| | | webLog.put("userName", user.getName()); |
| | | } |
| | | log.info(webLog.toString()); |
| | | log.info(JSON.toJSONString(webLog, JSONWriter.Feature.IgnoreErrorGetter)); |
| | | Object result = joinPoint.proceed(); |
| | | if (result == null) { |
| | | //如果切到了 没有返回类型的void方法,这里直接返回 |
| | |
| | | long endTime = System.currentTimeMillis(); |
| | | webLog.put("result",StringUtils.sub(JSON.toJSONString(result),0,2000)); |
| | | webLog.put("spendTime",endTime - startTime); |
| | | log.info(webLog.toString()); |
| | | log.info(JSON.toJSONString(webLog, JSONWriter.Feature.IgnoreErrorGetter)); |
| | | return result; |
| | | } |
| | | |