From 271ae63c20fcbe28d29c47f1881138ff6551a2a1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 10 六月 2020 19:26:26 +0800
Subject: [PATCH] 唯品会订单bug修复,APP端佣金比例展示错误bug修复

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
index 177ac29..b07b699 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
@@ -94,13 +94,14 @@
 	@Resource
 	private TeamUserLevelStatisticService teamUserLevelStatisticService;
 
+	@Transactional
 	@Override
 	public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
 		if (info == null || info.getUid() == null || info.getProcess() == null || info.getSourceType() == null)
 			throw new UserVIPPreInfoException(1, "淇℃伅涓嶅畬鏁�");
 		for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 绂佹涓嶈兘鍗囩骇鐨勭敤鎴峰崌绾�
 			if (info.getUid().longValue() == fuid)
-				return;
+				throw new UserVIPPreInfoException(100, "绂佹鍗囩骇");
 		}
 
 		UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(info.getUid(), info.getProcess());
@@ -108,9 +109,33 @@
 			throw new UserVIPPreInfoException(2, "杩涘害宸插瓨鍦�");
 		if (info.getCreateTime() == null)
 			info.setCreateTime(new Date());
+
+		UserVIPPreInfo old = getLatestProcessInfo(info.getUid());
+
 		userVIPPreInfoMapper.insertSelective(info);
 		// 璁剧疆缁熻鏁版嵁
 		teamUserLevelStatisticService.setUserLevel(info.getUid(), UserLevelUtil.getByLevel(info.getProcess()));
+
+		// 鍙戦�佺瓑绾у彉鍖栨秷鎭�
+		if (!Constant.IS_TEST) {
+			UserLevelEnum oldLevel = null;
+			if (old == null)
+				oldLevel = UserLevelEnum.daRen;
+			else {
+				oldLevel = UserLevelUtil.getByLevel(old.getProcess());
+			}
+
+			if (oldLevel == UserLevelEnum.normalVIP)
+				oldLevel = UserLevelEnum.daRen;
+
+			UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(info.getUid(), oldLevel,
+					UserLevelUtil.getByLevel(info.getProcess()), new Date());
+			Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg);
+			//寤舵椂10s鍙戦��
+			message.setStartDeliverTime(System.currentTimeMillis()+1000*10L);
+			producer.send(message);
+		}
+
 	}
 
 	@Override
@@ -315,12 +340,6 @@
 			LogHelper.error(e);
 		}
 
-		if (!Constant.IS_TEST) {
-			UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, UserLevelEnum.daRen, UserLevelEnum.highVIP,
-					new Date());
-			Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg);
-			producer.send(message);
-		}
 	}
 
 	@Override

--
Gitblit v1.8.0