package com.hzs.report.member.mapper;

import com.hzs.report.member.param.ProductDetailQueryParam;
import com.hzs.report.member.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @BelongsProject: hzs_cloud
 * @BelongsPackage: com.hzs.report.member.mapper
 * @Author: yh
 * @CreateTime: 2023-08-26  09:53
 * @Description: TODO
 * @Version: 1.0
 */
public interface MemberReportMapper {
    /**
     * 查询伞下直推新增业绩-查询会员
     *
     * @return
     */
    List<DirectPushNewVo> directPushNewList(@Param("memberCodeList") List<String> memberCodeList,
                                            @Param("pkCountry") Integer pkCountry,
                                            @Param("startPayTime") Date startPayTime,
                                            @Param("endPayTime") Date endPayTime);

    /**
     * @description: 查询伞下直推新增业绩-业绩
     * @author: zhang jing
     * @date: 2023/9/6 14:10
     * @param: [pkMember, memberName, pkAwards, pkTeamCode, pkCountry, startPayTime, endPayTime, pkVertex]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    List<DirectPushNewVo> directPushNewAchieList(@Param("dpo") DirectPushNewVo dpo,
                                                 @Param("pkMemberList") List<Long> pkMemberList);

    /**
     * @description: 查询会员总盒数
     * @author: zhang jing
     * @date: 2025/2/14 15:02
     * @param: [dpb, pkMemberList]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushBoxVo>
     **/
    List<DirectPushBoxVo> directPushNewBoxList(@Param("dpo") DirectPushBoxVo dpb,
                                               @Param("dpbList") List<DirectPushBoxVo> dpbList);

    /**
     * @description: 查询伞下直推新增业绩-业绩
     * @author: zhang jing
     * @date: 2024/3/18 15:41
     * @param: [pkMember, startPayTime, endPayTime, pkCountry, monthList]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    List<DirectPushNewVo> directPushNewAchieUpList(@Param("dpo") DirectPushNewVo dpo,
                                                   @Param("pkMemberList") List<Long> pkMemberList);

    /**
     * 用户消费统计
     *
     * @param memberCode   用户编号
     * @param memberName   用户姓名
     * @param startPayTime 开始支付时间
     * @param endPayTime   结束支付时间
     * @param pkWares      商品主键
     * @return
     */
    List<MemberConsumptionVo> memberConsumptionList(@Param("memberCode") String memberCode, @Param("memberName") String memberName, @Param("startPayTime") Date startPayTime, @Param("endPayTime") Date endPayTime, @Param("pkWares") Integer pkWares);

    /**
     * 伞下新增安置业绩
     *
     * @return
     */
    List<MemberResettleAchieveVo> memberResettleAchieve(@Param("pkMember") Long pkMember, @Param("memberName") String memberName, @Param("startPayTime") Date startPayTime, @Param("endPayTime") Date endPayTime, @Param("pkVertex") Integer pkVertex, @Param("pkTeamCode") Integer pkTeamCode, @Param("pkCountry") Integer pkCountry, @Param("pkAwards") Integer pkAwards, @Param("orderTypeList") List<Integer> orderTypeList);

    /**
     * @description: 伞下新增安置业绩
     * @author: zhang jing
     * @date: 2024/3/12 16:57
     * @param: [pkMember, memberName, startPayTime, endPayTime, pkVertex, pkTeamCode, pkCountry, pkAwards, orderTypeList]
     * @return: java.util.List<com.hzs.report.member.vo.MemberResettleAchieveVo>
     **/
    List<MemberResettleAchieveVo> selectBrollyNewABAchieve(@Param("pkMember") Long pkMember,
                                                           @Param("memberName") String memberName,
                                                           @Param("startPayTime") Date startPayTime,
                                                           @Param("endPayTime") Date endPayTime,
                                                           @Param("pkVertex") Integer pkVertex,
                                                           @Param("pkTeamCode") Integer pkTeamCode,
                                                           @Param("pkCountry") Integer pkCountry,
                                                           @Param("pkAwards") Integer pkAwards,
                                                           @Param("achieveTableName") String achieveTableName,
                                                           @Param("period") int period);

    /**
     * 订单币种查询
     *
     * @param memberCode 会员编号
     * @param memberName 会员名称
     * @param orderCode  订单编号
     * @param orderType  订单类型
     * @return
     */
    List<OrderCurrencyVo> getOrderCurrencyList(@Param("memberCode") String memberCode, @Param("memberName") String memberName, @Param("orderCode") String orderCode, @Param("orderType") Integer orderType);

    /**
     * 查询订单币种
     *
     * @param orderCodeList
     * @return
     */
    List<MemberTradeVo> getBySourceCodeMemberTradeList(@Param("orderCodeList") List<String> orderCodeList);

    /**
     * 查询省订单
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @param pkCountry 所属国家
     * @return
     */
    List<OrderDistribution> getByProvinceOrderDistribution(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry);

    /**
     * 查询市订单
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @param pkCountry 所属国家
     * @return
     */
    List<OrderDistribution> getByCityOrderDistribution(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry);

