提交代码

master
胡锐 4 months ago
parent 58f21fa9a1
commit 6b5c47bf52
  1. 6
      schedule/src/main/java/com/hfkj/consumer/OrderCancelConsumer.java

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

Loading…
Cancel
Save