package com.yc.ship.module.trade.service.supplier;


import com.yc.ship.module.trade.controller.admin.supplier.vo.SupplierRespVO;
import com.yc.ship.module.trade.controller.app.ota.vo.OtaInnerRefundVoucherVO;
import com.yc.ship.module.trade.dal.dataobject.order.TradeDetailBaseDO;
import com.yc.ship.module.trade.dal.dataobject.order.TradeDetailDO;
import com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO;
import com.yc.ship.module.trade.dal.dataobject.supplier.SupplierRefundDO;
import com.yc.ship.module.trade.dal.dataobject.supplier.SupplierRetryRecordDO;
import com.yc.ship.module.trade.dal.dataobject.supplier.TradeSupplierOrderDO;
import com.yc.ship.module.trade.service.order.bo.TradeOrderDetailBaseBO;
import com.yc.ship.module.trade.service.order.bo.TradeVisitorBO;
import com.yc.ship.module.trade.service.refund.bo.TradeSupplierRefundBaseBO;
import com.yc.ship.module.trade.service.supplier.bo.SupplierTradeOrderPayRespBO;
import com.yc.ship.module.trade.service.supplier.bo.TradeSupplierOrderBO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * &#064;Description 供应商订单数据service接口
 * &#064;Author qsl
 * &#064;Date 2025/6/4 15:03
 */
public interface TradeSupplierOrderRepositoryService {

    /**
     * 供应商订单保存
     * @param tradeSupplierOrderBOList
     * @return
     */
    void saveOrder(List<TradeSupplierOrderBO> tradeSupplierOrderBOList);
    /**
     * 更新订单状态
     * @param tradeSupplierOrderDO
     * @return
     */
    void updateOrderStatus(TradeSupplierOrderDO tradeSupplierOrderDO);
    /**
     * 下单成功
     * @param tradeSupplierOrderDO
     * @return
     */
    void updateAfterOrderSuccess(TradeSupplierOrderDO tradeSupplierOrderDO);
    /**
     * 根据平台供应商订单查询游客
     * @param platSupplierOrderId
     * @return
     */
    List<TradeVisitorDO> getVisitorListBySupplierOrder(Long platSupplierOrderId);

    /**
     * 获取需要供应商下单列表
     * @param orderId
     * @return
     */
    List<TradeOrderDetailBaseBO> getNeedSupplierOrderList(Long orderId);

    List<TradeDetailBaseDO> getBaseListFromOrder(Long orderId, TradeOrderDetailBaseBO baseBO);
    List<TradeDetailBaseDO> getDistinctBaseListBySupplierOrderId(Long platSupplierOrderId);
    List<TradeDetailDO> getDistinctDetailListBySupplierOrderId(Long platSupplierOrderId);
    List<TradeDetailBaseDO> selectBaseListBySupplierOrderNo(String platSupplierOrderId);

    List<TradeVisitorDO> getVisitorListBySpecType(Long platSupplierOrderId,String specType,List<Long> baseList);

    Integer getCountBySpecType(Long platSupplierOrderId,String specType);

    void updateAfterPaySuccess(SupplierTradeOrderPayRespBO respBO, TradeSupplierOrderDO tradeSupplierOrderDO);

    List<TradeSupplierOrderDO> getTradeSupplierOrderList(Long orderId);

    List<SupplierRefundDO> getSupplierOrderToCreateRefund(Long refundId, Integer supplierOrderStatus);

    void saveSupplierRefundOrder(List<SupplierRefundDO> supplierRefundDOList);

    void updateSupplierRefundDetailBase(List<SupplierRefundDO> supplierRefundDOList);

    List<String> getVoucherListByPlatSupplierRefundId(Long platSupplierRefundId);

    List<OtaInnerRefundVoucherVO> getVoucherAndBaseListByPlatSupplierRefundId(Long platSupplierRefundId);

    void updateRefundStatus(SupplierRefundDO refundDO);

    TradeSupplierOrderDO getById(Long supplierOrderId);

    SupplierRetryRecordDO addRetryRecord(Long bizId, Integer bizType);
    void updateRetryRecord(SupplierRetryRecordDO supplierRetryRecordDO);

    SupplierRefundDO getSupplierRefundById(Long supplierRefundId);

    Map<String,Long> getSupplierOrderSuccessCount(Long orderId);

    List<TradeSupplierOrderDO> getUnPaySuccessOrder(Long orderId);

    List<TradeSupplierOrderDO> getSupplierOrderIdBySupplierOrderNo(String supplierOrderNo);

    List<TradeVisitorBO> getSupplierVisitor(Long platSupplierOrderId, List<Long> visitorIdList);

    /**
     * 根据分销商订单ID查询平台订单列表
     * @param orderId
     * @return
     */
    List<Map<String,Object>> getPlatformOrderList(Long orderId);

    List<TradeDetailBaseDO> getTradeBaseListByPlatSupplierOrderId(Long platSupplierOrderId);

    List<TradeSupplierRefundBaseBO> getRefundDetailBaseBOList(Long supplierRefundId);

    void updateOrderPayStatus(TradeSupplierOrderDO tradeSupplierOrderDO);

    TradeSupplierOrderDO getSupplierOrderByChange(Long orderId, String supplierProductId, Long supplierId);

    @Transactional
    void updateAddSupplierOrder(TradeSupplierOrderDO tradeSupplierOrderDO, TradeSupplierOrderDO mainSupplierOrderDO);

    List<SupplierRefundDO> getSupplierRefundListByRefundId(Long refundId);

    List<SupplierRespVO> selectSupplierByUserId(Long userId);;
}
