| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.omg.CORBA.LongHolder;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
| | | 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;
|
| | |
| | | throw new RedPackExchangeException(1, "参数不正确");
|
| | |
|
| | | String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
|
| | | |
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | |
| | | RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (balance == null)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | |
|
| | | if (balance.compareTo(amount) < 0)
|
| | | 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)
|
| | | throw new RedPackExchangeException(1, "提现余额不足");
|
| | |
|
| | |
|
| | |
| | |
|
| | | // 退回红包
|
| | | try {
|
| | | redPackBalanceService.addRedPack(record.getUid(), record.getMoney(), RedPackDetailFactory.createExchange(record));
|
| | | redPackBalanceService.addRedPack(record.getUid(), record.getMoney(), RedPackDetailFactory.createExchangeReject(record));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new RedPackExchangeException(1, "红包退回时出错");
|