From c54fb6a88876be994906d57d2d18e844686964d0 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 01 七月 2020 14:16:13 +0800 Subject: [PATCH] rcoketmq集中管理 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java | 41 +++++++++++++++++++++++------------------ 1 files changed, 23 insertions(+), 18 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java index 5227136..9385ab5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java @@ -23,7 +23,6 @@ import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; -import com.yeshi.fanli.entity.common.AdminUser; import com.yeshi.fanli.entity.common.Config; import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.exception.user.vip.UserVIPInfoException; @@ -40,6 +39,7 @@ import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; +import com.yeshi.fanli.service.manger.msg.RocketMQManager; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; @@ -81,8 +81,8 @@ @Resource private UserInviteMsgNotificationService userInviteMsgNotificationService; - @Resource(name = "producer") - private Producer producer; + @Resource + private RocketMQManager rocketMQManager; @Resource private ConfigService configService; @@ -162,7 +162,8 @@ throw new UserVIPInfoException(1, "璇峰厛鍗囩骇涓洪珮绾т細鍛�"); } - if (!verifyVip(uid)) + int verifyResult = verifyVip(uid); + if (verifyResult <= 0) throw new UserVIPInfoException(1, "涓嶆弧瓒冲崌绾ф潯浠�"); UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid); @@ -215,7 +216,9 @@ throw new UserVIPInfoException(1, "璇ョ敤鎴疯繕涓嶆槸楂樼骇浼氬憳"); } - if (!verifyVip(uid)) + int verifyVipResult = verifyVip(uid); + + if (verifyVipResult <= 0) throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢"); Date upgradeTime = new Date(); @@ -230,6 +233,7 @@ UserVIPPreInfo preInfo = new UserVIPPreInfo(); preInfo.setCreateTime(new Date()); preInfo.setProcess(UserLevelEnum.superVIP.getLevel()); + preInfo.setSourceType(verifyVipResult); preInfo.setUid(uid); try { @@ -263,13 +267,6 @@ } } catch (Exception e) { e.printStackTrace(); - } - - if (!Constant.IS_TEST) { - UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, UserLevelEnum.highVIP, UserLevelEnum.superVIP, - new Date()); - Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg); - producer.send(message); } } @@ -318,11 +315,15 @@ } /** - * 楠岃瘉鏄惁绗﹀悎VIP + * 楠岃瘉鏄惁绗﹀悎VIP + * @Title: verifyVip + * @Description: * @param uid - * @return + * @return 0-涓嶇鍚� 1-璁㈠崟 2-鍥㈤槦 + * int 杩斿洖绫诲瀷 + * @throws */ - private boolean verifyVip(Long uid) { + private int verifyVip(Long uid) { // 鑷喘 + 鍒嗕韩璁㈠崟 long doneOrder = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY); // 鏈夋晥绮変笣 @@ -351,10 +352,14 @@ limitSecond = Long.parseLong(second); } - if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) { - return true; + if (doneOrder >= limitOrder) { + return UserVIPPreInfo.SOURCE_TYPE_ORDER; } - return false; + + if ((doneFirst >= limitFirst && doneSecond >= limitSecond)) + + return UserVIPPreInfo.SOURCE_TYPE_TEAM; + return 0; } @Transactional(rollbackFor = Exception.class) -- Gitblit v1.8.0