From b2e526370aaed3e20ebabd7ca494e0fb2b2ca73e Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 01 七月 2020 11:22:51 +0800
Subject: [PATCH] 付款金额大于等于9.9
---
fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 52 insertions(+), 2 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 49c1cde..b4e0bd4 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
@@ -1,11 +1,15 @@
package com.yeshi.fanli.service.manger.user;
+import java.util.Date;
+
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;
@@ -27,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())
@@ -37,4 +39,52 @@
return UserLevelEnum.daRen;
}
+ /**
+ * 鑾峰彇褰撴椂鐨勭敤鎴风瓑绾�
+ * @Title: getUserLevel
+ * @Description:
+ * @param uid
+ * @param date
+ * @return
+ * UserLevelEnum 杩斿洖绫诲瀷
+ * @throws
+ */
+ 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())
+ return level;
+ 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);
+ //榛樿涓鸿鍗曞瀷
+ info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
+ try {
+ userVIPPreInfoService.addUserVIPPreInfo(info);
+ } catch (UserVIPPreInfoException e) {
+ e.printStackTrace();
+ }
+
+ }
+
}
--
Gitblit v1.8.0