package cn.iocoder.yudao.module.order.listener;

import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeTransportEvent;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * 入仓订单变更运输方式审批通过监听
 *
 * @author zhengYi
 */
@Component("WarehouseInOrderChangeTransportListener")
@AllArgsConstructor
public class WarehouseInOrderChangeTransportListener {

    private final OrderWarehouseInService orderWarehouseInService;
    /**
     * 入仓订单变更运输方式审批通过后更新入仓业务
     *
     * @param event 订单id
     */
    @EventListener(WarehouseInOrderChangeTransportEvent.class)
    public void warehouseInOrderChangeTransportEvent(WarehouseInOrderChangeTransportEvent event) {
        orderWarehouseInService.finishWarehouseInWhenChangeTransportType(event.getOrderId());
    }
}
