admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
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;
@@ -162,7 +161,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 +215,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 +232,7 @@
      UserVIPPreInfo preInfo = new UserVIPPreInfo();
      preInfo.setCreateTime(new Date());
      preInfo.setProcess(UserLevelEnum.superVIP.getLevel());
      preInfo.setSourceType(verifyVipResult);
      preInfo.setUid(uid);
      try {
@@ -263,13 +266,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 +314,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 +351,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)