package com.hzs.member.achieve.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.domain.member.achieve.CuMemberTree;
import com.hzs.common.domain.member.ext.CuMemberSettleExt;
import com.hzs.member.achieve.param.MemberParentCountParam;
import com.hzs.member.achieve.vo.CuMemberAwardsUnderVO;

import java.util.List;

/**
 * 会员网体历史记录 服务类
 */
public interface ICuMemberTreeService extends IService<CuMemberTree> {

    /**
     * 判断是否存在临时表
     *
     * @param tableName 表名
     */
    Integer queryExistOracleTable(String tableName);

    /**
     * 查询会员结算表，查询出结算表中会员伞下左右区满足等级
     *
     * @param settleTableName 结算表
     * @param placeDept       部门
     * @param awardsValue     奖衔对应的值
     * @param pkMember        会员
     */
    Boolean queryCuMemberSettlePlaceUnderUmbrella(String settleTableName, Integer awardsValue, Integer placeDept, Long pkMember);

    /**
     * 查询会员结算表，查询出结算表中会员血缘关系满足等级
     *
     * @param settleTableName 结算表
     * @param pkMember        会员
     */
    Boolean queryCuMemberSettleBloodUnderUmbrella(String settleTableName, Integer awardsValue, Integer placeDept, Long pkMember);

    /**
     * 根据pkmember查询
     *
     * @param settleTableName
     * @param pkMember
     * @return
     */
    CuMemberSettleExt queryCuMemberTreeByPkMemberTable(String settleTableName, Long pkMember);

    /**
     * 查询推荐关系
     *
     * @param settleTableName
     * @param pkMember
     * @param vertexIdList    体系
     * @return
     */
    List<CuMemberSettleExt> queryCuMemberTreeParentTable(String settleTableName, Long pkMember, Integer level, List<Integer> vertexIdList);

    /**
     * 查询直推人数
     *
     * @param settleTableName
     * @param pkMember
     * @return
     */
    Long queryCuMemberTreeParentTableCount(String settleTableName, Long pkMember);

    /**
     * 查询历史安置上下级
     *
     * @param settleTableName
     * @param pkMember
     * @return
     */
    List<CuMemberSettleExt> queryCuMemberTreePlaceParentHistoryTable(String settleTableName, Long pkMember, List<Long> memberIdList, Integer level);

    /**
     * 查询秒结表会员信息
     *
     * @param pkMember
     * @param settleTableName
     * @param level
     * @param vertexIdList    体系
     * @return
     */
    List<CuMemberSettleExt> selectByTreeMemberList(Long pkMember, String settleTableName, Integer level, List<Integer> vertexIdList);

    /**
     * 查询秒结表会员信息
     *
     * @param pkMember
     * @param level
     * @param vertexIdList 体系
     * @return
     */
    List<CuMemberSettleExt> selectByTreeMemberListFive(Long pkMember, Integer level, List<Integer> vertexIdList);

    /**
     * 查询秒结表是否有值
     *
     * @param settleTableName
     * @return
     */
    Long selectByselectByTreeMemberCount(String settleTableName, Long pkMember);

    /**
     * 查询伞下安置新增业绩
     *
     * @param settleTableName
     * @param pkMember
     * @return
     */
    List<CuMemberSettleExt> brollyBelowResettle(String settleTableName, Long pkMember);

    /**
     * 根据pkmember查询 关联parent
     *
     * @param settleTableName
     * @param pkMember
     * @return
     */
    CuMemberSettleExt queryCuMemberTreeByPlacePkMemberTable(String settleTableName, Long pkMember);

    /**
     * 查询会员直推业绩
     *
     * @param settleTableName
     * @param memberIds
     * @return
     */
    List<MemberParentCountParam> queryByMemberParentSumPv(String settleTableName, List<Long> memberIds);

    /**
     * 查询历史安置上下架
     *
     * @param settleTableName
     * @param pkMember
     * @param memberIdList
     * @param level
     * @return
     */
    List<CuMemberSettleExt> queryCuMemberTreePlaceParentHistoryFramework(String settleTableName, Long pkMember, List<Long> memberIdList, Integer level);

    /**
     * 查询会员历史直推业绩
     *
     * @param settleTableName
     * @param memberIds
     * @return
     */
    List<MemberParentCountParam> queryByMemberParentSettleSumPv(String settleTableName, List<Long> memberIds);

    /**
     * 查询会员显示业绩
     *
     * @param settleTable
     * @param pkMember
     * @param monthTable
     * @return
     */
    CuMemberAwardsUnderVO queryMemberPv(String settleTable, Long pkMember, String monthTable);

    /**
     * 查询会员当天业绩
     *
     * @param pkMember
     * @return
     */
    CuMemberAwardsUnderVO queryMemberTodayPv(Long pkMember);

}
