| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes;
|
| | |
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | public static final String EDP = "execution(* com.yeshi.fanli.controller.client.*.*(..))";
|
| | |
|
| | | // @Around(EDP)
|
| | | @Around(EDP)
|
| | | public Object activeAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
| | |
|
| | | Long uid = null;
|
| | | |
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
|
| | | .getRequestAttributes();
|
| | | HttpServletRequest request = servletContainer.getRequest();
|
| | |
|
| | | Object[] args = joinPoint.getArgs();
|
| | | |
| | | Long uid = null;
|
| | | HttpServletRequest request = servletContainer.getRequest();
|
| | | String str_uid = request.getParameter("uid");
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | uid = Long.parseLong(str_uid);
|
| | | }
|
| | |
|
| | | System.out.println("uid: "+ uid);
|
| | |
|
| | | final Long uuid = uid;
|
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | |
| | | if (uuid == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 接收券
|
| | | try {
|
| | | userSystemCouponService.receivedCoupon(uuid);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | if (Constant.IS_OUTNET) {
|
| | | String key = "activeUid_" + uuid;
|
| | | // 缓存中是否存在uid
|
| | | String cacheValue = redisManager.getCommonString(key);
|
| | | if (cacheValue != null && cacheValue.trim().length() > 0) {
|
| | | return;
|
| | | }
|
| | | // 加入缓存 20分钟
|
| | | redisManager.cacheCommonString(key, uuid.toString(), 60 * 20);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | return joinPoint.proceed(args);
|
| | | return joinPoint.proceed(joinPoint.getArgs());
|
| | | }
|
| | |
|
| | | |
| | | }
|