Преглед изворни кода

Merge branch 'zzy' into test

zhouzeyu@c-top.com.cn пре 3 година
родитељ
комит
664da8fb42

+ 1 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/MaterialReportOverViewV2Controller.java

@@ -268,6 +268,7 @@ public class MaterialReportOverViewV2Controller {
                 params.getInteger("mediaId"),
                 params.getString("startDate"),
                 params.getString("endDate"),
+                params.getString("userId"),
                 params.getInteger("type"),
                 params.getInteger("pageNumber"),
                 params.getInteger("pageSize"));

+ 11 - 10
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialReportOverViewV3Mapper.java

@@ -2,6 +2,7 @@ package org.jeecg.ctop.material.mapper;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Lang;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -35,16 +36,16 @@ public interface MaterialReportOverViewV3Mapper {
     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, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    List<Map<String, String>> queryMaterialCountList(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
     //上新 快手
-    List<Map<String, String>> queryMaterialCountListKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    List<Map<String, String>> queryMaterialCountListKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
     //查询有消耗的素材 - 头条
-    Long queryMaterialCostList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    Long queryMaterialCostList(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
     //查询有消耗的素材 - 快手
-    Long queryMaterialCostListKs(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    Long queryMaterialCostListKs(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
     //查询有效视频-头条
     List<Map<String, String>> selectEffectiveMaterialVideoBytedance(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
@@ -106,9 +107,9 @@ public interface MaterialReportOverViewV3Mapper {
     Long queryTopDesignCount(String startDate, String endDate, Set<String> userIds);
 
     //设计排行榜新版本
-    List<JSONObject> queryKuaishouTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type);
+    List<JSONObject> queryKuaishouTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type,@Param("companyId") String companyId);
 
-    List<JSONObject> queryBytedanceTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type);
+    List<JSONObject> queryBytedanceTopDesign(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("type") Integer type,@Param("companyId") String companyId);
 
     //素材详情页
     JSONObject queryBytedanceVideoDetail(String md5);
@@ -185,11 +186,11 @@ public interface MaterialReportOverViewV3Mapper {
 
     BigDecimal getKuaishouDesignTeaminnovativeVideoCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("leaderId") String leaderId, @Param("companyId") String companyId);
 
-    JSONObject getBytedanceMaterialCountByLable(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    JSONObject getBytedanceMaterialCountByLable(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
-    JSONObject getBytedanceMaterialCountByCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    JSONObject getBytedanceMaterialCountByCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
-    JSONObject getKuaishouMaterialCountByLable(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    JSONObject getKuaishouMaterialCountByLable(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 
-    JSONObject getKuaishouMaterialCountByCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
+    JSONObject getKuaishouMaterialCountByCost(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("projects") JSONArray projects, @Param("dimension") String dimension, @Param("leaderId") String leaderId, @Param("designerId") String designerId, @Param("companyId") String companyId);
 }

+ 205 - 283
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialReportOverViewV3Mapper.xml

@@ -158,21 +158,16 @@
     <!-- 查询素材 上新 数据  头条-->
     <select id="queryMaterialCountList" resultType="java.util.HashMap">
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.create_time, '%Y-%m-%d') as time
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.media_time, '%Y-%m-%d') as time
         from (
-        SELECT  t.signature ,t.create_time from
-        (
-        select advertiser_id,signature,create_time,clip_id,shot_id,plan_id,leader_id from application.app_bytedance_file_video_get
-        where create_time &gt;= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
-        and create_time &lt;= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
-        group by
-        advertiser_id,signature
-        ) t
+        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id  from
+        application.app_bytedance_material_info t
         left join
-        ctop_user_allocation t1 on t.advertiser_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
+
         <where>
+         t.media_time BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -187,8 +182,7 @@
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-            AND t2.company_id=#{companyId}
-            GROUP BY signature
+            AND t.company_id=#{companyId}
         </where>
         )tt
         GROUP BY time
@@ -197,20 +191,15 @@
     <!-- 查询素材 上新 数据  快手-->
     <select id="queryMaterialCountListKs" resultType="java.util.HashMap">
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.stat_date, '%Y-%m-%d') as time
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.media_time, '%Y-%m-%d') as time
         from (
-        SELECT t.signature ,t.stat_date from
-        (select account_id,signature,stat_date,clip_id,shot_id,plan_id,leader_id from application.app_kuaishou_video_list where
-        stat_date &gt;= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
-        and stat_date &lt;= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
-        group by account_id,signature)
-        t
+        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
+        application.app_kuaishou_material_info t
         left join
-        ctop_user_allocation t1 on t.account_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
-
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
         <where>
+            t.media_time BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -221,12 +210,10 @@
             <if test='dimension=="designTeam" and leaderId!=null'>
                 and t.leader_id=#{leaderId}
             </if>
-
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-            AND t2.company_id=#{companyId}
-            GROUP BY signature
+            AND t.company_id=#{companyId}
         </where>
         )tt
         GROUP BY time
@@ -235,22 +222,14 @@
 
     <!-- 查询有消耗的素材 头条 -->
     <select id="queryMaterialCostList" resultType="long">
-        SELECT count(*) from (
-        SELECT
-        count(distinct t.signature) as count
-        from
-        (
-        select advertiser_id,signature,create_time from application.app_bytedance_file_video_get
-        where create_time &gt;= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
-        and create_time &lt;= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
-        group by
-        signature
-        ) t
-        left join application.bytedance_material_video_report_daily_dw t1 on t.signature = t1.signature
-
+        select  count(0) from (
+        SELECT  t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id  from
+        application.app_bytedance_material_info t
+        left join
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
+        left  join application.bytedance_material_farst_cost_time t2 on t.material_id =t2.signature
         <where>
-            and t1.stat_datetime BETWEEN DATE_FORMAT(#{startDate},'%Y%m%d') and DATE_FORMAT(#{endDate},'%Y%m%d')
-
+            t.media_time BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -260,34 +239,28 @@
             </if>
 
             <if test='dimension=="designTeam" and leaderId!=null'>
-                and t1.leader_id=#{leaderId}
+                and t.leader_id=#{leaderId}
             </if>
-
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-
-            AND t1.company_id=#{companyId}
+            AND t.company_id=#{companyId}
+            and t2.frast_cost_time is not null
         </where>
-        GROUP BY t.signature HAVING sum(t1.cost)>0
         ) tt
     </select>
 
     <!-- 查询有消耗的素材 快手 -->
     <select id="queryMaterialCostListKs" resultType="long">
-        SELECT count(*) from (
-        SELECT
-        count(distinct t.signature) as count
-        from (select account_id,signature,stat_date from application.app_kuaishou_video_list
-        where
-        stat_date &gt;= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
-        and stat_date &lt;=str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
-        group by
-        signature)
-        t
-        left join application.kuaishou_material_video_report_daily_dw t1 on t.signature = t1.signature
+        select count(0) from (
+        SELECT t.material_id ,t.media_time,leader_id,clip_id,shot_id,plan_id,company_id from
+        application.app_kuaishou_material_info t
+        left join
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
+        left join application.material_farst_cost_time t2 on t.material_id=t2.signature
         <where>
-            and t1.stat_date BETWEEN DATE_FORMAT(#{startDate},'%Y%m%d') and DATE_FORMAT(#{endDate},'%Y%m%d')
+            t.media_time BETWEEN #{startDate} and #{endDate}
+
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -296,37 +269,30 @@
                 </foreach>
             </if>
             <if test='dimension=="designTeam" and leaderId!=null'>
-                and t1.leader_id=#{leaderId}
+                and t.leader_id=#{leaderId}
             </if>
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-            AND t1.company_id=#{companyId}
+            AND t.company_id=#{companyId}
+            and t2.frast_cost_time is not null
         </where>
-        GROUP BY t.signature HAVING sum(t1.charge)>0
         ) tt
+
     </select>
 
     <!-- 有效视频-头条 -->
     <select id="selectEffectiveMaterialVideoBytedance" resultType="java.util.HashMap">
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.effective_video_date, '%Y-%m-%d') as time
-        from
-        (
-        SELECT  t.signature ,t.effective_video_date from (
-        select advertiser_id,signature,effective_video_date,create_time,clip_id,shot_id,plan_id,leader_id from
-        application.app_bytedance_file_video_get
-        where effective_video_date &gt;= #{startDate}
-        and effective_video_date &lt;= #{endDate}
-        group by
-        advertiser_id,signature
-        ) t
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.effect_date, '%Y-%m-%d') as time
+        from (
+        SELECT  t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id  from
+        application.app_bytedance_material_info t
         left join
-        ctop_user_allocation t1 on t.advertiser_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
-
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
         <where>
+            t.effect_date BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -338,13 +304,12 @@
             <if test='dimension=="designTeam" and leaderId!=null'>
                 and t.leader_id=#{leaderId}
             </if>
-
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-            AND t2.company_id=#{companyId}
+            AND t.company_id=#{companyId}
         </where>
-        GROUP BY signature  ) tt
+        )tt
         GROUP BY time
         ORDER BY time
     </select>
@@ -353,22 +318,15 @@
     <!-- 有效视频-快手 -->
     <select id="selectEffectiveMaterialVideoKs" resultType="java.util.HashMap">
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.effective_video_date, '%Y-%m-%d') as time
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.effect_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.signature ,t.effective_video_date from
-        (select account_id,signature,effective_video_date,stat_date,clip_id,shot_id,plan_id,leader_id from
-        application.app_kuaishou_video_list
-        where
-        effective_video_date &gt;= #{startDate}
-        and effective_video_date &lt;= #{endDate}
-        group by
-        account_id,signature)
-        t
+        SELECT  t.material_id ,t.effect_date,leader_id,clip_id,shot_id,plan_id,company_id from
+        application.app_kuaishou_material_info t
         left join
-        ctop_user_allocation t1 on t.account_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
         <where>
+            t.effect_date BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -382,9 +340,9 @@
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
-            AND t2.company_id=#{companyId}
+            AND t.company_id=#{companyId}
         </where>
-        GROUP BY signature  ) tt
+        )tt
         GROUP BY time
         ORDER BY time
     </select>
@@ -392,23 +350,22 @@
 
     <!-- 爆款视频-头条 -->
     <select id="selectHotMaterialVideoBytedance" resultType="java.util.HashMap">
+
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.hot_video_date, '%Y-%m-%d') as time
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.faddish_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.signature ,t.hot_video_date from (
-        select advertiser_id,signature,create_time,hot_video_date,tag_code,clip_id,shot_id,plan_id,leader_id from
-        application.app_bytedance_file_video_get
-        where
-        hot_video_date &gt;= #{startDate}
-        and hot_video_date &lt;= #{endDate}
-        group by
-        advertiser_id,signature
-        ) t
+        SELECT  t.material_id,t.faddish_date  from
+        application.app_bytedance_material_info t
         left join
-        ctop_user_allocation t1 on t.advertiser_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
+
+        <if test='type==1 or type==2'>
+            left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        </if>
+
         <where>
+            t.faddish_date BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -422,39 +379,40 @@
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
+
             <if test='type==1'>
-                and t.tag_code='Z02Z05'
+                and t2.tag_code='Z02Z05'
             </if>
             <if test='type==2'>
-                and t.tag_code='Z01B12'
+                and t2.tag_code='Z01B12'
             </if>
-            AND t2.company_id=#{companyId}
+            AND t.company_id=#{companyId}
         </where>
-        GROUP BY signature  ) tt
+            group by t.material_id
+        )tt
         GROUP BY time
         ORDER BY time
