From a5fde818ef9969e2e53acfa29b2e6f423bd0c8fc Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 30 四月 2020 19:02:51 +0800
Subject: [PATCH] 小米推送bug修改,增加用户团队信息消费
---
fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java b/fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java
index 70a7bb8..34c2e53 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java
@@ -5,9 +5,11 @@
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
+import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
@@ -29,8 +31,6 @@
* @throws
*/
public UserLevelEnum getUserLevel(Long uid) {
- if (userVIPInfoService.isVIP(uid))
- return UserLevelEnum.superVIP;
UserVIPPreInfo info = userVIPPreInfoService.getLatestProcessInfo(uid);
if (info != null)
for (UserLevelEnum level : UserLevelEnum.values())
@@ -38,7 +38,7 @@
return level;
return UserLevelEnum.daRen;
}
-
+
/**
* 鑾峰彇褰撴椂鐨勭敤鎴风瓑绾�
* @Title: getUserLevel
@@ -49,11 +49,8 @@
* UserLevelEnum 杩斿洖绫诲瀷
* @throws
*/
- public UserLevelEnum getUserLevel(Long uid,Date date) {
- //TODO 鎸夋椂闂存鑾峰彇
- if (userVIPInfoService.isVIP(uid))
- return UserLevelEnum.superVIP;
- UserVIPPreInfo info = userVIPPreInfoService.getLatestProcessInfo(uid);
+ public UserLevelEnum getUserLevel(Long uid, Date date) {
+ UserVIPPreInfo info = userVIPPreInfoService.getProcessInfo(uid, date);
if (info != null)
for (UserLevelEnum level : UserLevelEnum.values())
if (level.getLevel() == info.getProcess())
@@ -61,4 +58,31 @@
return UserLevelEnum.daRen;
}
+ @Transactional
+ public void setUserLevel(Long uid, UserLevelEnum level, Date date) {
+
+ // 鍒犻櫎鍘熸湁绛夌骇
+
+ for (UserLevelEnum le : UserLevelEnum.values()) {
+ UserVIPPreInfo info = userVIPPreInfoService.getVipByProcess(uid, le.getLevel());
+ if (info != null)
+ userVIPPreInfoService.deleteByPrimaryKey(info.getId());
+ }
+
+ // 娣诲姞鏂扮殑绛夌骇
+ if (level == UserLevelEnum.daRen)
+ return;
+
+ UserVIPPreInfo info = new UserVIPPreInfo();
+ info.setCreateTime(date);
+ info.setProcess(level.getLevel());
+ info.setUid(uid);
+ try {
+ userVIPPreInfoService.addUserVIPPreInfo(info);
+ } catch (UserVIPPreInfoException e) {
+ e.printStackTrace();
+ }
+
+ }
+
}
--
Gitblit v1.8.0