modify file
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.peanut.modules.mq.Consumer;
|
||||
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Description: 消息超时取消死信队列消费者
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/10
|
||||
*/
|
||||
@Component
|
||||
public class OrderCancelConsumer {
|
||||
@Autowired
|
||||
BuyOrderService buyOrderService;
|
||||
|
||||
@RabbitListener(queues = DelayQueueConfig.ORDER_CANCEL_DEAD_LETTER_QUEUE)
|
||||
public void orderConsumer(String orderId) {
|
||||
BuyOrderEntity buyOrder = buyOrderService.getById(orderId);
|
||||
if(buyOrder == null){
|
||||
return;
|
||||
}
|
||||
if(Constants.ORDER_STATUS_TO_BE_PAID.equals(buyOrder.getOrderStatus())){
|
||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_OUT_OF_TIME);
|
||||
}
|
||||
buyOrderService.updateById(buyOrder);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user