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

import cn.iocoder.yudao.framework.apollo.core.event.OrderCustomerServiceEvent;
import cn.iocoder.yudao.framework.apollo.core.event.OrderOperateLogEvent;
import cn.iocoder.yudao.module.order.dal.mysql.order.OrderMapper;
import cn.iocoder.yudao.module.order.service.order.OrderQueryService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;

/**
 * 查询客户所属订单的客户经理列表
 *
 * @author zhengYi
 */
@Component("OrderCustomerServiceListener")
@AllArgsConstructor
public class OrderCustomerServiceListener {

    private final OrderMapper orderMapper;

    /**
     * 查询客户所属订单的客户经理列表监听
     *
     * @param event 客户所属订单的客户经理参数
     */
    @EventListener(OrderCustomerServiceEvent.class)
    public void orderCustomerServiceEvent(OrderCustomerServiceEvent event) {
        List<Long> customerServices = orderMapper.getOrderCustomerServiceByCustomerId(event.getCustomerId());
        event.setCustomerServices(customerServices);
    }
}
