选择人数添加锁

This commit is contained in:
2024-09-28 16:14:30 +08:00
parent a4ce1f0299
commit 84acdd0161
2 changed files with 56 additions and 50 deletions

View File

@@ -24,6 +24,9 @@ public interface RedisConstant {
// 排队取号全局号码
String TABLE_CALL_NUMBER = "TABLE_CALL_NUMBER:";
// 选择人数锁
String CHOSE_TABLE_COUNT = "CHOSE_TABLE_COUNT";
static String getCurrentOrderKey(String tableId, String shopId) {
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
}

View File

@@ -1679,6 +1679,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
@Override
public Object choseCount(ChoseCountDTO choseCountDTO) {
return Utils.runFunAndCheckKey(() -> {
TbShopInfo shopInfo = shopInfoRepository.findById(choseCountDTO.getShopId()).orElse(null);
if (shopInfo == null) throw new BadRequestException("店铺信息不存在");
@@ -1735,6 +1736,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
return tbCashierCart;
}, stringRedisTemplate, RedisConstant.getLockKey(RedisConstant.CHOSE_TABLE_COUNT, choseCountDTO.getShopId(), choseCountDTO.getTableId()));
}
@Override