From a55587c773d8877430b49477cd4b4961c6a2ba92 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期五, 19 六月 2020 15:06:52 +0800
Subject: [PATCH] 云发单群匹配
---
fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 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 1155a17..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
@@ -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())
@@ -50,8 +50,6 @@
* @throws
*/
public UserLevelEnum getUserLevel(Long uid, Date date) {
- if (userVIPInfoService.isVIP(uid, date.getTime()))
- return UserLevelEnum.superVIP;
UserVIPPreInfo info = userVIPPreInfoService.getProcessInfo(uid, date);
if (info != null)
for (UserLevelEnum level : UserLevelEnum.values())
@@ -60,4 +58,33 @@
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