package cn.com.ctop.userefficientvideomap.mapper;

import cn.com.ctop.common.module.entity.MaterialInfo;
import cn.com.ctop.performanceaccount.entity.PerformanceAccount;
import cn.com.ctop.userefficientvideomap.entity.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

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

/**
 * 有效视频与角色对应表
 *
 * @author: jeecg-boot
 * @date: 2019-12-16
 * @cersion: V1.0
 */
@Component
public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVideoMap> {

    List<EffiVideoDTO> getUserVideoMap(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("startCalcDate") String startCalcDate, @Param("endCalcDate") String endCalcDate);

    int getEffiVideoCountBySignature(@Param("signature") String signature, @Param("appType") Integer appType);

    int getEffiVideoCountByUserId(@Param("appType") int appType, @Param("year") int year, @Param("quarter") int quarter, @Param("userId") String userId, @Param("roleId") String roleId);

    int getQuarterMaterialCountByUserId(@Param("roleCode") String roleCode, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("userId") String userId);

    int getVideoCountByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getTotalCostByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getTotalCostByClipId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getTotalCostByShotId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getTotalCostByPlanId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getTotalCostByPlaneId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getProjectTotalCostByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<ProjectDTO> getProjectsByUserId(@Param("userId") String userId);

    int getPlaneCountByProjectId(@Param("projectId") Long projectId);

    int getPlaneCountByUserId(@Param("userId") String userId);

    List<DesignMaterialInfo> designMaterialInfoList(@Param("roleCode") String roleCode, @Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<DesignMaterialInfo> getMaterialAccountInfoByMaterialId(@Param("materialId") String materialId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<ProjectDTO> getProjects(@Param("mediaId") String mediaId);

    BigDecimal getProjectQuarterCostById(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Long projectId);

    BigDecimal getToutiaoProjectQuarterCostById(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Long projectId);

    List<UserDto2> getPlaneByProjectId(@Param("projectId") Long projectId);

    List<UserDto2> getKuaishouDesignLeaderList();

    List<UserDto2> getKuaishouPlanList();

    List<UserDto2> getKuaishouShotList();

    List<UserDto2> getKuaishouClipList();

    List<UserDto2> getToutiaoPlanList();

    List<UserDto2> getToutiaoShotList();

    List<UserDto2> getToutiaoClipList();

    List<UserDto2> getToutiaoDesignLeaderList();

    List<String> getClip(@Param("depId") String depId);

    BigDecimal getClipQuarterCost(@Param("appType") int appType, @Param("quarter") int quarter, @Param("year") int year, @Param("userId") String userId);

    //头条有效视频计算sql
    List<EffiVideoDTO> getToutiaoUserVideoMap(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("startCalcDate") String startCalcDate, @Param("endCalcDate") String endCalcDate);

    BigDecimal toutiaoGetTotalCostByClipId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal toutiaoGetTotalCostByShotId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal toutiaoGetTotalCostByPlanId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getQuarterPerformance(@Param("userId") String userId, @Param("year") int year, @Param("quarter") int quarter, @Param("appType") int appType);

    BigDecimal getQuarterCost(@Param("userId") String userId, @Param("year") int year, @Param("quarter") int quarter, @Param("appType") int appType);

    String getOrgCodeByProjectId(@Param("projectId") Long projectId);

    SysRole getRoleIdByUserId(@Param("userId") String userId);

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

    List<UserDto2> getUserListByDepartId(@Param("departId") String departId);

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

    String getParentIdByDepartId(@Param("departId") String departId);

    List<PlaneProjectCostDTO> getPlanePerformanceInfo(@Param("appType") int appType, @Param("year") int year, @Param("quarter") int quarter, @Param("userId") String userId);

    List<UserDto2> getUserPerformanceList(@Param("appType") Integer appType, @Param("year") Integer year, @Param("quarter") Integer quarter);

    List<String> getUserIdListByDepId(@Param("depId") String depId);

    void updateKuaishouEffiType(@Param("kuaishouEffiType") Integer kuaishouEffiType, @Param("signature") String signature);

    void updateToutiaoEffiType(@Param("toutiaoEffiType") Integer toutiaoEffiType, @Param("signature") String signature);

    List<UserDto2> getKuaishouDepartUserInfo();

    List<UserDto2> getKuaishouDepartAllUserInfo();

    List<UserDto2> getToutiaoDepartUserInfo();

    List<UserDto2> getToutiaoDepartAllUserInfo();

    //根据天数的区间获取userId获取有效视频数量
    Integer getEffiVideoCountByCalcDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userId") String userId, @Param("appType") Integer appType);

    List<MaterialInfo> getEffiVideoList(@Param("appType") Integer appType, @Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId);

    List<UserDto2> getKuaishouYunyingDepartUserInfo();

    List<UserDto2> getAllKuaishouYunyingDepartUserInfo();

    List<UserDto2> getToutiaoYunyingDepartUserInfo();

    List<UserDto2> getAllToutiaoYunyingDepartUserInfo();

    //获取快手单个优化师当前账户下的总消耗
    BigDecimal getKuaishouYunyingTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);

    //获取快手单个优化师当前账户下的总消耗
    BigDecimal getToutiaoYunyingTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);

    //获取快手单个优化师其下所有的账户下当前的消耗
    List<AccountDTO> getKuaishouAccountTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);

    //获取头条单个优化师其下所有的账户下当前的消耗
    List<AccountDTO> getToutiaoAccountTotalCost(@Param("userId") String userId, @Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<MaterialInfo> getEffiWeekVideoList(@Param("appType") Integer appType, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userId") String userId);

    List<String> getWeekCostMd5(@Param("startDate") String startDate, @Param("endDate") String endDate);

    List<String> toutiaoGetWeekCostMd5(@Param("startDate") String startDate, @Param("endDate") String endDate);

    Integer beforeWeekCostCount(@Param("md5") String md5, @Param("date") String date);

    Integer toutiaoBeforeWeekCostCount(@Param("md5") String md5, @Param("date") String date);

    String getVideoEarlistCostDate(@Param("md5") String md5);

    String getToutiaoVideoEarlistCostDate(@Param("md5") String md5);

    BigDecimal videoTotalCostInDates(@Param("md5") String md5, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal toutiaoVideoTotalCostInDates(@Param("md5") String md5, @Param("startDate") String startDate, @Param("endDate") String endDate);

    EffiVideoDTO getDesignerInfoByCode(@Param("code") String code);

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

    List<String> getVideoByDates(@Param("startDate") String startDate, @Param("endDate") String endDate);

    Integer getVideoCountByCode(@Param("signature") String signature, @Param("appType") Integer appType);

    List<String> getTotalSignatureByUserId(@Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getSumChargeBySignature(@Param("signature") String signature, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getToutiaoSumChargeBySignature(@Param("signature") String signature, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<MaterialInfo> getVideoList(@Param("appType") Integer appType, @Param("userId") String userId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    Integer kuaishouCreativeLtCount(@Param("signature") String signature, @Param("date") String date);

    String kuaishouCreativeEarlistDate(@Param("signature") String singature);

    List<String> getToutiaoVideoByDates(@Param("startDate") String startDate, @Param("endDate") String endDate);

    Integer toutiaoCreativeLtCount(@Param("signature") String signature, @Param("date") String date);

    String toutiaoCreativeEarlistDate(@Param("signature") String singature);

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

    List<TransferorAccountDTO> accountTransforerListByUserId(@Param("accountId") String accountId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getAccountSumCharge(@Param("accountId") String accountId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BigDecimal getToutiaoAccountSumCharge(@Param("accountId") String accountId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<UserDto2> getKuaishouYunyingLeaderUserInfo();

    List<UserDto2> getToutiaoYunyingLeaderUserInfo();

    List<UserDto2> getYunyingLeaderMember(@Param("depId") String depId);

    BigDecimal getYunyingRoyalty(@Param("userId") String userId, @Param("year") Integer year, @Param("quarter") Integer quarter);

    List<String> getAccountListByMediaId(@Param("mediaId") Integer mediaId);

    String getAccountUserId(@Param("accountId") String userId);

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

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

    Integer getQuarterVideoCount(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId, @Param("appType") Integer appType);

    Integer getQuarterEffiVideoCount(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId, @Param("appType") Integer appType);

    BigDecimal getYunyingQuarterCost(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId, @Param("appType") Integer appType);

    BigDecimal getYunyingQuarterPerformance(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId, @Param("appType") Integer appType);

    List<PerformanceAccount> getYunyingQuarterDetailByUserId(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("userId") String userId, @Param("appType") Integer appType);

    //按平台获取其下所有项目信息以及消耗
    List<ProjectDTO> getProjcetListByMediaType(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("appType") Integer appType);

    //根据projectId获取其下账户季度消耗信息
    List<AccountDTO> getQuarterAccountDetail(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("projectId") Integer projectId, @Param("appType") Integer appType);

    Integer getQuarterVideoCountByRoleCodeAndUserId(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("appType") Integer appType, @Param("userId") String userId, @Param("roleCode") String roleCode);

    UserDto2 getProjectDesignResponsibleInfo(@Param("projectId") Long projectId);

    List<VideoDTO> getKuaishouQuarterVideoInfoByAccountId(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountId") Long accountId);

    List<VideoDTO> getToutiaoQuarterVideoInfoByAccountId(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountId") Long accountId);

    SysUser getDesignLeaderInfoByDesignUserId(@Param("userId") String userId);

    List<VideoDTO> getUserQuarterVideo(@Param("userId") String userId, @Param("year") Integer year, @Param("quarter") Integer quarter);

    List<VideoDTO> getUserQuarterEffiVideo(@Param("userId") String userId, @Param("year") Integer year, @Param("quarter") Integer quarter);

    BigDecimal getQuarterTotalCostByRoleCode(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("roleCode") String roleCode, @Param("userId") String userId);

    List<String> getQuarterSignature(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("roleCode") String roleCode, @Param("userId") String userId);

    BigDecimal getQuarterTotalCostByCode(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature);

    BigDecimal getToutiaoQuarterTotalCostByCode(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature);

    BigDecimal getToutiaoQuarterTotalCostByRoleCode(@Param("year") Integer year, @Param("quarter") Integer quarter, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("roleCode") String roleCode, @Param("userId") String userId);

    List<AccountDTO> getAccountInfoByAppType(@Param("appType") Integer appType);
}

