转桌 台桌状态

This commit is contained in:
2026-03-26 09:53:35 +08:00
parent ab697be8ef
commit e8731e1d4d
3 changed files with 21 additions and 12 deletions

View File

@@ -33,6 +33,11 @@ public interface ShopTableService extends IService<ShopTable> {
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
/**
* 更新台桌状态
*/
Boolean updateStatus(long shopId, Long tableId, String tableCode, String status);
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
Boolean expiredTable(long tableId);

View File

@@ -278,6 +278,13 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
return update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId()));
}
@Override
public Boolean updateStatus(long shopId, Long tableId, String tableCode, String status) {
ShopTable shopTable = new ShopTable();
shopTable.setStatus(status);
return update(shopTable, query().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, tableId).eq(ShopTable::getTableCode, tableCode));
}
@Override
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));

View File

@@ -582,24 +582,21 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
orderInfoService.updateById(updateTargetOrder);
}
OrderDetail orderDetailUp = new OrderDetail();
orderDetailUp.setOrderId(targetOrder.getId());
orderDetailUp.setPlaceNum(targetOrder.getPlaceNum());
if (CollUtil.isEmpty(param.getDetailIds())) {
long count = orderDetailService.queryChain().eq(OrderDetail::getOrderId, sourceOrder.getId()).count();
long count = orderDetailService.count(new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
if (count < 1) {
throw new CzgException("转台失败,该订单无可转商品");
}
orderDetailService.updateChain()
.eq(OrderDetail::getOrderId, sourceOrder.getId())
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
.set(OrderDetail::getOrderId, targetOrder.getId())
.update();
orderDetailService.update(orderDetailUp,new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
} else {
orderDetailService.updateChain()
.eq(OrderDetail::getOrderId, sourceOrder.getId())
.in(OrderDetail::getId, param.getDetailIds())
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
.set(OrderDetail::getOrderId, targetOrder.getId())
.update();
orderDetailService.update(orderDetailUp,
new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()).in(OrderDetail::getId, param.getDetailIds()));
}
shopTableService.updateStatus(sourceOrder.getShopId(), null, sourceOrder.getTableCode(), ShopTableStatusEnum.IDLE.getValue());
shopTableService.updateStatus(sourceOrder.getShopId(), null, targetOrder.getTableCode(), ShopTableStatusEnum.UNSETTLED.getValue());
return CzgResult.success();
}