package com.hzs.member.achieve.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.domain.member.achieve.CuMemberAchieve;
import com.hzs.common.domain.member.achieve.ext.CuMemberAchieveExt;
import com.hzs.member.achieve.controller.vo.*;
import com.hzs.member.achieve.param.MemberAchieveDisParam;
import com.hzs.member.achieve.param.MonthAchieveParam;
import com.hzs.member.achieve.vo.*;
import com.hzs.member.settlecenter.param.PlacementDataParam;
import com.hzs.member.settlecenter.vo.PlacementDataVO;
import com.hzs.member.settlecenter.vo.PlacementImageDataVO;
import com.hzs.member.settlecenter.vo.RecommendImageDataVO;
import com.hzs.member.settlecenter.vo.RecommendTeamImagVO;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * 会员业绩记录 服务类
 */
public interface ICuMemberAchieveService extends IService<CuMemberAchieve> {

    /**
     * 查询会员最新业绩
     *
     * @param pkMember  会员主键
     * @param pkCountry 公司
     */
    CuMemberAchieve queryCuMemberAchieveByPkMember(Long pkMember, Integer pkCountry);

    /*
     *  点击架构树显示会员的业绩情况
     **/
    CuMemberDisVO queryCuMemberDis(MemberAchieveDisParam memberAchieveDisParam);

    /*
     *  查询会员伞下血缘业绩
     **/
    BigDecimal queryCuMemberUnderBloodAchieveByPkMember(MemberAchieveDisParam memberAchieveDisParam);

    /**
     * 会员端新增业绩
     *
     * @param cuMemberNewAddAchieveVO 端新增业绩
     * @return List<CuMemberNewAddAchieveVO>
     */
    List<CuMemberNewAddAchieveVO> selectNewAddAchieve(CuMemberNewAddAchieveVO cuMemberNewAddAchieveVO);

    /**
     * 会员端首页荣誉奖衔
     *
     * @param pkMember  用户ID
     * @param pkCountry 国家ID
     * @return
     */
    CuMemberAwardsDisVO selectAwardsByPkMember(Long pkMember, Integer pkCountry);

    /**
     * 查询个人的奖衔信息
     *
     * @param pkMember  用户ID
     * @param pkCountry 国家ID
     * @return CuMemberAwardsUnderVO
     */
    CuMemberAwardsUnderVO selectMemberAwards(Long pkMember, Integer pkCountry);

    /**
     * 月度新增业绩对比
     *
     * @param pkMember  用户ID
     * @param pkCountry 国家ID
     * @param month     月份
     * @return CuMemberMonthAchieveContrastVO
     */
    List<CuMemberMonthAchieveContrastVO> selectNewAddAchieveContrast(Long pkMember, Integer pkCountry, Integer month);

    LocalDate getStartDateByType(Integer dayType, LocalDate localDate);

    /**
     * 业绩分布-新增业绩统计
     **/
    PlaceNewAddAchieveVO placeNewAddAchieveStat(PlaceNewAddAchieveVO pna);

    Date getDateFromYearAndMonth(String year, String month);

    /**
     * 月度业绩-左右区人数详情(最新)
     **/
    List<PlaceNewAddAchieveVO> placeNewAddAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * 月度业绩-左右区人数详情(历史)
     **/
    List<PlaceNewAddAchieveVO> placeNewAddAchieveHistoryDetails(PlaceNewAddAchieveVO pna);

    /**
     * 月度业绩-左右区业绩详情
     **/
    List<PlaceNewAddAchieveVO> leftRightAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * 月度业绩-左右区血缘业绩详情
     **/
    List<PlaceNewAddAchieveVO> leftRightDirectAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * 月度业绩-查询血缘业绩详情
     **/
    List<PlaceNewAddAchieveVO> directAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * 业绩分布-直推业绩（右图）
     **/
    ParentAchieveVO parentAchieveRight(ParentAchieveVO pa);

    /**
     * 业绩分布-直推业绩（左图）
     **/
    List<ParentAchieveVO> parentAchieveLeft(ParentAchieveVO pa);

    /**
     * 查询安置数据
     *
     * @param param 入参
     * @return List<PlacementDataVO>
     */
    List<PlacementDataVO> selectPlacementDataList(PlacementDataParam param);


    /**
     * 查询推荐数据
     *
     * @param param 入参
     * @return List<PlacementDataVO>
     */
    List<PlacementDataVO> selectRecommendDataList(PlacementDataParam param);

    /**
     * 查询会员真实业绩
     *
     * @param pkMember
     * @param pkCountry
     * @param month
     * @return
     */
    RealPerformanceVo queryRealPerformance(Long pkMember, Integer pkCountry, Integer month);

    /**
     * 会员真实业绩饼状图
     *
     * @param pkMember
     * @param pkCountry
     * @param month
     * @return
     */
    AzAchievementPie queryRealPerformancePic(Long pkMember, Integer pkCountry, Integer month);

    /**
     * 查询安置图表
     *
     * @param param 入参
     * @return PlacementImageDataVO
     */
    PlacementImageDataVO selectPlaceImage(PlacementDataParam param);

    /**
     * 查询推荐体第图表
     *
     * @param param 入参
     * @return RecommendImageDataVO
     */
    List<RecommendImageDataVO> selectRecommendVertexImage(PlacementDataParam param);

    /**
     * 查询推荐团队图表
     *
     * @param param 入参
     * @return RecommendImageDataVO
     */
    List<RecommendTeamImagVO> selectRecommendTeamImage(PlacementDataParam param);

    /*
     *  查询月统计数据，按照月倒叙
     **/
    List<CuMemberAchieveExt> queryMemberMonthAchieve(Long pkMember, String month);

    /*
     *  查询月统计数据，查询明细，安置伞下
     **/
    List<CuMemberAchieveExt> queryPlaceParentMemberMonthAchieve(MonthAchieveParam monthAchieveParam);

    /*
     *  查询月统计数据，查询明细，安置伞下
     **/
    List<CuMemberAchieveExt> queryParentMemberMonthAchieve(MonthAchieveParam monthAchieveParam);

    /**
     * 根据实时小区业绩获取奖衔
     *
     * @param pkMember      会员ID
     * @param pkCountry     国家ID
     * @param yesterdayFlag 查询昨日业绩标记（true=查询，false=不查询）
     * @return Integer
     */
    CuMemberAwardsUnderVO getPkAwardBySmallAchieve(Long pkMember, Integer pkCountry, boolean yesterdayFlag);

}