+
     </select>
 
 
     <!-- 爆款视频-快手 -->
     <select id="selectHotMaterialVideoKs" resultType="java.util.HashMap">
         SELECT
-        count(distinct tt.signature) as count ,
-        DATE_FORMAT(tt.hot_video_date, '%Y-%m-%d') as time
+        count( tt.material_id) as count ,
+        DATE_FORMAT(tt.faddish_date, '%Y-%m-%d') as time
         from (
-        SELECT  t.signature ,t.hot_video_date from (
-        select account_id,signature,stat_date,hot_video_date,tag_code,clip_id,shot_id,plan_id,leader_id from
-        application.app_kuaishou_video_list
-        where
-        hot_video_date &gt;= #{startDate}
-        and hot_video_date &lt;= #{endDate}
-        group by
-        account_id,signature )
-        t
+        SELECT  t.material_id,t.faddish_date  from
+        application.app_kuaishou_material_info t
         left join
-        ctop_user_allocation t1 on t.account_id=t1.account_id
-        left join user_company t2 on t1.user_id=t2.user_id
+        ctop_user_allocation t1 on t.leader_id=t1.user_id
+
+        <if test='type==1 or type==2'>
+            left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        </if>
+
         <where>
+            t.faddish_date BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -462,22 +420,23 @@
                     #{item}
                 </foreach>
             </if>
-
             <if test='dimension=="designTeam" and leaderId!=null'>
                 and t.leader_id=#{leaderId}
             </if>
             <if test='dimension=="designer" and designerId!=null'>
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
+
             <if test='type==1'>
-                and t.tag_code='Z02Z05'
+                and t2.tag_code='Z02Z05'
             </if>
             <if test='type==2'>
-                and t.tag_code='Z01B12'
+                and t2.tag_code='Z01B12'
             </if>
-            AND t2.company_id=#{companyId}
+            AND t.company_id=#{companyId}
         </where>
-        GROUP BY signature  ) tt
+        group by t.material_id
+        )tt
         GROUP BY time
         ORDER BY time
     </select>
