|
@@ -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 >= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
|
|
|
- and create_time <= 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 >= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
|
|
|
- and stat_date <= 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 >= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
|
|
|
- and create_time <= 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 >= str_to_date(#{startDate}, '%Y-%m-%d %H:%i:%s')
|
|
|
- and stat_date <=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 >= #{startDate}
|
|
|
- and effective_video_date <= #{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 >= #{startDate}
|
|
|
- and effective_video_date <= #{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 >= #{startDate}
|
|
|
- and hot_video_date <= #{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 >= #{startDate}
|
|
|
- and hot_video_date <= #{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 >= #{startDate}
|
|
|
- AND t1.stat_datetime <= #{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 >=#{startDate}
|
|
|
- AND t1.stat_datetime <=#{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 >= #{startDate}
|
|
|
- AND t1.stat_date <= #{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 >= str_to_date(#{startDate}, '%Y-%m-%d')
|
|
|
- and create_time <=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 >= str_to_date(#{startDate}, '%Y-%m-%d')
|
|
|
- and create_time <=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 >=str_to_date(#{startDate}, '%Y-%m-%d')
|
|
|
- and stat_date <=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 >=str_to_date(#{startDate}, '%Y-%m-%d')
|
|
|
- and stat_date <=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>
|