From 6b5c47bf521903a84e6b4b76361005a75fd59971 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 23 Jul 2024 17:37:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hfkj/consumer/OrderCancelConsumer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/schedule/src/main/java/com/hfkj/consumer/OrderCancelConsumer.java b/schedule/src/main/java/com/hfkj/consumer/OrderCancelConsumer.java index 5091535..87d7272 100644 --- a/schedule/src/main/java/com/hfkj/consumer/OrderCancelConsumer.java +++ b/schedule/src/main/java/com/hfkj/consumer/OrderCancelConsumer.java @@ -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 { @Override public void onMessage(OrderModel order) { - // 取消订单 - orderService.cancel(order.getOrderNo()); + // 查询订单 + BsOrder bsOrder = orderService.getOrder(order.getOrderNo()); + if (bsOrder != null && bsOrder.getOrderStatus().equals(OrderStatusEnum.status1.getCode())) { + // 取消订单 + orderService.cancel(order.getOrderNo()); + } } }