@@ -618,20 +577,26 @@
     </select>
 
     <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT ROUND(SUM(cost),2) as charge,t.signature,t1.cover_url as 'coverUrl',t1.video_url as 'url',t.filename as
+        SELECT ROUND(SUM(t1.cost),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as 'url',tt.material_name as
         'materialName',
-        t.tag as 'tag'
+        tt.tag as 'tag'
         from (
-        select advertiser_id,signature,filename,GROUP_CONCAT(DISTINCT
-        if(tag_category_id=1,replace(tag_name,'-',','),null)) as
-        'tag',clip_id,shot_id,plan_id
-        from application.app_bytedance_file_video_get where tag_category_id=1 group by
-        advertiser_id,signature
-        ) t
+        select t.material_id,t.material_name,GROUP_CONCAT(t2.tag_name) as tag,video_url,cover_url from
+        application.app_bytedance_material_info t left join
+        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id   where tag_category_id=1 and t.company_id=#{companyId}
+
+        <if test='dimension=="designTeam" and leaderId!=null'>
+            and t.leader_id=#{leaderId}
+        </if>
+        <if test='dimension=="designer" and designerId!=null'>
+            and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
+        </if>
+         group by t.material_id
+        ) tt
+
         left join
-        (select cost,project_id,leader_id,stat_datetime,company_id,signature,account_id,video_url,cover_url from  application.bytedance_material_video_report_daily_dw) t1
-         on t.signature = t1.signature and
-        t.advertiser_id=t1.account_id
+        application.bytedance_material_video_report_daily_dw t1 on t1.signature=tt.material_id
+
         <where>
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
@@ -640,18 +605,10 @@
                     #{item}
                 </foreach>
             </if>
