//package com.yxcheng.token.common.aop;
//
//
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.annotation.Configuration;
//
//@Aspect
//@Configuration
//public class ServiceDigestAop {
//    private final Logger logger = LoggerFactory.getLogger(this.getClass());
//    public static final String POINT = "execution (* com..*.service.impl.*.*(..))";
//    private static final long FIVE_SECONDS = 5000L;
//
//    public ServiceDigestAop() {
//    }
//
//    @Around("execution (* com..*.service.impl.*.*(..))")
//    public Object timeAround(ProceedingJoinPoint joinPoint) {
//        Object obj = null;
//        Object[] args = joinPoint.getArgs();
//        long startTime = System.currentTimeMillis();
//        MethodSignature signature = (MethodSignature)joinPoint.getSignature();
//        String methodName = signature.getDeclaringTypeName() + "_" + signature.getName();
//
//        try {
//            obj = joinPoint.proceed(args);
//        } catch (Throwable var10) {
//            if (var10 instanceof RuntimeException) {
//                throw (RuntimeException)var10;
//            }
//
//            throw new RuntimeException(var10);
//        }
//
//        long endTime = System.currentTimeMillis();
//        this.printExecTime(methodName, args, startTime, endTime);
//        return obj;
//    }
//
//    private boolean isPrimite(Class<?> clazz) {
//        return clazz.isPrimitive() || clazz == String.class;
//    }
//
//    private void printExecTime(String methodName, Object[] args, long startTime, long endTime) {
//        long diffTime = endTime - startTime;
//        StringBuffer argString = new StringBuffer();
//        Object[] var10 = args;
//        int var11 = args.length;
//
//        for(int var12 = 0; var12 < var11; ++var12) {
//            Object arg = var10[var12];
//            if (this.isPrimite(arg.getClass())) {
//                argString.append(arg.toString()).append(",");
//            } else {
//                argString.append(arg.getClass()).append(",");
//            }
//        }
//
//        if (diffTime > 5000L) {
//            this.logger.warn("[" + methodName + "] param:" + argString + " cost " + diffTime + " ms");
//        } else {
//            this.logger.info("[" + methodName + "] param:" + argString + " cost " + diffTime + " ms");
//        }
//
//    }
//}