选择人数添加锁
This commit is contained in:
@@ -24,6 +24,9 @@ public interface RedisConstant {
|
|||||||
// 排队取号全局号码
|
// 排队取号全局号码
|
||||||
String TABLE_CALL_NUMBER = "TABLE_CALL_NUMBER:";
|
String TABLE_CALL_NUMBER = "TABLE_CALL_NUMBER:";
|
||||||
|
|
||||||
|
// 选择人数锁
|
||||||
|
String CHOSE_TABLE_COUNT = "CHOSE_TABLE_COUNT";
|
||||||
|
|
||||||
static String getCurrentOrderKey(String tableId, String shopId) {
|
static String getCurrentOrderKey(String tableId, String shopId) {
|
||||||
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
|
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1679,6 +1679,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object choseCount(ChoseCountDTO choseCountDTO) {
|
public Object choseCount(ChoseCountDTO choseCountDTO) {
|
||||||
|
return Utils.runFunAndCheckKey(() -> {
|
||||||
TbShopInfo shopInfo = shopInfoRepository.findById(choseCountDTO.getShopId()).orElse(null);
|
TbShopInfo shopInfo = shopInfoRepository.findById(choseCountDTO.getShopId()).orElse(null);
|
||||||
if (shopInfo == null) throw new BadRequestException("店铺信息不存在");
|
if (shopInfo == null) throw new BadRequestException("店铺信息不存在");
|
||||||
|
|
||||||
@@ -1735,6 +1736,8 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return tbCashierCart;
|
return tbCashierCart;
|
||||||
|
}, stringRedisTemplate, RedisConstant.getLockKey(RedisConstant.CHOSE_TABLE_COUNT, choseCountDTO.getShopId(), choseCountDTO.getTableId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user