yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java
@@ -218,12 +218,13 @@
      String thing = "";
      String thingNum = "";
      int couponNews = 0;
      boolean once = false; // 兑换一次是否消失
      try {
         if (ExchangeTypeEnum.freeCouponBuy == type) {
            thing = "自购免单券";
            thingNum = "1张";
            userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
            once = true;
            couponNews = 1;
         } else if (ExchangeTypeEnum.freeCouponGive == type) {
            thing = "赠送免单券";
@@ -242,6 +243,9 @@
            if(codePublishRecordService.countValidRecord(uid) > 0)
               throw new IntegralExchangeException(1, "三天之内不可重复兑换");
            codePublishRecordService.publishInviteCode(uid);
            exchange.setNeedJump(true);
            exchange.setBtnName("去查看");
         } else if (ExchangeTypeEnum.taoLiJin == type) {
            thing = "推广红包";
            thingNum = exchange.getAmount() + "元";
@@ -317,6 +321,9 @@
            }
         });
         
         if (once) // 兑换之后消失
            exchange = null;
         return exchange;
      } catch (Exception e) {
         LogHelper.errorDetailInfo(e);
@@ -367,7 +374,7 @@
   
   
   @Override
   public void exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
   public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
      if (uid == null || uid <= 0)
         throw new IntegralExchangeException(1, "用户未登录");
@@ -401,7 +408,6 @@
            throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在");
         
         String inviteCode = inviteExtra.getInviteCode();
         userInfoExtraService.activateInviteCode(uid, inviteExtra.getInviteCode());
         
         // 剩余金币
         int surplus = goldCoinHas.intValue() - goldCoin.intValue();
@@ -442,11 +448,11 @@
               userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
            }
         });
         return inviteCode;
      } catch (Exception e) {
         LogHelper.errorDetailInfo(e);
         throw new IntegralExchangeException(1, "兑换失败");
      }
   }
}