diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 259b7e78..ed558d89 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -267,7 +267,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { throw new BadRequestException("购物车商品不存在"); } - int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId()); + int currentPlaceNum = getCurrentPlaceNum(tbCashierCart.getTableId().toString(), tbCashierCart.getShopId(), tbCashierCart.getUseType()); if (tbCashierCart.getPlaceNum() != null && !tbCashierCart.getPlaceNum().equals(currentPlaceNum)) { throw new BadRequestException("已下单商品仅支持退单操作"); @@ -330,7 +330,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { return shopTable; } - private int getCurrentPlaceNum(String tableId, String shopId) { + private int getCurrentPlaceNum(String tableId, String shopId, String useType) { String currentOrderKey = RedisConstant.getCurrentOrderKey(tableId, shopId); String orderId = redisTemplate.opsForValue().get(currentOrderKey); @@ -338,7 +338,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { return 1; } TbOrderInfo orderInfo = orderInfoMapper.selectOne(new LambdaQueryWrapper() - .eq(TbOrderInfo::getUseType, "postPay") + .eq(TbOrderInfo::getUseType, useType) .eq(TbOrderInfo::getId, orderId).select(TbOrderInfo::getPlaceNum)); return orderInfo == null ? 1 : orderInfo.getPlaceNum() + 1; } @@ -349,7 +349,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { checkTableIsOpen(addCartDTO.getTableId()); } - int currentPlaceNum = getCurrentPlaceNum(addCartDTO.getTableId(), addCartDTO.getShopId().toString()); + int currentPlaceNum = getCurrentPlaceNum(addCartDTO.getTableId(), addCartDTO.getShopId().toString(), addCartDTO.getUseType()); TbProductSku productSku = productMapper.selectSkuByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getSkuId()); TbProduct product = productMapper.selectByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getProductId()); @@ -485,7 +485,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public void removeCart(RemoveCartDTO removeCartDTO) { - int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString()); + int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId() == null ? "" : removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString(), removeCartDTO.getUseType()); // 会员点单 TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, removeCartDTO.getShopId()) @@ -528,7 +528,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { public void returnCart(ReturnOrderDTO removeCartDTO) { rabbitMsgUtils.printDishesReturnTicket(4450, 9313); - int currentPlaceNum = getCurrentPlaceNum(removeCartDTO.getTableId().toString(), removeCartDTO.getShopId().toString()); // 会员点单 TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, removeCartDTO.getShopId()) @@ -1001,7 +1000,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { BigDecimal feeAmount = BigDecimal.ZERO; BigDecimal saleAmount = BigDecimal.ZERO; // 当前下单次数 - int placeNum = StrUtil.isNotBlank(createOrderDTO.getTableId()) ? getCurrentPlaceNum(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString()) : 1; + int placeNum = StrUtil.isNotBlank(createOrderDTO.getTableId()) ? getCurrentPlaceNum(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString(), createOrderDTO.getUseType()) : 1; List orderDetails = new ArrayList<>(); Integer mealNum = null;