    /**
     * 区县订单查询
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @param pkCountry 所属国家
     * @return
     */
    List<OrderDistribution> getByDistrictOrderDistribution(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry);

    /**
     * 出货明细汇总
     *
     * @param productName
     * @param pkClassify
     * @param startTime
     * @param endTime
     * @return
     */
    List<ProductOrderInfoVo> getProductOrderInfo(@Param("productName") String productName,
                                                 @Param("pkClassify") Integer pkClassify,
                                                 @Param("startTime") Date startTime,
                                                 @Param("endTime") Date endTime,
                                                 @Param("pkCountry") Integer pkCountry,
                                                 @Param("orderTypeList") List<Integer> orderTypeList);

    /**
     * 报单汇总
     *
     * @return
     */
    List<ReportSummaryVo> reportSummaryList(ReportSummaryVo reportSummaryVo);

    /**
     * 查询会员伞下订单左右区业绩
     *
     * @param pkMember
     * @return
     */
    List<MemberPerformanceVo> brollyBelowResettle(@Param("pkMember") Long pkMember, @Param("startPayTime") Date startPayTime, @Param("endPayTime") Date endPayTime, @Param("orderTypeList") List<Integer> orderTypeList);

    /**
     * 出货明细汇总统计详情
     *
     * @param pkProduct
     * @param productName
     * @return
     */
    List<ProductShippingDetailsInfoVo> productShippingDetailsList(@Param("pkProduct") Integer pkProduct, @Param("productName") String productName, @Param("pkClassify") Integer pkClassify, @Param("pkAwards") Integer pkAwards, @Param("orderTypeList") List<Integer> orderTypeList, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry);

    /**
     * 产品明细查询
     *
     * @param productDetailQueryParam
     * @return
     */
    List<ProductDetailQueryVo> productDetailQueryList(ProductDetailQueryParam productDetailQueryParam);

    /**
     * 小区新增业绩（历史）
     *
     * @param addAchieveVO 入参
     * @return List<SmallAreaNewAddAchieveVO>
     */
    List<SmallAreaNewAddAchieveVO> selectSmallAreaNewAdd(SmallAreaNewAddAchieveVO addAchieveVO);

    /**
     * 小区新增业绩（查询时间新增会员）
     *
     * @param addAchieveVO 入参
     * @return List<SmallAreaNewAddAchieveVO>
     */
    List<SmallAreaNewAddAchieveVO> selectSmallAreaNewAddNemMember(SmallAreaNewAddAchieveVO addAchieveVO);

    /**
     * 小区新增业绩 分页查询
     *
     * @param addAchieveVO 入参
     * @return List<SmallAreaNewAddAchieveVO>
     */
    List<SmallAreaNewAddAchieveVO> selectSmallAreaNewAddPage(SmallAreaNewAddAchieveVO addAchieveVO);

    /**
     * 查询伞下钱包明细
     *
     * @param walletVO 入参
     * @return List<CuMemberWalletVO>
     */
    List<CuMemberWalletVO> selectMemberUnderWalletList(CuMemberWalletVO walletVO);

    /**
     * 查询商品统计信息
     *
     * @param
     * @return
     */
    List<ProductSaleStatVo> productSaleStatList(@Param("skuCode") String skuCode, @Param("productName") String productName, @Param("orderType") Integer orderType, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry);

    /**
     * 统计产品所有汇总
     *
     * @param productName
     * @param pkClassify
     * @param startTime
     * @param endTime
     * @param pkCountry
     * @param orderTypeList
     * @return
     */
    Integer sumQuantity(@Param("productName") String productName, @Param("pkClassify") Integer pkClassify, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("pkCountry") Integer pkCountry, @Param("orderTypeList") List<Integer> orderTypeList);

    /**
     * @description: 查询表是否存在
     * @author: zhang jing
     * @date: 2024/4/7 16:10
     * @param: [tableName]
     * @return: java.lang.Integer
     **/
    Integer selectExistTable(String tableName);

    /**
     * @description: 查询直推会员
     * @author: zhang jing
     * @date: 2025/2/7 16:10
     * @param: [pkMember]
     * @return: java.util.List<java.lang.Long>
     **/
    List<Long> selectDirectPushByPkMember(@Param("pkMember") Long pkMember);

    /**
     * @description: 查询会员业绩
     * @author: zhang jing
     * @date: 2025/2/7 16:08
     * @param: [directPushNewVo]
     * @return: com.hzs.report.member.vo.DirectPushNewVo
     **/
    DirectPushNewVo selectMemberOrderAchieveByPkMember(DirectPushNewVo directPushNewVo);

    /**
     * @description: 查询会员个人业绩金额
     * @author: zhang jing
     * @date: 2025/2/13 11:31
     * @param: [directPushNewVo]
     * @return: com.hzs.report.member.vo.DirectPushNewVo
     **/
    DirectPushNewVo querMemberAchieveAmount(DirectPushNewVo directPushNewVo);

    List<DirectPushNewVo> selectMemberAchieve(DirectPushNewVo directPushNewVo);

