From e283023f8193d5d9da75bcbbb0c8746d90a8985f Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 14 五月 2019 11:26:14 +0800
Subject: [PATCH] Merge branch 'div_11'
---
fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java | 80 +++++++++++----------------------------
1 files changed, 23 insertions(+), 57 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java b/fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java
index 2667956..6167436 100644
--- a/fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java
+++ b/fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java
@@ -12,9 +12,8 @@
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
/**
@@ -43,75 +42,42 @@
@Around(EDP)
public Object activeAround(ProceedingJoinPoint joinPoint) throws Throwable {
+ Long uid = null;
+
ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
+ HttpServletRequest request = servletContainer.getRequest();
- final Object[] args = joinPoint.getArgs();
+ String str_uid = request.getParameter("uid");
+ if (str_uid != null && str_uid.trim().length() > 0) {
+ uid = Long.parseLong(str_uid);
+ }
- final HttpServletRequest request = servletContainer.getRequest();
+
+ final Long uuid = uid;
executor.execute(new Runnable() {
@Override
public void run() {
- AcceptData acceptData = null;
- for (Object argsobj : args) {
- if (argsobj instanceof AcceptData) {
- acceptData = (AcceptData) argsobj;
- }
+ if (uuid == null) {
+ return;
}
- // 鑷姩棰嗗彇鍒�-绯荤粺鍙戞斁
- receivedPushCoupon(acceptData, request);
+ if (Constant.IS_OUTNET) {
+ String key = "activeUid_" + uuid;
+ // 缂撳瓨涓槸鍚﹀瓨鍦╱id
+ 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());
}
-
-
- /**
- * 浣跨敤涓� 鑷姩棰嗗彇绯荤粺鎺ㄩ�佸埜
- * @param acceptData
- * @param request
- */
- public void receivedPushCoupon(AcceptData acceptData, HttpServletRequest request) {
-
- if (acceptData == null) {
- return;
- }
-
- String strUid = request.getParameter("uid");
- if (strUid == null || strUid.trim().length() == 0) {
- return;
- }
-
- try {
- Long uid = Long.parseLong(strUid);
-
- // 缂撳瓨涓槸鍚﹀瓨鍦╱id
- String key = "activeUid_" + uid;
- String cacheValue = redisManager.getCommonString(key);
- if (cacheValue != null && cacheValue.trim().length() > 0) {
- return;
- }
-
- // 鍔犲叆缂撳瓨 20鍒嗛挓
- redisManager.cacheCommonString("activeUid_" + uid, strUid, 60 * 20);
-
- // 鎺ユ敹鍒�
- userSystemCouponService.receivedCoupon(uid);
-
- } catch (Exception e) {
- try {
- LogHelper.errorDetailInfo(e);
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
-
- }
-
-
}
--
Gitblit v1.8.0