| | |
| | | package com.yeshi.fanli.service.impl.user.integral;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | 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.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.integral.IntegralExchangeException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.vo.integral.ExchangeTipVO;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | | @Service
|
| | | public class IntegralExchangeServiceImpl implements IntegralExchangeService {
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | @Resource
|
| | | private IntegralExchangeMapper integralExchangeMapper;
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserTaoLiJinOriginService userTaoLiJinOriginService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource
|
| | | private CodePublishRecordService codePublishRecordService;
|
| | | |
| | | @Resource
|
| | | private IntegralExchangeRecordService integralExchangeRecordService;
|
| | | |
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | | |
| | | @Resource
|
| | | private MsgInviteDetailService msgInviteDetailService;
|
| | | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<IntegralExchange> listValidCache(long start, int count){
|
| | | return integralExchangeMapper.listValid(start, count);
|
| | | }
|
| | | |
| | | @Override
|
| | | public Long countValid(){
|
| | | return integralExchangeMapper.countValid();
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public ExchangeTipVO verifyExchange(Long uid, Long id) throws IntegralExchangeException{
|
| | | if (uid == null || uid <= 0) |
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | | |
| | | if (id == null || id <= 0) |
| | | throw new IntegralExchangeException(1, "兑换id不正确");
|
| | | |
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | | |
| | | IntegralExchange exchange = integralExchangeMapper.selectByPrimaryKey(id);
|
| | | if (exchange == null)
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | |
| | | Integer state = exchange.getState();
|
| | | if (state == null || state != 1)
|
| | | throw new IntegralExchangeException(1, "兑换活动未开启");
|
| | | |
| | | |
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | |
| | | ExchangeTipVO exchangeTip = new ExchangeTipVO();
|
| | | exchangeTip.setId(id);
|
| | | ExchangeTypeEnum type = exchange.getType();
|
| | | if (ExchangeTypeEnum.inviteCodeActivate == type) {
|
| | | exchangeTip.setType(type.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | | long exchangeCount = 0;
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, null);
|
| | | if (exchangeCount >= 1) {
|
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | }
|
| | | }
|
| | | |
| | | Integer upperLimit = exchange.getUpperLimit();
|
| | | if (upperLimit != null) { // 是否有限制每日次数
|
| | | Integer today = 1;
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, today);
|
| | | if (exchangeCount >= upperLimit) {
|
| | | throw new IntegralExchangeException(1, "今日兑换已达上限");
|
| | | }
|
| | | }
|
| | | |
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) {
|
| | | exchangeTip.setType("notEnough");
|
| | | exchangeTip.setTip("当前账户中可用金币不足,无法兑换该奖品!");
|
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币");
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeTip.setTip("自购免单券仅能自己使用,且每个用户ID只能兑换一次。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | | exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | if(codePublishRecordService.countValidRecord(uid) > 0)
|
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换");
|
| | | exchangeTip.setInviteCode(extraVO.getInviteCode());
|
| | | exchangeTip.setTip("兑换成功后,将发布于“激活邀请码兑换功能中”,需激活邀请的用户可用金币兑换,本次展示有效期为3天。");
|
| | | } else if (ExchangeTypeEnum.taoLiJin == type) {
|
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元推广红包");
|
| | | exchangeTip.setTip("注:兑换成功后请到“我的-推广红包”中查看");
|
| | | } else if (ExchangeTypeEnum.cash == type) { |
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元现金红包");
|
| | | exchangeTip.setTip("注:兑换成功后请到“我的-账户余额”中查看");
|
| | | } else {
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | }
|
| | | |
| | | exchangeTip.setGoldCoin(goldCoin + "金币");
|
| | | exchangeTip.setType(type.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | | @Override
|
| | | public IntegralExchange exchange(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | |
|
| | | if (id == null || id <= 0)
|
| | | throw new IntegralExchangeException(1, "兑换id不正确");
|
| | |
|
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | |
|
| | | IntegralExchange exchange = integralExchangeMapper.selectByPrimaryKey(id);
|
| | | if (exchange == null)
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | |
|
| | | Integer state = exchange.getState();
|
| | | if (state == null || state != 1)
|
| | | throw new IntegralExchangeException(1, "兑换活动未开启");
|
| | | |
| | | long exchangeCount = 0;
|
| | | ExchangeTypeEnum type = exchange.getType();
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, null);
|
| | | if (exchangeCount >= 1) {
|
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | }
|
| | | }
|
| | | |
| | | Integer upperLimit = exchange.getUpperLimit();
|
| | | if (upperLimit != null) { // 是否有限制每日次数
|
| | | Integer today = 1;
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, today);
|
| | | if (exchangeCount >= upperLimit) {
|
| | | throw new IntegralExchangeException(1, "兑换已达上限");
|
| | | }
|
| | | }
|
| | | |
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) {
|
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
|
| | | }
|
| | | |
| | | String thing = "";
|
| | | String thingNum = "";
|
| | | int couponNews = 0;
|
| | | boolean once = false; // 兑换一次是否消失
|
| | | try {
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponService.getFreeCouponByType(uid, CouponTypeEnum.freeCouponBuy.name());
|
| | | if (listCoupon != null && listCoupon.size() > 0)
|
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | |
| | | thing = "自购免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | once = true; |
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | | thing = "赠送免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | 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));
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | thing = "邀请码发布卡";
|
| | | thingNum = "3天";
|
| | | 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() + "元";
|
| | | userTaoLiJinOriginService.exchangeMoney(uid, exchange.getAmount());
|
| | | } else if (ExchangeTypeEnum.cash == type) {
|
| | | thing = "现金红包";
|
| | | BigDecimal money = exchange.getAmount();
|
| | | thingNum = money + "元";
|
| | | |
| | | // 1、插入红包数据
|
| | | HongBaoV2 hongBaoV2 = new HongBaoV2();
|
| | | hongBaoV2.setMoney(money);
|
| | | hongBaoV2.setType(HongBaoV2.TYPE_EXCHANGE);
|
| | | hongBaoV2.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBaoV2.setVersion(2);
|
| | | hongBaoV2.setCreateTime(new Date());
|
| | | hongBaoV2.setUpdateTime(new Date());
|
| | | hongBaoV2.setUserInfo(new UserInfo(uid));
|
| | | hongBaoV2.setPreGetTime(new Date());
|
| | | hongBaoV2.setGetTime(new Date());
|
| | | hongBaoV2Service.insertSelective(hongBaoV2);
|
| | |
|
| | | // 2.插入资金明细,用户余额
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createScoreConvert(money, new UserInfo(uid));
|
| | | userMoneyDetailService.addUserMoneyDetail(userMoneyDetail);
|
| | | userInfoService.addMoney(new UserInfo(uid), money);
|
| | | } else {
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | }
|
| | | |
| | | exchangeCount ++;
|
| | | String progress = exchange.getProgress();
|
| | | if (!StringUtil.isNullOrEmpty(progress))
|
| | | progress = progress.replace("{已兑换}",exchangeCount + "").replace("{上限数}", exchange.getUpperLimit() + "");
|
| | | exchange.setProgress(progress);
|
| | | |
| | | // 剩余金币
|
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue();
|
| | | exchange.setUserGoldCoin(surplus + "枚");
|
| | | |
| | | // 更新金币 + 福利中心消息数
|
| | | if (extraVO.getCouponNews() != null && extraVO.getCouponNews() > 0) |
| | | couponNews = couponNews + extraVO.getCouponNews();
|
| | | |
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
|
| | | extraUpdate.setId(extraVO.getId());
|
| | | extraUpdate.setGoldCoin(surplus);
|
| | | extraUpdate.setCouponNews(couponNews);
|
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate);
|
| | | |
| | | // 添加兑换记录
|
| | | integralExchangeRecordService.addExchangeRecord(id, uid);
|
| | | |
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | | detail.setTitle("金币兑换-" + thing + "-" + thingNum);
|
| | | detail.setMoney(-goldCoin);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | // 消息 |
| | | final String things = thing;
|
| | | 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 (once) // 兑换之后消失
|
| | | exchange = null;
|
| | | |
| | | return exchange;
|
| | | } catch (IntegralExchangeException e) {
|
| | | throw new IntegralExchangeException(1, e.getMsg());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new IntegralExchangeException(1, "兑换异常");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public ExchangeTipVO verifyInviteCode(Long uid, Long id) throws IntegralExchangeException{
|
| | | if (uid == null || uid <= 0)
|
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | |
|
| | | if (id == null || id <= 0)
|
| | | throw new IntegralExchangeException(1, "兑换id不正确");
|
| | |
|
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换");
|
| | | |
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id);
|
| | | if (record == null)
|
| | | throw new IntegralExchangeException(1, "兑换记录不存在");
|
| | |
|
| | | IntegralExchange exchange = integralExchangeMapper.getValidByType(ExchangeTypeEnum.inviteCodeActivate.name());
|
| | | if (exchange == null)
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | |
|
| | | ExchangeTipVO exchangeTip = new ExchangeTipVO();
|
| | | exchangeTip.setId(id);
|
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) {
|
| | | exchangeTip.setType("notEnough");
|
| | | exchangeTip.setTip("当前账户中可用金币不足,无法兑换该奖品!");
|
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币");
|
| | | return exchangeTip;
|
| | | } |
| | | |
| | | exchangeTip.setTip("注:兑换成功后请到“消息-系统消息”查看");
|
| | | exchangeTip.setGoldCoin(goldCoin + "金币");
|
| | | exchangeTip.setType(ExchangeTypeEnum.inviteCodeActivate.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | |
|
| | | if (id == null || id <= 0)
|
| | | throw new IntegralExchangeException(1, "兑换id不正确");
|
| | |
|
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换");
|
| | | |
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id);
|
| | | if (record == null)
|
| | | throw new IntegralExchangeException(1, "兑换记录不存在");
|
| | |
|
| | | IntegralExchange exchange = integralExchangeMapper.getValidByType(ExchangeTypeEnum.inviteCodeActivate.name());
|
| | | if (exchange == null)
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | |
|
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue())
|
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
|
| | | |
| | | |
| | | try {
|
| | | UserInfoExtraVO inviteExtra = userInfoExtraService.getInfoExtraVOByUid(record.getUid());
|
| | | if (inviteExtra == null || StringUtil.isNullOrEmpty(inviteExtra.getInviteCode()))
|
| | | throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在");
|
| | | |
| | | String inviteCode = inviteExtra.getInviteCode();
|
| | | |
| | | // 剩余金币
|
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue();
|
| | | |
| | | // 更新金币
|
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
|
| | | extraUpdate.setId(extraVO.getId());
|
| | | extraUpdate.setGoldCoin(surplus);
|
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate);
|
| | | |
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | | detail.setTitle("金币兑换-邀请码激活卡-1组");
|
| | | detail.setMoney(-goldCoin);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | // 添加兑换记录
|
| | | integralExchangeRecordService.addExchangeRecord(exchange.getId(), uid);
|
| | | |
| | | // 消息 |
| | | 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);
|
| | | }
|
| | | });
|
| | | |
| | | return inviteCode;
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new IntegralExchangeException(1, "兑换失败");
|
| | | }
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.service.impl.user.integral; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeMapper; |
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon; |
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord; |
| | | import com.yeshi.fanli.entity.integral.IntegralDetail; |
| | | 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; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService; |
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService; |
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service; |
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService; |
| | | import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeRecordService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralExchangeService; |
| | | import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory; |
| | | import com.yeshi.fanli.vo.integral.ExchangeTipVO; |
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO; |
| | | |
| | | @Service |
| | | public class IntegralExchangeServiceImpl implements IntegralExchangeService { |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | @Resource |
| | | private IntegralExchangeMapper integralExchangeMapper; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | |
| | | @Resource |
| | | private UserSystemCouponService userSystemCouponService; |
| | | |
| | | @Resource |
| | | private UserTaoLiJinOriginService userTaoLiJinOriginService; |
| | | |
| | | @Resource |
| | | private HongBaoV2Service hongBaoV2Service; |
| | | |
| | | @Resource |
| | | private UserMoneyDetailService userMoneyDetailService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private CodePublishRecordService codePublishRecordService; |
| | | |
| | | @Resource |
| | | private IntegralExchangeRecordService integralExchangeRecordService; |
| | | |
| | | @Resource |
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService; |
| | | |
| | | @Resource |
| | | private MsgInviteDetailService msgInviteDetailService; |
| | | |
| | | @Resource |
| | | private IntegralDetailService integralDetailService; |
| | | |
| | | @Override |
| | | public IntegralExchange selectByPrimaryKey(Long id) { |
| | | return integralExchangeMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<IntegralExchange> listValidCache(long start, int count) { |
| | | return integralExchangeMapper.listValid(start, count); |
| | | } |
| | | |
| | | @Override |
| | | public Long countValid() { |
| | | return integralExchangeMapper.countValid(); |
| | | } |
| | | |
| | | @Override |
| | | public ExchangeTipVO verifyExchange(Long uid, Long id) throws IntegralExchangeException { |
| | | if (uid == null || uid <= 0) |
| | | throw new IntegralExchangeException(1, "用户未登录"); |
| | | |
| | | if (id == null || id <= 0) |
| | | throw new IntegralExchangeException(1, "兑换id不正确"); |
| | | |
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid); |
| | | if (extraVO == null) |
| | | throw new IntegralExchangeException(1, "用户相关信息不存在"); |
| | | |
| | | IntegralExchange exchange = integralExchangeMapper.selectByPrimaryKey(id); |
| | | if (exchange == null) |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | |
| | | Integer state = exchange.getState(); |
| | | if (state == null || state != 1) |
| | | throw new IntegralExchangeException(1, "兑换活动未开启"); |
| | | |
| | | Integer goldCoin = exchange.getGoldCoin(); |
| | | |
| | | ExchangeTipVO exchangeTip = new ExchangeTipVO(); |
| | | exchangeTip.setId(id); |
| | | ExchangeTypeEnum type = exchange.getType(); |
| | | if (ExchangeTypeEnum.inviteCodeActivate == type) { |
| | | exchangeTip.setType(type.name()); |
| | | return exchangeTip; |
| | | } |
| | | |
| | | long exchangeCount = 0; |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) { |
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, null); |
| | | if (exchangeCount >= 1) { |
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次"); |
| | | } |
| | | } |
| | | |
| | | Integer upperLimit = exchange.getUpperLimit(); |
| | | if (upperLimit != null) { // 是否有限制每日次数 |
| | | Integer today = 1; |
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, today); |
| | | if (exchangeCount >= upperLimit) { |
| | | throw new IntegralExchangeException(1, "今日兑换已达上限"); |
| | | } |
| | | } |
| | | |
| | | Integer goldCoinHas = extraVO.getGoldCoin(); |
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) { |
| | | exchangeTip.setType("notEnough"); |
| | | exchangeTip.setTip("当前账户中可用金币不足,无法兑换该奖品!"); |
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币"); |
| | | return exchangeTip; |
| | | } |
| | | |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) { |
| | | exchangeTip.setTip("自购免单券仅能自己使用,且每个用户ID只能兑换一次。\r\n注:兑换成功后请到“我的-福利中心”中查看"); |
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) { |
| | | exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看"); |
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) { |
| | | exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看"); |
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) { |
| | | if (codePublishRecordService.countValidRecord(uid) > 0) |
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换"); |
| | | |
| | | String inviteCode = null; |
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCodeVip())) { |
| | | inviteCode = extraVO.getInviteCodeVip(); |
| | | } else { |
| | | inviteCode = extraVO.getInviteCode(); |
| | | } |
| | | exchangeTip.setInviteCode(inviteCode); |
| | | exchangeTip.setTip("兑换成功后,将发布于“激活邀请码兑换功能中”,需激活邀请的用户可用金币兑换,本次展示有效期为3天。"); |
| | | } else if (ExchangeTypeEnum.taoLiJin == type) { |
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元推广红包"); |
| | | exchangeTip.setTip("注:兑换成功后请到“我的-推广红包”中查看"); |
| | | } else if (ExchangeTypeEnum.cash == type) { |
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元现金红包"); |
| | | exchangeTip.setTip("注:兑换成功后请到“我的-账户余额”中查看"); |
| | | } else { |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | } |
| | | |
| | | exchangeTip.setGoldCoin(goldCoin + "金币"); |
| | | exchangeTip.setType(type.name()); |
| | | return exchangeTip; |
| | | } |
| | | |
| | | @Override |
| | | public IntegralExchange exchange(Long uid, Long id) throws IntegralExchangeException { |
| | | if (uid == null || uid <= 0) |
| | | throw new IntegralExchangeException(1, "用户未登录"); |
| | | |
| | | if (id == null || id <= 0) |
| | | throw new IntegralExchangeException(1, "兑换id不正确"); |
| | | |
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid); |
| | | if (extraVO == null) |
| | | throw new IntegralExchangeException(1, "用户相关信息不存在"); |
| | | |
| | | IntegralExchange exchange = integralExchangeMapper.selectByPrimaryKey(id); |
| | | if (exchange == null) |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | |
| | | Integer state = exchange.getState(); |
| | | if (state == null || state != 1) |
| | | throw new IntegralExchangeException(1, "兑换活动未开启"); |
| | | |
| | | long exchangeCount = 0; |
| | | ExchangeTypeEnum type = exchange.getType(); |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) { |
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, null); |
| | | if (exchangeCount >= 1) { |
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次"); |
| | | } |
| | | } |
| | | |
| | | Integer upperLimit = exchange.getUpperLimit(); |
| | | if (upperLimit != null) { // 是否有限制每日次数 |
| | | Integer today = 1; |
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, today); |
| | | if (exchangeCount >= upperLimit) { |
| | | throw new IntegralExchangeException(1, "兑换已达上限"); |
| | | } |
| | | } |
| | | |
| | | Integer goldCoin = exchange.getGoldCoin(); |
| | | Integer goldCoinHas = extraVO.getGoldCoin(); |
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) { |
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!"); |
| | | } |
| | | |
| | | SystemEnum system= userInfoService.getUserSystem(uid); |
| | | |
| | | String thing = ""; |
| | | String thingNum = ""; |
| | | int couponNews = 0; |
| | | boolean once = false; // 兑换一次是否消失 |
| | | try { |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) { |
| | | List<UserSystemCoupon> listCoupon = userSystemCouponService.getFreeCouponByType(uid, |
| | | CouponTypeEnum.freeCouponBuy.name()); |
| | | if (listCoupon != null && listCoupon.size() > 0) |
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次"); |
| | | |
| | | thing = "自购免单券"; |
| | | thingNum = "1张"; |
| | | userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponBuy, UserSystemCoupon.SOURCE_EXCHANGE, |
| | | 1, true); |
| | | |
| | | once = true; |
| | | couponNews = 1; |
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) { |
| | | thing = "赠送免单券"; |
| | | thingNum = "1张"; |
| | | userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponGive, UserSystemCoupon.SOURCE_EXCHANGE, |
| | | 1, true); |
| | | |
| | | couponNews = 1; |
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) { |
| | | thing = "返利奖励券"; |
| | | thingNum = "1张"; |
| | | String percent = configService.getValue(ConfigKeyEnum.exchangeRebatePercent.getKey(),system); |
| | | userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_EXCHANGE, 1, |
| | | true, new BigDecimal(percent)); |
| | | couponNews = 1; |
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) { |
| | | thing = "邀请码发布卡"; |
| | | thingNum = "3天"; |
| | | if (codePublishRecordService.countValidRecord(uid) > 0) |
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换"); |
| | | codePublishRecordService.publishInviteCode(uid); |
| | | |
| | | exchange.setNeedJump(true); |
| | | exchange.setBtnName("去查看"); |
| | | } else if (ExchangeTypeEnum.taoLiJin == type) { |
| | | throw new IntegralExchangeException(1, "推广红包相关功能已下线!"); |
| | | } else if (ExchangeTypeEnum.cash == type) { |
| | | thing = "现金红包"; |
| | | BigDecimal money = exchange.getAmount(); |
| | | thingNum = money + "元"; |
| | | |
| | | // 1、插入红包数据 |
| | | HongBaoV2 hongBaoV2 = new HongBaoV2(); |
| | | hongBaoV2.setMoney(money); |
| | | hongBaoV2.setType(HongBaoV2.TYPE_EXCHANGE); |
| | | hongBaoV2.setState(HongBaoV2.STATE_YILINGQU); |
| | | hongBaoV2.setVersion(2); |
| | | hongBaoV2.setCreateTime(new Date()); |
| | | hongBaoV2.setUpdateTime(new Date()); |
| | | hongBaoV2.setUserInfo(new UserInfo(uid)); |
| | | hongBaoV2.setPreGetTime(new Date()); |
| | | hongBaoV2.setGetTime(new Date()); |
| | | hongBaoV2Service.insertSelective(hongBaoV2); |
| | | |
| | | // 2.插入资金明细,用户余额 |
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createScoreConvert(money, new UserInfo(uid)); |
| | | userMoneyDetailService.addUserMoneyDetail(userMoneyDetail); |
| | | userInfoService.addMoney(new UserInfo(uid), money); |
| | | } else { |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | } |
| | | |
| | | exchangeCount++; |
| | | String progress = exchange.getProgress(); |
| | | if (!StringUtil.isNullOrEmpty(progress)) |
| | | progress = progress.replace("{已兑换}", exchangeCount + "").replace("{上限数}", |
| | | exchange.getUpperLimit() + ""); |
| | | exchange.setProgress(progress); |
| | | |
| | | // 剩余金币 |
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue(); |
| | | exchange.setUserGoldCoin(surplus + "枚"); |
| | | |
| | | // 更新金币 + 福利中心消息数 |
| | | if (extraVO.getCouponNews() != null && extraVO.getCouponNews() > 0) |
| | | couponNews = couponNews + extraVO.getCouponNews(); |
| | | |
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO(); |
| | | extraUpdate.setId(extraVO.getId()); |
| | | extraUpdate.setGoldCoin(surplus); |
| | | extraUpdate.setCouponNews(couponNews); |
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate); |
| | | |
| | | // 添加兑换记录 |
| | | integralExchangeRecordService.addExchangeRecord(id, uid); |
| | | |
| | | // 加入明细 |
| | | IntegralDetail detail = new IntegralDetail(); |
| | | detail.setUid(uid); |
| | | detail.setTitle("金币兑换-" + thing + "-" + thingNum); |
| | | detail.setMoney(-goldCoin); |
| | | detail.setCreateTime(new Date()); |
| | | integralDetailService.insertSelective(detail); |
| | | |
| | | // 消息 |
| | | final String things = thing; |
| | | final String exNum = thingNum; |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (ExchangeTypeEnum.inviteCodePublish == type) { |
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, "1张"); |
| | | } else { |
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, exNum); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (once) // 兑换之后消失 |
| | | exchange = null; |
| | | |
| | | return exchange; |
| | | } catch (IntegralExchangeException e) { |
| | | throw new IntegralExchangeException(1, e.getMsg()); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | throw new IntegralExchangeException(1, "兑换异常"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ExchangeTipVO verifyInviteCode(Long uid, Long id) throws IntegralExchangeException { |
| | | if (uid == null || uid <= 0) |
| | | throw new IntegralExchangeException(1, "用户未登录"); |
| | | |
| | | if (id == null || id <= 0) |
| | | throw new IntegralExchangeException(1, "兑换id不正确"); |
| | | |
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid); |
| | | if (extraVO == null) |
| | | throw new IntegralExchangeException(1, "用户相关信息不存在"); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换"); |
| | | |
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id); |
| | | if (record == null) |
| | | throw new IntegralExchangeException(1, "兑换记录不存在"); |
| | | |
| | | IntegralExchange exchange = integralExchangeMapper.getValidByType(ExchangeTypeEnum.inviteCodeActivate.name()); |
| | | if (exchange == null) |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | |
| | | ExchangeTipVO exchangeTip = new ExchangeTipVO(); |
| | | exchangeTip.setId(id); |
| | | Integer goldCoin = exchange.getGoldCoin(); |
| | | Integer goldCoinHas = extraVO.getGoldCoin(); |
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) { |
| | | exchangeTip.setType("notEnough"); |
| | | exchangeTip.setTip("当前账户中可用金币不足,无法兑换该奖品!"); |
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币"); |
| | | return exchangeTip; |
| | | } |
| | | |
| | | exchangeTip.setTip("注:兑换成功后请到“消息-系统消息”查看"); |
| | | exchangeTip.setGoldCoin(goldCoin + "金币"); |
| | | exchangeTip.setType(ExchangeTypeEnum.inviteCodeActivate.name()); |
| | | return exchangeTip; |
| | | } |
| | | |
| | | @Override |
| | | public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException { |
| | | if (uid == null || uid <= 0) |
| | | throw new IntegralExchangeException(1, "用户未登录"); |
| | | |
| | | if (id == null || id <= 0) |
| | | throw new IntegralExchangeException(1, "兑换id不正确"); |
| | | |
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid); |
| | | if (extraVO == null) |
| | | throw new IntegralExchangeException(1, "用户相关信息不存在"); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换"); |
| | | |
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id); |
| | | if (record == null) |
| | | throw new IntegralExchangeException(1, "兑换记录不存在"); |
| | | |
| | | IntegralExchange exchange = integralExchangeMapper.getValidByType(ExchangeTypeEnum.inviteCodeActivate.name()); |
| | | if (exchange == null) |
| | | throw new IntegralExchangeException(1, "兑换方式不存在"); |
| | | |
| | | Integer goldCoin = exchange.getGoldCoin(); |
| | | Integer goldCoinHas = extraVO.getGoldCoin(); |
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) |
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!"); |
| | | |
| | | try { |
| | | UserInfoExtraVO inviteExtra = userInfoExtraService.getInfoExtraVOByUid(record.getUid()); |
| | | if (inviteExtra == null || StringUtil.isNullOrEmpty(inviteExtra.getInviteCode())) |
| | | throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在"); |
| | | |
| | | String inviteCode = inviteExtra.getInviteCode(); |
| | | |
| | | // 剩余金币 |
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue(); |
| | | |
| | | // 更新金币 |
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO(); |
| | | extraUpdate.setId(extraVO.getId()); |
| | | extraUpdate.setGoldCoin(surplus); |
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate); |
| | | |
| | | // 加入明细 |
| | | IntegralDetail detail = new IntegralDetail(); |
| | | detail.setUid(uid); |
| | | detail.setTitle("金币兑换-邀请码激活卡-1组"); |
| | | detail.setMoney(-goldCoin); |
| | | detail.setCreateTime(new Date()); |
| | | integralDetailService.insertSelective(detail); |
| | | |
| | | // 添加兑换记录 |
| | | integralExchangeRecordService.addExchangeRecord(exchange.getId(), uid); |
| | | |
| | | // 消息 |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, "邀请码激活卡", "1张"); |
| | | } |
| | | }); |
| | | |
| | | return inviteCode; |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | throw new IntegralExchangeException(1, "兑换失败"); |
| | | } |
| | | } |
| | | |
| | | } |