package org.jeecg.ctop.material.mapper;

import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.ctop.material.entity.vo.KuaiShouAccountPieVo;
import org.jeecg.ctop.material.entity.vo.KuaiShouOperateAccountVo;
import org.jeecg.ctop.material.entity.vo.KuaiShouOperateProjectVo;
import org.jeecg.ctop.material.entity.vo.KuaiShouOperateVo;

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

@Mapper
public interface MaterialStareMapper {


    String getRoleCodeByUserId(@Param("userId") String userId);
    Set<String> getCompanyAllUserId(@Param("companyId") String companyId);
    String getUserCompanyByUserId(@Param("userId")String userId);
    Set<String> getAffiliateId(@Param("leaderId")String leaderId,@Param("companyId")String companyId);
    Set<String> querySubordinateRecursive(@Param("companyId")String companyId,@Param("leaderIds")Set<String> leaderIds);
    Set<String> getKuaiShouAllOperators(@Param("companyId")String companyId,@Param("startDate")Long start, @Param("endDate")Long endDate,@Param("userIds")Set<String> userIds);



    // 快手 - 时报 查询
    List<Map> getKuaiShouCostHourlyByUserIdList(@Param("startDate") Long today, @Param("endDate") Long yesterday, @Param("list") Set<String> operatorUserIds);
    //快手-查询时报 消耗 前5
    List<JSONObject> getKuaiShouCostByTop5HourList(@Param("startDate")Long start, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);

    //快手 -日报查询
    List<Map> getKuaiShouCostDailyByUserIdList(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);
    //快手-查询日报 消耗 前5
    List<JSONObject> getKuaiShouCostByTop5DailyList(@Param("startDate")Long start, @Param("endDate")Long end, @Param("list")Set<String> operatorUserIds);

    //快手 时报总消耗
    JSONObject getKuaiShouTotalCost(@Param("startDate")Long startDate,@Param("endDate")Long endDate, @Param("nowHour")int nowHour, @Param("list")Set<String> operatorUserIds);
    //快手 日报总消耗
    JSONObject getKuaiShouTotalCostDaily(@Param("startDate")Long startDate,@Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);

    //快手-查询账户数据信息
    List<KuaiShouOperateVo> getKuaiShouOperateInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);

    //查看 快手 有效 计划 组
    JSONObject getKuaiShouAccountBaseByUserId(@Param("userId")String userId,@Param("projectId")String projectId,@Param("accountId")String accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);

    //快手 -查询 项目 数据信息
    List<KuaiShouOperateProjectVo> getKuaiShouOperateProjectInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("projectId")String projectId,@Param("list")Set<String> operatorUserIds);

    //快手 -查询 账户 数据信息
    List<KuaiShouOperateAccountVo> getKuaiShouOperateAccountInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("projectId")String projectId,@Param("accountId")Long accountId, @Param("list")Set<String> operatorUserIds);



    //快手 账户 余额
    JSONObject getKuaiShouAccountBalance(@Param("accountId")Long accountId);
    //快手 账户 消耗以及状态
    JSONObject getKuaiShouAccountTotalCost(@Param("accountId")Long accountId,@Param("statDate")Long statDate);
    //快手-运营 月总消耗
    JSONObject getKuaiShouAccountCostMonth(@Param("userId")String userId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
    JSONObject getKuaiShouUserByUserId(@Param("userId")String userId);

    //快手 账户趋势图-时报
    List<JSONObject> getKuaiShouAccountInfoBrokenLineHour(@Param("type")String type,@Param("accountId")Long accountId,@Param("statDate")Long statDate,@Param("endDate")Long endDate);
    //快手 账户趋势图-日报
    List<JSONObject> getKuaiShouAccountInfoBrokenLineDaily(@Param("type")String type,@Param("accountId")Long accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);

    //快手 账户 素材上新-有效-爆款   searchType： 0-全部 1-上新 2-有效 3-爆款
    List<JSONObject> getKuaiShouAccountMaterialNewAndEffectAndFaddish(@Param("accountId")Long accountId,@Param("searchType")String searchType,@Param("startDate")Long startDate, @Param("endDate")Long endDate);


    //快手 账户饼图图-分版位
    List<KuaiShouAccountPieVo> getKuaiShouAccountPieScene(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);
    //快手 账户饼图图-分年龄
    List<KuaiShouAccountPieVo> getKuaiShouAccountPieAge(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);
    //快手 账户饼图图-分性别
    List<KuaiShouAccountPieVo> getKuaiShouAccountPieGender(@Param("accountId")Long accountId, @Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("type")String type);

    //快手组实时数据查询-当天创建的组+当天有消耗的组
    List<JSONObject> kuaiShouRealTimeUnitDateInfo(@Param("accountId")Long accountId, @Param("nowDate")Long nowDate);


    //快手 账户 框返 激励 消耗
    JSONObject getKuaiShouAccountCharged(@Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("list")Set<String> operatorUserIds);

    //快手 运营 组内消耗 排名
    List<JSONObject> getKuaiShouPersonalGroupRank(@Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("companyId")String companyId);







    List<JSONObject> getProjectByUserIdAndMediaIdsSubordinate(@Param("userIds") Set<String> userIds, @Param("mediaIds") List<Integer> mediaIds);
    List<JSONObject> getAccountListByProjectListSubordinate(@Param("userIds") Set<String> userIds,@Param("list") List list);




}
