From d8bfa7274e91718fd822d0b0b4bee8a49fb4adec Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Sun, 29 Sep 2024 14: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/util/ShopUtils.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 f445c46..80abd0a 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/util/ShopUtils.java @@ -37,6 +37,10 @@ public class ShopUtils { boolean isOpenTakeout = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.TAKE_OUT.getValue()); boolean isOpenDineIn = shopInfo.getEatModel().contains(ShopInfoEatModelEnum.DINE_IN.getValue()); + if (!isOpenDineIn && !isOpenTakeout) { + throw new MsgException("此店铺未开通任何就餐模式"); + } + tableId = isOpenDineIn ? tableId : null; String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); @@ -44,18 +48,17 @@ public class ShopUtils { throw new MsgException("当前店铺未开启此就餐模式"); } - boolean isTakeout = ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); // 是否是快餐版/先付费 boolean isMunchies = StrUtil.isNotBlank(shopInfo.getRegisterType()) && ShopInfoRegisterlEnum.MUNCHIES.getValue().equals(shopInfo.getRegisterType()); - boolean isDineInAfter = !isMunchies && !isTakeout; - boolean isDineInBefore = isMunchies && !isTakeout; - + boolean isTakeout = isOpenTakeout && ShopInfoEatModelEnum.TAKE_OUT.getValue().equals(eatModel); + boolean isDineInAfter = isOpenDineIn && !isMunchies && !isTakeout; + boolean isDineInBefore = isOpenDineIn && isMunchies && !isTakeout; 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); + isDineInBefore ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : isDineInAfter ? OrderUseTypeEnum.DINE_IN_AFTER.getValue() : null, isOpenTakeout, isOpenDineIn); } public ShopEatTypeInfoDTO getEatModel(String tableId, Object shopId) {