zhaotx пре 1 година
родитељ
комит
5f9f46efda

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

@@ -129,22 +129,36 @@
         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(share_iaa_amount)+sum(share_pay_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,
+        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,
         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,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,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
+        round(ifnull(sum(if(share_iaa_amount_3>0,share_iaa_amount_3,share_iaa_amount)), 0),2) as share_iaa_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 deepthink.mini_app_info where business_type in (1,3,8))
         group by movie_id
         ) tb3 on tb1.product_id=tb3.movie_id

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

@@ -84,10 +84,10 @@ 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(
         );
@@ -117,13 +117,13 @@ public class DateReportsPushServiceImpl implements IDateReportsPushService {
                 new Pair<>("cost_amount", "消耗金额"),
                 new Pair<>("end_amount", "结算金额"),
                 new Pair<>("pay_amount", "充值金额"),
-                new Pair<>("share_iaa_amount", "广告预估收入"),
+                new Pair<>("share_iaa_amount", "广告预估收入")
 //                new Pair<>("water_roi", "流水ROI"),
 //                new Pair<>("real_roi", "真实ROI"),
 //                new Pair<>("water_profit", "流水利润"),
 //                new Pair<>("real_profit", "真实利润"),
-                new Pair<>("iaa_roi", "广告-ROI"),
-                new Pair<>("iap_roi", "付费-ROI")
+//                new Pair<>("iaa_roi", "广告-ROI"),
+//                new Pair<>("iap_roi", "付费-ROI")
         );
         JSONArray dateIndicatorTable = new JSONArray();
         for (Pair<String, String> column : columns) {

+ 6 - 4
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/ReportsAdPushServiceImpl.java

@@ -30,7 +30,7 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
     public static final String APP_KEY = "OUlg7WTa6UWZItfTmJw2JdQvhVI4VcRj";
 
     public static final String TEMPLATE_ID = "AAqBGlVblKabY";
-    public static final String TEMPLATE_VERSION = "1.0.10";
+    public static final String TEMPLATE_VERSION = "1.0.11";
     @Autowired
     ReportsAdPushMapper reportsPushMapper;
 
@@ -89,11 +89,11 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
                 new Pair<>("cost_amount", "消耗金额"),
                 new Pair<>("end_amount", "结算金额"),
                 new Pair<>("pay_amount", "充值金额"),
-                new Pair<>("share_iaa_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", "真实利润")
         );
 
         JSONArray object_list_1 = new JSONArray();
@@ -123,6 +123,8 @@ public class ReportsAdPushServiceImpl implements IReportsAdPushService {
             obj.put("movieEndAmount", m.get("end_amount"));
             obj.put("movieRealRoi", m.get("real_roi"));
             obj.put("hourCostAmount", m.get("hour_cost_amount"));
+            obj.put("iaaRoi", m.get("iaa_roi"));
+            obj.put("iapRoi", m.get("iap_roi"));
             object_list_2.add(obj);
         }
         template_variables.put("object_list_2", object_list_2);