Commit ee2e14c8 authored by yanzg's avatar yanzg

默认日期格式的支持

parent 386061e8
...@@ -2,13 +2,18 @@ package com.yanzuoguang.cloud.aop; ...@@ -2,13 +2,18 @@ package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.util.exception.ExceptionHelper; import com.yanzuoguang.util.exception.ExceptionHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.log.Log;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
/** /**
* LogsAspect(接口请求日志切面) * LogsAspect(接口请求日志切面)
* *
...@@ -39,7 +44,12 @@ public class MqAspect extends BaseRequestAspect { ...@@ -39,7 +44,12 @@ public class MqAspect extends BaseRequestAspect {
*/ */
@Around(value = "mqAspect()") @Around(value = "mqAspect()")
public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable { public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable {
boolean clear = requestLogInit(); boolean clear = isRabbit(joinPoint);
if (clear) {
Log.threadBegin();
} else {
clear = requestLogInit();
}
long start = requestLog(TAG, joinPoint); long start = requestLog(TAG, joinPoint);
Object result = null; Object result = null;
Exception ex = null; Exception ex = null;
...@@ -58,6 +68,20 @@ public class MqAspect extends BaseRequestAspect { ...@@ -58,6 +68,20 @@ public class MqAspect extends BaseRequestAspect {
} }
} }
private boolean isRabbit(ProceedingJoinPoint joinPoint) {
if (joinPoint.getSignature() instanceof MethodSignature) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method targetMethod = methodSignature.getMethod();
Annotation[] annotations = targetMethod.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.getClass().getSimpleName().indexOf("RabbitListener") >= 0) {
return true;
}
}
}
return false;
}
private Object executeMethod(ProceedingJoinPoint joinPoint) throws Throwable { private Object executeMethod(ProceedingJoinPoint joinPoint) throws Throwable {
return joinPoint.proceed(); return joinPoint.proceed();
} }
......
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