台桌状态

This commit is contained in:
2025-05-09 11:07:58 +08:00
parent 4321847add
commit fc255e5969
11 changed files with 141 additions and 18 deletions

View File

@@ -1,8 +1,10 @@
package com.czg.config;
import com.czg.account.service.ShopTableService;
import com.czg.order.service.OrderInfoService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -25,6 +27,8 @@ public class RedisKeyExpirationListener implements MessageListener {
private String database;
@Resource
private OrderInfoService tbOrderInfoService;
@DubboReference
private ShopTableService tableService;
//redis key失效监听
@@ -46,6 +50,10 @@ public class RedisKeyExpirationListener implements MessageListener {
log.info("监听到订单过期,订单Id: {}", expiredKey);
String orderId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_ORDER.length());
tbOrderInfoService.expired(Long.parseLong(orderId));
}else if (expiredKey.startsWith(RedisCst.classKeyExpired.EXPIRED_TABLE)) {
log.info("监听到台桌清台过期,台桌Id: {}", expiredKey);
String tableId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_TABLE.length());
tableService.expiredTable(Long.parseLong(tableId));
}
}
}