yumeng %!s(int64=4) %!d(string=hai) anos
pai
achega
9afe715bc3

+ 2 - 35
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -60,7 +60,7 @@ public class KsVideoReportCtrl {
         Result<PageInfo<JSONObject>> result = new Result<>();
         try {
             if (Check.isNull(requestBody)) {
-                throw new Exception("入参不能为空");
+                new Exception("入参不能为空");
             }
             int pageSize = requestBody.getInteger("pageSize");
             if (Check.isNull(pageSize)) {
@@ -109,49 +109,16 @@ public class KsVideoReportCtrl {
                 requestMap.put("order", requestBody.getString("order"));
             }
             PageInfo<JSONObject> listData = ksVideoReportService.getKuaiShouVideoPageReportByMap(requestMap, pageSize, pageNo);
-            System.err.println(listData);
             if (Check.isNull(listData)) {
                 throw new Exception("暂无素材相关信息,请检查账户");
             }
             result.setSuccess(true);
             result.setResult(listData);
         } catch (Exception e) {
-            e.printStackTrace();
             log.error(e.getMessage(), e);
             result.setSuccess(false);
-            result.setMessage(e.getMessage());
+            result.setMessage(e.toString());
         }
-
-
-     /*   if (requestBody.isEmpty()) {
-            log.error("request body is empty");
-            result.setSuccess(false);
-        } else {
-            JSONArray accountIds = requestBody.getJSONArray("accountIds");
-            String startDate = requestBody.getString("startDate");
-            String endDate = requestBody.getString("endDate");
-            String clip = requestBody.getString("clip");
-            String shot = requestBody.getString("shot");
-            String plan = requestBody.getString("plan");
-            String target = requestBody.getString("target");
-            String order = requestBody.getString("order");
-            int pageSize = requestBody.getInteger("pageSize");
-            int pageNo = requestBody.getInteger("pageNo");
-
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
-
-            try {
-                if (accountIds.isEmpty()) {
-                    accountIds = null;
-                }
-                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot, plan, pageSize, pageNo);
-                result.setResult(listData);
-                result.setSuccess(true);
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                result.setSuccess(false);
-            }
-        }*/
         return result;
     }
 

+ 20 - 16
module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json

@@ -31,11 +31,11 @@
     "comment": "行为数"
   },
   "clickRate": {
-    "filed": "CASE WHEN sum(t1.photo_click) / sum(t1.photo_show) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.photo_click) / sum(t1.photo_show)) * 100,2),'%') END AS clickRate ",
+    "filed": "CASE WHEN sum(t1.photo_show) != 0    THEN CONCAT( CAST(ROUND((sum(t1.photo_click) / sum(t1.photo_show)) * 100,2) AS CHAR) ,'%') else '0%' END AS clickRate ",
     "comment": "封面点击率"
   },
   "bClickRate": {
-    "filed": "CASE WHEN sum(t1.bclick) / sum(t1.aclick) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2),'%') 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": {
@@ -59,7 +59,7 @@
     "comment": "安卓开始下载单价"
   },
   "downloadStartRate": {
-    "filed": "CASE WHEN sum(t1.download_started) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.download_started) / sum(t1.bclick)*100,2),'%') 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": {
@@ -71,7 +71,7 @@
     "comment": "安卓下载完成单价"
   },
   "downloadFinishRate": {
-    "filed": "CASE WHEN sum(t1.download_completed) / sum(t1.download_started) IS NULL THEN 0 ELSE  concat(round(sum(t1.download_completed) / sum(t1.download_started)*100,2),'%') 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": {
@@ -82,12 +82,8 @@
     "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(round(sum(t1.activation) / sum(t1.download_completed)*100,2),'%') 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  end as firstDayPay ",
     "comment": "首日付费次数"
   },
   "firstDayPayAmount": {
@@ -115,7 +111,7 @@
     "comment": "付费次数成本"
   },
   "ROI": {
-    "filed": "CASE WHEN sum(t1.charge) != 0  THEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) else 0 END AS ROI",
+    "filed": "CASE WHEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) IS NULL THEN 0 ELSE sum(t1.event_pay_purchase_amount) / sum(t1.charge) end AS ROI ",
     "comment": "ROI"
   },
   "register": {
@@ -127,7 +123,7 @@
     "comment": "注册成本"
   },
   "activeRegisterRate": {
-    "filed": " CASE WHEN sum(t1.event_register) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_register) / sum(t1.activation)*100,2),'%') 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": {
@@ -147,7 +143,7 @@
     "comment": "授信成本"
   },
   "eventCreditGrantAppRate": {
-    "filed": "CASE WHEN sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app)*100,2),'%') 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": {
@@ -155,7 +151,7 @@
     "comment": "表单提交数"
   },
   "formCountRate": {
-    "filed": "CASE WHEN sum(t1.form_count) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.form_count) / sum(t1.activation)*100,2),'%') 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": {
@@ -171,7 +167,7 @@
     "comment": "次留成本"
   },
   "nextDayOpenRate": {
-    "filed": "CASE WHEN sum(t1.event_next_day_stay) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2),'%') end as nextDayOpenRate ",
+    "filed": "CASE WHEN  sum(t1.activation) != 0 THEN  concat(CAST(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2) AS CHAR) ,'%') ELSE '0%' end as nextDayOpenRate",
     "comment": "次留率"
   },
   "eventJinJianLandingPage": {
@@ -191,7 +187,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(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') 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": {
@@ -203,9 +199,17 @@
     "comment": "按钮点击成本"
   },
   "submitRate": {
-    "filed": "CASE WHEN sum(t1.submit) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.submit) / sum(t1.bclick)*100,2),'%') 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": "下载完成激活率"
+  },
   "play3sCount": {
     "filed": "sum(t1.play_3s_count) as play3sCount",
     "comment": "3s播放数"