fix: 修改会员信息校验餐位费修改

This commit is contained in:
张松 2024-11-07 10:58:15 +08:00
parent d912ff5064
commit 8e308cf187
1 changed files with 4 additions and 4 deletions

View File

@ -1130,7 +1130,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
// 就餐模式信息 // 就餐模式信息
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType()); ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType());
OrderCartInfoDTO cartInfoDTO = getCartForCreateOrder(shopEatTypeInfoDTO, createOrderDTO.getMasterId(), shopUser, byOrderId ? createOrderDTO.getOrderId() : null); OrderCartInfoDTO cartInfoDTO = getCartForCreateOrder(shopEatTypeInfoDTO, createOrderDTO.getMasterId(), shopUser, byOrderId ? createOrderDTO.getOrderId() : null, byOrderId);
if (cartInfoDTO.getOrderId() == null) { if (cartInfoDTO.getOrderId() == null) {
createOrderDTO.setOrderId(shopEatTypeInfoDTO.isDineInAfter() ? createOrderDTO.setOrderId(shopEatTypeInfoDTO.isDineInAfter() ?
getCurrentOrderId(shopEatTypeInfoDTO) : null); getCurrentOrderId(shopEatTypeInfoDTO) : null);
@ -1309,7 +1309,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
return infoDTO; return infoDTO;
} }
private OrderCartInfoDTO getCartForCreateOrder(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TbShopUser shopUser, Integer orderId) { private OrderCartInfoDTO getCartForCreateOrder(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, TbShopUser shopUser, Integer orderId, boolean ignoreEmpty) {
OrderCartInfoDTO cartInfoDTO = new OrderCartInfoDTO(); OrderCartInfoDTO cartInfoDTO = new OrderCartInfoDTO();
List<TbCashierCart> allCashierCarts; List<TbCashierCart> allCashierCarts;
if (orderId != null) { if (orderId != null) {
@ -1329,10 +1329,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
cartInfoDTO.getCashierCarts().add(cashierCart); cartInfoDTO.getCashierCarts().add(cashierCart);
} }
if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId()) if (ignoreEmpty && (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())
&& (cartInfoDTO.getCashierCarts().isEmpty() || && (cartInfoDTO.getCashierCarts().isEmpty() ||
(shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && cartInfoDTO.getCashierCarts().size() < 2) (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && cartInfoDTO.getCashierCarts().size() < 2)
|| (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null))) { || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null)))) {
throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费"); throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费");
} }