소스 검색

前一日投放日报-更新

zhaotx 1 년 전
부모
커밋
618e9fd927

+ 91 - 46
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/ReportsAdPushMapper.xml

@@ -8,22 +8,32 @@
     <select id="tmpPushData" 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,
+        concat(round(if(ifnull(sum(iaa_real_cost_amount),0)=0, 0, sum(share_iaa_amount)/sum(iaa_real_cost_amount)*100), 2), '%') AS iaa_roi,
+        concat(round(if(ifnull(sum(iap_real_cost_amount),0)=0, 0, sum(share_pay_amount)/sum(iap_real_cost_amount)*100), 2), '%') AS iap_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
+        ifnull(sum(share_iaa_amount), 0) + ifnull(sum(share_pay_amount), 0) as end_amount
         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))
+        (select 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(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
+        sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
+        FROM
+        (select 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 deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAA')
+        UNION ALL
+        select 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 deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAP'))subtb2
         ) 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
+        (select sum(pay_amount) as pay_amount,
+        sum(iaa_amount) as iaa_amount,
+        ifnull(round(sum(if(share_iaa_amount_3>0,share_iaa_amount_3,share_iaa_amount)),2), 0) 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))
+        where stat_date = ${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         ) tb2
     </select>
     <select id="adHourData" resultType="java.util.Map">
@@ -38,33 +48,50 @@
         from
         (select sum(cost_amount) as cost_amount, sum(real_cost_amount) as real_cost_amount
         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))
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,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_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))
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         ) tb2
     </select>
     <select id="tmpTopMovie" 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
+        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(iaa_amount)+sum(pay_amount) desc) as rk,
+        round(sum(share_pay_amount)+sum(share_iaa_amount),2) as share_end_amount, sum(iaa_amount)+sum(pay_amount) as end_amount,
+        sum(cost_amount) as cost_amount,
+        round(sum(real_cost_amount),2) as real_cost_amount,
+        concat(round(if(ifnull(sum(cost_amount),0)=0, 0, (sum(iaa_amount)+sum(pay_amount))/sum(cost_amount)*100), 2), '%') AS water_roi,
+        concat(round(if(ifnull(sum(real_cost_amount),0)=0, 0, (sum(share_iaa_amount)+sum(share_pay_amount))/sum(real_cost_amount)*100), 2), '%') AS real_roi,
+        concat(round(if(ifnull(sum(iaa_real_cost_amount),0)=0, 0, sum(share_iaa_amount)/sum(iaa_real_cost_amount)*100), 2), '%') AS iaa_roi,
+        concat(round(if(ifnull(sum(iap_real_cost_amount),0)=0, 0, sum(share_pay_amount)/sum(iap_real_cost_amount)*100), 2), '%') AS iap_roi
         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))
+        (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,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,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))
+        (select product_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(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
+        sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
+        from
+        (select product_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_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAA')
+        group by product_id
+        union all
+        select product_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_product_report_daily where stat_date=${date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAP')
+        group by product_id) subt2
         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))
+        (select movie_id, ifnull(sum(iaa_amount), 0) as iaa_amount,
+        ifnull(sum(pay_amount), 0) as pay_amount,
+        ifnull(sum(share_pay_amount), 0) as share_pay_amount,
+        ifnull(sum(if(share_iaa_amount_3>0,share_iaa_amount_3,share_iaa_amount)), 0) as share_iaa_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,3,8))
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
@@ -72,7 +99,7 @@
         ) 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
+        order by sum(iaa_amount)+sum(pay_amount) desc
         limit 10
     </select>
 
@@ -89,12 +116,12 @@
         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))
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,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))
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         ) tb2
     </select>
 
@@ -108,17 +135,17 @@
         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
+        (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,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,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))
+        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,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))
+        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,3,8))
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id
         left join
@@ -126,7 +153,7 @@
         ) 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))
+        where stat_date=${date} and `hour`=${hour}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,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
@@ -143,11 +170,11 @@
         from
         (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
-        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))
+        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,3,8))
         group by advertiser_id) tb2
         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
-        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))
+        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,3,8))
         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
@@ -171,13 +198,13 @@
         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
         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))
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
         left join
         (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
         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))
+        where stat_date = #{date} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         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
         on tb1.user_id=tb4.user_id
@@ -196,13 +223,13 @@
         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
         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))
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         group by advertiser_id) tb2 on tb1.advertiser_id = tb2.advertiser_id
         left join
         (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
         from application.user_data_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))
+        where stat_date = #{date} and `hour`= #{hour} and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,3,8))
         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
         on tb1.user_id=tb4.user_id
@@ -219,11 +246,11 @@
         from
         (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
-        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))
+        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,3,8))
         group by advertiser_id) tb2
         on tb1.advertiser_id = tb2.advertiser_id
         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}  and ma_appid in (select app_id from deepthink.mini_app_info where business_type in (1,2,3,8))
+        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,3,8))
         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
@@ -303,15 +330,31 @@
         select tb4.dept_id, tb5.dept_name,
         rank() over (order by sum(cost_amount) desc) as rk,
         ifnull(sum(cost_amount), 0) as cost_amount,
