admin
2019-03-15 a8e45a802600ca1cde28fe8522a26635328bbd99
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.push;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -94,9 +95,18 @@
      }
      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) {
@@ -112,6 +122,10 @@
         PushCoupon current = selectByPrimaryKey(id);
         if (current == null) {
            throw new PushCouponException(1, "该记录已不存在");
         }
         if(current.isPushed()) {
            throw new PushCouponException(1, "已推送的信息不能修改");
         }
         current.setTitle(title);
@@ -199,6 +213,7 @@
      
      for (Long id: list) {
         long receivedCount = pushCouponRecordService.countByPushId(id);
         // 领取数量
         if (receivedCount > 0) {
            continue;
         }