| @@ -491,29 +491,29 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | ||||
| if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { | if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { | ||||
| // 总库存数要大于等于可用库存数 | // 总库存数要大于等于可用库存数 | ||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); | |||||
| } | } | ||||
| if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { | if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { | ||||
| // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 | // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 | ||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); | |||||
| } | } | ||||
| if(wxCoupon.getInventory()-wxCoupon.getRemainInventory() != oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { | if(wxCoupon.getInventory()-wxCoupon.getRemainInventory() != oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { | ||||
| // 已售卖数不变 | // 已售卖数不变 | ||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "已售卖数不变"); | |||||
| } | } | ||||
| if(wxCoupon.getValidType() != oldCoupon.getValidType()) { | if(wxCoupon.getValidType() != oldCoupon.getValidType()) { | ||||
| // 券有效期类型不能改变 | // 券有效期类型不能改变 | ||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期类型不能改变"); | |||||
| } | } | ||||
| if(oldCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { | if(oldCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { | ||||
| if(wxCoupon.getValidEndDate().before(oldCoupon.getValidEndDate())) { | if(wxCoupon.getValidEndDate().before(oldCoupon.getValidEndDate())) { | ||||
| // 券有效期只可增加 | // 券有效期只可增加 | ||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期只可增加"); | |||||
| } | } | ||||
| } else { | } else { | ||||
| if(wxCoupon.getValidDays()<oldCoupon.getValidDays()) { | if(wxCoupon.getValidDays()<oldCoupon.getValidDays()) { | ||||
| // 券有效期只可增加 | // 券有效期只可增加 | ||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); | |||||
| return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期只可增加"); | |||||
| } | } | ||||
| } | } | ||||