package org.jeecg.ctop.material.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.ctop.material.entity.ManagerSaleValue;

import java.util.List;

/**
 * 分公司总经理&销售总监阶段性目标值
 *
 * @author jeecg-boot
 * 2022-04-14
 * @version V1.0
 */
public interface ManagerSaleValueMapper extends BaseMapper<ManagerSaleValue> {


    /**
     * =----------------------------------------------------------------------------------------------------------------=
     */
    String getRoleCodeByUserId(@Param("userId") String userId);

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

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

    List<JSONObject> queryList();

    List<String> querySaleDirctorItsTeamMember(@Param("userId") String userId);

    List<Long> querySalesDirectorAccountIds(@Param("companyId") String companyId, @Param("mediaId") String mediaId, @Param("userIds") List<String> saleTeaMber);

    List<Long> querySalesDirectorAccountIds2(@Param("companyId") String companyId, @Param("mediaId") String mediaId, @Param("userIds") List<String> saleTeaMber);

    /**
     * -----------------------------------------------------
     */

    JSONObject queryTtTodayCharge(@Param("statDay") String statDay, @Param("hour") Integer hour, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryTtTodayCharge2(@Param("statDay") String statDay, @Param("endTime") String endTime, @Param("hour") Integer hour, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId, @Param("days") long days);

    JSONObject queryTtTodayCharge3(@Param("statDay") String statDay, @Param("endTime") String endTime, @Param("mediaId") String mediaId, @Param("hour") Integer hour, @Param("companyId") String companyId, @Param("days") long days);

    String queryTtManydaysTotalCharge(@Param("startDay") String startDay, @Param("endDay") String endDay, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryTtRealCharged(@Param("lastMonthFirstday") String lastMonthFirstday, @Param("monthFirstday") String monthFirstday, @Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds, @Param("companyId") String companyId);


    JSONObject queryKsTodayCharge(@Param("statDay") String statDay, @Param("hour") Integer hour, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryKsTodayCharge2(@Param("statDay") String statDay, @Param("endTime") String endTime, @Param("hour") Integer hour, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId, @Param("days") long days);

    JSONObject queryKsTodayCharge3(@Param("statDay") String statDay, @Param("endTime") String endTime, @Param("mediaId") String mediaId, @Param("hour") Integer hour, @Param("companyId") String companyId, @Param("days") long days);

    String queryKsManydaysTotalCharge(@Param("startDay") String startDay, @Param("endDay") String endDay, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryKsRealCharged(@Param("lastMonthFirstday") String lastMonthFirstday, @Param("monthFirstday") String monthFirstday, @Param("statDay") String statDay, @Param("accountIds") List<Long> accountIds, @Param("companyId") String companyId);

    Long getWeekly(@Param("userId") String userId, @Param("companyId") String companyId, @Param("mediaId") String mediaId);

    Long getMonthly(@Param("userId") String userId, @Param("companyId") String companyId, @Param("mediaId") String mediaId);

    List<JSONObject> queryKsHourList(@Param("statDay") String statDay, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    List<JSONObject> queryTtHourList(@Param("statDay") String statDay, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryTtManydaysChargeAndRoi(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lastTimeStart") String lastTimeStart, @Param("lastTimeEnd") String lastTimeEnd, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    List<JSONObject> queryTtManydaysCharge(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    JSONObject queryKsManydaysChargeAndRoi(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lastTimeStart") String lastTimeStart, @Param("lastTimeEnd") String lastTimeEnd, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    List<JSONObject> queryKsManydaysCharge(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("saleTeaMber") List<String> saleTeaMber, @Param("companyId") String companyId);

    List<Long> querySalesDirectorProjectIds(@Param("companyId") String companyId, @Param("mediaId") String mediaId, @Param("userIds") List<String> saleTeaMber);

    Long queryKsHourProjectTopTotal(@Param("saleTeaMber") List<String> saleTeaMber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("companyId") String companyId);

    List<JSONObject> queryKsHourProjectTop(@Param("saleTeaMber") List<String> saleTeaMber,@Param("accountIds") List<Long> accountIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("days") Long days, @Param("hour") Integer hour, @Param("companyId") String companyId);

    Long queryTtHourProjectTopTotal(@Param("saleTeaMber") List<String> saleTeaMber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("companyId") String companyId);

    List<JSONObject> queryTtHourProjectTop(@Param("saleTeaMber") List<String> saleTeaMber,@Param("accountIds") List<Long> accountIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("days") Long days, @Param("hour") Integer hour, @Param("companyId") String companyId);


}
