fix: 购物车全部退单清空购物车

This commit is contained in:
张松
2024-12-20 10:15:30 +08:00
parent 23bb11af55
commit 3f747743b1

View File

@@ -938,11 +938,19 @@ public class TbShopTableServiceImpl implements TbShopTableService {
if (TableConstant.OrderInfo.UseType.TAKEOUT.equalsVals(cashierCart.getUseType())) { if (TableConstant.OrderInfo.UseType.TAKEOUT.equalsVals(cashierCart.getUseType())) {
return; return;
} }
List<TbCashierCart> cashierCarts = mpCashierCartService.selectByShopEatTypeAndOrderId(shopEatTypeInfoDTO, cashierCart.getMasterId(), cashierCart.getOrderId() == null ? null : cashierCart.getOrderId(), false, TableConstant.OrderInfo.Status.CREATE); List<TbCashierCart> cashierCarts = mpCashierCartService.selectByShopEatTypeAndOrderId(shopEatTypeInfoDTO, cashierCart.getMasterId(), cashierCart.getOrderId() == null ? null : cashierCart.getOrderId(), false);
if (cashierCarts.isEmpty() && cashierCart.getOrderId() != null) { int activateCount = 0;
ArrayList<Integer> cartIds = new ArrayList<>();
for (TbCashierCart item : cashierCarts) {
if (TableConstant.OrderInfo.Status.CREATE.equalsVals(item.getStatus())) {
activateCount++;
}
}
if (activateCount == 0 && cashierCart.getOrderId() != null) {
mpOrderDetailService.remove(new LambdaQueryWrapper<TbOrderDetail>() mpOrderDetailService.remove(new LambdaQueryWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getOrderId, cashierCart.getOrderId())); .eq(TbOrderDetail::getOrderId, cashierCart.getOrderId()));
mpOrderInfoService.removeById(cashierCart.getOrderId()); mpOrderInfoService.removeById(cashierCart.getOrderId());
mpCashierCartService.removeByIds(cashierCarts);
} }
} }