package org.jeecg.ctop.material.mapper;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Mapper
public interface MaterialReportOverViewV3Mapper {

    Set<String> recursiveQuerySubordinateByLeader(@Param("leaderId") String leaderId);

    List<JSONObject> getDesignTeamList(@Param("userId") String userId);

    Set<String> recursiveQuerySubordinateByLeaders(@Param("leaderIds") Set<String> leaderIds);

    Set<String> recursiveQuerySubordinateByUserId(@Param("userId") String userId);

    //查询用户参与的项目
    Set<JSONObject> queryProjectBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);

    JSONArray queryProjectIdBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);

    //查询头条总消耗
    BigDecimal queryBytedanceCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询快手总消耗
    BigDecimal queryKuaishouCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询素材总数
    Long queryMaterialCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

    //查询素材 上新 数据 头条
    List<Map<String, String>> queryMaterialCountList(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //上新 快手
    List<Map<String, String>> queryMaterialCountListKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询有消耗的素材 - 头条
    Long queryMaterialCostList(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询有消耗的素材 - 快手
    Long queryMaterialCostListKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询有效视频-头条
    List<Map<String, String>> selectEffectiveMaterialVideoBytedance(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //有效视频-快手
    List<Map<String, String>> selectEffectiveMaterialVideoKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询爆款视频-头条
    List<Map<String, String>> selectHotMaterialVideoBytedance(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId, @Param("type") int type);

    //爆款视频 -快手
    List<Map<String, String>> selectHotMaterialVideoKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId, @Param("type") int type);

    //查询今日上新素材数
    Long queryNewMaterialCount(@Param("statDate") String statDate, @Param("projects") JSONArray projects);

    //查询头条消耗数据趋势
    List<JSONObject> queryBytedanceChat(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    List<JSONObject> queryBytedanceChatGroupMonth(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //查询快手消耗数据趋势
    List<JSONObject> queryKuaishouChat(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    List<JSONObject> queryKuaishouChatGroupMonth(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //头条素材排行榜
    List<JSONObject> queryBytedanceTopMaterial(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    //头条素材排行榜New
    List<JSONObject> queryBytedanceTopMaterialNew(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("channelType") Integer channelType);

    //查看更多
    List<JSONObject> queryBytedanceMaterialReport(@Param("filed") String filed, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects,
                                                  @Param("md5") String md5, @Param("dimension") String dimension, @Param("leaderId") String leaderId,
                                                  @Param("designerId") String designerId, @Param("materialQuality") Integer materialQuality, @Param("materialType") Integer materialType,
                                                  @Param("innovative") Integer innovative,
                                                  @Param("target") String target, @Param("order") String order, @Param("companyId") String companyId);

    Long queryBytedanceMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
                                           @Param("md5") String md5);

    //快手素材排行榜
    List<JSONObject> queryKuaishouTopMaterial(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId, @Param("channelType") Integer channelType);

    //查看更多
    List<JSONObject> queryKuaishouMaterialReport(@Param("filed") String filed, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects,
                                                 @Param("md5") String md5, @Param("dimension") String dimension, @Param("leaderId") String leaderId,
                                                 @Param("designerId") String designerId, @Param("materialQuality") Integer materialQuality, @Param("materialType") Integer materialType,
                                                 @Param("innovative") Integer innovative,
                                                 @Param("target") String target, @Param("order") String order, @Param("companyId") String companyId);

    Long queryKuaishouMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
                                          @Param("channelType") String channelType, @Param("md5") String md5);

    //设计排行榜
    List<JSONObject> queryTopDesign(String startDate, String endDate, Set<String> userIds, String target, String order, String roleName);

    Long queryTopDesignCount(String startDate, String endDate, Set<String> userIds);

    //设计排行榜新版本
    List<JSONObject> queryKuaishouTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type,@Param("companyId") String companyId);

    List<JSONObject> queryBytedanceTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type,@Param("companyId") String companyId);

    //素材详情页
    JSONObject queryBytedanceVideoDetail(String md5);

    JSONObject queryKuaishouVideoDetail(String md5);

    //数据概览
    Long queryBytedanceProjectIdByMd5(String md5);

    Long queryKuaishouProjectIdByMd5(String md5);

    List<JSONObject> queryBytedanceCostByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceClickByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceMaterialShowByMd5(String md5, Long project);

    List<JSONObject> queryBytedancePlay100RateByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceLikeMaterialByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceCommentMaterialByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceShareMaterialByMd5(String md5, Long project);

    List<JSONObject> queryBytedanceFollowByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouChargeByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouPhotoShowByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouPhotoClickByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouAClickByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouBClickByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouActivationByMd5(String md5, Long project);

    List<JSONObject> queryKuaishouPlay3sRateByMd5(String md5, Long project);

    //数据趋势
    List<JSONObject> queryBytedanceVideoChat(String md5);

    List<JSONObject> queryKuaishouVideoChat(String md5);

    List<Map> populationAnalysisList(@Param("signature") String signature);

    String getActualProb(@Param("signature") String signature, @Param("targetType") String targetType);

    List<Map> populationAnalysisChart(@Param("signature") String signature);

    Map<String, String> optimalCombination(@Param("signature") String signature, @Param("targetType") String targetType);

    Map similarMaterialInfo(@Param("signature") String signature);

    Map<String, String> getSimilarMaterialList(@Param("signature") String signature);

    String getCompanyId(@Param("userId") String userId);

    BigDecimal getBytedanceDesignTeamAvgCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    BigDecimal getKuaishouDesignTeamAvgCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    BigDecimal getBytedanceDesignTeamGroupWork(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    BigDecimal getKuaishouDesignTeamGroupWork(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    int getBytedanceDesignTeaminnovativeVideoCount(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    int getKuaishouDesignTeaminnovativeVideoCount(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    BigDecimal getBytedanceMaterialCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    BigDecimal getKuaishouDesignTeaminnovativeVideoCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);

    JSONObject getBytedanceMaterialCountByLable(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    JSONObject getBytedanceMaterialCountByCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    JSONObject getKuaishouMaterialCountByLable(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    JSONObject getKuaishouMaterialCountByCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);

    List<JSONObject> getDesignTeamALLList();

    String getRoleCodeByUserId(String userId);
}
