package org.jeecg.modules.ctop.mapper;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.orderplatform.util.JsonArrayUtil;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface MaterialReportOverViewMapper {

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

    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") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

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

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

    //查询素材 上新 数据 头条
    List<Map<String,String>> queryMaterialCountList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
    //上新 快手
    List<Map<String,String>> queryMaterialCountListKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

    //查询有消耗的素材 - 头条
    Long queryMaterialCostList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
    //查询有消耗的素材 - 快手
    Long queryMaterialCostListKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

    //查询有效视频-头条
    List<Map<String,String>> selectEffectiveMaterialVideoBytedance(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
    //有效视频-快手
    List<Map<String,String>> selectEffectiveMaterialVideoKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

    //查询爆款视频-头条
    List<Map<String,String>> selectHotMaterialVideoBytedance(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
    //爆款视频 -快手
    List<Map<String,String>> selectHotMaterialVideoKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

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

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

    List<JSONObject> queryBytedanceChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

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

    List<JSONObject> queryKuaishouChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);

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

    //头条素材排行榜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") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
                                                  @Param("md5") String md5, @Param("target") String target, @Param("order") String order);

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

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

    //查看更多
    List<JSONObject> queryKuaishouMaterialReport(@Param("filed") String filed, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
                                                 @Param("channelType") String channelType, @Param("md5") String md5, @Param("target") String target, @Param("order") String order);

    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") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray  projects, @Param("type")  String type);
    List<JSONObject> queryBytedanceTopDesign(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray  projects, @Param("type")  String type);

    //素材详情页
    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);
}