-        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,
+        concat(round(if(ifnull(sum(iaa_real_cost_amount),0)=0, 0, sum(share_iaa_amount)/sum(iaa_real_cost_amount)*100), 2), '%') AS iaa_roi,
+        concat(round(if(ifnull(sum(iap_real_cost_amount),0)=0, 0, sum(share_pay_amount)/sum(iap_real_cost_amount)*100), 2), '%') AS iap_roi
         from
         (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
-        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
+        left join
+        (select advertiser_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(iaa_cost_amount)+sum(iap_cost_amount) as cost_amount,
+        sum(iaa_real_cost_amount)+sum(iap_real_cost_amount) as real_cost_amount
+        FROM
+        (select advertiser_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 deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAA')
+        group by advertiser_id
+        UNION ALL
+        select advertiser_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 deepthink.mini_app_info where business_type in (1,3,8) and business_method='IAP')
+        group by advertiser_id)subtb2
+        group by advertiser_id
+        ) tb2
         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
-        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))
+        left join (select advertiser_id,
+        ifnull(sum(if(share_iaa_amount_3>0,share_iaa_amount_3,share_iaa_amount)), 0) 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,3,8))
         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
@@ -388,8 +431,10 @@
         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
+        (select movie_id, ifnull(sum(iaa_amount), 0) as iaa_amount,
+        ifnull(sum(pay_amount), 0) as pay_amount,
+        ifnull(sum(share_pay_amount), 0) as share_pay_amount,
+        ifnull(sum(if(share_iaa_amount_3>0,share_iaa_amount_3,share_iaa_amount)), 0) as share_iaa_amount
         from application.user_data_report_daily where stat_date=${date}
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id

+ 0 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IDateReportsPushService.java

@@ -9,6 +9,4 @@ public interface IDateReportsPushService {
     void preSend();
 
     public void send12hour();
-
-    void test();
 }

+ 15 - 15
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DateReportsPushServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -34,7 +33,7 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
-    private static final String TEMPLATE_VERSION = "1.0.9";
+    private static final String TEMPLATE_VERSION = "1.0.12";
     private static final String TEMPLATE_ID = "AAqRhJzMBoO0E";
 
     /**
@@ -85,19 +84,14 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
     public void preSend() {
         List<String> userIds = Arrays.asList(
                 "44fbaed6" //zhaotx
-                ,"ebeeced9" //yumeng
-                ,"58e7a98a"  //xsq
-                ,"2ga9669f" //angaoqi
-                ,"43gb7fbc" //huangpingkang
+//                ,"ebeeced9" //yumeng
+//                ,"58e7a98a"  //xsq
+//                ,"2ga9669f" //angaoqi
+//                ,"43gb7fbc" //huangpingkang
         );
         List<String> chatid = Arrays.asList(
         );
-        sendParam("暂不包含广点通当日数据", userIds, chatid);
-    }
-
-    @Override
-    public void test(){
-        sendParam("", Arrays.asList("44fbaed6"), Collections.EMPTY_LIST);
+        sendParam("", userIds, chatid);
     }
 
 
@@ -118,16 +112,18 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
         Map<String, String> todayData = reportsPushMapper.tmpPushData(todayLong);
         Map<String, String> lastDayData = reportsPushMapper.tmpPushData(lastDayLong);
 
-        String updateTime = String.valueOf(todayData.get("update_time"));
+        String updateTime = reportsPushMapper.updateTime(todayLong);
         List<Pair<String, String>> columns = Arrays.asList(
                 new Pair<>("cost_amount", "消耗金额"),
                 new Pair<>("end_amount", "结算金额"),
                 new Pair<>("pay_amount", "充值金额"),
                 new Pair<>("share_iaa_amount", "广告预估收入"),
 //                new Pair<>("water_roi", "流水ROI"),
-                new Pair<>("real_roi", "真实ROI"),
+//                new Pair<>("real_roi", "真实ROI"),
 //                new Pair<>("water_profit", "流水利润"),
-                new Pair<>("real_profit", "真实利润")
+//                new Pair<>("real_profit", "真实利润"),
+                new Pair<>("iaa_roi", "广告-ROI"),
+                new Pair<>("iap_roi", "付费-ROI")
         );
         JSONArray dateIndicatorTable = new JSONArray();
         for (Pair<String, String> column : columns) {
@@ -182,6 +178,8 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
             obj.put("movieName", movieName);
             obj.put("endAmount", String.valueOf(movie.get("share_end_amount")));
             obj.put("realROI", String.valueOf(movie.get("real_roi")));
+            obj.put("iapRoi", String.valueOf(movie.get("iap_roi")));
+            obj.put("iaaRoi", String.valueOf(movie.get("iaa_roi")));
             movieRankTable.add(obj);
         }
 
@@ -193,6 +191,8 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
             obj.put("deptName", String.valueOf(dept.get("dept_name")));
             obj.put("todayCost", String.valueOf(dept.get("cost_amount")));
             obj.put("ROI", String.valueOf(dept.get("real_roi")));
+            obj.put("iapRoi", String.valueOf(dept.get("iap_roi")));
+            obj.put("iaaRoi", String.valueOf(dept.get("iaa_roi")));
             deptRank.add(obj);
         }