
package com.tmerclub.cloud.delivery.service;

import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.tmerclub.cloud.common.order.vo.TransportVO;
import com.tmerclub.cloud.delivery.model.DeliveryOrder;
import com.tmerclub.cloud.delivery.vo.DeliveryOrderVO;

import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * 订单快递信息
 *
 * @author tmerclub
 * @date 2020-12-07 15:10:00
 */
public interface DeliveryOrderService {

    /**
     * 根据订单快递信息id获取订单快递信息
     *
     * @param deliveryOrderId 订单快递信息id
     * @return 订单快递信息
     */
    DeliveryOrderVO getByDeliveryOrderId(Long deliveryOrderId);

    /**
     * 保存订单快递信息
     *
     * @param deliveryOrder 订单快递信息
     */
    void save(DeliveryOrder deliveryOrder);

    /**
     * 更新订单快递信息
     *
     * @param deliveryOrder 订单快递信息
     */
    void update(DeliveryOrder deliveryOrder);

    /**
     * 根据订单快递信息id删除订单快递信息
     *
     * @param deliveryOrderId
     */
    void deleteById(Long deliveryOrderId);

    /**
     * 根据订单号获取包裹信息
     *
     * @param orderId 订单id
     * @return 包裹信息
     * @throws UnsupportedEncodingException 编码异常
     */
    List<DeliveryOrderFeignVO> getByDeliveryByOrderId(Long orderId);

    /**
     * 生成物流信息及保存物流与订单关联
     *
     * @param deliveryOrder 订单发货信息
     * @param isPurchase 是否为采购订单 0否1是
     * @param unDeliveryNum 未发货数量（采购订单默认为0）
     */
    void saveDeliveryInfo(DeliveryOrderDTO deliveryOrder, Integer isPurchase, Integer unDeliveryNum);

    /**
     * 查询订单物流包裹信息
     *
     * @param orderId
     * @return
     */
    List<DeliveryOrderVO> listDetailDelivery(Long orderId);

    /**
     * 修改订单物流包裹信息
     *
     * @param list
     */
    void updateOrderDeliveries(List<DeliveryOrderDTO> list);

    /**
     * 获取物流信息
     *
     * @param deliveryOrderId 订单物流包裹id
     * @return 物流信息
     */
    DeliveryOrderFeignVO deliveryOrderItemInfo(Long deliveryOrderId);

    /**
     * 根据订单编号获取发货数量
     *
     * @param orderIds
     * @return
     */
    List<DeliveryOrderFeignVO> listDeliveryCountByOrderId(List<Long> orderIds);

    /**
     * 判断用户地址是否包含在配送范围内
     * @param transportVO
     * @param userId
     * @param addrId
     * @return
     */
    Boolean checkAddr(TransportVO transportVO, Long userId, Long addrId);
}
