From 0dbc76c2076be0bf137c4b224cc518c66f9d5744 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sun, 29 Sep 2024 13:37:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=B1=E9=A4=90=E6=A8=A1=E5=BC=8F=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/CartService.java | 5 ++++- .../chaozhanggui/system/cashierservice/util/ShopUtils.java | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java index 3cdbe33..b507fe5 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java @@ -172,6 +172,10 @@ public class CartService { BigDecimal amount = BigDecimal.ZERO; JSONArray array = new JSONArray(); + ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.getEatModel(tableId, shopId); + if (!shopEatTypeInfoDTO.isOpenDineIn() && shopEatTypeInfoDTO.isOpenTakeout()) { + tableId = null; + } String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId); TbCashierCart seatCartInfo = null; if (redisUtil.exists(tableCartKey)) { @@ -215,7 +219,6 @@ public class CartService { } } - ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(tableId, shopId); redisUtil.saveMessage(RedisCst.getCurrentTableSeatCount(shopEatTypeInfoDTO.getShopInfo().getId(), tableId), JSONObject.toJSONString(seatCartInfo), 60 * 60 * 12L); JSONObject jsonObject1 = new JSONObject(); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java b/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java index c38630f..8393e17 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java @@ -39,6 +39,10 @@ public class ShopUtils { if (!shopInfo.getEatModel().contains(eatModel)) { throw new MsgException("当前店铺未开启此就餐模式"); } + + boolean isOpenTakeout = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.TAKE_OUT.getValue()); + boolean isOpenDineIn = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.DINE_IN.getValue()); + boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); // 是否是快餐版/先付费 boolean isMunchies = StrUtil.isNotBlank(shopInfo.getRegisterType()) && @@ -47,8 +51,7 @@ public class ShopUtils { boolean isDineInAfter = !isMunchies && !isTakeout; boolean isDineInBefore = isMunchies && !isTakeout; - boolean isOpenTakeout = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.TAKE_OUT.getValue()); - boolean isOpenDineIn = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.DINE_IN.getValue()); + return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() : isMunchies ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : OrderUseTypeEnum.DINE_IN_AFTER.getValue(), isOpenTakeout, isOpenDineIn);