admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.entity.integral.IntegralExchange;
import com.yeshi.fanli.entity.integral.IntegralExchange.ExchangeTypeEnum;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
import com.yeshi.fanli.exception.integral.IntegralExchangeException;
import com.yeshi.fanli.log.LogHelper;
@@ -159,9 +160,9 @@
      if (ExchangeTypeEnum.freeCouponBuy == type) {
         exchangeTip.setTip("自购免单券仅能自己使用,且每个用户ID只能兑换一次。\r\n注:兑换成功后请到“我的-福利中心”中查看");
      } else if (ExchangeTypeEnum.freeCouponGive == type) {
         exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
         exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看");
      } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
         exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
         exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看");
      } else if (ExchangeTypeEnum.inviteCodePublish == type) {
         if (codePublishRecordService.countValidRecord(uid) > 0)
            throw new IntegralExchangeException(1, "三天之内不可重复兑换");
@@ -246,22 +247,24 @@
            thing = "自购免单券";
            thingNum = "1张";
            userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(),
                  UserSystemCoupon.SOURCE_EXCHANGE, null);
            userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponBuy, UserSystemCoupon.SOURCE_EXCHANGE,
                  1, true);
            once = true;
            couponNews = 1;
         } else if (ExchangeTypeEnum.freeCouponGive == type) {
            thing = "赠送免单券";
            thingNum = "1张";
            userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
                  UserSystemCoupon.SOURCE_EXCHANGE, null);
            userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponGive, UserSystemCoupon.SOURCE_EXCHANGE,
                  1, true);
            couponNews = 1;
         } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
            thing = "返利奖励券";
            thingNum = "1张";
            String percent = configService.get("exchange_rebate_percent");
            userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
                  UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
            String percent = configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey());
            userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_EXCHANGE, 1,
                  true, new BigDecimal(percent));
            couponNews = 1;
         } else if (ExchangeTypeEnum.inviteCodePublish == type) {
            thing = "邀请码发布卡";
@@ -334,15 +337,15 @@
         // 消息
         final String things = thing;
         final String exNum = thingNum;
         executor.execute(new Runnable() {
            @Override
            public void run() {
               MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
               msgOther.setState("金币兑换成功");
               msgOther.setExpend(goldCoin + "金币");
               msgOther.setTotalGold(surplus + "金币");
               msgOther.setThing(things);
               userOtherMsgNotificationService.exchangeMsg(uid, "", msgOther);
               if (ExchangeTypeEnum.inviteCodePublish == type) {
                  userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, "1张");
               } else {
                  userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, exNum);
               }
            }
         });
@@ -457,19 +460,7 @@
         executor.execute(new Runnable() {
            @Override
            public void run() {
               UserInfo userInfo = userInfoService.selectByPKey(record.getUid());
               if (userInfo == null)
                  return;
               String beizu = "邀请人:" + userInfo.getNickName() + ",邀请码:" + inviteCode;
               MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
               msgOther.setState("金币兑换成功");
               msgOther.setExpend(goldCoin + "金币");
               msgOther.setTotalGold(surplus + "金币");
               msgOther.setThing("邀请码激活卡");
               userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
               userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, "邀请码激活卡", "1张");
            }
         });