|
@@ -63,12 +63,33 @@ public class SysCouponServiceImpl extends BaseServiceImpl<Integer, SysCoupon> i
|
|
|
oldCoupon.setStockCount(sysCoupon.getStockCount());
|
|
|
oldCoupon.setWarningStockNum(sysCoupon.getWarningStockNum());
|
|
|
}
|
|
|
+ if(oldCoupon.getStockCount()==-1){
|
|
|
+ oldCoupon.setWarningStockNum(-1);
|
|
|
+ }
|
|
|
oldCoupon.setStatus(sysCoupon.getStatus());
|
|
|
if(oldCoupon.getStockCount()-oldCoupon.getConsumeNum()>oldCoupon.getWarningStockNum()){
|
|
|
oldCoupon.setWarningStatus(0);
|
|
|
}
|
|
|
sysCouponDao.update(oldCoupon);
|
|
|
}else{
|
|
|
+ switch (sysCoupon.getType()){
|
|
|
+ case DISCOUNT:
|
|
|
+ if(Objects.isNull(sysCoupon.getFaceValue())){
|
|
|
+ throw new BizException("请指定折扣比例");
|
|
|
+ }
|
|
|
+ sysCoupon.setFullAmount(null);
|
|
|
+ break;
|
|
|
+ case FULL_REDUCTION:
|
|
|
+ if(Objects.isNull(sysCoupon.getFaceValue())){
|
|
|
+ throw new BizException("请指定优惠金额");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(sysCoupon.getFullAmount())){
|
|
|
+ throw new BizException("请指定达标金额");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("请指定优惠券类型");
|
|
|
+ }
|
|
|
switch (sysCoupon.getEffectiveType()){
|
|
|
case DAYS:
|
|
|
if(Objects.isNull(sysCoupon.getDeadline())){
|
|
@@ -86,6 +107,9 @@ public class SysCouponServiceImpl extends BaseServiceImpl<Integer, SysCoupon> i
|
|
|
default:
|
|
|
throw new BizException("请指定有效期类型");
|
|
|
}
|
|
|
+ if(sysCoupon.getStockCount()==-1){
|
|
|
+ sysCoupon.setWarningStockNum(-1);
|
|
|
+ }
|
|
|
sysCouponDao.update(sysCoupon);
|
|
|
}
|
|
|
}
|