| | |
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.TokenRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private RedPackForbidService redPackForbidService;
|
| | | |
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | |
| | | if (uid == null || amount == null)
|
| | | throw new RedPackGiveRecordException(1, "参数不正确");
|
| | |
|
| | | if(redPackForbidService.verifyForbid(uid))
|
| | | throw new RedPackGiveRecordException(1, "红包功能已被封禁");
|
| | | |
| | | String giveMin = redPackConfigService.getValueByKey("give_money_min");
|
| | | String giveMax = redPackConfigService.getValueByKey("give_money_max");
|
| | | if (amount.compareTo(new BigDecimal(giveMin)) < 0 || amount.compareTo(new BigDecimal(giveMax)) > 0)
|
| | | throw new RedPackGiveRecordException(1, "赠送金额至少" + giveMin + "元至多" + giveMax + "元");
|
| | |
|
| | | BigDecimal balance = null;
|
| | | try {
|
| | | balance = redPackBalanceService.getBalance(uid);
|
| | | } catch (RedPackBalanceException e1) {
|
| | | throw new RedPackGiveRecordException(1, e1.getMsg());
|
| | | }
|
| | |
|
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || amount.compareTo(balance) > 0)
|
| | | throw new RedPackGiveRecordException(1, "余额不足");
|
| | |
|