From 9d9bd39e437941eed2af951ec042ee6758682cab Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Tue, 24 Sep 2019 18:33:17 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=BC=93=E5=AD=98][=E4=BF=AE=E6=94=B9]:mybati?= =?UTF-8?q?s=E7=BC=93=E5=AD=98=E5=AF=BC=E8=87=B4=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=85=88=E6=8B=BF=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iformall/mapper/WxCouponChannelMapper.java | 1 - .../java/com/iformall/mapper/WxCouponMapper.java | 1 - .../iformall/service/impl/WxCouponServiceImpl.java | 14 +++++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java index fb6683750..a13751591 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java @@ -10,7 +10,6 @@ import com.iformall.domain.po.WxCouponChannel; import org.apache.ibatis.annotations.CacheNamespace; import org.apache.ibatis.annotations.Param; -@CacheNamespace public interface WxCouponChannelMapper extends CommonMapper { List findList(WxCouponChannel wxCouponChannel); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java index ebdc457b0..4499e8443 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java @@ -9,7 +9,6 @@ import org.apache.ibatis.annotations.CacheNamespace; import org.apache.ibatis.annotations.Param; import com.iformall.domain.po.WxCoupon; -@CacheNamespace public interface WxCouponMapper extends CommonMapper { List findPressData(WxCoupon wxCoupon); List findCouponData(WxCoupon wxCoupon); 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 9d7f513ad..a013bba60 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -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);