-            <if test='dimension=="designTeam" and leaderId!=null'>
-                and t1.leader_id=#{leaderId}
-            </if>
-            <if test='dimension=="designer" and designerId!=null'>
-                and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
-            </if>
-            AND t1.stat_datetime &gt;= #{startDate}
-            AND t1.stat_datetime &lt;= #{endDate}
-            AND t1.company_id=#{companyId}
+            AND t1.stat_datetime between #{startDate} and #{endDate}
         </where>
-        GROUP BY t.signature
-        ORDER BY SUM(cost) DESC LIMIT 5
+        GROUP BY tt.material_id
+        ORDER BY SUM(t1.cost) DESC LIMIT 5
     </select>
 
     <select id="queryKuaishouTopDesign" resultType="com.alibaba.fastjson.JSONObject">
@@ -677,29 +634,19 @@
         <if test="type == 1">t1.shot_name as userName, "摄像" as roleName,</if>
         <if test="type == 2">t1.clip_name as userName, "剪辑" as roleName,</if>
         <if test="type == 3">t1.plan_name as userName, "编导" as roleName,</if>
-        IFNULL(t2.size,0) as 'videoHotCount',
-
-        IFNULL(t2.size/(SELECT COUNT(1) from application.app_bytedance_file_video_get WHERE hot_video_date BETWEEN
-        #{startDate} and #{endDate} )*0.04,0)+
-        IFNULL(SUM(t1.cost)/(SELECT SUM(cost) from application.bytedance_material_video_report_daily_dw where stat_datetime
-        BETWEEN
-        #{startDate} and #{endDate} )*0.06,0) as 'sort'
-
+        IFNULL(COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null)),0) as 'videoHotCount',
+
+        COUNT(DISTINCT t.material_id,IF(faddish_date BETWEEN #{startDate} and #{endDate} ,true,null))/
+        (SELECT COUNT(0) from application.app_bytedance_material_info where faddish_date BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId})*0.4+
+        SUM(t1.cost)/
+        (SELECT SUM(cost) from application.bytedance_material_video_report_daily_dw where stat_datetime
+        BETWEEN #{startDate} and #{endDate}
+        )*0.6  as sort
         from
-        (SELECT * from application.app_bytedance_file_video_get GROUP BY signature,advertiser_id) t
-        LEFT JOIN application.bytedance_material_video_report_daily_dw t1 on t.signature=t1.signature and
-        t.advertiser_id=t1.account_id
-        LEFT JOIN
-        (SELECT COUNT(1) as 'size',clip_id,shot_id,plan_id from application.app_bytedance_file_video_get where
-        hot_video_date
-        BETWEEN #{startDate}
-        and #{endDate}
-        <if test="type == 1">and shot_id is not null GROUP BY shot_id)t2 on t.shot_id =t2.shot_id</if>
-        <if test="type == 2">and clip_id is not null GROUP BY clip_id)t2 on t.clip_id =t2.clip_id</if>
-        <if test="type == 3">and plan_id is not null GROUP BY plan_id)t2 on t.plan_id =t2.plan_id</if>
+        application.app_bytedance_material_info t
+        LEFT JOIN application.bytedance_material_video_report_daily_dw t1 on t.material_id=t1.signature
         <where>
-            t1.stat_datetime &gt;=#{startDate}
-            AND t1.stat_datetime &lt;=#{endDate}
+            t1.stat_datetime BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId}
         </where>
         <if test="type == 1">AND t.shot_id is not null and t.shot_id != '' GROUP BY t.shot_id</if>
         <if test="type == 2">AND t.clip_id is not null and t.clip_id != '' GROUP BY t.clip_id</if>
@@ -741,15 +688,18 @@
         t1.signature AS signature,
         IFNULL(t1.video_url, '') AS url,
         t1.cover_url AS coverUrl,
-        t.filename AS materialName,
+        t.material_name AS materialName,
         t1.project_name AS projectName,
-        t.create_time AS createTime,
         ${filed}
         FROM
-        (SELECT * from application.app_bytedance_file_video_get GROUP BY signature,advertiser_id) t
+        application.bytedance_material_video_report_daily_dw t1
         LEFT JOIN
-        application.bytedance_material_video_report_daily_dw t1 on t.advertiser_id=t1.account_id and
-        t.signature=t1.signature
+        application.app_bytedance_material_info t on t.material_id=t1.signature
+        <if test='materialType!=null'>
+            LEFT JOIN
+            application.app_material_tag_busi_info t2 on  t.material_id=t1.material_id
+        </if>
+
         <where>
             and t1.stat_datetime BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
@@ -763,19 +713,20 @@
                 and t1.leader_id=#{leaderId}
             </if>
             <if test='dimension=="designer" and designerId!=null'>
