From f5429c463a78aaf3aeeb230ad4a5f613a5d8799d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Sun, 15 Aug 2021 01:16:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(CartServiceImpl.java):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=87=B3=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=85=88?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=95=86=E5=93=81=E6=98=AF=E5=90=A6=E5=AD=98?= =?UTF-8?q?=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/youlai/mall/oms/service/impl/CartServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java index fe9e78174..7903a9892 100644 --- a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java +++ b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/CartServiceImpl.java @@ -87,7 +87,9 @@ public class CartServiceImpl implements ICartService { } }); CompletableFuture.allOf(cartItemCompletableFuture).join(); - cartHashOperations.put(hKey,cartItem); + + Assert.isTrue(cartItem.getSkuId() != null && cartItem.getSkuId() > 0,"商品不存在"); + cartHashOperations.put(hKey, cartItem); return true; }