From 33a603f2c8abe311fae3c84b0e54067580cc088c Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 24 四月 2020 16:26:25 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java | 66 +++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 28 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 3c14853..e43a13b 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 @@ -24,6 +24,7 @@ import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; import com.yeshi.fanli.exception.user.vip.UserVIPInfoException; +import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException; import com.yeshi.fanli.service.inter.count.HongBaoV2CountService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; @@ -56,30 +57,26 @@ @Resource private HongBaoV2CountService hongBaoV2CountService; - @Resource private ThreeSaleSerivce threeSaleSerivce; - @Resource private UserVIPPreInfoService userVIPPreInfoService; @Resource private UserAccountMsgNotificationService userAccountMsgNotificationService; - + @Resource private UserInviteValidNumService userInviteValidNumService; - + @Resource private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService; - + @Resource private UserInviteMsgNotificationService userInviteMsgNotificationService; - + @Resource(name = "producer") private Producer producer; - - @Override @Transactional(rollbackFor = Exception.class) @@ -96,7 +93,6 @@ info.setCreateTime(new Date()); userVIPInfoMapper.insert(info); } - @Override public boolean isVIP(Long uid) { @@ -139,7 +135,6 @@ return map; } - @Override public List<UserVIPInfo> listQuery(int page, int count, String key, Integer state) { return userVIPInfoMapper.listQuery((page - 1) * count, count, key, state); @@ -149,7 +144,6 @@ public long countQuery(String key, Integer state) { return userVIPInfoMapper.countQuery(key, state); } - @Transactional(rollbackFor = Exception.class) @Override @@ -198,7 +192,7 @@ if (!verifyVip(uid)) throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢"); - + Date upgradeTime = new Date(); // 閫氳繃瓒呯骇浼氬憳 UserVIPInfo info = new UserVIPInfo(); @@ -208,6 +202,17 @@ info.setUpdateTime(upgradeTime); userVIPInfoMapper.updateByPrimaryKeySelective(info); + UserVIPPreInfo preInfo = new UserVIPPreInfo(); + preInfo.setCreateTime(new Date()); + preInfo.setProcess(UserLevelEnum.superVIP.getLevel()); + preInfo.setUid(uid); + + try { + userVIPPreInfoService.addUserVIPPreInfo(preInfo); + } catch (UserVIPPreInfoException e1) { + throw new UserVIPInfoException(100, "鍗囩骇澶辫触"); + } + // 鍗囩骇寮规鎻愮ず UserLevelUpgradedNotify notify = new UserLevelUpgradedNotify(); notify.setUid(uid); @@ -216,31 +221,32 @@ notify.setValid(true); notify.setCreateTime(new Date()); userLevelUpgradedNotifyService.addUserLevelUpgradedNotify(notify); - + try { // 鍗囩骇娑堟伅 UserVIPPreInfo pre1 = userVIPPreInfoService.getVipByProcess(uid, UserVIPPreInfo.PROCESS_2); - userAccountMsgNotificationService.vipUpgradeSuccess(uid, TimeUtil.getDayDifferenceCount(pre1.getCreateTime(), new Date())); - + userAccountMsgNotificationService.vipUpgradeSuccess(uid, + TimeUtil.getDayDifferenceCount(pre1.getCreateTime(), new Date())); + // 鐩存帴绮変笣鍗囩骇鎻愰啋 ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid); if (threeSale != null) { Long bossId = threeSale.getBoss().getId(); UserInfo userInfo = userInfoService.selectByPKey(uid); - userInviteMsgNotificationService.fansUpgrade(bossId, "瓒呯骇浼氬憳", userInfo.getNickName(), getPassItem(uid), upgradeTime); + userInviteMsgNotificationService.fansUpgrade(bossId, "瓒呯骇浼氬憳", userInfo.getNickName(), getPassItem(uid), + upgradeTime); } } catch (Exception e) { e.printStackTrace(); } - if (!Constant.IS_TEST) { - UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, UserLevelEnum.highVIP,UserLevelEnum.superVIP, new Date()); + UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(uid, UserLevelEnum.highVIP, UserLevelEnum.superVIP, + new Date()); Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg); producer.send(message); } } - /** * 楠岃瘉鏄惁绗﹀悎VIP @@ -264,19 +270,19 @@ if (!StringUtil.isNullOrEmpty(zigou)) { limitOrder = Long.parseLong(zigou); } - + long limitFirst = 0; String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count"); if (!StringUtil.isNullOrEmpty(first)) { limitFirst = Long.parseLong(first); } - + long limitSecond = 0; String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count"); if (!StringUtil.isNullOrEmpty(second)) { limitSecond = Long.parseLong(second); } - + String item = ""; if (doneOrder >= limitOrder) { item = "杩斿埄+鍒嗕韩璁㈠崟"; @@ -285,8 +291,7 @@ } return item; } - - + /** * 楠岃瘉鏄惁绗﹀悎VIP * @param uid @@ -308,20 +313,20 @@ if (!StringUtil.isNullOrEmpty(zigou)) { limitOrder = Long.parseLong(zigou); } - + long limitFirst = 0; String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count"); if (!StringUtil.isNullOrEmpty(first)) { limitFirst = Long.parseLong(first); } - + long limitSecond = 0; String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count"); if (!StringUtil.isNullOrEmpty(second)) { limitSecond = Long.parseLong(second); } - - if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) { + + if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) { return true; } return false; @@ -347,4 +352,9 @@ userAccountMsgNotificationService.vipUpgradeFail(uid, reason); } + @Override + public void deleteByPrimaryKey(Long id) { + userVIPInfoMapper.deleteByPrimaryKey(id); + } + } -- Gitblit v1.8.0