| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum;
|
| | | 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.RedPackGiveRecord;
|
| | |
| | | if (amount.compareTo(new BigDecimal(giveMin)) < 0 || amount.compareTo(new BigDecimal(giveMax)) > 0)
|
| | | throw new RedPackGiveRecordException(1, "赠送金额至少" + giveMin + "元至多" + giveMax + "元");
|
| | |
|
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || amount.compareTo(balance) > 0)
|
| | | RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (balance == null)
|
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | | |
| | | if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED) |
| | | throw new RedPackGiveRecordException(1, "红包已封禁,感谢使用");
|
| | | |
| | | if (balance.getMoney() == null || amount.compareTo(balance.getMoney()) > 0)
|
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | | |
| | |
|
| | | Date nowDate = new Date();
|
| | | // 赠送记录
|
| | |
| | | tips = tips.replace("{APP名称}", projectChineseName);
|
| | | }
|
| | | tips = tips.replace("{口令}", token).replace("{下载链接}", redPackConfigService.getValueByKey("app_down_link")).replace("{面额}",
|
| | | amount.toString());
|
| | | amount.setScale(2).toString());
|
| | |
|
| | | // 减少红包
|
| | | try {
|