Commit d9dbee18 authored by 赵啸非's avatar 赵啸非

添加站点查询子站点接口

parent 8db9e3b5
...@@ -51,7 +51,7 @@ public class WebLogAspect { ...@@ -51,7 +51,7 @@ public class WebLogAspect {
public void doBefore(JoinPoint joinPoint) { public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
// log.debug("请求路径 {} ,进入方法 {}", request.getRequestURI(), joinPoint.getSignature().getDeclaringTypeName() + ":" + joinPoint.getSignature().getName()); // log.debug("请求路径 {} ,进入方法 {}", request.getRequestURI(), joinPoint.getSignature().getDeclaringTypeName() + ":" + joinPoint.getSignature().getName());
MDC.put("req", getRequestInfo(request).toJSONString()); MDC.put("req", getRequestInfo(request).toJSONString());
MDC.put("startTime", String.valueOf(System.currentTimeMillis())); MDC.put("startTime", String.valueOf(System.currentTimeMillis()));
} }
...@@ -64,17 +64,17 @@ public class WebLogAspect { ...@@ -64,17 +64,17 @@ public class WebLogAspect {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
Map<String, String> map = MDC.getCopyOfContextMap(); Map<String, String> map = MDC.getCopyOfContextMap();
if (map != null&&result!=null) { if (map != null && result != null) {
String startTime = map.getOrDefault("startTime", String.valueOf(System.currentTimeMillis())); String startTime = map.getOrDefault("startTime", String.valueOf(System.currentTimeMillis()));
long takeTime = (System.currentTimeMillis() - Long.parseLong(startTime)); long takeTime = (System.currentTimeMillis() - Long.parseLong(startTime));
if(result instanceof String){ if (result instanceof String) {
log.info(" \n 请求路径:{} 耗时:{}ms \n 请求报文:{} \n 响应报文:{}" log.info(" \n 请求路径:{} 耗时:{}ms \n 请求报文:{} \n 响应报文:{}"
, request.getRequestURI(), takeTime, map.getOrDefault("req", ""), result == null ? "" : result); , request.getRequestURI(), takeTime, map.getOrDefault("req", ""), result);
}else{ } else {
log.info(" \n 请求路径:{} 耗时:{}ms \n 请求报文:{} \n 响应报文:{}" log.info(" \n 请求路径:{} 耗时:{}ms \n 请求报文:{} \n 响应报文:{}"
, request.getRequestURI(), takeTime, map.getOrDefault("req", ""), result == null ? "" : JSON.toJSONString(result)); , request.getRequestURI(), takeTime, map.getOrDefault("req", ""), JSON.toJSONString(result));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment