转桌 台桌状态
This commit is contained in:
@@ -33,6 +33,11 @@ public interface ShopTableService extends IService<ShopTable> {
|
|||||||
|
|
||||||
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
|
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新台桌状态
|
||||||
|
*/
|
||||||
|
Boolean updateStatus(long shopId, Long tableId, String tableCode, String status);
|
||||||
|
|
||||||
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
|
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
|
||||||
Boolean expiredTable(long tableId);
|
Boolean expiredTable(long tableId);
|
||||||
|
|
||||||
|
|||||||
@@ -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()));
|
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
|
@Override
|
||||||
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
|
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
|
||||||
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));
|
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));
|
||||||
|
|||||||
@@ -582,24 +582,21 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
|
updateTargetOrder.setPlaceNum(targetOrder.getPlaceNum() + 1);
|
||||||
orderInfoService.updateById(updateTargetOrder);
|
orderInfoService.updateById(updateTargetOrder);
|
||||||
}
|
}
|
||||||
|
OrderDetail orderDetailUp = new OrderDetail();
|
||||||
|
orderDetailUp.setOrderId(targetOrder.getId());
|
||||||
|
orderDetailUp.setPlaceNum(targetOrder.getPlaceNum());
|
||||||
if (CollUtil.isEmpty(param.getDetailIds())) {
|
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) {
|
if (count < 1) {
|
||||||
throw new CzgException("转台失败,该订单无可转商品");
|
throw new CzgException("转台失败,该订单无可转商品");
|
||||||
}
|
}
|
||||||
orderDetailService.updateChain()
|
orderDetailService.update(orderDetailUp,new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()));
|
||||||
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
|
||||||
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
|
|
||||||
.set(OrderDetail::getOrderId, targetOrder.getId())
|
|
||||||
.update();
|
|
||||||
} else {
|
} else {
|
||||||
orderDetailService.updateChain()
|
orderDetailService.update(orderDetailUp,
|
||||||
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
new QueryWrapper().eq(OrderDetail::getOrderId, sourceOrder.getId()).in(OrderDetail::getId, param.getDetailIds()));
|
||||||
.in(OrderDetail::getId, param.getDetailIds())
|
|
||||||
.set(OrderDetail::getPlaceNum, targetOrder.getPlaceNum())
|
|
||||||
.set(OrderDetail::getOrderId, targetOrder.getId())
|
|
||||||
.update();
|
|
||||||
}
|
}
|
||||||
|
shopTableService.updateStatus(sourceOrder.getShopId(), null, sourceOrder.getTableCode(), ShopTableStatusEnum.IDLE.getValue());
|
||||||
|
shopTableService.updateStatus(sourceOrder.getShopId(), null, targetOrder.getTableCode(), ShopTableStatusEnum.UNSETTLED.getValue());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user