fix: 餐位费退菜修复

This commit is contained in:
2024-10-26 16:14:12 +08:00
parent ce94bd7e4e
commit f75aae14a8

View File

@@ -169,7 +169,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
* @param eatModel 就餐模式
* @param tableId 台桌id
* @return just餐类型信息
* */
*/
private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) {
TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper<TbShopInfo>()
.eq(TbShopInfo::getId, shopId)
@@ -673,18 +673,15 @@ public class TbShopTableServiceImpl implements TbShopTableService {
TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getCartId, cashierCart.getId()));
if (cashierCart.getId() == -999) {
if (cashierCart.getProductId().equals("-999")) {
cashierCartMapper.deleteById(cashierCart.getId());
if (cashierCart.getOrderId() != null) {
orderDetailMapper.delete(new LambdaQueryWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getCartId, cashierCart.getId()));
orderInfoMapper.update(null, new LambdaUpdateWrapper<TbOrderInfo>()
.eq(TbOrderInfo::getId, cashierCart.getOrderId())
.eq(TbOrderInfo::getShopId, removeCartDTO.getShopId())
.set(TbOrderInfo::getSeatCount, null)
.set(TbOrderInfo::getSeatAmount, null));
}
cashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
.eq(TbCashierCart::getId, cashierCart.getId())
.set(TbCashierCart::getStatus, "return"));
orderDetailMapper.update(null, new LambdaUpdateWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getId, tbOrderDetail.getId())
.set(TbOrderDetail::getUpdateTime, DateUtil.date())
.set(TbOrderDetail::getStatus, "return"));
} else {
@@ -1155,7 +1152,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
}
if (StrUtil.isNotBlank(createOrderDTO.getTableId()) && (allCashierCarts.isEmpty() || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && allCashierCarts.size() < 2)
if (StrUtil.isNotBlank(createOrderDTO.getTableId())
&& (cashierCarts.isEmpty() ||
(shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && cashierCarts.size() < 2)
|| (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null))) {
throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费");
}
@@ -1196,7 +1195,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
List<TbOrderDetail> addOrderDetails = new ArrayList<>();
boolean hasNewInfo = false;
for (TbCashierCart cashierCart : cashierCarts) {
if (!"return".equals(cashierCart.getStatus())) {