fix: 无台桌购物车为空创建订单报错

This commit is contained in:
2024-10-26 17:54:04 +08:00
parent 3b2f2e4bbe
commit 7a9d226783

View File

@@ -55,6 +55,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.Order;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@@ -643,7 +644,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
// 会员点单
TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper<TbCashierCart>()
.eq(TbCashierCart::getShopId, removeCartDTO.getShopId())
.in(TbCashierCart::getStatus, "create", "refund")
.in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue())
.isNotNull(TbCashierCart::getOrderId)
.eq(TbCashierCart::getId, removeCartDTO.getCartId()));
@@ -1158,6 +1159,10 @@ public class TbShopTableServiceImpl implements TbShopTableService {
throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费");
}
if (cashierCarts.isEmpty()) {
throw new BadRequestException("购物车为空");
}
ArrayList<Integer> cartIdList = new ArrayList<>();
for (TbCashierCart tbCashierCart : cashierCarts) {
if (tbCashierCart.getOrderId() != null) {