支付成功清空台桌就餐人数等信息

This commit is contained in:
2024-10-25 11:23:31 +08:00
parent 0334d88a4f
commit a2ada0db33
5 changed files with 41 additions and 20 deletions

View File

@@ -17,4 +17,10 @@ public interface MpShopTableService extends IService<TbShopTable> {
* @param tableId qrcode
*/
TbShopTable selectByQrcode(String tableId);
/**
* 清除台桌状态
* @param tableId 台桌id
*/
boolean clearTableState(String tableId);
}

View File

@@ -25,4 +25,21 @@ public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbSho
return getOne(new LambdaQueryWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, tableId));
}
@Override
public boolean clearTableState(String tableId) {
TbShopTable shopTable = selectByQrcode(tableId);
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
return update(new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, tableId)
.set(TbShopTable::getUseTime, null)
.set(TbShopTable::getProductNum, 0)
.set(TbShopTable::getTotalAmount, 0)
.set(TbShopTable::getRealAmount, 0)
.set(TbShopTable::getUseNum, 0)
.set(TbShopTable::getStatus, TableConstant.ShopTable.State.CLEANING.getValue()));
}else {
return updateStateByQrcode(tableId, TableConstant.ShopTable.State.CLEANING);
}
}
}