yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -26,6 +26,7 @@
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.integral.IntegralDetail;
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -86,7 +87,7 @@
   @Override
   @Transactional
   @Transactional(rollbackFor = Exception.class)
   public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException {
      if (info.getId() == null) {
         throw new UserVIPInfoException(1, "信息不完整");
@@ -142,7 +143,7 @@
      
      try {
         // 奖励券
         BigDecimal percent = new BigDecimal(configService.get("exchange_rebate_percent"));
         BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
         for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
            userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), 
                  UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
@@ -188,7 +189,7 @@
      userInviteSeparateService.updateStateByWorkerIdAndBossId(uid, bossId, UserInviteSeparate.STATE_INVALID);
      
      // 限制时间
      int limitDays = Integer.parseInt(configService.get("invite_separate_limit_days"));
      int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
      UserInviteSeparate inviteSeparate = new UserInviteSeparate();
      inviteSeparate.setBossId(bossId);
      inviteSeparate.setWorkerId(uid);
@@ -207,7 +208,7 @@
      userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
   }
   
   @Transactional
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException {
      UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
@@ -231,7 +232,7 @@
      userOtherMsgNotificationService.rejectVIPApply(uid, "如有疑问请联系我的-人工客服", msgOther);
   }
   @Transactional
   @Transactional(rollbackFor = Exception.class)
   @Override
   public void applyVIP(Long uid) throws UserVIPInfoException {
      UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
@@ -297,6 +298,12 @@
      if (extra == null) 
         return false;
      
      // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
      BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
      long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
      // 区分老用户和新用户
      String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
      Date executeDate = null;
      try {
@@ -308,9 +315,6 @@
      if (executeDate == null)
         return false;
      
      // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
      BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
      long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, executeDate.getTime(), payMoney);
      if (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime()) {
         long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user"));
         if (teamNum < limitNum)
@@ -358,6 +362,7 @@
   
   
   @Override
   @Transactional(rollbackFor = Exception.class)
   public void inviteSeparate(Long workerId, Long bossId) {
      if (workerId == null || bossId == null)
         return;
@@ -396,7 +401,7 @@
         // 脱离邀请关系
         threeSaleSerivce.inviteSeparate(workerId, bossId);
         
         int limitDays = Integer.parseInt(configService.get("invite_separate_limit_days"));
         int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
         // 消息
         UserInfo userInfo = userInfoService.selectByPKey(workerId);
         MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();