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