| | |
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackBalance;
|
| | | 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;
|
| | |
| | |
|
| | | String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
|
| | |
|
| | | RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (balance == null)
|
| | | BigDecimal balance = null;
|
| | | try {
|
| | | balance = redPackBalanceService.getBalance(uid);
|
| | | } catch (RedPackBalanceException e1) {
|
| | | throw new RedPackExchangeException(1, e1.getMsg());
|
| | | }
|
| | | |
| | | if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | |
|
| | | if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED) |
| | | throw new RedPackExchangeException(1, "红包已封禁,感谢使用");
|
| | | |
| | | BigDecimal balanceMoney = balance.getMoney();
|
| | | if (balanceMoney == null || balanceMoney.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | | |
| | | if (balanceMoney.compareTo(amount) < 0)
|
| | | if (balance.compareTo(amount) < 0)
|
| | | throw new RedPackExchangeException(1, "提现余额不足");
|
| | | |
| | |
|
| | | String moneyMin = redPackConfigService.getValueByKey("extract_money_min");
|
| | | String moneyMax = redPackConfigService.getValueByKey("extract_money_max");
|
| | |
| | | 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());
|
| | | }
|
| | | }
|
| | |
|
| | |
|