diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index a3e8f931f..7ef2fb294 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -112,6 +112,7 @@ public enum ErrorCode{ COUPON_STOCK_DATE_NO_CAR(2037, "券库存不支持停车券"), COUPON_ONLY_FOR_NEW_MEMBER(2038, "您已参加过新会员活动"), COUPON_SCORE_NOT_IN_RANGE(2038, "您的成长值/等级与要求不符"), + COUPON_STOCK_NO_EQUAL_ERR(2039, "券库存设置要保证同增同减"), PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"), PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"), diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 95ac302e4..a923a3000 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -579,6 +579,11 @@ public class WxCouponServiceImpl implements WxCouponService { wxCoupon.setOrgInventory(oldCoupon.getInventory()); wxCoupon.setOrgRemainInventory(oldCoupon.getRemainInventory()); + if((wxCoupon.getRemainInventory() - wxCoupon.getOrgRemainInventory()) != (wxCoupon.getInventory() - wxCoupon.getOrgInventory())) { + // 库存要保证,同增同减 + logger.error("券库存要保证同增同减"); + return new ResultData(ErrorCode.COUPON_STOCK_NO_EQUAL_ERR); + } int ret = wxCouponMapper.updateStockAndValidDate(wxCoupon); if(ret != 1) {