From 8aca8f63e045ba23b1a533cd963ebf617034b88d Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Wed, 26 Jun 2019 13:33:05 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BA=93=E5=AD=98][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=8F=AA=E8=83=BD=E5=90=8C=E5=A2=9E=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxCouponServiceImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 7390f4c17..95ac302e4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -293,6 +293,18 @@ public class WxCouponServiceImpl implements WxCouponService { wxCouponMapper.insertSelective(record); } else { + if(record.getInventory() != null && record.getRemainInventory() != null) { + // 库存修改检查 + WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(record.getId()); + if(oldCoupon.getRemainInventory() == record.getRemainInventory()) { + // 库存未变, 不更新库存 + record.setRemainInventory(null); + record.setInventory(null); + } else { + // 库存增加,要同时增加, 库存减少,要同时减少 + record.setInventory(oldCoupon.getInventory() + record.getRemainInventory() - oldCoupon.getRemainInventory()); + } + } if (merchantParamList != null && merchantParamList.size() > 0) { WxCouponMerchant cmParam = new WxCouponMerchant(); cmParam.setProductId(record.getId());