package com.fs.live.service;

import com.fs.common.core.domain.R;
import com.fs.live.domain.LiveAfterSales;
import com.fs.live.domain.LiveOrder;
import com.fs.live.param.FsUserLiveOrderPayUParam;
import com.fs.live.param.LiveOrderConfirmParam;
import com.fs.live.param.LiveOrderFinishParam;
import com.fs.live.vo.LiveGoodsVo;
import com.fs.live.vo.LiveOrderListVo;
import com.fs.live.vo.LiveOrderQueryVO;
import com.fs.live.vo.LiveOrderVo;
import com.fs.store.domain.FsStoreDelivers;
import com.fs.store.domain.FsStoreOrder;
import com.fs.store.dto.FsStoreOrderComputeDTO;
import com.fs.store.dto.LiveOrderComputeDTO;
import com.fs.store.param.FsStoreOrderAddTuiMoneyParam;
import com.fs.store.param.LiveOrderComputedParam;
import org.springframework.web.bind.annotation.RequestBody;

import java.text.ParseException;
import java.util.List;

/**
 * 订单Service接口
 *
 * @author fs
 * @date 2025-07-08
 */
public interface ILiveOrderService {
    /**
     * 查询订单
     *
     * @param orderId 订单主键
     * @return 订单
     */
    LiveOrder selectLiveOrderByOrderId(String orderId);
    void editLiveOrderDeliveryId(@RequestBody FsStoreDelivers deliveryDTO);

    /**
     * 查询订单列表
     *
     * @param liveOrder 订单
     * @return 订单集合
     */
    List<LiveOrder> selectLiveOrderList(LiveOrderQueryVO liveOrder);
    List<LiveOrder> selectLiveOrderListExport(LiveOrderQueryVO liveOrder);


    /**
     * 新增订单
     *
     * @param liveOrder 订单
     * @return 结果
     */
    Long insertLiveOrder(LiveOrder liveOrder);

    /**
     * 修改订单
     *
     * @param liveOrder 订单
     * @return 结果
     */
    int updateLiveOrder(LiveOrder liveOrder);

    /**
     * 批量删除订单
     *
     * @param orderIds 需要删除的订单主键集合
     * @return 结果
     */
    //int deleteLiveOrderByOrderIds(String[] orderIds);

    /**
     * 删除订单信息
     *
     * @param
     * @return 结果
     */
    //int deleteLiveOrderByOrderId(String orderId);

    void handlePay(LiveOrder liveOrder);

    R liveOrderUser(String liveId);

    /**
     * 获取订单时间粒度
     * @param liveOrder
     */
    R getLiveOrderTimeGranularity(LiveOrderVo liveOrder);

    /**
     * 同步物流信息
     * @param id
     * @return
     */
    R syncExpress(Long id);

    /**
     * 确认收货
     * @param orderId
     * @return
     */
    int getGoods(Long orderId);

    /**
     * 修改物流信息
     * @param orderId
     * @param mailNo
     * @param expressCode
     * @param expressName
     */
    void updateDeliveryOrder(Long orderId, String mailNo, String expressCode, String expressName);

    /**
     * 获取订单商品列表
     * @param orderId
     * @return
     */
    List<LiveGoodsVo> selectLiveOrderItemList(String orderId);

    /**
     * 创建订单
     * @param liveOrder
     * @return
     */
    R createLiveOrder(LiveOrder liveOrder);

    /**
     * 订单确认
     * @param param
     * @return
     */
    R confirmOrder(LiveOrderConfirmParam param);

    /**
     * 获取未推送的订单
     * @return
     */
    List<LiveOrder> selectNotPushedLiveOrder();

    /**
     * 推送订单
     * @param liveOrder
     */
    void pushLiveOrder(LiveOrder liveOrder)  throws ParseException;

//    R aliPayment(FsUserLiveOrderPayUParam param);

    String payConfirm(Integer type,Long orderId,String payCode,String tradeNo,String bankTransactionId,String bankSerialNo);

    R wxPayment(FsUserLiveOrderPayUParam param);


    int tuiOrder(Long orderId);

    R cancelOrder(LiveOrder order);

    List<LiveOrderListVo> selectLiveOrderListVo(LiveOrder liveOrder);

    R buy(LiveOrder liveOrder);

    R finishOrder(Long orderId);

    List<LiveOrder> selectLiveOrderByFinish();

    void autoFinishOrder(LiveOrderFinishParam param);

    LiveOrder getById(String orderId);

    R refundOrderMoney(Long orderId);
    R refundOrderMoney(Long orderId, LiveAfterSales liveAfterSales,String operator);

    List<LiveOrder> selectUpdateExpress();

    void syncDeliveryOrder(LiveOrder order);

    List<Long> selectSyncExpressIds();

    List<Long> selectOrderIdByNoErp();

    void createOmsOrder(Long id)  throws ParseException;

    List<LiveOrder> selectDeliverPenddingData();

    void deliveryOrder(String orderCode, String mailNo, String expressCode, String expressName);

    LiveOrderComputeDTO computedOrder(long l, LiveOrderComputedParam param);

    LiveOrder selectOrderIdByOrderCode(String platformCode);

    R auditPayRemain(Long orderId);

    R addTuiMoney(FsStoreOrderAddTuiMoneyParam param);

    R updateExpress(Long orderId);

    LiveOrder selectLiveOrderByExtendId(String extendOrderId);

    R editTuiMoney(Long orderId);

    LiveOrder selectLiveOrderByOrderCode(String soId);

    R getExpressMulti(LiveOrder order);

    R getExpress(LiveOrder order);

    void orderCancel();

    LiveOrderComputeDTO computedReward(long l, LiveOrderComputedParam param);

    R createRewardLiveOrder(LiveOrder liveOrder);

    R payConfirmReward(LiveOrder liveOrder);
}
