yumeng 4 rokov pred
rodič
commit
5503f459c2

+ 6 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java

@@ -93,11 +93,13 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
     public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
-        if (startDate.equals(endDate)) {
+        System.err.println(filedAll);
+         if (startDate.equals(endDate)) {
             if (startDate.equals(DateUtils.date2Str())) {
                 result = kuaiShouAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
                 JSONObject afterSum = kuaiShouAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);
                 JSONObject beforeSum = kuaiShouAccountReportMapper.querySumByHour(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts);
+                System.err.println(afterSum);
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
@@ -194,7 +196,9 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
             if ("accountId".equals(k) || "authName".equals(k) || v.toString().contains("%") || before.getString(k).contains("%")) {
                 jsonObject.put(k, "-");
             } else {
-                jsonObject.put(k, (LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k))).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP)+"%");
+                System.err.println(k);
+                System.err.println(k);
+                jsonObject.put(k, (LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k))).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%");
             }
         });
         return jsonObject;

+ 14 - 13
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -24,7 +24,7 @@
     "comment": "封面点击率"
   },
   "bClickRate": {
-    "filed": "CASE WHEN sum(t1.bclick) / sum(t1.aclick) IS NULL THEN 0 ELSE CONCAT( CAST(ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2) AS CHAR) ,'%') END AS bClickRate ",
+    "filed": "CASE WHEN  sum(t1.aclick) != 0 THEN CONCAT( CAST(ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2) AS CHAR) ,'%') ELSE '0%' END AS bClickRate ",
     "comment": "行为率"
   },
   "cpm": {
@@ -48,7 +48,7 @@
     "comment": "安卓开始下载单价"
   },
   "downloadStartRate": {
-    "filed": "CASE WHEN sum(t1.download_started) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.download_started) / sum(t1.bclick)*100,2) AS CHAR) ,'%') end AS downloadStartRate ",
+    "filed": "CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.download_started) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0%' end AS downloadStartRate",
     "comment": "安卓开始下载率"
   },
   "downloadFinish": {
@@ -60,7 +60,7 @@
     "comment": "安卓下载完成单价"
   },
   "downloadFinishRate": {
-    "filed": "CASE WHEN sum(t1.download_completed) / sum(t1.download_started) IS NULL THEN 0 ELSE  concat(CAST(round(sum(t1.download_completed) / sum(t1.download_started)*100,2) AS CHAR) ,'%') end AS downloadFinishRate ",
+    "filed": "CASE WHEN  sum(t1.download_started) != 0 then  concat(CAST(round(sum(t1.download_completed) / sum(t1.download_started)*100,2) AS CHAR) ,'%') else '0%' end AS downloadFinishRate  ",
     "comment": "安卓下载完成率"
   },
   "active": {
@@ -71,12 +71,9 @@
     "filed": "CASE WHEN sum(t1.charge) / sum(t1.activation) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.activation) end AS activeCost ",
     "comment": "激活单价"
   },
-  "activeRate": {
-    "filed": "CASE WHEN sum(t1.activation) / sum(t1.download_completed) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.activation) / sum(t1.download_completed)*100,2) AS CHAR) ,'%') end as activeRate ",
-    "comment": "下载完成激活率"
-  },
+
   "firstDayPay": {
-    "filed": "IFNULL(sum(t1.event_pay_first_day),0) as firstDayPay  ",
+    "filed": "CASE WHEN sum(t1.event_pay_first_day) != 0 THEN sum(t1.event_pay_first_day) ELSE 0 as firstDayPay ",
     "comment": "首日付费次数"
   },
   "firstDayPayAmount": {
@@ -116,7 +113,7 @@
     "comment": "注册成本"
   },
   "activeRegisterRate": {
-    "filed": " CASE WHEN sum(t1.event_register) / sum(t1.activation) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.event_register) / sum(t1.activation)*100,2) AS CHAR) ,'%') end as activeRegisterRate ",
+    "filed": "CASE WHEN  sum(t1.activation) !=0  THEN concat(CAST(round(sum(t1.event_register) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0%' end as activeRegisterRate ",
     "comment": "注册率"
   },
   "eventJinJianApp": {
@@ -136,7 +133,7 @@
     "comment": "授信成本"
   },
   "eventCreditGrantAppRate": {
-    "filed": "CASE WHEN sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app)*100,2) AS CHAR) ,'%') end as eventCreditGrantAppRate",
+    "filed": "CASE WHEN  sum(t1.event_jin_jian_app) !=0 THEN concat(CAST(round(sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app)*100,2) AS CHAR) ,'%') ELSE '0' end as eventCreditGrantAppRate",
     "comment": "授信率"
   },
   "formCount": {
@@ -144,7 +141,7 @@
     "comment": "表单提交数"
   },
   "formCountRate": {
-    "filed": "CASE WHEN sum(t1.form_count) / sum(t1.activation) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.form_count) / sum(t1.activation)*100,2) AS CHAR) ,'%') end as formCountRate ",
+    "filed": "CASE WHEN sum(t1.activation) != 0  THEN  concat(CAST(round(sum(t1.form_count) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0%' end as formCountRate ",
     "comment": "表单提交率"
   },
   "formCountCost": {
@@ -180,7 +177,7 @@
     "comment": "落地页授信成本"
   },
   "eventCreditGrantLandingPageRate": {
-    "filed": "CASE WHEN sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat( CAST(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2) AS CHAR),'%') end as eventCreditGrantLandingPageRate ",
+    "filed": "CASE WHEN  sum(t1.event_jin_jian_landing_page)  != 0 THEN  concat( CAST(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2) AS CHAR),'%') ELSE '0%' end as eventCreditGrantLandingPageRate ",
     "comment": "落地页授信率"
   },
   "submit": {
@@ -192,11 +189,15 @@
     "comment": "按钮点击成本"
   },
   "submitRate": {
-    "filed": "CASE WHEN sum(t1.submit) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(CAST(round(sum(t1.submit) / sum(t1.bclick)*100,2) AS CHAR) ,'%') end as submitRate ",
+    "filed": "CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.submit) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0%' end as submitRate ",
     "comment": "按钮点击率"
   },
   "play3sRate": {
     "filed": "CASE WHEN sum(CEIL(t1.play_3s_ratio * t1.photo_show)) / sum(t1.photo_show) IS NULL THEN 0 ELSE round(sum(CEIL(t1.play_3s_ratio * t1.photo_show)) / sum(t1.photo_show)*100,2)end as play3sRate ",
     "comment": "3s播放率"
+  },
+  "activeRate": {
+    "filed": "CASE WHEN  sum(t1.download_completed) != 0 THEN concat(CAST(round(sum(t1.activation) / sum(t1.download_completed)*100,2) AS CHAR) ,'%') else '0%' end as activeRate ",
+    "comment": "下载完成激活率"
   }
 }