|
@@ -264,15 +264,15 @@
|
|
|
|
|
|
|
|
<select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
|
|
<select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
|
|
|
select
|
|
select
|
|
|
- tb4.ly_movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name, tb4.movie_type,
|
|
|
|
|
|
|
+ tb4.movie_name as movie_name, tb4.movie_project_source, tb6.dict_name as movie_project_source_name, tb4.movie_type,
|
|
|
case
|
|
case
|
|
|
- when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 1
|
|
|
|
|
|
|
+ when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 1
|
|
|
and 3 then '新剧1阶'
|
|
and 3 then '新剧1阶'
|
|
|
- when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 4
|
|
|
|
|
|
|
+ when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 4
|
|
|
and 7 then '新剧2阶'
|
|
and 7 then '新剧2阶'
|
|
|
- when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 8
|
|
|
|
|
|
|
+ when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) between 8
|
|
|
and 15 then '次新剧'
|
|
and 15 then '次新剧'
|
|
|
- when (DATEDIFF(STR_TO_DATE(tb1.stat_date, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) >=15 then
|
|
|
|
|
|
|
+ when (DATEDIFF(STR_TO_DATE(${date}, '%Y%m%d'), STR_TO_DATE(tb4.project_ad_date, '%Y%m%d')) + 1) >=15 then
|
|
|
'老剧'
|
|
'老剧'
|
|
|
else 999 end as project_ad_step,
|
|
else 999 end as project_ad_step,
|
|
|
<include refid="endAmount"/>,
|
|
<include refid="endAmount"/>,
|
|
@@ -287,43 +287,46 @@
|
|
|
<include refid="iapCostAmount"/>,
|
|
<include refid="iapCostAmount"/>,
|
|
|
round(ifnull(sum(hour_cost_amount), 0), 2) as hour_cost_amount
|
|
round(ifnull(sum(hour_cost_amount), 0), 2) as hour_cost_amount
|
|
|
from
|
|
from
|
|
|
- (select ${date} as stat_date, movie_id from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
|
|
- union select ${date} as stat_date, movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))) tb1
|
|
|
|
|
- left join
|
|
|
|
|
(
|
|
(
|
|
|
- select movie_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
|
|
|
|
|
|
|
+ select ma_appid, movie_id, sum(iaa_cost_amount) as iaa_cost_amount, sum(iaa_real_cost_amount) as iaa_real_cost_amount,
|
|
|
sum(iap_cost_amount) as iap_cost_amount, sum(iap_real_cost_amount) as iap_real_cost_amount,
|
|
sum(iap_cost_amount) as iap_cost_amount, sum(iap_real_cost_amount) as iap_real_cost_amount,
|
|
|
sum(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
|
|
sum(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
|
|
|
sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
|
|
sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
|
|
|
from
|
|
from
|
|
|
- (select movie_id, round(ifnull(sum(cost_amount),0),2) as iaa_cost_amount, sum(real_cost_amount) as iaa_real_cost_amount, 0 as iap_cost_amount, 0 as iap_real_cost_amount
|
|
|
|
|
- from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAA')
|
|
|
|
|
- group by movie_id
|
|
|
|
|
|
|
+ (select ma_appid, movie_id, round(ifnull(sum(cost_amount),0),2) as iaa_cost_amount, sum(real_cost_amount) as iaa_real_cost_amount, 0 as iap_cost_amount, 0 as iap_real_cost_amount
|
|
|
|
|
+ from application.media_ad_report_daily where stat_date=${date}
|
|
|
|
|
+ and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAA')
|
|
|
|
|
+ group by ma_appid, movie_id
|
|
|
union all
|
|
union all
|
|
|
- select movie_id, 0 as iaa_cost_amount, 0 as iaa_real_cost_amount,round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
|
|
- from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAP')
|
|
|
|
|
- group by movie_id) subt2
|
|
|
|
|
- group by movie_id
|
|
|
|
|
- ) tb2 on tb1.movie_id=tb2.movie_id
|
|
|
|
|
- left join
|
|
|
|
|
- (select movie_id, sum(iaa_amount) as iaa_amount, sum(pay_amount) as pay_amount,
|
|
|
|
|
|
|
+ select ma_appid, movie_id, 0 as iaa_cost_amount, 0 as iaa_real_cost_amount,round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
|
|
+ from application.media_ad_report_daily where stat_date=${date}
|
|
|
|
|
+ and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10) and business_method='IAP')
|
|
|
|
|
+ group by ma_appid, movie_id) subt2
|
|
|
|
|
+ group by ma_appid, movie_id
|
|
|
|
|
+ ) tb2
|
|
|
|
|
+ full join
|
|
|
|
|
+ (select ma_appid, movie_id, sum(iaa_amount) as iaa_amount, sum(pay_amount) as pay_amount,
|
|
|
sum(share_iaa_amount_3) as share_iaa_amount_3,
|
|
sum(share_iaa_amount_3) as share_iaa_amount_3,
|
|
|
ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
|
|
ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
|
|
|
ifnull(sum(share_pay_amount), 0) as share_pay_amount
|
|
ifnull(sum(share_pay_amount), 0) as share_pay_amount
|
|
|
from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
- group by movie_id
|
|
|
|
|
- ) tb3 on tb1.movie_id=tb3.movie_id
|
|
|
|
|
|
|
+ group by ma_appid, movie_id
|
|
|
|
|
+ ) tb3 on tb2.movie_id=tb3.movie_id and tb2.ma_appid = tb3.ma_appid
|
|
|
|
|
+ left join tidb.deepthink.mini_app_info app on coalesce(tb2.ma_appid, tb3.ma_appid)=app.app_id
|
|
|
left join
|
|
left join
|
|
|
- (select moive_id, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name, movie_type from tidb.deepthink.all_moive
|
|
|
|
|
- ) tb4 on tb1.movie_id=tb4.moive_id
|
|
|
|
|
|
|
+ (select moive_id as movie_id, movie_name, standard_movie_id, standard_movie_name, movie_source, movie_project_source,project_ad_date, ly_movie_name, movie_type from tidb.deepthink.all_moive
|
|
|
|
|
+ ) tb4
|
|
|
|
|
+ on coalesce(tb2.movie_id, tb3.movie_id)=tb4.movie_id and find_in_set(tb4.movie_source, app.movie_sources)> 0
|
|
|
left join
|
|
left join
|
|
|
- (select movie_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_ad_report_hourly
|
|
|
|
|
|
|
+ (select ma_appid, movie_id, ifnull(sum(cost_amount), 0) as hour_cost_amount
|
|
|
|
|
+ from application.media_ad_report_hourly
|
|
|
where stat_date=${date} and `hour`=${hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
where stat_date=${date} and `hour`=${hour} and ma_appid in (select app_id from tidb.deepthink.mini_app_info where business_line in (1,6,7,4,8,9,10))
|
|
|
- group by movie_id) tb5 on tb1.movie_id=tb5.movie_id
|
|
|
|
|
|
|
+ group by ma_appid, movie_id
|
|
|
|
|
+ ) tb5 on tb4.movie_id=tb5.movie_id and app.app_id = tb5.ma_appid
|
|
|
left join
|
|
left join
|
|
|
(select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
|
|
(select dict_key, dict_name from tidb.deepthink.dt_dictionary where select_key='movie_project_source'
|
|
|
) tb6 on tb4.movie_project_source=tb6.dict_key
|
|
) tb6 on tb4.movie_project_source=tb6.dict_key
|
|
|
- where 1=1 and tb1.movie_id != '-9999'
|
|
|
|
|
|
|
+ where 1=1 and tb4.movie_id != '-9999'
|
|
|
group by 1,2,3,4,5
|
|
group by 1,2,3,4,5
|
|
|
order by ${sort}
|
|
order by ${sort}
|
|
|
limit 20
|
|
limit 20
|