    /**
     * @description: 查询会员直推伞下业绩金额
     * @author: zhang jing
     * @date: 2025/2/13 13:34
     * @param: [directPushNewVo]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    List<DirectPushNewVo> querMemberAchieveAmountTeam(DirectPushNewVo directPushNewVo);

    /**
     * @description: 添加新的表
     * @author: zhang jing
     * @date: 2025/2/25 16:20
     * @param: [tableName]
     * @return: void
     **/
    void createCuMemberAmountBoxTable(String tableName);

    /**
     * @description: 创建表字段索引
     * @author: zhang jing
     * @date: 2025/2/25 16:20
     * @param: [tableName]
     * @return: void
     **/
    void createPkMemberIndex (@Param("indexName")String indexName,@Param("tableName")String tableName);

    /**
     * @description: 查询订单金额，业绩，盒数，批量添加会员个人操作
     * @author: zhang jing
     * @date: 2025/2/12 11:35
     * @param: [staDate, endDate, tableName, beforeTabeName, rangeTabeName]
     * @return: int
     **/
    int innertMemberAmountBoxTable(@Param("staDate") String staDate,
                                   @Param("endDate") String endDate,
                                   @Param("tableName") String tableName,
                                   @Param("beforeTabeName") String beforeTabeName,
                                   @Param("rangeTabeName") String rangeTabeName);

    /**
     * @description: 查询订单金额，业绩，盒数，批量添加会员伞下操作
     * @author: zhang jing
     * @date: 2025/2/12 11:36
     * @param: [staDate, endDate, tableName, beforeTabeName, rangeTabeName]
     * @return: int
     **/
    int innertTeamAmountBoxTable(@Param("apb") DirectPushAmountPvBoxVo apb,
                                 @Param("staDate") String staDate,
                                 @Param("endDate") String endDate,
                                 @Param("tableName") String tableName,
                                 @Param("beforeTabeName") String beforeTabeName,
                                 @Param("rangeTabeName") String rangeTabeName);

    /**
     * @description: 查询会员订单
     * @author: zhang jing
     * @date: 2025/2/12 15:59
     * @param: [staDate, endDate]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushAmountPvBoxVo>
     **/
    List<DirectPushAmountPvBoxVo> querMemberOrder(@Param("staDate") String staDate, @Param("endDate") String endDate);

    /**
     * @description: 7天重算删除会员统计业绩金额盒数表数据
     * @author: zhang jing
     * @date: 2025/2/12 15:58
     * @param: [tableName]
     * @return: void
     **/
    void delMemberAmountBox(@Param("tableName") String tableName);

    /**
     * @description: 初始化会员直推金额业绩盒数数据
     * @author: zhang jing
     * @date: 2025/2/14 17:41
     * @param: [tableName, rangeTabeName]
     * @return: void
     **/
    void washMemberAmountBox(@Param("tableName") String tableName,@Param("rangeTabeName") String rangeTabeName);

    /**
     * @description: 将未激活的会员盒数更新为0
     * @author: zhang jing
     * @date: 2025/2/14 17:41
     * @param: [tableName, rangeTabeName]
     * @return: void
     **/
    void updMemberBox (@Param("tableName") String tableName,@Param("rangeTabeName") String rangeTabeName);

    /**
     * @description: 秒结表查询会员是否激活
     * @author: zhang jing
     * @date: 2025/2/14 10:25
     * @param: [directPushBoxVo]
     * @return: java.lang.Integer
     **/
    List<DirectPushBoxVo> selectMemberActiveState(@Param("dpb") DirectPushBoxVo dpb,
                                                  @Param("pkMemberList") List<Long> pkMemberList);

    /**
     * @description: 查询结束日期总盒数
     * @author: zhang jing
     * @date: 2025/2/14 12:00
     * @param: [directPushBoxVo]
     * @return: java.lang.Integer
     **/
    Integer selectMemberTotalBox(DirectPushBoxVo directPushBoxVo);

    /**
     * 根据会员编号查询注水
     *
     * @param memberCode 会员编号
     * @return Integer
     */
    Integer selectWaterInjection(@Param("memberCode") String memberCode);

    /**
     * @description: 查询会员注水的大区盒数
     * @author: zhang jing
     * @date: 2025/2/14 13:22
     * @param: [directPushBoxVo]
     * @return: java.lang.Integer
     **/
    Integer selectMemberBoxWaterInjection(DirectPushBoxVo directPushBoxVo);

    /**
     * @description: 查询会员没有注水的大区盒数
     * @author: zhang jing
     * @date: 2025/2/14 13:24
     * @param: [directPushBoxVo]
     * @return: java.lang.Integer
     **/
    Integer selectMemberBoxNoWaterInjection(DirectPushBoxVo directPushBoxVo);

    /**
     * @description: 查询直推会员信息
     * @author: zhang jing
     * @date: 2025/2/17 15:49
     * @param: [directPushNewVo]
     * @return: java.util.List<com.hzs.report.member.vo.DirectPushNewVo>
     **/
    List<DirectPushNewVo> querDirectPushDetails(DirectPushNewVo directPushNewVo);

}
