admin
2019-11-12 0cf8c0bf5649b0b7269f78f6eae7c09cffea75cd
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java
@@ -21,6 +21,7 @@
import com.yeshi.fanli.entity.redpack.RedPackDetail;
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.money.UserMoneyService;
@@ -88,14 +89,19 @@
         throw new RedPackExchangeException(1, "参数不正确");
      String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
      BigDecimal balance = null;
      try {
         balance = redPackBalanceService.getBalance(uid);
      } catch (RedPackBalanceException e1) {
         throw new RedPackExchangeException(1, e1.getMsg());
      }
      
      BigDecimal balance = redPackBalanceService.getBalance(uid);
      if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
         throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
      
      if (balance.compareTo(amount) < 0)
         throw new RedPackExchangeException(1, "提现余额不足");
      
      String moneyMin = redPackConfigService.getValueByKey("extract_money_min");
      String moneyMax = redPackConfigService.getValueByKey("extract_money_max");
@@ -163,16 +169,20 @@
         throw new RedPackExchangeException(1,"更新提现明细出错");
      }
      
      //消息
      SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
      String beizu = "红包提现成功后请到“我的-账户余额”中查看";
      MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
      dto.setTitle("红包提现");
      dto.setTime(sd.format(record.getCreateTime()));
      dto.setHandle("人工审核" + sd.format(new Date()));
      dto.setMoney("¥" + record.getMoney().setScale(2));
      dto.setBalance("¥" + redPackBalanceService.getBalance(record.getUid()));
      userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass, new Gson().toJson(dto), beizu);
      try {
         //消息
         SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
         String beizu = "红包提现成功后请到“我的-账户余额”中查看";
         MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
         dto.setTitle("红包提现");
         dto.setTime(sd.format(record.getCreateTime()));
         dto.setHandle("人工审核" + sd.format(new Date()));
         dto.setMoney("¥" + record.getMoney().setScale(2));
         dto.setBalance("¥" + redPackBalanceService.getBalance(record.getUid()));
         userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass, new Gson().toJson(dto), beizu);
      } catch (RedPackBalanceException e) {
         throw new RedPackExchangeException(1, e.getMsg());
      }
   }