| 68 | return result; |
| 69 | } |
| 70 | public Object recordLog(ProceedingJoinPoint point) throws Throwable { |
| 71 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| 72 | HttpServletRequest request = (HttpServletRequest) Objects.requireNonNull(attributes).getRequest(); |
| 73 | String methodName = point.getSignature().getName(); |
| 74 | Object result = point.proceed(); |
| 75 | if(methodName.startsWith("update")||methodName.startsWith("save")){ |
| 76 | // 打印请求相关参数 |
| 77 | long startTime = System.currentTimeMillis(); |
| 78 | String traceId = request.getAttribute("trace_id").toString(); |
| 79 | // final ControllerAspectseLog l = ControllerAspectseLog.builder() |
| 80 | // .ip(getIp(request)) |
| 81 | // .url(request.getRequestURL().toString()) |
| 82 | // .httpMethod(request.getMethod()) |
| 83 | // .requestParams(getNameAndValue(point)) |
| 84 | // .result(result) |
| 85 | // .timeCost(System.currentTimeMillis() - startTime) |
| 86 | // .traceId(traceId) |
| 87 | // .springApplicationName(springApplicationName) |
| 88 | // .build(); |
| 89 | // uploadData(l); |
| 90 | } |
| 91 | |
| 92 | return result; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | // /** |