扫码上菜实现
This commit is contained in:
@@ -8,6 +8,8 @@ import com.czg.config.RabbitConstants;
|
||||
import com.czg.order.entity.MqLog;
|
||||
import com.czg.order.service.MqLogService;
|
||||
import com.czg.order.service.OrderInfoRpcService;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.service.order.utils.FunUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
@@ -26,6 +28,29 @@ public class OrderMqListener {
|
||||
private OrderInfoRpcService orderInfoRpcService;
|
||||
@Resource
|
||||
private MqLogService mqLogService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private FunUtil funUtil;
|
||||
|
||||
/**
|
||||
* 订单上菜
|
||||
*/
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_PRODUCT_STATUS_QUEUE})
|
||||
public void orderDetailUp(String info) {
|
||||
if (!info.contains("UP_ORDER_DETAIL:")) {
|
||||
return;
|
||||
}
|
||||
log.info("接收到修改菜品状态mq, info: {}", info);
|
||||
String finalInfo = info;
|
||||
funUtil.debounce("UP_ORDER_DETAIL:" + info, 5, () -> {
|
||||
orderInfoService.updateOrderDetailStatus(Long.valueOf(finalInfo));
|
||||
|
||||
});
|
||||
info = info.replace("UP_ORDER_DETAIL:", "");
|
||||
System.out.println(info);
|
||||
|
||||
}
|
||||
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_STOCK_QUEUE})
|
||||
public void orderStockSubtract(String orderId) {
|
||||
@@ -80,4 +105,7 @@ public class OrderMqListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user