| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | }
|
| | |
|
| | | Integer amount = record.getAmount();
|
| | | if (amount == null || amount < 1) {
|
| | | throw new PushCouponException(1, "券数量不能小于1");
|
| | | if (amount == null) {
|
| | | throw new PushCouponException(1, "券数量不能为空");
|
| | | } else if (amount < 1 || amount > 5) {
|
| | | throw new PushCouponException(1, "券数量范围是 1~5");
|
| | | }
|
| | | |
| | | BigDecimal percent = record.getPercent();
|
| | | if (percent != null && (percent.compareTo(new BigDecimal(60)) > 0
|
| | | || percent.compareTo(new BigDecimal(1)) < 0)) {
|
| | | throw new PushCouponException(1, "券比例范围是1~60 的正整数");
|
| | | }
|
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | |
| | | PushCoupon current = selectByPrimaryKey(id);
|
| | | if (current == null) {
|
| | | throw new PushCouponException(1, "该记录已不存在");
|
| | | }
|
| | | |
| | | if(current.isPushed()) {
|
| | | throw new PushCouponException(1, "已推送的信息不能修改");
|
| | | }
|
| | |
|
| | | current.setTitle(title);
|
| | |
| | |
|
| | | for (Long id: list) {
|
| | | long receivedCount = pushCouponRecordService.countByPushId(id);
|
| | | // 领取数量
|
| | | if (receivedCount > 0) {
|
| | | continue;
|
| | | }
|