package com.yonge.cooleshow.biz.dal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq;
import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
import com.yonge.cooleshow.biz.dal.entity.UserOrder;
import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch;
import com.yonge.cooleshow.biz.dal.vo.res.OrderPayRes;
import com.yonge.cooleshow.common.entity.HttpResponseResult;

import java.util.List;

/**
 * 平台订单表 服务类
 *
 * @author liweifan
 * @date 2022-03-30
 */
public interface UserOrderService extends IService<UserOrder> {

    /**
     * 查询详情 通过订单id
     *
     * @author liweifan
     * @date 2022-03-30
     */
    UserOrderVo detail(Long id);

    /**
     * 查询详情 通过订单号
     *
     * @author liweifan
     * @date 2022-03-30
     */
    UserOrderVo detail(String orderNo);

    /**
     * 分页查询
     *
     * @author liweifan
     * @date 2022-03-30
     */
    IPage<UserOrderVo> selectPage(IPage<UserOrderVo> page, OrderSearch query);

    /***
     * 查询集合
     * @author liweifan
     * @param: query
     * @updateTime 2022/4/15 15:05
     * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.UserOrderVo>
     */
    List<UserOrderVo> selectList(OrderSearch query);

    /***
     * 下单接口
     * @author liweifan
     * @param: orderReq
     * @updateTime 2022/3/31 15:42
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.entity.Order>
     */
    HttpResponseResult<UserOrder> executeOrder(OrderReq orderReq);

    /***
     * 订单付款
     * @author liweifan
     * @param: payReq
     * @updateTime 2022/3/31 17:23
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult
     */
    HttpResponseResult<OrderPayRes> orderPay(OrderPayReq payReq);

    /***
     * 通过业务id查询用户正在交易中的订单
     * @author liweifan
     * @param: query
     * @updateTime 2022/4/27 16:56
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.UserOrderVo>
     */
    HttpResponseResult<UserOrderVo> getPendingOrder(OrderSearch query);

    /***
     * 支付中订单付款
     * @author liweifan
     * @param: payReq
     * @updateTime 2022/4/21 19:32
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.res.OrderPayRes>
     */
    HttpResponseResult<OrderPayRes> orderPaytoPaying(OrderPayReq payReq);

    /***
     * 用户付款回调
     * @author liweifan
     * @param: data
     * @updateTime 2022/4/8 18:24
     */
    void orderCallback(String data, String type);

    /***
     * 轮询用户订单
     * @author liweifan
     * @updateTime 2022/4/13 16:27
     */
    void pollingOrder();

    /***
     * app查询订单详情
     * @author liweifan
     * @param: orderNo
     * @updateTime 2022/4/24 17:49
     * @return: com.yonge.cooleshow.biz.dal.vo.UserOrderVo
     */
    UserOrderVo detailApp(UserOrder param);

    /***
     * 取消订单
     * @author liweifan
     * @param: payReq
     * @updateTime 2022/4/21 19:39
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.lang.Boolean>
     */
    HttpResponseResult<Boolean> orderCancel(OrderPayReq payReq);
    /***
     * 完成所有订单
     * @author liweifan
     * @updateTime 2022/4/27 17:38
     */
    void setSuccessStatus();
    /***
     * 查询未记录第一次购买时间的订单
     * @author liweifan
     * @param: query
     * @updateTime 2022/4/28 10:17
     * @return: java.util.List<com.yonge.cooleshow.biz.dal.entity.UserOrder>
     */
    List<UserOrder> selectUnRecordTimeOrder(OrderSearch query);
}