-                and t1.user_id=#{designerId}
+                and (t1.clip_id=#{designerId} or t1.shot_id=#{designerId} or t1.plan_id=#{designerId})
             </if>
             <if test='materialQuality==0'>
-                and t.hot_video_date BETWEEN #{startDate} and #{endDate}
+                and t.faddish_date BETWEEN #{startDate} and #{endDate}
             </if>
             <if test='materialQuality==1'>
-                and t.effective_video_date BETWEEN #{startDate} and #{endDate}
+                and t.effect_date BETWEEN #{startDate} and #{endDate}
             </if>
+
             <if test='materialType==0'>
-                and t.parent_id=60155
+                and t2.parent_id=60155
             </if>
             <if test='materialType==1'>
-                and t.parent_id=60156
+                and t2.parent_id=60156
             </if>
             <if test='innovative==0'>
                 and t.material_innovate=2
@@ -785,7 +736,7 @@
             </if>
             AND t1.company_id=#{companyId}
         </where>
-        GROUP BY t.signature
+        GROUP BY t1.signature
         ORDER BY ${target} ${order}
 
     </select>
@@ -815,22 +766,26 @@
 
 
     <select id="queryKuaishouTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT ROUND(SUM(t1.charge),2) as charge,t.signature,t1.cover_url as 'coverUrl',t1.photo_url as
-        'url',t.photo_name as
+        SELECT ROUND(SUM(t1.charge),2) as charge,tt.material_id,t1.cover_url as 'coverUrl',tt.video_url as 'url',tt.material_name as
         'materialName',
-        t.tag as 'tag'
-        from (select account_id,signature,channel_type,photo_name,GROUP_CONCAT(DISTINCT
-        if(tag_category_id=1,replace(tag_name,'-',','),null)) as'tag',clip_id,shot_id,plan_id
-        from application.app_kuaishou_video_list
-        where
-        channel_type=#{channelType} and tag_category_id=1
-        group by
-        account_id,signature)
-        t
+        tt.tag as 'tag'
+        from (
+        select t.material_id,t.material_name,GROUP_CONCAT(t2.tag_name) as tag,video_url,cover_url from
+        application.app_kuaishou_material_info t left join
+        application.app_material_tag_busi_info t2 on t.material_id=t2.material_id   where tag_category_id=1 and t.company_id=#{companyId}
+
+        <if test='dimension=="designTeam" and leaderId!=null'>
+            and t.leader_id=#{leaderId}
+        </if>
+        <if test='dimension=="designer" and designerId!=null'>
+            and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
+        </if>
+        group by t.material_id
+        ) tt
+
         left join
-        (select charge,project_id,leader_id,stat_date,company_id,signature,account_id,photo_url,cover_url from application.kuaishou_material_video_report_daily_dw  ) t1
-        on t.signature = t1.signature and
-        t.account_id=t1.account_id
+        application.kuaishou_material_video_report_daily_dw t1 on t1.signature=tt.material_id
+
         <where>
             <if test='dimension=="project" and projects!=null'>
                 AND t1.project_id IN
@@ -839,17 +794,9 @@
                     #{item}
                 </foreach>
             </if>
-            <if test='dimension=="designTeam" and leaderId!=null'>
-                and t1.leader_id=#{leaderId}
-            </if>
-            <if test='dimension=="designer" and designerId!=null'>
-                and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
-            </if>
-            AND t1.stat_date &gt;= #{startDate}
-            AND t1.stat_date &lt;= #{endDate}
-            AND t1.company_id=#{companyId}
+            AND t1.stat_date between #{startDate} and #{endDate}
         </where>
-        GROUP BY t.signature
+        GROUP BY tt.material_id
         ORDER BY SUM(t1.charge) DESC LIMIT 5
     </select>
 
@@ -857,14 +804,16 @@
         SELECT
         IFNULL(t1.photo_url, '') AS url,
         t1.cover_url AS coverUrl,
-        t.photo_name AS materialName,
-        t.stat_date AS createTime,
+        t.material_name AS materialName,
         ${filed}
         FROM
-        (SELECT * from application.app_kuaishou_video_list GROUP BY signature,account_id) t
+        application.kuaishou_material_video_report_daily_dw t1
         LEFT JOIN
-        application.kuaishou_material_video_report_daily_dw t1 on t.account_id=t1.account_id and
-        t.signature=t1.signature
+        application.app_kuaishou_material_info t on  t1.signature=t.material_id
+        <if test='materialType!=null'>
+            LEFT JOIN
+            application.app_material_tag_busi_info t2 on  t.material_id=t1.material_id
+        </if>
         <where>
             t1.stat_date BETWEEN #{startDate} and #{endDate}
             <if test='dimension=="project" and projects!=null'>
@@ -878,21 +827,21 @@
                 and t1.leader_id=#{leaderId}
             </if>
             <if test='dimension=="designer" and designerId!=null'>
-                and t1.user_id=#{designerId}
+                and (t1.clip_id=#{designerId} or t1.shot_id=#{designerId} or t1.plan_id=#{designerId})
             </if>
             <choose>
                 <when test='materialQuality==0'>
-                    and t.hot_video_date BETWEEN #{startDate} and #{endDate}
+                    and t.faddish_date BETWEEN #{startDate} and #{endDate}
                 </when>
                 <when test='materialQuality==1'>
-                    and t.effective_video_date BETWEEN #{startDate} and #{endDate}
+                    and t.effect_date BETWEEN #{startDate} and #{endDate}
                 </when>
             </choose>
             <if test='materialType==0'>
-                and t.parent_id=60155
+                and t2.parent_id=60155
             </if>
             <if test='materialType==1'>
-                and t.parent_id=60156
+                and t2.parent_id=60156
             </if>
             <if test='innovative==0'>
                 and t.material_innovate=2
@@ -902,7 +851,7 @@
             </if>
             AND t1.company_id=#{companyId}
         </where>
-        GROUP BY t.signature
+        GROUP BY t1.signature
         ORDER BY ${target} ${order}
     </select>
 
@@ -1592,24 +1541,16 @@
         MAX( case tt.label WHEN 'other' then tt.size ELSE 0 end ) 'other'
         from
         (
-        SELECT COUNT( distinct t1.signature) as 'size',
-        case when t.parent_name='其他' then 'other' when t.parent_name='制作' then 'making' when t.parent_name='真人' then
+        SELECT COUNT( distinct t.material_id) as 'size',
+        case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from (
-        select advertiser_id,signature,create_time,parent_name,tag_category_id,leader_id,parent_id,clip_id,shot_id,plan_id from
-        application.app_bytedance_file_video_get
-        where
-        tag_category_id=1
-        and create_time &gt;= str_to_date(#{startDate}, '%Y-%m-%d')
-        and create_time &lt;=str_to_date(#{endDate}, '%Y-%m-%d')
-        group by
-        advertiser_id,signature
-        ) t
-        left join application.bytedance_material_video_report_daily_dw t1 on t.signature = t1.signature and
-        t.advertiser_id=t1.account_id
+        from  application.app_bytedance_material_info t
+        left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        left join ctop_user_allocation t1 on t.leader_id = t1.user_id
         <where>
-
-            and t1.company_id=#{companyId}
+            t.media_time between #{startDate} and #{endDate}
+            and t2.tag_category_id=1
+            and t.company_id=#{companyId}
             <if test='dimension=="project" and projects!=null and projects.size>0'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -1624,7 +1565,7 @@
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
         </where>
-        GROUP BY t.parent_id
+        GROUP BY t2.parent_id
         )tt
     </select>
 
@@ -1638,21 +1579,14 @@
         from
         (
         SELECT ROUND(SUM(t1.cost),2) as 'cost',
-        case when t.parent_name='其他' then 'other' when t.parent_name='制作' then 'making' when t.parent_name='真人' then
+        case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from (
-        select advertiser_id,signature,create_time,parent_name,tag_category_id,leader_id,parent_id,clip_id,shot_id,plan_id from
-        application.app_bytedance_file_video_get
-        where
-        create_time &gt;= str_to_date(#{startDate}, '%Y-%m-%d')
-        and create_time &lt;=str_to_date(#{endDate}, '%Y-%m-%d')
-        and tag_category_id=1
-        group by
-        advertiser_id,signature
-        ) t
-        left join application.bytedance_material_video_report_daily_dw t1 on t.signature = t1.signature and
-        t.advertiser_id=t1.account_id
+        from application.app_bytedance_material_info t
+        left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        left join application.bytedance_material_video_report_daily_dw t1 on t.material_id = t1.signature
         <where>
+            t1.stat_datetime between #{startDate} and #{endDate}
+            and t2.tag_category_id=1
             and t1.company_id=#{companyId}
             <if test='dimension=="project" and projects!=null and projects.size>0'>
                 AND t1.project_id IN
@@ -1668,7 +1602,7 @@
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
         </where>
-        GROUP BY t.parent_id
+        GROUP BY t2.parent_id
         ) tt
     </select>
 
@@ -1680,22 +1614,16 @@
         MAX( case tt.label WHEN 'other' then tt.size ELSE 0 end ) 'other'
         from
         (
-        SELECT COUNT( distinct t1.signature) as 'size',
-        case when t.parent_name='其他' then 'other' when t.parent_name='制作' then 'making' when t.parent_name='真人' then
+        SELECT COUNT( distinct t.material_id) as 'size',
+        case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from (select account_id,signature,stat_date,parent_name,tag_category_id,parent_id,leader_id,clip_id,shot_id,plan_id from
-        application.app_kuaishou_video_list
-        where
-        tag_category_id=1
-        and stat_date &gt;=str_to_date(#{startDate}, '%Y-%m-%d')
-        and stat_date &lt;=str_to_date(#{endDate}, '%Y-%m-%d')
-        group by
-        account_id,signature)
-        t
-        left join application.kuaishou_material_video_report_daily_dw t1 on t.signature = t1.signature and
-        t.account_id=t1.account_id
+        from  application.app_kuaishou_material_info t
+        left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        left join ctop_user_allocation t1 on t.leader_id = t1.user_id
         <where>
-            and t1.company_id=#{companyId}
+            t.media_time between #{startDate} and #{endDate}
+            and t2.tag_category_id=1
+            and t.company_id=#{companyId}
             <if test='dimension=="project" and projects!=null and projects.size>0'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
@@ -1710,13 +1638,13 @@
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
         </where>
-        GROUP BY t.parent_id
+        GROUP BY t2.parent_id
         )tt
     </select>
 
 
     <!-- 快手根据标签查询消耗-->
-    <select id="getKuaishouMaterialCountByCost" resultType="com.alibaba.fastjson.JSONObject">
+     <select id="getKuaishouMaterialCountByCost" resultType="com.alibaba.fastjson.JSONObject">
 
         SELECT MAX(case tt.label WHEN 'making' then tt.cost ELSE 0 end ) 'making' ,
         MAX( case tt.label WHEN 'reality' then tt.cost ELSE 0 end ) 'reality',
@@ -1724,23 +1652,17 @@
         from
         (
         SELECT ROUND(SUM(t1.charge),2) as 'cost',
-        case when t.parent_name='其他' then 'other' when t.parent_name='制作' then 'making' when t.parent_name='真人' then
+        case when t2.parent_name='其他' then 'other' when t2.parent_name='制作' then 'making' when t2.parent_name='真人' then
         'reality' end as 'label'
-        from (select account_id,signature,stat_date,parent_name,tag_category_id,parent_id,leader_id,clip_id,shot_id,plan_id from
-        application.app_kuaishou_video_list
-        where
-        tag_category_id=1
-        and stat_date &gt;=str_to_date(#{startDate}, '%Y-%m-%d')
-        and stat_date &lt;=str_to_date(#{endDate}, '%Y-%m-%d')
-        group by
-        account_id,signature)
-        t
-        left join application.kuaishou_material_video_report_daily_dw t1 on t.signature = t1.signature and
-        t.account_id=t1.account_id
-        <where>
+        from application.app_bytedance_material_info t
+        left join application.app_material_tag_busi_info t2 on t.material_id=t2.material_id
+        left join application.kuaishou_material_video_report_daily_dw t1 on t.material_id = t1.signature
 
+        <where>
+            t1.stat_date between #{startDate} and #{endDate}
+            and t2.tag_category_id=1
             and t1.company_id=#{companyId}
-            <if test='dimension=="project" and projects!=null and projects.size>0 '>
+            <if test='dimension=="project" and projects!=null and projects.size>0'>
                 AND t1.project_id IN
                 <foreach collection="projects" item="item" separator=","
                          open="(" close=")">
@@ -1754,8 +1676,8 @@
                 and (t.clip_id=#{designerId} or t.shot_id=#{designerId} or t.plan_id=#{designerId})
             </if>
         </where>
-        GROUP BY t.parent_id
-        )tt
+        GROUP BY t2.parent_id
+        ) tt
     </select>
 
 </mapper>

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/IMaterialReportOverViewV2Service.java

@@ -47,7 +47,7 @@ public interface IMaterialReportOverViewV2Service {
     void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response);
 
     //查询设计人员排行榜
-    PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate, Integer type, int pageNUmber, int pageSize);
+    PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate,String userId, Integer type, int pageNUmber, int pageSize);
 
     // 视频详情页
     JSONObject getMaterialDetailInfo(int mediaId, String md5);

+ 24 - 17
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialReportOverViewV2ServiceImpl.java

@@ -161,16 +161,19 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         }
         //根据userID查询公司id
         String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
+        startDate=startDate.replace("-", "");
+        endDate=endDate.replace("-", "");
+
 
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
             //视频上新
-            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountList(startDate + " 00:00:00", endDate + " 23:59:59", projects, dimension, leaderId, designerId, companyId);
+            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountList(Long.parseLong(startDate) , Long.parseLong(endDate) , projects, dimension, leaderId, designerId, companyId);
             //总数
             long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("videoList", videoList);
             result.put("videoTotal", videoTotal);
             //素材使用率 = 有消耗的素材 / 总数 * 100%
-            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostList(startDate + " 00:00:00", endDate + " 23:59:59", projects, dimension, leaderId, designerId, companyId);
+            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostList(Long.parseLong(startDate) , Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             result.put("useCompare", Check.isNull(videoCost) ? 0 : new BigDecimal(videoCost).divide(new BigDecimal(videoTotal), 4, RoundingMode.HALF_UP));
             //有效视频
             List<Map<String, String>> effectiveList = materialReportOverViewV3Mapper.selectEffectiveMaterialVideoBytedance(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), projects, dimension, leaderId, designerId, companyId);
@@ -184,13 +187,13 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
 
             //视频上新
-            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountListKs(startDate + " 00:00:00", endDate + " 23:59:59", projects, dimension, leaderId, designerId, companyId);
+            List<Map<String, String>> videoList = materialReportOverViewV3Mapper.queryMaterialCountListKs(Long.parseLong(startDate) , Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             //总数
             long videoTotal = videoList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("videoList", videoList);
             result.put("videoTotal", videoTotal);
             //素材使用率 = 有消耗的素材 / 总数 * 100%
-            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostListKs(startDate + " 00:00:00", endDate + " 23:59:59", projects, dimension, leaderId, designerId, companyId);
+            long videoCost = materialReportOverViewV3Mapper.queryMaterialCostListKs(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), projects, dimension, leaderId, designerId, companyId);
             result.put("useCompare", Check.isNull(videoCost) ? 0 : new BigDecimal(videoCost).divide(new BigDecimal(videoTotal), 4, RoundingMode.HALF_UP));
             //有效视频
             List<Map<String, String>> effectiveList = materialReportOverViewV3Mapper.selectEffectiveMaterialVideoKs(Long.parseLong(startDate.replace("-", "")), Long.parseLong(endDate.replace("-", "")), projects, dimension, leaderId, designerId, companyId);
@@ -225,7 +228,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("hotList", hotList);
             result.put("hotTotal", hotTotal);
-            //上阶段
+           /* //上阶段
             List<Map<String, String>> lastHostList = materialReportOverViewV3Mapper.selectHotMaterialVideoBytedance(Long.parseLong(DateUtils.addDayParse(startDate, -DateUtils.dateDiffParse(startDate, endDate) - 1)), Long.parseLong(DateUtils.addDayParse(startDate, -1)), projects, dimension, leaderId, designerId, companyId, type);
             long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
@@ -237,7 +240,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //日环比 (昨日-前日)/前日消耗 X 100%
-            result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));
+            result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));*/
 
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
             //爆款视频
@@ -246,7 +249,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             long hotTotal = hotList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             result.put("hotList", hotList);
             result.put("hotTotal", hotTotal);
-            //上阶段
+         /*   //上阶段
             List<Map<String, String>> lastHostList = materialReportOverViewV3Mapper.selectHotMaterialVideoKs(Long.parseLong(DateUtils.addDayParse(startDate, -DateUtils.dateDiffParse(startDate, endDate) - 1)), Long.parseLong(DateUtils.addDayParse(startDate, -1)), projects, dimension, leaderId, designerId, companyId, type);
             long lastHotTotal = lastHostList.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //同比 (本阶段截止昨天的爆款视频数量-上一个阶段截止和昨天对应日期的爆款视频数量)/上一个阶段截止和昨天对应日期的爆款视频数量X 100%
@@ -258,7 +261,7 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             long yesterday = yesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             long before = beforeYesterdayHost.stream().collect(Collectors.summarizingInt(s -> Integer.valueOf(String.valueOf(s.get("count"))))).getSum();
             //日环比 (昨日-前日)/前日消耗 X 100%
-            result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));
+            result.put("hostCompare", countLink(new BigDecimal(yesterday), new BigDecimal(before)));*/
         }
         return result;
     }
@@ -468,22 +471,24 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
     }
 
     @Override
-    public PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate, Integer type, int pageNumber, int pageSize) {
+    public PageInfo getTopDesignList(Integer mediaId, String startDate, String endDate,String userId, Integer type, int pageNumber, int pageSize) {
 
         startDate = startDate.replace("-", "");
         endDate = endDate.replace("-", "");
         List<JSONObject> result = new ArrayList<>();
         int total=0;
         int page=pageNumber;
+        //根据userID查询公司id
+        String companyId = materialReportOverViewV3Mapper.getCompanyId(userId);
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
-            total=materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type).size();
+            total=materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId).size();
             PageHelper.startPage(pageNumber, pageSize,false);
-            result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type);
+            result = materialReportOverViewV3Mapper.queryBytedanceTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId);
 
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
-            total= materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type).size();
+            total= materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId).size();
             PageHelper.startPage(pageNumber, pageSize,false);
