|
|
|
@@ -588,12 +588,14 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
// 库存 是否改变 |
|
|
|
bChanged = true; |
|
|
|
} |
|
|
|
if(wxCoupon.getInventory()-wxCoupon.getRemainInventory() != oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { |
|
|
|
Integer newSale = wxCoupon.getInventory()-wxCoupon.getRemainInventory(); |
|
|
|
Integer oldSale = oldCoupon.getInventory() - oldCoupon.getRemainInventory(); |
|
|
|
if (!newSale.equals(oldSale)) { |
|
|
|
// 已售卖数不变 |
|
|
|
logger.error("已售卖数不变"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "已售卖数不变"); |
|
|
|
logger.error("券库存要保证同增同减"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "券库存要保证同增同减"); |
|
|
|
} |
|
|
|
if(wxCoupon.getValidType() != oldCoupon.getValidType()) { |
|
|
|
if (!wxCoupon.getValidType().equals(oldCoupon.getValidType())) { |
|
|
|
// 券有效期类型不能改变 |
|
|
|
logger.error("券有效期类型不能改变"); |
|
|
|
return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期类型不能改变"); |
|
|
|
@@ -625,7 +627,9 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
|
|
|
|
wxCoupon.setOrgInventory(oldCoupon.getInventory()); |
|
|
|
wxCoupon.setOrgRemainInventory(oldCoupon.getRemainInventory()); |
|
|
|
if((wxCoupon.getRemainInventory() - wxCoupon.getOrgRemainInventory()) != (wxCoupon.getInventory() - wxCoupon.getOrgInventory())) { |
|
|
|
Integer newSale1 = wxCoupon.getRemainInventory() - wxCoupon.getOrgRemainInventory(); |
|
|
|
Integer oldSale1 = wxCoupon.getInventory() - wxCoupon.getOrgInventory(); |
|
|
|
if (!newSale1.equals(oldSale1)) { |
|
|
|
// 库存要保证,同增同减 |
|
|
|
logger.error("券库存要保证同增同减"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_NO_EQUAL_ERR); |
|
|
|
|