package com.ycwl.basic.mapper;

import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
import com.ycwl.basic.model.mobile.statistic.resp.AppStatisticsFunnelVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @Author：longbinbin
 * @Date：2024/12/12 9:51
 */
@Mapper
public interface StatisticsMapper {
    /**
     * 统计支付订单金额
     * @param query
     * @return
     */
    BigDecimal countOrderAmount(CommonQueryReq query);

    /**
     * 统计预览视频人数
     * @param query
     * @return
     */
    Integer countPreviewVideoOfMember(CommonQueryReq query);

    /**
     * 统计扫码访问人数
     * @param query
     * @return
     */
    Integer countScanCodeOfMember(CommonQueryReq query);

    /**
     * 统计点击购买人数
     * @param query
     * @return
     */
    Integer countClickPayOfMember(CommonQueryReq query);

    /**
     * 统计付费人数
     * @param query
     * @return
     */
    Integer countPayOfMember(CommonQueryReq query);

    /**
     * 统计现场支付订单数
     * @param query
     * @return
     */
    Integer countSceneOrderNum(CommonQueryReq query);

    /**
     * 统计推送支付订单数
     * @param query
     * @return
     */
    Integer countPushOrderNum(CommonQueryReq query);

    /**
     * 统计推送订阅人数
     * @param query
     * @return
     */
    Integer countPushOfMember(CommonQueryReq query);

    Integer countCameraShotOfMember(CommonQueryReq query);

    Integer countUploadFaceOfMember(CommonQueryReq query);

    Integer countCompleteVideoOfMember(CommonQueryReq query);

    Integer countTotalVisitorOfMember(CommonQueryReq query);

    Integer countCompleteOfVideo(CommonQueryReq query);

    Integer countPreviewOfVideo(CommonQueryReq query);

    Integer countPayOfOrder(CommonQueryReq query);

    Integer countRefundOfOrder(CommonQueryReq query);

    BigDecimal countRefundAmount(CommonQueryReq query);

    int addStatisticsRecord(StatisticsRecordAddReq req);

    List<Long> getBrokerIdListForUser(Long memberId, Date startTime, Date endTime);
    List<Long> getProjectIdListForUser(Long memberId, Date startTime, Date endTime);

    Long getUserRecentEnterType(Long memberId, Date endTime);

    List<AppStatisticsFunnelVO> listStatByScenic(Long scenicId, Date startTime, Date endTime);
    int insertStat(Long scenicId, Date date, AppStatisticsFunnelVO data);

    List<HashMap<String, String>> orderChartByDate(CommonQueryReq query);

    List<HashMap<String, String>> orderChartByHour(CommonQueryReq query);

    /**
     * 按小时统计扫码人数（仅统计数据，不含订单）
     */
    List<HashMap<String, String>> scanCodeMemberChartByHour(CommonQueryReq query);

    /**
     * 按日期统计扫码人数（仅统计数据，不含订单）
     */
    List<HashMap<String, String>> scanCodeMemberChartByDate(CommonQueryReq query);

    /**
     * 按小时统计访问打印样片页面人数
     */
    List<HashMap<String, String>> printerFromSampleChartByHour(CommonQueryReq query);

    /**
     * 按日期统计访问打印样片页面人数
     */
    List<HashMap<String, String>> printerFromSampleChartByDate(CommonQueryReq query);

    /**
     * 按小时统计订单数据
     */
    List<HashMap<String, String>> orderChartByHourForMerge(CommonQueryReq query);

    /**
     * 按日期统计订单数据
     */
    List<HashMap<String, String>> orderChartByDateForMerge(CommonQueryReq query);

    /**
     * 统计分销员扫码次数
     */
    Integer countBrokerScanCount(Long brokerId);

    /**
     * 按日期统计分销员扫码数据
     */
    List<HashMap<String, Object>> getDailyScanStats(@Param("brokerId") Long brokerId,
                                                    @Param("startTime") Date startTime,
                                                    @Param("endTime") Date endTime);

    /**
     * 统计订单数量和金额（包含推送订单和现场订单）
     * @param query
     * @return
     */
    com.ycwl.basic.model.pc.statistics.resp.OrderStatisticsResp getOrderStatistics(CommonQueryReq query);
}