-            result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type);
+            result = materialReportOverViewV3Mapper.queryKuaishouTopDesign(Long.parseLong(startDate), Long.parseLong(endDate), type,companyId);
         }
         int number=(page-1)*10+1;
         for (JSONObject jsonObject : result) {
@@ -791,17 +796,19 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
         if (projects != null && projects.isEmpty()) {
             projects = getProjectsByCurrentUser(mediaId);
         }
+        startDate=startDate.replace("-","");
+        endDate=endDate.replace("-","");
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
             //头条
             if (type == 0) {
                 //素材数
                 //获取真人 制作 其他 数量
-                object = materialReportOverViewV3Mapper.getBytedanceMaterialCountByLable(startDate, endDate, projects, dimension, leaderId, designerId, companyId);
+                object = materialReportOverViewV3Mapper.getBytedanceMaterialCountByLable(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
 
             } else if (type == 1) {
                 //消耗
                 //获取真人 制作 其他 数量
-                object = materialReportOverViewV3Mapper.getBytedanceMaterialCountByCost(startDate, endDate, projects, dimension, leaderId, designerId, companyId);
+                object = materialReportOverViewV3Mapper.getBytedanceMaterialCountByCost(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             }
 
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
@@ -809,11 +816,11 @@ public class MaterialReportOverViewV2ServiceImpl implements IMaterialReportOverV
             if (type == 0) {
                 //素材数
                 //获取真人 制作 其他 数量
-                object = materialReportOverViewV3Mapper.getKuaishouMaterialCountByLable(startDate, endDate, projects, dimension, leaderId, designerId, companyId);
+                object = materialReportOverViewV3Mapper.getKuaishouMaterialCountByLable(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             } else if (type == 1) {
                 //消耗
                 //获取真人 制作 其他 数量
-                object = materialReportOverViewV3Mapper.getKuaishouMaterialCountByCost(startDate, endDate, projects, dimension, leaderId, designerId, companyId);
+                object = materialReportOverViewV3Mapper.getKuaishouMaterialCountByCost(Long.parseLong(startDate), Long.parseLong(endDate), projects, dimension, leaderId, designerId, companyId);
             }
         }