# Coverage Summary for Class: ExpiredOrderListener (cn.edu.ecnu.stu.bookstore.listener)

Class | Class, % | Method, % | Line, %
--- | --- | --- | ---
ExpiredOrderListener | 100% (1/1) | 100% (2/2) | 100% (5/5)

     package cn.edu.ecnu.stu.bookstore.listener;

     import cn.edu.ecnu.stu.bookstore.config.RabbitMqConfig;
     import cn.edu.ecnu.stu.bookstore.mapper.OrderMapper;
     import cn.edu.ecnu.stu.bookstore.pojo.OrderStatus;
     import com.rabbitmq.client.Channel;
     import org.springframework.amqp.core.Message;
     import org.springframework.amqp.rabbit.annotation.RabbitListener;
     import org.springframework.beans.factory.annotation.Autowired;
     import org.springframework.stereotype.Component;

     @Component
     public class ExpiredOrderListener {

         @Autowired
         private OrderMapper orderMapper;

         @RabbitListener(queues = RabbitMqConfig.EXPIRED_ORDER_QUEUE)
         public void processExpiredOrder(String msg, Channel channel, Message message) {
             System.out.println(msg + "¹ýÆÚ");
             OrderStatus status = OrderStatus.getByValue(orderMapper.selectStatus(msg));
             if(OrderStatus.WAIT_PAYMENT.equals(status)) {
                 orderMapper.updateOrderStatus(msg, OrderStatus.CANCEL);
             }
         }
     }