统计不统计

This commit is contained in:
2025-04-30 18:29:24 +08:00
parent 00f38c949c
commit 6197f13e8e

View File

@ -27,10 +27,10 @@ public class StatsInterceptor implements HandlerInterceptor {
if (!(handler instanceof HandlerMethod)) { if (!(handler instanceof HandlerMethod)) {
return true; return true;
} }
HandlerMethod handlerMethod = (HandlerMethod) handler; // HandlerMethod handlerMethod = (HandlerMethod) handler;
request.setAttribute("startTime", System.currentTimeMillis()); // request.setAttribute("startTime", System.currentTimeMillis());
String requestURI = request.getRequestURI(); // String requestURI = request.getRequestURI();
String method = request.getMethod(); // String method = request.getMethod();
String traceId = request.getHeader("traceId"); String traceId = request.getHeader("traceId");
if (StringUtils.isEmpty(traceId)) { if (StringUtils.isEmpty(traceId)) {
return true; return true;
@ -38,9 +38,9 @@ public class StatsInterceptor implements HandlerInterceptor {
// response.setHeader("Set-TraceId", traceId); // response.setHeader("Set-TraceId", traceId);
// statsService.addStats(traceId, null); // statsService.addStats(traceId, null);
} }
if (handlerMethod.getMethodAnnotation(IgnoreLogReq.class) == null) { // if (handlerMethod.getMethodAnnotation(IgnoreLogReq.class) == null) {
statsService.addRecord(traceId, "REQUEST",method + " " + requestURI, null); // statsService.addRecord(traceId, "REQUEST",method + " " + requestURI, null);
} // }
if (StringUtils.isNotEmpty(BaseContextHandler.getUserId())) { if (StringUtils.isNotEmpty(BaseContextHandler.getUserId())) {
statsService.updateStats(traceId, Long.valueOf(BaseContextHandler.getUserId())); statsService.updateStats(traceId, Long.valueOf(BaseContextHandler.getUserId()));
} }