//package com.ssm.annotation;
//
//import com.ssm.manage.utils.StringUtils;
//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.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.context.event.SpringApplicationEvent;
//import org.springframework.context.ApplicationEventPublisher;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import java.lang.reflect.Method;
//import java.util.Optional;
//
//@Component
//@Aspect
//@Order(0)
//public  class RedissonAspect {
//    @Autowired
//    private RedissonLockService redissonLockService;
//    @Autowired
//    private ApplicationEventPublisher applicationEventPublisher;
//
//
//    @Around("@annotation(redissonLock)")
//    public Object around(ProceedingJoinPoint joinPoint,RedissonLock redissonLock) throws Throwable {
//        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
//        //获取前缀
//        applicationEventPublisher.publishEvent(new SmsSendEvent(this,"15913619401"));
//        String prefix = StringUtils.isBlank(redissonLock.prefix())?SpELUtils.getMethodKey(method):redissonLock.prefix();
//        String key = SpELUtils.parseSpEl(method,joinPoint.getArgs(),redissonLock.key());
//        Object lock = redissonLockService.lock(prefix + key, redissonLock.timeout(), redissonLock.timeUnit(), joinPoint::proceed);
//        return lock;
//    }
//
//}
