package com.qs.mp.user.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qs.mp.admin.domain.param.IndexTicketBoxTopQueryParam;
import com.qs.mp.admin.domain.param.IndexTicketSiteTopQueryParam;
import com.qs.mp.admin.domain.param.UserTicketOrderQueryParam;
import com.qs.mp.admin.domain.vo.IndexVO;
import com.qs.mp.admin.domain.vo.TicketCntVO;
import com.qs.mp.admin.domain.vo.UserTicketOrderDetailVO;
import com.qs.mp.admin.domain.vo.UserTicketOrderListVO;
import com.qs.mp.channel.domain.ChannelOrder;
import com.qs.mp.channel.domain.ChannelOrderDetail;
import com.qs.mp.pay.domain.PayOrder;
import com.qs.mp.user.domain.UserDeliverOrder;
import com.qs.mp.user.domain.UserTicketOrder;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qs.mp.user.domain.UserTicketOrderItem;
import com.qs.mp.user.domain.vo.TicketOrderSettleVO;
import com.qs.mp.user.domain.vo.UserShareVO;
import java.util.List;

import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 用户盲票订单 服务类
 * </p>
 *
 * @author quanshu
 * @since 2022-03-07
 */
public interface IUserTicketOrderService extends IService<UserTicketOrder> {

  /**
   * 提交盲票购买订单
   * @param userId
   * @param orderSettleVO
   * @param userShareVO
   * @return
   */
  String submitOrder(Long userId, TicketOrderSettleVO orderSettleVO, UserShareVO userShareVO);

  /**
   * 批量取消一个票组（线上）的订单（恢复优惠券、票组销量）
   * @param boxId
   * @param orderIds
   * @return
   */
  boolean batchCancelOrder(String boxId, List<String> orderIds);

  /**
   * 取消订单（恢复优惠券、票组销量）
   * @param orderId
   * @return
   */
  boolean cancelOrder(String orderId);

  /**
   * 支付成功回调
   * @param payOrder
   * @return
   */
  boolean paySuccess(PayOrder payOrder);

  /**
   * 给渠道分润
   * @param orderId
   * @param resource 订单来源1用户,2经销商
   * @return
   */
  boolean commToChannel(String orderId,Integer resource);
  
  
  /**
   * 统计交易金额
   * @param wrapper
   * @return
   */
  List<IndexVO> selectIndexPayAmtList(Wrapper<UserTicketOrder> wrapper);
  
  /**
   * 统计交易用户数
   * @param wrapper
   * @return
   */
  List<IndexVO> selectIndexPayUserCntList(Wrapper<UserTicketOrder> wrapper);
  
  /**
   * 统计实时交易数据
   * @param wrapper
   * @return
   */
  List<IndexVO> selectIndexDailyInfoList(Wrapper<UserTicketOrder> wrapper);
  
  
  /**
   * 统计票组销售TOP10
   * @param wrapper
   * @return
   */
  List<IndexVO> selectIndexTicketBoxTop(Wrapper<UserTicketOrder> wrapper);
  
  /**
   * 统计经销商交易额TOP10
   * @param wrapper
   * @return
   */
  List<IndexVO> selectIndexTicketSiteTop(Wrapper<UserTicketOrder> wrapper);
  

 /**
 * 查询子渠道全部的盲票销售张数
 * @param channelNo
 * @return
  */
  int getChannelTotalTicketNumCnt(String channelNo);
  

  /**
  * 查询子渠道全部的盲票销售张数
  * @param channelNo
  * @return
   */
   int getSaleSiteTotalTicketNumCnt(Long channelId);
   
   /**
    * 统计经销商盲票销量线下和线上
    * @param channelId
    * @return
    */
   TicketCntVO getTicketSaleCnt(Long channelId);
   
   /**
    * 查询统计经销商盲票销量数据线下和线上
    * @param queryWrapper
    * @return
    */
   List<TicketCntVO> listTicketSaleCnt(Wrapper<UserTicketOrder> queryWrapper);


    /**
     * 获取用户盲票订单列表
     * @return
     */
    List<UserTicketOrderListVO> listUserTicketOrder(QueryWrapper<UserTicketOrder> queryWrapper);


    /**
     * 查询用户订单详情
     * @param orderId
     * @return
     */
    UserTicketOrderDetailVO detail(String orderId);

    /**
     * 统计用户订单数量
     * @return
     */
    int countUserTicketOrder(QueryWrapper<UserTicketOrder> queryWrapper);

    /**
     * 统计盲票组销量
     * @param queryWrapper
     * @param channelOrderQueryWrapper
     * @return
     */
    List<IndexVO> selectIndexTicketBoxTopByTicketOrderAndChannelOrder(IndexTicketBoxTopQueryParam indexTicketBoxTopQueryParam );

    /**
     * 统计经销商交易额
     * @param indexTicketSiteTopQueryParam
     * @return
     */
    List<IndexVO> selectIndexTicketSiteTopByTicketOrderAndChannelOrder(IndexTicketSiteTopQueryParam indexTicketSiteTopQueryParam);
}
