package com.kxs.product.biz.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kxs.common.core.util.R;
import com.kxs.product.api.dto.kxsapp.shop.PayOrderDTO;
import com.kxs.product.api.model.KxsShopOrder;
import com.kxs.product.api.dto.kxsapp.shop.GoodsSubmitDTO;
import com.kxs.product.api.vo.kxsapp.shop.ShopOrderCountVO;
import com.kxs.product.api.vo.kxsapp.shop.ShopOrderDetailVO;
import com.kxs.product.api.vo.kxsapp.shop.ShopOrderGoodsUserVO;
import com.kxs.product.api.vo.kxsapp.shop.ShopOrderListVO;

import java.util.List;

/**
 * 商城订单表(KxsShopOrder)表服务接口
 *
 * @author 系统
 * @since 2023-12-20 10:09:35
 */
public interface KxsShopOrderService extends IService<KxsShopOrder> {

    /**
     * kxs app 提交订单
     *
     * @param param 参数
     * @return {@link R}
     */
    R submitOrder(GoodsSubmitDTO param);

    /**
     * kxs app 订单详情
     *
     * @param orderId 订单id
     * @return {@link ShopOrderDetailVO}
     */
    ShopOrderDetailVO getByOrderId(Integer orderId);

    /**
     * kxs app 支付订单
     *
     * @param param 参数
     * @return {@link R}
     */
    R payOrder(PayOrderDTO param);

    /**
     * kxs app 取消订单
     *
     * @param param 参数
     * @return {@link R}
     */
    R cancelOrder(KxsShopOrder param);

    /**
     * kxs app 确认收货
     *
     * @param param 参数
     * @return {@link R}
     */
    R confirmOrder(KxsShopOrder param);

    /**
     * kxs app 订单列表
     *
     * @param page  页面
     * @param param 参数
     * @return {@link IPage}<{@link ShopOrderListVO}>
     */
    IPage<ShopOrderListVO> getByPage(Page<ShopOrderListVO> page, KxsShopOrder param);

    /**
     * kxs app 待付款待发货数量
     *
     * @return {@link Object}
     */
    ShopOrderCountVO orderUnCount();

    /**
     * 查询指定时间区间的电签大机券订单
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return {@link List}<{@link ShopOrderGoodsUserVO}>
     */
    List<ShopOrderGoodsUserVO> getDateBetweenOrders(String startTime, String endTime);

    /**
     * 支付订单回调
     *
     * @param outTradeNo 订单编号
     */
    void payBack(String outTradeNo);


    /**
     * 订单过期
     */
    void shopOrderTimeout();


    /**
     * 订单过期的处理
     *
     * @param order 次序
     */
    void changeTimeoutOrder(KxsShopOrder order);
}

