Browse Source

修改bug

zhaoxian 3 năm trước cách đây
mục cha
commit
51768d479a

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java

@@ -115,11 +115,11 @@ public class KuaiShouAccountReportCtrl {
             log.error("请选择需要导出的字段");
         }
         log.info("需要导出的字段:{}", columns);
-        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapKs(), columns);
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapKs2(), columns);
         List<String> titles = new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs(), columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapKs2(), columns));
         //此处增加两个元素是为了保证数据有序
         columns.add(0, "accountId");
         columns.add(1, "authName");

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

@@ -61,7 +61,7 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
     @Override
     public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
         List<JSONObject> result = new ArrayList<>();
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs2());
         if (startDate.equals(endDate)) {
             List<JSONObject> after = kuaiShouAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
             List<JSONObject> before = kuaiShouAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
@@ -96,7 +96,7 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
         if (!Check.isNull(target) && "photo_show".equals(target)) {
             target = "`show`";
         }
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs2());
         filedAll = filedAll.replace("photo_show", "`show`");
         if (startDate.equals(endDate)) {
             if (startDate.equals(DateUtils.date2Str())) {

+ 208 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -350,6 +350,209 @@ public class AccountReportConstants {
             "    \"filed\": \"(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
+            "  \"activeRate\": {\n" +
+            "    \"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.00%' end as activeRate \",\n" +
+            "    \"comment\": \"下载完成激活率\"\n" +
+            "  }\n" +
+            "}";
+
+    public static final String KUAISHOU_FILED_MAPPING_JSON2 = "{\n" +
+            "  \"cost\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.charge),0) as cost \",\n" +
+            "    \"comment\": \"消耗\"\n" +
+            "  },\n" +
+            "  \"photoShow\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.photo_show),0) as photoShow \",\n" +
+            "    \"comment\": \"封面曝光数\"\n" +
+            "  },\n" +
+            "  \"photoClick\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.photo_click),0) as photoClick \",\n" +
+            "    \"comment\": \"封面点击数\"\n" +
+            "  },\n" +
+            "  \"aClick\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.aclick),0) as aClick \",\n" +
+            "    \"comment\": \"素材曝光数\"\n" +
+            "  },\n" +
+            "  \"bClick\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.bclick),0) as bClick \",\n" +
+            "    \"comment\": \"行为数\"\n" +
+            "  },\n" +
+            "  \"clickRate\": {\n" +
+            "    \"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.00%' END AS clickRate \",\n" +
+            "    \"comment\": \"封面点击率\"\n" +
+            "  },\n" +
+            "  \"bClickRate\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.aclick) != 0 THEN CONCAT( CAST(ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2) AS CHAR) ,'%') ELSE '0.00%' END AS bClickRate \",\n" +
+            "    \"comment\": \"行为率\"\n" +
+            "  },\n" +
+            "  \"cpm\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.photo_show) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.photo_show)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"comment\": \"平均千次封面曝光花费\"\n" +
+            "  },\n" +
+            "  \"cpc\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.photo_click) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.photo_click)), 2) END AS cpc \",\n" +
+            "    \"comment\": \"平均封面点击单价\"\n" +
+            "  },\n" +
+            "  \"cpb\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.bclick) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.bclick)), 2) END AS cpb \",\n" +
+            "    \"comment\": \"平均行为单价\"\n" +
+            "  },\n" +
+            "  \"downloadStart\": {\n" +
+            "    \"filed\": \"IFNULL(sum(download_started),0) as downloadStart \",\n" +
+            "    \"comment\": \"安卓开始下载数\"\n" +
+            "  },\n" +
+            "  \"downloadStartCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / (t1.download_started) IS NULL THEN 0 ELSE round(sum(t1.charge) / sum(t1.download_started),3) end AS downloadStartCost \",\n" +
+            "    \"comment\": \"安卓开始下载单价\"\n" +
+            "  },\n" +
+            "  \"downloadStartRate\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.download_started) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0.00%' end AS downloadStartRate\",\n" +
+            "    \"comment\": \"安卓开始下载率\"\n" +
+            "  },\n" +
+            "  \"downloadFinish\": {\n" +
+            "    \"filed\": \"IFNULL(sum(download_completed),0) as downloadFinish \",\n" +
+            "    \"comment\": \"安卓下载完成数\"\n" +
+            "  },\n" +
+            "  \"downloadFinishCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.download_completed) IS NULL THEN 0 ELSE  round(sum(t1.charge) / sum(t1.download_completed),3) end AS downloadFinishCost \",\n" +
+            "    \"comment\": \"安卓下载完成单价\"\n" +
+            "  },\n" +
+            "  \"downloadFinishRate\": {\n" +
+            "    \"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.00%' end AS downloadFinishRate  \",\n" +
+            "    \"comment\": \"安卓下载完成率\"\n" +
+            "  },\n" +
+            "  \"active\": {\n" +
+            "    \"filed\": \"IFNULL(sum(activation),0) as active \",\n" +
+            "    \"comment\": \"激活数\"\n" +
+            "  },\n" +
+            "  \"activeCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.activation) IS NULL THEN 0 ELSE round(sum(t1.charge) / sum(t1.activation),3) end AS activeCost \",\n" +
+            "    \"comment\": \"激活单价\"\n" +
+            "  },\n" +
+            "  \"firstDayPay\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.event_pay_first_day) != 0 THEN sum(t1.event_pay_first_day) ELSE 0  end as firstDayPay \",\n" +
+            "    \"comment\": \"首日付费次数\"\n" +
+            "  },\n" +
+            "  \"firstDayPayAmount\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_pay_purchase_amount_first_day),0) as firstDayPayAmount  \",\n" +
+            "    \"comment\": \"首日付费金额\"\n" +
+            "  },\n" +
+            "  \"firstDayPayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_pay_first_day) IS NULL THEN 0 ELSE round(sum(t1.charge) / sum(t1.event_pay_first_day),3) end AS firstDayPayCost \",\n" +
+            "    \"comment\": \"首日付费成本\"\n" +
+            "  },\n" +
+            "  \"firstDayPayROI\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.event_pay_purchase_amount_first_day) / sum(t1.charge) IS NULL THEN '0.00%' ELSE concat(CAST(round(sum(t1.event_pay_purchase_amount_first_day) / sum(t1.charge)*100,2) AS CHAR) ,'%') end AS firstDayPayROI \",\n" +
+            "    \"comment\": \"首日ROI\"\n" +
+            "  },\n" +
+            "  \"eventPay\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_pay),0) as eventPay  \",\n" +
+            "    \"comment\": \"付费次数\"\n" +
+            "  },\n" +
+            "  \"eventPayPurchaseAmount\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_pay_purchase_amount),0) as eventPayPurchaseAmount  \",\n" +
+            "    \"comment\": \"付费金额\"\n" +
+            "  },\n" +
+            "  \"eventPayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_pay) IS NULL THEN 0 ELSE round(sum(t1.charge) / sum(t1.event_pay),3) end AS eventPayCost \",\n" +
+            "    \"comment\": \"付费次数成本\"\n" +
+            "  },\n" +
+            "  \"ROI\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) IS NULL THEN '0.00%' ELSE concat(CAST(round(sum(t1.event_pay_purchase_amount) / sum(t1.charge)*100,2) AS CHAR) ,'%') end AS ROI \",\n" +
+            "    \"comment\": \"ROI\"\n" +
+            "  },\n" +
+            "  \"register\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_register),0) as register \",\n" +
+            "    \"comment\": \"注册数\"\n" +
+            "  },\n" +
+            "  \"activeRegisterCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_register) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_register),3) end as activeRegisterCost \",\n" +
+            "    \"comment\": \"注册成本\"\n" +
+            "  },\n" +
+            "  \"activeRegisterRate\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.activation) !=0  THEN concat(CAST(round(sum(t1.event_register) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0.00%' end as activeRegisterRate \",\n" +
+            "    \"comment\": \"注册率\"\n" +
+            "  },\n" +
+            "  \"eventJinJianApp\": {\n" +
+            "    \"filed\": \"IFNULL(sum(event_jin_jian_app),0) as eventJinJianApp \",\n" +
+            "    \"comment\": \"完件数\"\n" +
+            "  },\n" +
+            "  \"eventJinJianAppCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_jin_jian_app) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_jin_jian_app),3) end as eventJinJianAppCost \",\n" +
+            "    \"comment\": \"完件成本\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantApp\": {\n" +
+            "    \"filed\": \"IFNULL(sum(event_credit_grant_app),0) as eventCreditGrantApp \",\n" +
+            "    \"comment\": \"授信数\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantAppCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_credit_grant_app) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_credit_grant_app),3) end as eventCreditGrantAppCost \",\n" +
+            "    \"comment\": \"授信成本\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantAppRate\": {\n" +
+            "    \"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\",\n" +
+            "    \"comment\": \"授信率\"\n" +
+            "  },\n" +
+            "  \"formCount\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.form_count),0) as formCount \",\n" +
+            "    \"comment\": \"表单提交数\"\n" +
+            "  },\n" +
+            "  \"formCountRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.activation) != 0  THEN  concat(CAST(round(sum(t1.form_count) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0.00%' end as formCountRate \",\n" +
+            "    \"comment\": \"表单提交率\"\n" +
+            "  },\n" +
+            "  \"formCountCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as formCountCost \",\n" +
+            "    \"comment\": \"表单提交成本\"\n" +
+            "  },\n" +
+            "  \"nextDayOpen\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_next_day_stay),0) as nextDayOpen \",\n" +
+            "    \"comment\": \"次留数\"\n" +
+            "  },\n" +
+            "  \"nextDayOpenCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_next_day_stay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_next_day_stay),3) end as nextDayOpenCost \",\n" +
+            "    \"comment\": \"次留成本\"\n" +
+            "  },\n" +
+            "  \"nextDayOpenRate\": {\n" +
+            "    \"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.00%' end as nextDayOpenRate\",\n" +
+            "    \"comment\": \"次留率\"\n" +
+            "  },\n" +
+            "  \"eventJinJianLandingPage\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_jin_jian_landing_page),0) as eventJinJianLandingPage \",\n" +
+            "    \"comment\": \"落地页完件数\"\n" +
+            "  },\n" +
+            "  \"eventJinJianLandingPageCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_jin_jian_landing_page),3) end as eventJinJianLandingPageCost \",\n" +
+            "    \"comment\": \"落地页完件成本\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantLandingPage\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_credit_grant_landing_page),0) as eventCreditGrantLandingPage \",\n" +
+            "    \"comment\": \"落地页授信数\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantLandingPageCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_credit_grant_landing_page) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_credit_grant_landing_page),3) end as eventCreditGrantLandingPageCost \",\n" +
+            "    \"comment\": \"落地页授信成本\"\n" +
+            "  },\n" +
+            "  \"eventCreditGrantLandingPageRate\": {\n" +
+            "    \"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.00%' end as eventCreditGrantLandingPageRate \",\n" +
+            "    \"comment\": \"落地页授信率\"\n" +
+            "  },\n" +
+            "  \"submit\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.submit),0) as submit \",\n" +
+            "    \"comment\": \"按钮点击数\"\n" +
+            "  },\n" +
+            "  \"submitCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.submit) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.submit),3) end as submitCost \",\n" +
+            "    \"comment\": \"按钮点击成本\"\n" +
+            "  },\n" +
+            "  \"submitRate\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.submit) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0.00%' end as submitRate \",\n" +
+            "    \"comment\": \"按钮点击率\"\n" +
+            "  },\n" +
+            "  \"play3sRate\": {\n" +
+            "    \"filed\": \"(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
+            "    \"comment\": \"3s播放率\"\n" +
+            "  },\n" +
             "  \"keyAction\": {\n" +
             "    \"filed\": \"IFNULL(sum(t1.key_action),0) as keyAction \",\n" +
             "    \"comment\": \"关键行为数\"\n" +
@@ -363,6 +566,7 @@ public class AccountReportConstants {
             "    \"comment\": \"下载完成激活率\"\n" +
             "  }\n" +
             "}";
+
     public static final String KUAISHOU_VIDEO_REPORT_FILED_MAPPING_JSON = "{\n" +
             "  \"signature\": {\n" +
             "    \"filed\": \"t1.signature as signature \",\n" +
@@ -1466,6 +1670,10 @@ public class AccountReportConstants {
         Object jsonKs = JSON.parseObject(KUAISHOU_FILED_MAPPING_JSON);
         return JsonResourceUtil.jsonToMap(jsonKs);
     }
+    public static Map<String, Map<String, Object>> getDicMapKs2(){
+        Object jsonKs = JSON.parseObject(KUAISHOU_FILED_MAPPING_JSON2);
+        return JsonResourceUtil.jsonToMap(jsonKs);
+    }
     public static Map<String, Map<String, Object>> getDicMapByVideo(){
         Object jsonByVideo = JSON.parseObject(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON);
         return JsonResourceUtil.jsonToMap(jsonByVideo);