|
|
|
@ -1,7 +1,9 @@ |
|
|
|
|
package com.hfkj.consumer; |
|
|
|
|
|
|
|
|
|
import com.hfkj.entity.BsOrder; |
|
|
|
|
import com.hfkj.model.order.OrderModel; |
|
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
|
import com.hfkj.sysenum.order.OrderStatusEnum; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
|
|
|
|
import org.apache.rocketmq.spring.core.RocketMQListener; |
|
|
|
@ -19,7 +21,11 @@ public class OrderCancelConsumer implements RocketMQListener<OrderModel> { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onMessage(OrderModel order) { |
|
|
|
|
// 查询订单
|
|
|
|
|
BsOrder bsOrder = orderService.getOrder(order.getOrderNo()); |
|
|
|
|
if (bsOrder != null && bsOrder.getOrderStatus().equals(OrderStatusEnum.status1.getCode())) { |
|
|
|
|
// 取消订单
|
|
|
|
|
orderService.cancel(order.getOrderNo()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|