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.*;

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);
    List<JSONObject> getOperateSubordinateCountBatch(@Param("managerIds") List<String> managerIds);

    Set<String> getKuaiShouAllOperators(@Param("companyId") String companyId, @Param("startDate") Long start, @Param("endDate") Long endDate, @Param("userIds") Set<String> userIds);

    // 头条 同公司所有下级运营人员 有消耗的
    Set<String> getBytedanceAllOperators(@Param("companyId")String companyId,@Param("startDate")Long start, @Param("endDate")Long endDate,@Param("userIds")Set<String> userIds);
    Set<String> getAllOperatorsByLearderId(@Param("learderId")String learderId);
    //快手-在投项目数量
    String getKuaiShouOperatorProjectNum(@Param("startDate") Long start, @Param("endDate") Long endDate, @Param("userIds") Set<String> userIds);
    //头条-在投项目数量
    String getBytedanceOperatorProjectNum(@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);

    //头条-时报 查询
    List<Map> getBytedanceCostHourlyByUserIdList(@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);
    //头条-查询时报 消耗 前5
    List<JSONObject> getBytedanceCostByTop5HourList(@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);

    //头条-日报查询
    List<Map> getBytedanceCostDailyByUserIdList(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);
    List<Map> getAdqCostHourlyByUserIdList(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    List<Map> getAdqCostDailyByUserIdList(@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);
    //头条-查询日报 消耗 前5
    List<JSONObject> getBytedanceCostByTop5DailyList(@Param("startDate")Long start, @Param("endDate")Long end, @Param("list")Set<String> operatorUserIds);
    List<JSONObject> getAdqCostByTop5HourList(@Param("startDate") Long start, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    List<JSONObject> getAdqCostByTop5DailyList(@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 getBytedanceTotalCost(@Param("startDate")Long startDate,@Param("endDate")Long endDate, @Param("nowHour")int nowHour, @Param("list")Set<String> operatorUserIds);
    JSONObject getAdqTotalCost(@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);
    //头条 日报总消耗
    JSONObject getBytedanceTotalCostDaily(@Param("startDate")Long startDate,@Param("endDate")Long endDate, @Param("list")Set<String> operatorUserIds);
    JSONObject getAdqTotalCostDaily(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    JSONObject getKuaiShouTodayYesterdayCostSummary(@Param("today") Long today, @Param("yesterday") Long yesterday, @Param("nowHour") int nowHour, @Param("list") Set<String> operatorUserIds);
    JSONObject getBytedanceTodayYesterdayCostSummary(@Param("today") Long today, @Param("yesterday") Long yesterday, @Param("nowHour") int nowHour, @Param("list") Set<String> operatorUserIds);
    JSONObject getAdqTodayYesterdayCostSummary(@Param("today") Long today, @Param("yesterday") Long yesterday, @Param("nowHour") int nowHour, @Param("list") Set<String> operatorUserIds);
    JSONObject getKuaiShouPeriodCostSummary(@Param("currentStart") Long currentStart, @Param("currentEnd") Long currentEnd, @Param("lastStart") Long lastStart, @Param("lastEnd") Long lastEnd, @Param("list") Set<String> operatorUserIds);
    JSONObject getBytedancePeriodCostSummary(@Param("currentStart") Long currentStart, @Param("currentEnd") Long currentEnd, @Param("lastStart") Long lastStart, @Param("lastEnd") Long lastEnd, @Param("list") Set<String> operatorUserIds);
    JSONObject getAdqPeriodCostSummary(@Param("currentStart") Long currentStart, @Param("currentEnd") Long currentEnd, @Param("lastStart") Long lastStart, @Param("lastEnd") Long lastEnd, @Param("list") Set<String> operatorUserIds);
    JSONObject getKuaiShouOperateSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    JSONObject getBytedanceOperateSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    JSONObject getKuaiShouOperateProjectUserSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("list") Set<String> operatorUserIds);
    JSONObject getBytedanceOperateProjectUserSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("list") Set<String> operatorUserIds);
    JSONObject getOperateTodayYesterdaySummary(@Param("tableName") String tableName, @Param("dateField") String dateField, @Param("costField") String costField, @Param("hourField") String hourField, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("yesterday") Long yesterday, @Param("list") Set<String> operatorUserIds);
    String getAdqOperatorProjectNum(@Param("startDate") Long start, @Param("endDate") Long endDate, @Param("userIds") Set<String> userIds);
    String getAdqOperatorProjectNumHourly(@Param("startDate") Long start, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("userIds") Set<String> userIds);

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

    List<KuaiShouOperateVo> getKuaiShouOperateInfoHourly(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateVo> getBytedanceOperateInfoHourly(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateVo> getAdqOperateInfoHourly(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("nowHour") Integer nowHour, @Param("list") Set<String> operatorUserIds);

    //查看 快手 有效 计划 组
    JSONObject getKuaiShouAccountBaseByUserId(@Param("list") Set<String> operatorUserIds, @Param("projectId") String projectId, @Param("accountId") String accountId, @Param("startDate") Long startDate, @Param("endDate") Long endDate);
    //查看 头条 有效 计划 组
    JSONObject getBytedanceAccountBaseByUserId(@Param("list")Set<String> operatorUserIds,@Param("projectId")String projectId,@Param("accountId")String accountId,@Param("startDate")Long startDate, @Param("endDate")Long endDate);
    List<JSONObject> getKuaiShouAccountBaseGroupByUserIds(@Param("list") Set<String> operatorUserIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);
    List<JSONObject> getBytedanceAccountBaseGroupByUserIds(@Param("list") Set<String> operatorUserIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    //查看 快手  当天数据 有效 计划 组
    JSONObject getKuaiShouAccountNowBaseByUserId(@Param("list") Set<String> operatorUserIds, @Param("projectId") String projectId, @Param("accountId") String accountId, @Param("startDate") Long startDate, @Param("endDate") Long endDate);
    List<JSONObject> getKuaiShouAccountNowBaseGroupByUserIds(@Param("list") Set<String> operatorUserIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    //查看 上传到助手、媒体的素材数量 分版位花费
    List<JSONObject> getKuaiShouMaterailUploadType(@Param("projectId") String projectId, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    //查看 快手 分版位花费
    List<JSONObject> getKuaiShouAdSceneData(@Param("projectId") String projectId, @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<KuaiShouOperateProjectVo> getBytedanceOperateProjectInfo(@Param("startDate")Long startDate, @Param("endDate")Long endDate, @Param("projectId")String projectId,@Param("list")Set<String> operatorUserIds);
    //快手-查询消费 时报
    List<KuaiShouOperateProjectVo> getKuaiShouOperateProjectInfoHour(@Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("hour")int hour, @Param("projectId")String projectId,@Param("list")Set<String> operatorUserIds);
    //头条-查询消费 时报
    List<KuaiShouOperateProjectVo> getBytedanceOperateProjectInfoHour(@Param("startDate")Long startDate, @Param("endDate")Long endDate,@Param("hour")int hour, @Param("projectId")String projectId,@Param("list")Set<String> operatorUserIds);

    //快手 -查询 账户 数据信息
    List<KuaiShouOperateAccountVo> getKuaiShouOperateAccountIdPage(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getBytedanceOperateAccountIdPage(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getAdqOperateAccountIdPage(@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);
    List<KuaiShouOperateAccountVo> getBytedanceOperateAccountInfo(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("accountId") Long accountId, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getAdqOperateAccountInfo(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("accountId") Long accountId, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getKuaiShouOperateAccountPeriodBatch(@Param("queryStartDate") Long queryStartDate, @Param("queryEndDate") Long queryEndDate, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeStart") Long lastTimeStart, @Param("lastTimeEnd") Long lastTimeEnd, @Param("startEqually") Long startEqually, @Param("endEqually") Long endEqually, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getBytedanceOperateAccountPeriodBatch(@Param("queryStartDate") Long queryStartDate, @Param("queryEndDate") Long queryEndDate, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeStart") Long lastTimeStart, @Param("lastTimeEnd") Long lastTimeEnd, @Param("startEqually") Long startEqually, @Param("endEqually") Long endEqually, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getAdqOperateAccountPeriodBatch(@Param("queryStartDate") Long queryStartDate, @Param("queryEndDate") Long queryEndDate, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeStart") Long lastTimeStart, @Param("lastTimeEnd") Long lastTimeEnd, @Param("startEqually") Long startEqually, @Param("endEqually") Long endEqually, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getKuaiShouOperateAccountInfoBatch(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getBytedanceOperateAccountInfoBatch(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<KuaiShouOperateAccountVo> getAdqOperateAccountInfoBatch(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projectId") String projectId, @Param("accountIds") List<Long> accountIds, @Param("list") Set<String> operatorUserIds);
    List<JSONObject> getKuaiShouAccountBaseByAccountIds(@Param("accountIds") List<Long> accountIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);


    //快手 账户 余额
    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 getBytedanceAccountCostMonth(@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);
    JSONObject getKuaiShouPersonalRankSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("companyId") String companyId, @Param("userId") String userId);

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

    JSONObject getBytedancePersonalRankSummary(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("companyId") String companyId, @Param("userId") String userId);
    List<JSONObject> getBytedancePersonalGroupRank(@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);


    JSONObject getColumnInfo(@Param("userId") String userId, @Param("columnType") String columnType);

    /**
     * 查询运营经理角色的人
     *
     * @return
     */
    List<KuaiShouOperateGroupVo> getOperationManagerUser(@Param("roleCode") String roleCode);

    Set<String> queryKuaishouOperateTeamMember(@Param("userId") String userId,@Param("startDate") Long startDate, @Param("endDate") Long endDate);

    Set<String> queryToutiaoOperateTeamMember(@Param("userId") String userId,@Param("startDate") Long startDate, @Param("endDate") Long endDate);

    Set<String> queryAdqOperateTeamMember(@Param("userId") String userId,@Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<JSONObject> queryKuaishouOperateTeamMemberBatch(@Param("managerIds") List<String> managerIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<JSONObject> queryToutiaoOperateTeamMemberBatch(@Param("managerIds") List<String> managerIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<JSONObject> queryAdqOperateTeamMemberBatch(@Param("managerIds") List<String> managerIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);

    List<String> getAllOperationByMediaId(@Param("mediaId") String mediaId);

    List<KuaiShouOperateProjectVo> getBytedanceOperateProjectInfoNew(Map<String, Object> parameterMap);

    List<Long> getBytedanceProjectList(Map<String, Object> parameterMap);

    List<Long> getKuaishouProjectList(Map<String, Object> parameterMap);

    List<KuaiShouOperateProjectVo> getKuaiShouOperateProjectInfoNew(Map<String, Object> parameterMap);

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

    String getOperatLeaderRole(@Param("userId") String userId);
}
