|
@@ -18,15 +18,15 @@
|
|
|
from
|
|
from
|
|
|
(select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
(select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
from application.media_ad_report_daily
|
|
from application.media_ad_report_daily
|
|
|
- where stat_date = #{date}
|
|
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
) tb1,
|
|
) tb1,
|
|
|
(select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
(select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
from application.user_data_report_daily
|
|
from application.user_data_report_daily
|
|
|
- where stat_date = #{date}
|
|
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
) tb2
|
|
) tb2
|
|
|
</select>
|
|
</select>
|
|
|
- <select id="tmpPushHourData" resultType="java.util.Map">
|
|
|
|
|
|
|
+ <select id="adHourData" resultType="java.util.Map">
|
|
|
select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
|
|
select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
|
|
|
concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
ifnull(sum(cost_amount),0) AS cost_amount,
|
|
ifnull(sum(cost_amount),0) AS cost_amount,
|
|
@@ -38,12 +38,12 @@
|
|
|
from
|
|
from
|
|
|
(select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
(select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
from application.media_ad_report_hourly
|
|
from application.media_ad_report_hourly
|
|
|
- where stat_date = #{date} and `hour`= #{hour}
|
|
|
|
|
|
|
+ where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
) tb1,
|
|
) tb1,
|
|
|
(select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
(select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
from application.user_data_report_hourly
|
|
from application.user_data_report_hourly
|
|
|
- where stat_date = #{date} and `hour`= #{hour}
|
|
|
|
|
|
|
+ where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
) tb2
|
|
) tb2
|
|
|
</select>
|
|
</select>
|
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
<select id="tmpTopMovie" resultType="java.util.Map">
|
|
@@ -53,17 +53,18 @@
|
|
|
concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
|
|
concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
|
|
|
concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi
|
|
concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi
|
|
|
from
|
|
from
|
|
|
- (select product_id from application.media_product_report_daily where stat_date=${date}
|
|
|
|
|
- union select movie_id from application.user_data_report_daily where stat_date=${date}) tb1
|
|
|
|
|
|
|
+ (select product_id from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ union select movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ ) tb1
|
|
|
left join
|
|
left join
|
|
|
(select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
(select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
- from application.media_product_report_daily where stat_date=${date}
|
|
|
|
|
|
|
+ from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by product_id
|
|
group by product_id
|
|
|
) tb2 on tb1.product_id=tb2.product_id
|
|
) tb2 on tb1.product_id=tb2.product_id
|
|
|
left join
|
|
left join
|
|
|
(select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
|
|
(select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
|
|
|
ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
|
|
ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
|
|
|
- from application.user_data_report_daily where stat_date=${date}
|
|
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by movie_id
|
|
group by movie_id
|
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
) tb3 on tb1.product_id=tb3.movie_id
|
|
|
left join
|
|
left join
|
|
@@ -75,6 +76,64 @@
|
|
|
limit 10
|
|
limit 10
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <select id="adDailyData" resultType="java.util.Map">
|
|
|
|
|
+ select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
|
|
|
|
|
+ concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
|
|
+ ifnull(sum(cost_amount),0) AS cost_amount,
|
|
|
|
|
+ round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(round(sum(real_cost_amount), 2), 0) AS real_profit,
|
|
|
|
|
+ ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0) AS water_profit,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as end_amount,
|
|
|
|
|
+ date_format(update_time, '%Y-%m-%d %H:%i:%s') as update_time
|
|
|
|
|
+ from
|
|
|
|
|
+ (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
|
|
+ from application.media_ad_report_daily
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ ) tb1,
|
|
|
|
|
+ (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
|
|
+ sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
|
|
+ from application.user_data_report_daily
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ ) tb2
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="todayTopMovie" resultType="com.alibaba.fastjson.JSONObject" >
|
|
|
|
|
+ select tb4.standard_movie_id,
|
|
|
|
|
+ tb4.standard_movie_name as movie_name,
|
|
|
|
|
+ group_concat(distinct case tb4.movie_source when 2 then 2 else 1 end) as movie_source,
|
|
|
|
|
+ sum(share_end_amount) as share_end_amount, sum(end_amount) as end_amount,
|
|
|
|
|
+ sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount,
|
|
|
|
|
+ concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
|
|
|
|
|
+ concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
|
|
+ round(ifnull(sum(hour_cost_amount), 0), 2) as hour_cost_amount
|
|
|
|
|
+ from
|
|
|
|
|
+ (select product_id from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ union select movie_id from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))) tb1
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
|
|
+ from application.media_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by product_id
|
|
|
|
|
+ ) tb2 on tb1.product_id=tb2.product_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by movie_id
|
|
|
|
|
+ ) tb3 on tb1.product_id=tb3.movie_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source from deepthink.all_moive
|
|
|
|
|
+ ) tb4 on tb1.product_id=tb4.moive_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select product_id, ifnull(sum(cost_amount), 0) as hour_cost_amount from application.media_product_report_hourly
|
|
|
|
|
+ where stat_date=${date} and `hour`=${hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by product_id) tb5 on tb1.product_id=tb5.product_id
|
|
|
|
|
+ where 1=1 and tb1.product_id != '-9999'
|
|
|
|
|
+ group by tb4.standard_movie_name
|
|
|
|
|
+ order by sum(end_amount) desc
|
|
|
|
|
+ limit 10
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
<select id="optimizerCostRank" resultType="java.util.Map">
|
|
<select id="optimizerCostRank" resultType="java.util.Map">
|
|
|
select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id, tb5.dept_name,
|
|
select tb1.user_id, tb4.phonenumber, tb4.nick_name, tb4.dept_id, tb5.dept_name,
|
|
@@ -84,10 +143,12 @@
|
|
|
from
|
|
from
|
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
- from application.media_ad_report_daily where stat_date=#{date} group by advertiser_id) tb2
|
|
|
|
|
|
|
+ from application.media_ad_report_daily where stat_date=#{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb2
|
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
- from application.user_data_report_daily where stat_date=#{date} group by advertiser_id) tb3
|
|
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=#{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb3
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
@@ -110,13 +171,13 @@
|
|
|
left join
|
|
left join
|
|
|
(select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
(select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
from application.media_ad_report_daily
|
|
from application.media_ad_report_daily
|
|
|
- where stat_date = #{date}
|
|
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
|
|
group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join
|
|
left join
|
|
|
(select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
(select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
from application.user_data_report_daily
|
|
from application.user_data_report_daily
|
|
|
- where stat_date = #{date}
|
|
|
|
|
|
|
+ where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
@@ -135,13 +196,13 @@
|
|
|
left join
|
|
left join
|
|
|
(select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
(select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
from application.media_ad_report_hourly
|
|
from application.media_ad_report_hourly
|
|
|
- where stat_date = #{date} and `hour`= #{hour}
|
|
|
|
|
|
|
+ where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
|
|
group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join
|
|
left join
|
|
|
(select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
(select advertiser_id, sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
from application.user_data_report_hourly
|
|
from application.user_data_report_hourly
|
|
|
- where stat_date = #{date} and `hour`= #{hour}
|
|
|
|
|
|
|
+ where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
group by advertiser_id) tb3 on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber from deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber from deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
@@ -158,10 +219,12 @@
|
|
|
from
|
|
from
|
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
- from application.media_ad_report_daily where stat_date=#{date} group by advertiser_id) tb2
|
|
|
|
|
|
|
+ from application.media_ad_report_daily where stat_date=#{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb2
|
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount_hour
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount_hour
|
|
|
- from application.media_ad_report_hourly where stat_date=#{date} and `hour`= ${hour} group by advertiser_id) tb3
|
|
|
|
|
|
|
+ from application.media_ad_report_hourly where stat_date=#{date} and `hour`= ${hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb3
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
@@ -244,10 +307,12 @@
|
|
|
from
|
|
from
|
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
(select cast(advertiser_id as char) advertiser_id, user_id from deepthink.advertiser_bind_info) tb1
|
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
left join (select advertiser_id, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
- from application.media_ad_report_daily where stat_date=${date} group by advertiser_id) tb2
|
|
|
|
|
|
|
+ from application.media_ad_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb2
|
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
on tb1.advertiser_id = tb2.advertiser_id
|
|
|
left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
left join (select advertiser_id, sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
- from application.user_data_report_daily where stat_date=${date} group by advertiser_id) tb3
|
|
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
|
|
|
|
|
+ group by advertiser_id) tb3
|
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
on tb1.advertiser_id = tb3.advertiser_id
|
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
left join (select user_id, nick_name, phonenumber, dept_id from deepthink.sys_user) tb4
|
|
|
on tb1.user_id=tb4.user_id
|
|
on tb1.user_id=tb4.user_id
|
|
@@ -286,4 +351,66 @@
|
|
|
on b.dept_id=c.dept_id
|
|
on b.dept_id=c.dept_id
|
|
|
where stat_datetime=${date} and b.dept_id=${deptId}
|
|
where stat_datetime=${date} and b.dept_id=${deptId}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <select id="allBusinessPushData" resultType="java.util.Map">
|
|
|
|
|
+ select concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (ifnull(sum(iaa_amount),0)+ifnull(sum(pay_amount), 0))/sum(cost_amount)*100 ), 2), '%') AS water_roi,
|
|
|
|
|
+ concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (ifnull(sum(share_iaa_amount),0)+ifnull(sum(share_pay_amount),0))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
|
|
|
|
|
+ ifnull(sum(cost_amount),0) AS cost_amount,
|
|
|
|
|
+ round(ifnull(sum(pay_amount), 0), 2) AS pay_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) as share_iaa_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) - ifnull(round(sum(real_cost_amount), 2), 0) AS real_profit,
|
|
|
|
|
+ ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) - ifnull(sum(cost_amount), 0) AS water_profit,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as end_amount,
|
|
|
|
|
+ date_format(update_time, '%Y-%m-%d %H:%i:%s') as update_time
|
|
|
|
|
+ from
|
|
|
|
|
+ (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount, max(update_time) as update_time
|
|
|
|
|
+ from application.media_ad_report_daily
|
|
|
|
|
+ where stat_date = #{date}
|
|
|
|
|
+ ) tb1,
|
|
|
|
|
+ (select sum(pay_amount) as pay_amount, sum(iaa_amount) as iaa_amount,
|
|
|
|
|
+ sum(share_iaa_amount) as share_iaa_amount, sum(share_pay_amount) as share_pay_amount
|
|
|
|
|
+ from application.user_data_report_daily
|
|
|
|
|
+ where stat_date = #{date}
|
|
|
|
|
+ ) tb2
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="allBusinessTopMovie" resultType="java.util.Map">
|
|
|
|
|
+ select tb4.standard_movie_id, tb4.standard_movie_name as movie_name, group_concat(distinct case tb4.movie_source when 2 then 2 else 1 end) as movie_source,
|
|
|
|
|
+ rank() over (order by sum(end_amount) desc) as rk,
|
|
|
|
|
+ sum(share_end_amount) as share_end_amount, sum(end_amount) as end_amount, sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount,
|
|
|
|
|
+ concat(round(if(ifnull(sum(cost_amount),0)=0, 0, sum(end_amount)/sum(cost_amount)*100), 2), '%') AS water_roi,
|
|
|
|
|
+ concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, sum(share_end_amount)/sum(real_cost_amount)*100), 2), '%') AS real_roi
|
|
|
|
|
+ from
|
|
|
|
|
+ (select product_id from application.media_product_report_daily where stat_date=${date}
|
|
|
|
|
+ union select movie_id from application.user_data_report_daily where stat_date=${date}
|
|
|
|
|
+ ) tb1
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select product_id, round(ifnull(sum(cost_amount),0),2) as cost_amount, sum(real_cost_amount) as real_cost_amount
|
|
|
|
|
+ from application.media_product_report_daily where stat_date=${date}
|
|
|
|
|
+ group by product_id
|
|
|
|
|
+ ) tb2 on tb1.product_id=tb2.product_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select movie_id, ifnull(sum(iaa_amount), 0) + ifnull(sum(pay_amount), 0) as end_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as share_end_amount
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=${date}
|
|
|
|
|
+ group by movie_id
|
|
|
|
|
+ ) tb3 on tb1.product_id=tb3.movie_id
|
|
|
|
|
+ left join
|
|
|
|
|
+ (select moive_id, standard_movie_id, standard_movie_name, movie_source from deepthink.all_moive
|
|
|
|
|
+ ) tb4 on tb1.product_id=tb4.moive_id
|
|
|
|
|
+ where 1=1 and tb1.product_id!='-9999'
|
|
|
|
|
+ group by tb4.standard_movie_name
|
|
|
|
|
+ order by sum(end_amount) desc
|
|
|
|
|
+ limit 10
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="businessTypeData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
+ select ifnull(sum(share_pay_amount),0) as iap_end_amount,
|
|
|
|
|
+ ifnull(sum(share_iaa_amount),0) as iaa_end_amount
|
|
|
|
|
+ from application.user_data_report_daily where stat_date=${date}
|
|
|
|
|
+ and ma_appid in
|
|
|
|
|
+ (select app_id from deepthink.mini_app_info where business_type in
|
|
|
|
|
+ <if test="businessTypes != null and businessTypes.size > 0">
|
|
|
|
|
+ <foreach item="item" index="index" collection="businessTypes" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>)
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|