zhaoxian 3 лет назад
Родитель
Сommit
22758a6992
14 измененных файлов с 654 добавлено и 399 удалено
  1. 10 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  2. 6 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java
  3. 63 72
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  4. 85 77
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouAccountReportMapper.xml
  5. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouAccountReportService.java
  6. 2 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java
  7. 15 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java
  8. 2 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java
  9. 23 6
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  10. 143 128
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml
  11. 27 29
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  12. 4 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java
  13. 35 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  14. 238 66
      jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

+ 10 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -81,6 +81,7 @@ public class KsVideoReportCtrl {
                 throw new Exception("请输入查询结束时间");
             }
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
+            filedAll = filedAll.replace("t1.photo_show", "`show`");
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }
@@ -119,7 +120,11 @@ public class KsVideoReportCtrl {
                 requestMap.put("leaderId", requestBody.getString("leaderId"));
             }
             if (!Check.isNull(requestBody.getString("target"))) {
-                requestMap.put("target", requestBody.getString("target"));
+                if ("photo_show".equals(requestBody.getString("target"))) {
+                    requestMap.put("target", "`show`");
+                } else {
+                    requestMap.put("target", requestBody.getString("target"));
+                }
             }
             if (!Check.isNull(requestBody.getString("order"))) {
                 requestMap.put("order", requestBody.getString("order"));
@@ -211,6 +216,10 @@ public class KsVideoReportCtrl {
             if (Check.isNull(filedAll)) {
                 throw new Exception("初始化查询 字段返回为空");
             }
+            filedAll = filedAll.replace("photo_show", "`show`")
+                    .replace("keyAction", "key_action")
+                    .replace("keyActionCost", "key_action_cost");
+
             requestMap.put("filed", filedAll);
             requestMap.put("startDate", startDate);
             requestMap.put("endDate", endDate);

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouAccountReportService;
@@ -92,7 +93,7 @@ public class KuaiShouAccountReportCtrl {
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData = kuaiShouAccountReportService.getListDataBy(mediaId, discount, accounts, startDate, endDate, hour, target, order);
+            List<JSONObject> listData = kuaiShouAccountReportService.getListDataBy(mediaId, accounts, startDate, endDate, hour, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -130,9 +131,12 @@ public class KuaiShouAccountReportCtrl {
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String target = requestBody.getString("target");
+        if (!Check.isNull(target) && "photo_show".equals(target)) {
+            target = "`show`";
+        }
         String order = requestBody.getString("order");
         int hour = requestBody.getInteger("hour");
-        List<JSONObject> excelData = kuaiShouAccountReportService.getExcelDataBy(filed, mediaId, accounts, startDate, endDate, hour, target, order);
+        List<JSONObject> excelData = kuaiShouAccountReportService.getListDataBy(filed, accounts, startDate, endDate, hour, target, order);
         if (excelData.isEmpty()) {
             return;
         }

+ 63 - 72
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -2,22 +2,23 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper">
 
-    <select id="getKuaiShouVideoReportByMap" resultType="com.alibaba.fastjson.JSONObject" parameterType="map">
+    <select id="getKuaiShouVideoReportByMap"  resultType="com.alibaba.fastjson.JSONObject" parameterType="map">
         SELECT
-        t1.*,
-        IFNULL(t2.clip_name,'-') as clip,
-        IFNULL(t2.plan_name,'-') as plan,
-        IFNULL(t2.shot_name,'-') as shot,
-        IFNULL(t2.design_team_leader_name,'-') as designLeader,
-        IFNULL(t2.video_name,'-') as materialName,
-        IFNULL(t2.cover_url,'-') as coverUrl,
-        IFNULL(t2.url,'-') as url ,
-        IFNULL(t2.channel_name,'-') AS channel,
-        IFNULL(t2.state_date,'-') as createTime
+        IFNULL(t1.clip_name,'-') as clip,
+        IFNULL(t1.plan_name,'-') as plan,
+        IFNULL(t1.shot_name,'-') as shot,
+        IFNULL(t1.leader_name,'-') as designLeader,
+        IFNULL(t1.video_name,'-') as materialName,
+        IFNULL(t1.cover_url,'-') as coverUrl,
+        IFNULL(t1.photo_url,'-') as url ,
+        IFNULL(t1.channel_name,'-') AS channel,
+        DATE_FORMAT(stat_date,'%Y-%m-%d') as createTime,
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
+        ${filed}
         FROM
-        (select ${filed}
-        from ctop_etl_kuaishou_account_material_report_daily t1
-        where 1 = 1
+        application.kuaishou_material_video_report_daily_dw t1
+        where 1=1
         <if test="accountIds !=null and accountIds != ''">
             and t1.account_id in
             <foreach item="item" index="index" collection="accountIds"
@@ -26,85 +27,75 @@
             </foreach>
         </if>
         <if test="startDate !=null and startDate != ''">
-            AND t1.stat_date &gt;= #{startDate}
+            AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         </if>
         <if test="endDate !=null and endDate != ''">
-            AND t1.stat_date &lt;= #{endDate}
+            AND t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
         </if>
-        GROUP BY t1.signature
-        ) t1
-        LEFT JOIN ctop_etl_kuaishou_video_info t2
-        ON t1.signature = t2.video_code
-        WHERE
-        1 = 1
         <if test="leaderId !=null and leaderId != ''">
-            AND t2.design_team_leader_id = #{leaderId}
+            AND t1.leader_id = #{leaderId}
         </if>
         <if test="channelType != null">
-            AND t2.channel_type = #{channelType}
+            AND t1.channel_type = #{channelType}
         </if>
         <if test="clipId !=null and clipId != ''">
-            AND t2.clip_id = #{clipId}
+            AND t1.clip_id = #{clipId}
         </if>
         <if test="planId !=null and planId != ''">
-            AND t2.plan_id = #{planId}
+            AND t1.plan_id = #{planId}
         </if>
         <if test="shotId !=null and shotId != ''">
-            AND t2.shot_id = #{shotId}
+            AND t1.shot_id = #{shotId}
         </if>
         <if test="companyId !=null and companyId != ''">
-            AND t2.company_id = #{companyId}
+            AND t1.company_id = #{companyId}
         </if>
+        group by signature
         ORDER BY ${target} ${order}
     </select>
 
 
     <select id="getTotalByMap" resultType="java.lang.Long">
-        SELECT
-        count(1)
+        SELECT IFNULL(sum(1),0)
+        FROM (
+            SELECT
+        signature
         FROM
-        (select
-        t1.signature
-        from ctop_etl_kuaishou_account_material_report_daily t1
-        where 1 = 1
-        <if test="accountIds !=null and accountIds != ''">
-            and t1.account_id in
-            <foreach item="item" index="index" collection="accountIds"
-                     open="(" separator="," close=")">
-                #{item}
-            </foreach>
-        </if>
-        <if test="startDate !=null and startDate != ''">
-            AND t1.stat_date &gt;= #{startDate}
-        </if>
-        <if test="endDate !=null and endDate != ''">
-            AND t1.stat_date &lt;= #{endDate}
-        </if>
-        GROUP BY t1.signature
-        ) t1
-        LEFT JOIN ctop_etl_kuaishou_video_info t2
-        ON t1.signature = t2.video_code
-        WHERE
-        1 = 1
-        <if test="leaderId !=null and leaderId != ''">
-            AND t2.design_team_leader_id = #{leaderId}
-        </if>
-        <if test="channelType != null">
-            AND t2.channel_type = #{channelType}
-        </if>
-        <if test="clipId !=null and clipId != ''">
-            AND t2.clip_id = #{clipId}
-        </if>
-        <if test="planId !=null and planId != ''">
-            AND t2.plan_id = #{planId}
-        </if>
-        <if test="shotId !=null and shotId != ''">
-            AND t2.shot_id = #{shotId}
-        </if>
-        <if test="companyId !=null and companyId != ''">
-            AND t2.company_id = #{companyId}
-        </if>
-
+        application.kuaishou_material_video_report_daily_dw t1
+            where 1=1
+            <if test="accountIds !=null and accountIds != ''">
+                and t1.account_id in
+                <foreach item="item" index="index" collection="accountIds"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="startDate !=null and startDate != ''">
+                AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+            </if>
+            <if test="endDate !=null and endDate != ''">
+                AND t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+            </if>
+            <if test="leaderId !=null and leaderId != ''">
+                AND t1.leader_id = #{leaderId}
+            </if>
+            <if test="channelType != null">
+                AND t1.channel_type = #{channelType}
+            </if>
+            <if test="clipId !=null and clipId != ''">
+                AND t1.clip_id = #{clipId}
+            </if>
+            <if test="planId !=null and planId != ''">
+                AND t1.plan_id = #{planId}
+            </if>
+            <if test="shotId !=null and shotId != ''">
+                AND t1.shot_id = #{shotId}
+            </if>
+            <if test="companyId !=null and companyId != ''">
+                AND t1.company_id = #{companyId}
+            </if>
+            group by signature
+        ) t
     </select>
 
 

+ 85 - 77
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouAccountReportMapper.xml

@@ -5,14 +5,13 @@
     <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(charge),2) cost,
-        sum(photo_show) photoShow,
+        sum(`show`) photoShow,
         sum(photo_click) photoClick,
         sum(aClick) as aClick,
-        max(stat_hour) maxHour
-        FROM
-        ctop_kuaishou_report_hourly_account
+        max(`hour`) maxHour
+        FROM application.kuaishou_account_report_hourly_dw
         WHERE
-        stat_date = #{statDate}
+        stat_date = DATE_FORMAT(#{statDate},'%Y%m%d')
         AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -22,13 +21,15 @@
 
     <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        t1.account_id as accountId,
+        t1.account_name as authName,
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
         ${filed}
-        FROM ctop_kuaishou_report_hourly_account t1
-        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
-        WHERE t1.stat_date = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
+        FROM
+        application.kuaishou_account_report_hourly_dw t1
+        WHERE t1.stat_date = DATE_FORMAT(#{statDate},'%Y%m%d')
+        and t1.`hour` &lt;= #{hour}
         AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -40,15 +41,14 @@
 
     <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(charge),2) cost,
-          sum(photo_show) photoShow,
-          sum(photo_click) photoClick,
-          sum(aClick) as aClick
-        FROM
-          ctop_kuaishou_report_hourly_account
+        ROUND(sum(charge),2) cost,
+        sum(`show`) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick
+        FROM application.kuaishou_account_report_hourly_dw
         WHERE
-          stat_date = #{statDate}
-        AND stat_hour &lt;= #{hour}
+        stat_date = DATE_FORMAT(#{statDate},'%Y%m%d')
+        AND `hour` &lt;= #{hour}
         AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -58,13 +58,15 @@
 
     <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
         ${filed}
         FROM
-        ctop_kuaishou_report_hourly_account t1
+        application.kuaishou_account_report_hourly_dw t1
         WHERE
-        t1.stat_date = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.account_id in
+        stat_date = DATE_FORMAT(#{statDate},'%Y%m%d')
+        and `hour` &lt;= #{hour}
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
@@ -73,32 +75,33 @@
 
     <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(charge),2) cost,
-          sum(photo_show) photoShow,
-          sum(photo_click) photoClick,
-          sum(aClick) as aClick,
-          stat_hour as statHour
-        FROM
-          ctop_kuaishou_report_hourly_account
+        ROUND(sum(charge),2) cost,
+        sum(`show`) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick,
+        `hour` as statHour
+        FROM application.kuaishou_account_report_hourly_dw
         WHERE
-          stat_date = #{statDate}
+        stat_date = DATE_FORMAT(#{statDate},'%Y%m%d')
         AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
         GROUP BY
-        stat_hour
+        `hour`
         ORDER BY
-        stat_hour ASC
+        `hour` ASC
     </select>
 
     <select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
         ${filed}
-        FROM ctop_kuaishou_report_daily_account t1
-        WHERE t1.stat_date &lt;= #{endDate}
-        AND t1.stat_date &gt;= #{startDate}
+        FROM application.kuaishou_account_report_daily_dw t1
+        WHERE  t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -108,13 +111,14 @@
 
     <select id="querySumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(charge),2) cost,
-          sum(photo_show) photoShow,
-          sum(photo_click) photoClick,
-          sum(aClick) as aClick
-        FROM ctop_kuaishou_report_daily_account t1
-        WHERE t1.stat_date &lt;= #{endDate}
-        AND t1.stat_date &gt;= #{startDate}
+        ROUND(sum(charge),2) cost,
+        sum(`show`) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick
+        FROM
+        application.kuaishou_account_report_daily_dw
+        WHERE stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND stat_date &gt;= DATE_FORMAT( #{startDate},'%Y%m%d')
         AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -124,16 +128,17 @@
 
     <select id="querySumByDateGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.stat_date as statDate,
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        DATE_FORMAT(t1.stat_date,'%Y-%m-%d') as statDate,
+        t1.account_id as accountId,
+        t1.account_name as authName,
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
         ${filed}
         FROM
-        ctop_kuaishou_report_daily_account t1
-        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
+        application.kuaishou_account_report_daily_dw  t1
         WHERE
-        t1.stat_date &lt;= #{endDate}
-        AND t1.stat_date &gt;= #{startDate}
+        t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -145,16 +150,17 @@
 
     <select id="querySumByDateGroupAccountAndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.stat_date as statDate,
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        key_action as 'keyAction',
+        key_action_cost as 'keyActionCost',
+        DATE_FORMAT(t1.stat_date,'%Y-%m-%d') as statDate,
+        t1.account_id as accountId,
+        t1.account_name as authName,
         ${filed}
         FROM
-        ctop_kuaishou_report_daily_account t1
-        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
+        application.kuaishou_account_report_daily_dw  t1
         WHERE
-        t1.stat_date &lt;= #{endDate}
-        AND t1.stat_date &gt;= #{startDate}
+        t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -166,41 +172,43 @@
 
     <select id="queryDetailByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(charge),2) cost,
-          sum(photo_show) photoShow,
-          sum(photo_click) photoClick,
-          sum(aClick) as aClick,
-          stat_date as statDate
+        ROUND(sum(charge),2) cost,
+        sum(`show`) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick,
+        DATE_FORMAT(stat_date,'%Y-%m-%d') as statDate
         FROM
-          ctop_kuaishou_report_daily_account
-        WHERE stat_date &lt;= #{endDate}
-        AND stat_date &gt;= #{startDate}
+        application.kuaishou_account_report_daily_dw
+        WHERE stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
         group by stat_date
-        order by stat_date asc
+        order by stat_date
     </select>
 
     <select id="queryDetailGroupMonthByDate" resultType="com.alibaba.fastjson.JSONObject">
+
         SELECT
-          ROUND(sum(charge),2) cost,
-          sum(photo_show) photoShow,
-          sum(photo_click) photoClick,
-          sum(aClick) as aClick,
-          DATE_FORMAT(t1.stat_date, '%Y-%m') statDate
-        FROM ctop_kuaishou_report_daily_account t1
-        WHERE t1.stat_date &lt;= #{endDate}
-        AND t1.stat_date &gt;= #{startDate}
-        AND t1.account_id in
+        ROUND(sum(charge),2) cost,
+        sum(`show`) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick,
+        DATE_FORMAT(stat_date, '%Y-%m') statDate
+        FROM
+        application.kuaishou_account_report_daily_dw
+        WHERE stat_date &lt;=  DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by DATE_FORMAT(t1.stat_date, '%Y-%m')
-        order by t1.stat_date asc
+        group by DATE_FORMAT(stat_date, '%Y-%m')
+        order by stat_date
     </select>
 
     <select id="queryDetailGroupDayByMonth" resultType="com.alibaba.fastjson.JSONObject">

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouAccountReportService.java

@@ -14,7 +14,7 @@ public interface IKuaiShouAccountReportService {
 
     List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException;
 
-    List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
+    List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 
     List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 

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

@@ -39,7 +39,8 @@ public class KsVideoReportServiceImpl implements IKsVideoReportService {
     public PageInfo<JSONObject> getKuaiShouVideoPageReportByMap(Map<String, Object> requestMap, int pageSize, int pageNo) {
         Long total = ksVideoReportMapper.getTotalByMap(requestMap);
         PageHelper.startPage(pageNo, pageSize, false);
-        PageInfo pageInfo = new PageInfo(ksVideoReportMapper.getKuaiShouVideoReportByMap(requestMap));
+        List<JSONObject> list = ksVideoReportMapper.getKuaiShouVideoReportByMap(requestMap);
+        PageInfo pageInfo = new PageInfo(list);
         pageInfo.setTotal(total);
         return pageInfo;
 

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouAccountReportMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouAccountReportService;
@@ -90,21 +91,29 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
     }
 
     @Override
-    public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+    public List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
+        if (!Check.isNull(target) && "photo_show".equals(target)) {
+            target = "`show`";
+        }
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
+        filedAll = filedAll.replace("photo_show", "`show`");
         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);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = kuaiShouAccountReportMapper.querySumByHour(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
             } else {
                 result = kuaiShouAccountReportMapper.querySumByDateGroupAccount(filedAll, endDate, startDate, accounts, target, order);
                 JSONObject afterSum = kuaiShouAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = kuaiShouAccountReportMapper.queryAllSumByStartEndDate(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1), DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
@@ -115,13 +124,16 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
             } else {
                 result = kuaiShouAccountReportMapper.querySumByDateGroupAccountAndDate(filedAll, endDate, startDate, accounts, target, order);
             }
-            result.add(kuaiShouAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts));
+            JSONObject object = kuaiShouAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts);
+            object.put("authName", "总计");
+            result.add(object);
         }
         return result;
     }
 
     @Override
     public List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+        filed = filed.replace("photo_show", "`show`");
         List<JSONObject> result;
         if (startDate.equals(endDate)) {
             if (startDate.equals(DateUtils.date2Str())) {
@@ -197,6 +209,7 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
                 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) + "%");
             }
         });
+        jsonObject.put("authName", "环比");
         return jsonObject;
     }
 

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

@@ -98,7 +98,7 @@ public class BytedanceAccountReportCtrl {
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData = bytedanceAccountReportService.getListDataBy(mediaId, discount, accounts, startDate, endDate, hour, target, order);
+            List<JSONObject> listData = bytedanceAccountReportService.getListDataBy(mediaId, accounts, startDate, endDate, hour, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -141,7 +141,7 @@ public class BytedanceAccountReportCtrl {
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         int hour = requestBody.getInteger("hour");
-        List<JSONObject> excelData = bytedanceAccountReportService.getExcelDataBy(filed, mediaId, accounts, startDate, endDate, hour, target, order);
+        List<JSONObject> excelData = bytedanceAccountReportService.getListDataBy(filed, accounts, startDate, endDate, hour, target, order);
         if (excelData.isEmpty()) {
             return;
         }

+ 23 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoReportService;
@@ -53,7 +54,24 @@ public class BytedanceVideoReportCtrl {
             String order = requestBody.getString("order");
             int pageSize = requestBody.getInteger("pageSize");
             int pageNo = requestBody.getInteger("pageNo");
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo());
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo2());
+
+            if (!Check.isNull(target) && "material_show".equals(target)) {
+                target = "`show`";
+            } else if ("convert_material".equals(target)) {
+                target = "`convert`";
+            } else if ("play50_feed_break".equals(target)) {
+                target = "play_50_feed_break";
+            } else if ("play100_feed_break".equals(target)) {
+                target = "play_100_feed_break";
+            } else if ("play25_feed_break".equals(target)) {
+                target = "play_25_feed_break";
+            } else if ("play75_feed_break".equals(target)) {
+                target = "play_75_feed_break";
+            } else if ("share_material".equals(target)) {
+                target = "share";
+            }
+
             try {
                 if (accountIds.isEmpty()) {
                     accountIds = null;
@@ -76,13 +94,12 @@ public class BytedanceVideoReportCtrl {
             log.error("request body is empty");
             result.setSuccess(false);
         } else {
-
             JSONArray accountIds = requestBody.getJSONArray("accountIds");
             String signature = requestBody.getString("signature");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
 
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo());
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo2());
 
             try {
                 if (accountIds.isEmpty()) {
@@ -113,14 +130,14 @@ public class BytedanceVideoReportCtrl {
             //默认消耗必查
             columns.add("cost");
         }
-        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapByVideo(), columns);
-        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapByVideo(), columns));
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.getDicMapByVideo2(), columns);
+
+        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.getDicMapByVideo2(), columns));
         //此处增加两个元素是为了保证数据顺序
         if ("exportDetail".equals(exportType)) {
             titles.add(0, "客户");
             titles.add(1, "项目名称");
             titles.add(2, "时间");
-            titles.add(3, "消耗");
             columns.add(0, "advertiserName");
             columns.add(1, "projectName");
             columns.add(2, "statDate");

+ 143 - 128
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml

@@ -5,173 +5,184 @@
     <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) as convertNum,
-        max(stat_hour) maxHour
+        sum(`convert`) as convertNum,
+        max(`hour`) maxHour
         FROM
-        ctop_bytedance_report_advertiser_hourly
-        WHERE
-        stat_datetime = #{statDate}
-        AND advertiser_id in
+        application.bytedance_advertiser_report_hourly_dw
+        WHERE stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
     </select>
 
     <select id="queryTodayReportByAccount" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) as convertNum
-        FROM
-        ctop_bytedance_report_advertiser_daily
-        WHERE
-        stat_datetime = #{statDate} '00:00:00'
-        AND advertiser_id= #{accountId}
+        SELECT ROUND(sum(cost), 2) cost,
+               sum(show_num)       showNum,
+               sum(click)          click,
+               sum(convert_num) as convertNum
+        FROM ctop_bytedance_report_advertiser_daily
+        WHERE stat_datetime = #{statDate} '00:00:00'
+        AND account_id= #{accountId}
     </select>
 
     <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        t1.account_id as accountId,
+        t1.account_name as authName,
         ${filed}
-        FROM ctop_bytedance_report_advertiser_hourly t1
-        left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
-        WHERE t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
+        FROM application.bytedance_advertiser_report_hourly_dw t1
+        WHERE t1.stat_datetime = DATE_FORMAT(#{statDate}, '%Y%m%d' )
+        and t1.`hour` &lt;= #{hour}
+        <if test="accountIds !=null">
+        AND t1.account_id IN
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by t1.advertiser_id
+        </if>
+        group by t1.account_id
         order by ${target} ${order}
     </select>
 
     <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) as convertNum
+        sum(`convert`) as convertNum
         FROM
-        ctop_bytedance_report_advertiser_hourly
+        application.bytedance_advertiser_report_hourly_dw
         WHERE
-        stat_datetime = #{statDate}
-        and stat_hour &lt;= #{hour}
-        AND advertiser_id in
+        stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
+        and `hour` &lt;= #{hour}
+        <if test="accountIds !=null">
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
     </select>
 
     <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ${filed}
         FROM
-        ctop_bytedance_report_advertiser_hourly t1
+        application.bytedance_advertiser_report_hourly_dw t1
         WHERE
-        t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
+        t1.stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
+        and t1.`hour` &lt;= #{hour}
+        <if test="accountIds !=null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
     </select>
 
     <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) as convertNum,
-        stat_hour as statHour
+        sum(`convert`) as convertNum,
+        `hour` as statHour
         FROM
-        ctop_bytedance_report_advertiser_hourly
+        application.bytedance_advertiser_report_hourly_dw
         WHERE
-        stat_datetime = #{statDate}
-        AND advertiser_id in
+        stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
         GROUP BY
-        stat_hour
+        `hour`
         ORDER BY
-        stat_hour ASC
+        `hour` ASC
     </select>
 
     <select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ${filed}
-        FROM ctop_bytedance_report_advertiser_daily t1
-        WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
-        AND t1.stat_datetime &gt;= #{startDate}
-        AND t1.advertiser_id in
+        FROM application.bytedance_advertiser_report_hourly_dw  t1
+        WHERE t1.stat_datetime &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
     </select>
 
     <select id="querySumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT ROUND(sum(cost), 2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) as convertNum
-        FROM ctop_bytedance_report_advertiser_daily t1
-        WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
-        AND t1.stat_datetime &gt;= #{startDate}
-        AND advertiser_id in
+        sum(`convert`) as convertNum
+        FROM
+        application.bytedance_advertiser_report_hourly_dw
+        WHERE stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+          AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
     </select>
 
     <select id="querySumByDateGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         DATE_FORMAT(t1.stat_datetime,'%Y-%m-%d') as statDate,
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        t1.account_id as accountId,
+        t1.account_name as authName,
         ${filed}
-        FROM
-        ctop_bytedance_report_advertiser_daily t1
-        left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
+        FROM application.bytedance_advertiser_report_hourly_dw  t1
         WHERE
-        t1.stat_datetime &lt;= #{endDate} '00:00:00'
-        AND t1.stat_datetime &gt;= #{startDate}
-        AND t1.advertiser_id in
+        t1.stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+          AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        group by t1.advertiser_id
+        </if>
+        group by t1.account_id
         order by ${target} ${order}
     </select>
 
     <select id="querySumByDateGroupAccountAndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         DATE_FORMAT(t1.stat_datetime,'%Y-%m-%d') as statDate,
-        t2.account_id as accountId,
-        t2.auth_name as authName,
+        t1.account_id as accountId,
+        t1.account_name as authName,
         ${filed}
         FROM
-        ctop_bytedance_report_advertiser_daily t1
-        left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
+        FROM application.bytedance_advertiser_report_hourly_dw  t1
         WHERE
-        t1.stat_datetime &lt;= #{endDate} '00:00:00'
-        AND t1.stat_datetime &gt;= #{startDate}
-        AND t1.advertiser_id in
+        t1.stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
         group by t1.stat_datetime
         order by ${target} ${order}
     </select>
@@ -179,45 +190,48 @@
     <select id="queryDetailByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) convertNum,
+        sum(`convert`) convertNum,
         DATE_FORMAT(stat_datetime, '%Y-%m-%d') statDate
         FROM
-        ctop_bytedance_report_advertiser_daily
-        WHERE stat_datetime &lt;= #{endDate} '00:00:00'
-        AND stat_datetime &gt;= #{startDate}
-        AND advertiser_id in
+        application.bytedance_advertiser_report_daily_dw
+        WHERE stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
         group by stat_datetime
-        order by stat_datetime asc
+        order by stat_datetime
     </select>
 
     <select id="queryDetailGroupMonthByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
+        sum(`show`) showNum,
         sum(click) click,
-        sum(convert_num) convertNum,
+        sum(`convert`) convertNum,
         DATE_FORMAT(t1.stat_datetime, '%Y-%m') statDate
-        FROM ctop_bytedance_report_advertiser_daily t1
-        WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
-        AND t1.stat_datetime &gt;= #{startDate}
-        AND t1.advertiser_id in
+        FROM application.bytedance_advertiser_report_daily_dw t1
+        WHERE t1.stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        <if test="accountIds !=null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        </if>
         group by DATE_FORMAT(t1.stat_datetime, '%Y-%m')
-        order by t1.stat_datetime asc
+        order by t1.stat_datetime
     </select>
 
     <select id="queryDetailGroupDayByMonth" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-               DATE_FORMAT(stat_datetime, '%Y-%m-%d')                      statDate,
+        SELECT DATE_FORMAT(stat_datetime, '%Y-%m-%d') statDate,
                SUBSTR(DATE_FORMAT(stat_datetime, '%Y-%m-%d') FROM 9 FOR 2) day
         FROM ctop_bytedance_report_advertiser_daily
         WHERE stat_datetime like '${month}%'
@@ -226,7 +240,8 @@
     </select>
 
     <sql id="selectSql">
-        ifnull(sum(a.show_num),0)                          as showMaterial,
+        ifnull
+        (sum(a.show_num),0)                          as showMaterial,
         ifnull(sum(a.click),0)                             as clickMaterial,
         ifnull(sum(a.convert_num),0)                       as convertMaterial,
         ifnull(sum(a.cost),0)                              as cost,
@@ -250,53 +265,65 @@
 		case
         when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play25_feed_break) is not null
         then round(sum(a.play25_feed_break) / sum(a.total_play),2)
-        else 0 end                               as play25FeedBreakRate,
+        else 0
+        end                               as play25FeedBreakRate,
 		case
         when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert_num) is not null
         then round(sum(a.convert_num) / sum(a.click),2)
-        else 0 end                               as convertRate,
+        else 0
+        end                               as convertRate,
         case
         when sum(a.convert_num) != 0 and sum(a.convert_num) is not null and sum(a.cost) is not null
         then round(sum(a.cost)/sum(a.convert_num),2)
-        else 0 end as convertCost,
+        else 0
+        end as convertCost,
 		ifnull(sum(a.follow),0)                            as follow,
         ifnull(sum(a.next_day_open),0)                     as nextDayOpen,
         case
         when sum(a.active) != 0 and sum(a.next_day_open) is not null and sum(a.active) is not null
         then round(sum(a.next_day_open) / sum(a.active),2)
-        else 0 end                               as nextDayOpenRate,
+        else 0
+        end                               as nextDayOpenRate,
         case
         when sum(a.next_day_open) != 0 and sum(a.next_day_open) is not null and sum(a.cost) is not null
         then round(sum(a.cost) / sum(a.next_day_open),2)
-        else 0 end                               as nextDayOpenCost,
+        else 0
+        end                               as nextDayOpenCost,
 		case
         when sum(a.click) != 0 and sum(a.click) is not null and sum(a.cost) is not null
         then round(sum(a.cost) / sum(a.click),2)
-        else 0 end                               as cpc,
+        else 0
+        end                               as cpc,
         case
         when sum(a.show_num) != 0 and sum(a.show_num) is not null and sum(a.click) is not null
         then round(sum(a.click) / sum(a.show_num),2)
-        else 0 end                               as ctr,
+        else 0
+        end                               as ctr,
         case
         when sum(a.show_num) != 0 and sum(a.cost) is not null and sum(a.show_num) is not null
         then round(sum(a.cost) / sum(a.show_num) * 1000,2)
-        else 0 end                               as cpm,
+        else 0
+        end                               as cpm,
 		case
         when sum(a.active) != 0 and sum(a.cost) is not null and sum(a.active) is not null
         then round(sum(a.cost) / sum(a.active),2)
-        else 0 end                               as activeCost,
+        else 0
+        end                               as activeCost,
 		case
         when sum(a.click) != 0 and sum(a.active) is not null and sum(a.click) is not null
         then round(sum(a.active) / sum(a.click),2)
-        else 0 end                               as activeRate,
+        else 0
+        end                               as activeRate,
         case
         when sum(a.active) != 0 and sum(a.register) is not null and sum(a.active) is not null
         then round(sum(a.register) / sum(a.active),2)
-        else 0 end                               as activeRegisterRate,
+        else 0
+        end                               as activeRegisterRate,
         case
         when sum(a.register) != 0 and sum(a.cost) is not null and sum(a.register) is not null
         then round(sum(a.cost) / sum(a.register),2)
-        else 0 end                               as activeRegisterCost
+        else 0
+        end                               as activeRegisterCost
     </sql>
 
     <select id="getBytedanceAccountInfoByProjectId"
@@ -400,11 +427,9 @@
     </select>
 
     <select id="getRoleCodeByUserId" resultType="string">
-        select
-        role_code
-        from
-        sys_user_role a
-        left join sys_role b on a.role_id = b.id
+        select role_code
+        from sys_user_role a
+                 left join sys_role b on a.role_id = b.id
         where a.user_id = #{userId}
     </select>
 
@@ -460,40 +485,30 @@
     </select>
 
     <select id="getUserProjectAccountIds" resultType="long">
-        select
-        a.account_id
-        from
-        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
-        left join ctop_project_member b on a.project_id=b.project_id
-        where
-        a.user_id = #{userId}
-        and a.media_id in (1,3)
-        order by a.create_time desc
-        limit 50
+        select a.account_id
+        from (select project_id, account_id, media_id, create_time from ctop_user_allocation group by account_id) a
+                 left join ctop_project_member b on a.project_id = b.project_id
+        where a.user_id = #{userId}
+          and a.media_id in (1, 3)
+        order by a.create_time desc limit 50
     </select>
 
 
     <select id="getSaleProjectAccountIds" resultType="long">
-        select
-        a.account_id
-        from
-        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
-        left join ctop_project b on a.project_id=b.id
-        where
-        b.sale_id = #{userId}
-        and b.media_id in (1,3)
+        select a.account_id
+        from (select project_id, account_id, media_id, create_time from ctop_user_allocation group by account_id) a
+                 left join ctop_project b on a.project_id = b.id
+        where b.sale_id = #{userId}
+          and b.media_id in (1, 3)
         order by a.create_time desc
 
     </select>
 
     <select id="getUserProjectAccountIdsByAdmin" resultType="long">
-        select
-        a.account_id
-        from
-        ctop_user_allocation a
-        left join ctop_project b on a.project_id = b.id
-        where
-        b.media_id in (1,3)
+        select a.account_id
+        from ctop_user_allocation a
+                 left join ctop_project b on a.project_id = b.id
+        where b.media_id in (1, 3)
 
     </select>
     <select id="getBytedanceProjectInfoEntity"

+ 27 - 29
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -4,27 +4,25 @@
 
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.md5 signature,
-        (case when t1.toutiao_url != ''  then t1.toutiao_url
-            when t1.url !='' then t1.url
-            else ''  end ) AS url,
+        t1.signature,
+        t1.video_url AS url,
         t1.cover_url AS converUrl,
-        t1.clip_name AS clip,
-        t1.shot_name AS shot,
-        t1.plan_name AS plan,
-        t1.team_leader as leader,
-        t1.material_name AS materialName,
+        IFNULL(t1.clip_name,'-') AS clip,
+        IFNULL(t1.shot_name,'-') AS shot,
+        IFNULL(t1.plan_name,'-') AS plan,
+        IFNULL(t1.leader_name,'-') AS leader,
+        t1.video_name AS materialName,
         t1.project_name AS projectName,
-        t1.material_create_time AS createTime,
-        sum(t1.material_show) as showMaterial,
-        t1.team_leader as 'teamLeader',
-        concat(CAST(round(sum(t1.in_app_pay) / sum(t1.convert_material)*100,2) AS CHAR) ,'%') as 'firstPurchase',
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d') AS createTime,
+        sum( t1.SHOW ) AS showMaterial,
+        IFNULL(t1.leader_name,'-') AS 'teamLeader',
+        CASE WHEN t1.convert != 0 THEN concat( CAST( round(sum(t1.in_app_pay)/sum(t1.convert)* 100, 2 ) AS CHAR ), '%' ) ELSE '0.00%' end AS 'firstPurchase',
         ${filed}
         FROM
-        etl_report_bytedance_video t1
+        application.bytedance_material_video_report_daily_dw t1
         WHERE
-        t1.stat_datetime >= #{startDate}
-        AND t1.stat_datetime &lt;= #{endDate}
+        t1.stat_datetime >= DATE_FORMAT(#{startDate}, '%Y%m%d' )
+        AND t1.stat_datetime &lt;= DATE_FORMAT(#{endDate}, '%Y%m%d' )
         <if test="accountIds != null">
             AND t1.account_id in
             <foreach item="item" index="index" collection="accountIds"
@@ -42,28 +40,28 @@
             AND (t1.plan_name LIKE '%${plan}%')
         </if>
         <if test="leader!= null and leader!='' ">
-            AND t1.team_leader LIKE '%${leader}%'
+            AND t1.leader_name LIKE '%${leader}%'
         </if>
-        GROUP BY t1.md5
+        GROUP BY t1.signature
         ORDER BY ${target} ${order}
     </select>
 
     <select id="queryVideoDetailBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        t1.stat_datetime as statDate,
-        t1.md5 signature,
-        IFNULL(t1.toutiao_url, '') AS url,
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d') as statDate,
+        t1.signature,
+        IFNULL(t1.video_url, '') AS url,
         t1.cover_url AS converUrl,
-        t1.material_name AS materialName,
+        t1.video_name AS materialName,
         t1.project_name AS projectName,
-        t1.advertiser_name as advertiserName,
-        t1.material_create_time AS createTime,
+        t1.account_name as advertiserName,
+        DATE_FORMAT(stat_datetime,'%Y-%m-%d') AS createTime,
         ${filed}
         FROM
-        etl_report_bytedance_video t1
-        WHERE t1.md5=#{signature}
-        AND t1.stat_datetime >= #{startDate}
-        AND t1.stat_datetime &lt;= #{endDate}
+        application.bytedance_material_video_report_daily_dw t1
+        WHERE t1.signature=#{signature}
+        AND t1.stat_datetime >= DATE_FORMAT(#{startDate}, '%Y%m%d' )
+        AND t1.stat_datetime &lt;= DATE_FORMAT(#{endDate}, '%Y%m%d' )
         <if test="accountIds != null">
             AND t1.account_id in
             <foreach item="item" index="index" collection="accountIds"
@@ -71,7 +69,7 @@
                 #{item}
             </foreach>
         </if>
-        GROUP BY t1.md5,t1.stat_datetime
+        GROUP BY t1.signature,t1.stat_datetime
         order by t1.stat_datetime desc
     </select>
 </mapper>

+ 4 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -13,13 +13,13 @@ import java.util.Map;
 
 public interface IBytedanceAccountReportService {
 
-    Map<String,Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate , String endDate);
+    Map<String, Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate);
 
-    List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate , String endDate) throws ParseException;
+    List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException;
 
-    List<JSONObject> getListDataBy(String mediaId,BigDecimal discount, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
+    List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 
-    List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
+    List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort, Integer yn);
 

+ 35 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -99,22 +99,48 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     }
 
     @Override
-    public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+    public List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDictMapBy());
+        filedAll = filedAll.replace("like_num", "`like`").
+                replace("show_num", "`show`").
+                replace("convert_num", "`convert`").
+                replace("play50_feed_break", "play_50_feed_break").
+                replace("play100_feed_break", "play_100_feed_break").
+                replace("play25_feed_break", "play_25_feed_break").
+                replace("play75_feed_break", "play_75_feed_break");
+        if (!Check.isNull(target) && "like_num".equals(target)) {
+            target = "`like`";
+        } else if ("show_num".equals(target)) {
+            target = "`show`";
+        } else if ("convert_num".equals(target)) {
+            target = "`convert`";
+        } else if ("play50_feed_break".equals(target)) {
+            target = "play_50_feed_break";
+        } else if ("play100_feed_break".equals(target)) {
+            target = "play_100_feed_break";
+        } else if ("play25_feed_break".equals(target)) {
+            target = "play_25_feed_break";
+        } else if ("play75_feed_break".equals(target)) {
+            target = "play_75_feed_break";
+        }
         if (startDate.equals(endDate)) {
             //由于时报数据不准,修改逻辑除当日数据外全部请求日报数据
-            if(startDate.equals(DateUtils.date2Str())){
+            if (startDate.equals(DateUtils.date2Str())) {
                 result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
                 JSONObject afterSum = bytedanceAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = bytedanceAccountReportMapper.querySumByHour(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
-            }else {
-                result= bytedanceAccountReportMapper.querySumByDateGroupAccount(filedAll, endDate, startDate, accounts, target, order);
+            } else {
+                result = bytedanceAccountReportMapper.querySumByDateGroupAccount(filedAll, endDate, startDate, accounts, target, order);
                 JSONObject afterSum = bytedanceAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = bytedanceAccountReportMapper.queryAllSumByStartEndDate(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1), DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
@@ -135,10 +161,10 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
         List<JSONObject> result;
         if (startDate.equals(endDate)) {
             //由于时报数据不准,修改逻辑除当日数据外全部请求日报数据
-            if(startDate.equals(DateUtils.date2Str())){
+            if (startDate.equals(DateUtils.date2Str())) {
                 result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filed, startDate, hour, accounts, target, order);
-            }else {
-                result= bytedanceAccountReportMapper.querySumByDateGroupAccount(filed, startDate, endDate, accounts, target, order);
+            } else {
+                result = bytedanceAccountReportMapper.querySumByDateGroupAccount(filed, startDate, endDate, accounts, target, order);
             }
         } else {
             result = bytedanceAccountReportMapper.querySumByDateGroupAccount(filed, endDate, startDate, accounts, target, order);
@@ -205,9 +231,10 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             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)+"%");
+                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) + "%");
             }
         });
+        jsonObject.put("authName", "环比");
         return jsonObject;
     }
 

+ 238 - 66
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -29,7 +29,7 @@ public class AccountReportConstants {
             "    \"comment\": \"点击数\"\n" +
             "  },\n" +
             "  \"ctr\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.show_num) != 0 THEN concat(CAST(round( sum(t1.click) /sum(t1.show_num)*100,2) AS CHAR),'%') ELSE '0%' end as ctr \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.show_num) != 0 THEN concat(CAST(round( sum(t1.click) /sum(t1.show_num)*100,2) AS CHAR),'%') ELSE '0.00%' end as ctr \",\n" +
             "    \"comment\": \"点击率\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
@@ -45,7 +45,7 @@ public class AccountReportConstants {
             "    \"comment\": \"转化成本\"\n" +
             "  },\n" +
             "  \"convertRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.convert_num) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0%' end AS convertRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.convert_num) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0.00%' end AS convertRate\",\n" +
             "    \"comment\": \"转化率\"\n" +
             "  },\n" +
             "  \"downloadStart\": {\n" +
@@ -53,11 +53,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载数\"\n" +
             "  },\n" +
             "  \"downloadStartCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / (t1.download_start) IS NULL THEN 0 ELSE sum(t1.cost) / sum(t1.download_start) end AS downloadStartCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / (t1.download_start) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.download_start),3) end AS downloadStartCost \",\n" +
             "    \"comment\": \"安卓开始下载成本\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0%' end AS downloadStartRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0.00%' end AS downloadStartRate \",\n" +
             "    \"comment\": \"安卓开始下载率\"\n" +
             "  },\n" +
             "  \"downloadFinish\": {\n" +
@@ -65,11 +65,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成数\"\n" +
             "  },\n" +
             "  \"downloadFinishCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.download_finish) IS NULL THEN 0 ELSE  sum(t1.cost) / sum(t1.download_finish) end AS downloadFinishCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.download_finish) IS NULL THEN 0 ELSE  ROUND(sum(t1.cost) / sum(t1.download_finish),3) end AS downloadFinishCost \",\n" +
             "    \"comment\": \"安卓下载完成成本\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.download_finish) != 0 THEN  concat(CAST(round(sum(t1.install_finish) / sum(t1.download_finish)*100,2) AS CHAR) ,'%') ELSE '0%' end  AS downloadFinishRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.download_finish) != 0 THEN  concat(CAST(round(sum(t1.install_finish) / sum(t1.download_finish)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS downloadFinishRate \",\n" +
             "    \"comment\": \"安卓下载完成率\"\n" +
             "  },\n" +
             "  \"active\": {\n" +
@@ -77,11 +77,11 @@ public class AccountReportConstants {
             "    \"comment\": \"激活数\"\n" +
             "  },\n" +
             "  \"activeCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.active) IS NULL THEN 0 ELSE sum(t1.cost) / sum(t1.active) end AS activeCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.active) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.active),3) end AS activeCost \",\n" +
             "    \"comment\": \"激活成本\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0%' end as activeRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0.00%' end as activeRate \",\n" +
             "    \"comment\": \"激活率\"\n" +
             "  },\n" +
             "  \"register\": {\n" +
@@ -93,7 +93,7 @@ public class AccountReportConstants {
             "    \"comment\": \"注册成本\"\n" +
             "  },\n" +
             "  \"activeRegisterRate\": {\n" +
-            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end as activeRegisterRate \",\n" +
+            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end as activeRegisterRate \",\n" +
             "    \"comment\": \"注册率\"\n" +
             "  },\n" +
             "  \"nextDayOpen\": {\n" +
@@ -105,7 +105,7 @@ public class AccountReportConstants {
             "    \"comment\": \"次留成本\"\n" +
             "  },\n" +
             "  \"nextDayOpenRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end as nextDayOpenRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end as nextDayOpenRate \",\n" +
             "    \"comment\": \"次留率\"\n" +
             "  },\n" +
             "  \"activePayAmount\": {\n" +
@@ -175,11 +175,11 @@ public class AccountReportConstants {
             "    \"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%' END AS 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%' END AS 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" +
@@ -199,11 +199,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载数\"\n" +
             "  },\n" +
             "  \"downloadStartCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.charge) / (t1.download_started) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.download_started) end AS 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%' end AS 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" +
@@ -211,11 +211,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成数\"\n" +
             "  },\n" +
             "  \"downloadFinishCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.download_completed) IS NULL THEN 0 ELSE  sum(t1.charge) / sum(t1.download_completed) end AS 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%' end AS 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" +
@@ -223,7 +223,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活数\"\n" +
             "  },\n" +
             "  \"activeCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.activation) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.activation) end AS 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" +
@@ -235,11 +235,11 @@ public class AccountReportConstants {
             "    \"comment\": \"首日付费金额\"\n" +
             "  },\n" +
             "  \"firstDayPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_pay_first_day) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.event_pay_first_day) end AS 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%' ELSE concat(CAST(round(sum(t1.event_pay_purchase_amount_first_day) / sum(t1.charge)*100,2) AS CHAR) ,'%') end AS 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" +
@@ -251,11 +251,11 @@ public class AccountReportConstants {
             "    \"comment\": \"付费金额\"\n" +
             "  },\n" +
             "  \"eventPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_pay) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.event_pay) end AS 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%' ELSE concat(CAST(round(sum(t1.event_pay_purchase_amount) / sum(t1.charge)*100,2) AS CHAR) ,'%') end AS 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" +
@@ -267,7 +267,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -295,7 +295,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -311,7 +311,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -331,7 +331,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -343,15 +343,23 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
+            "  },\n" +
+            "  \"keyActionCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.key_action) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.key_action),3) end as keyActionCost \",\n" +
+            "    \"comment\": \"关键行为成本\"\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%' end as 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" +
             "}";
@@ -385,11 +393,11 @@ public class AccountReportConstants {
             "    \"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%' END AS 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%' END AS 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" +
@@ -413,7 +421,7 @@ public class AccountReportConstants {
             "    \"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%' end AS 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" +
@@ -425,7 +433,7 @@ public class AccountReportConstants {
             "    \"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%' end AS 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" +
@@ -477,7 +485,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -505,7 +513,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -521,7 +529,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -541,7 +549,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -553,11 +561,11 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
             "  \"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%' end as 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" +
             "  \"play3sCount\": {\n" +
@@ -600,11 +608,11 @@ public class AccountReportConstants {
             "    \"comment\": \"行为数\"\n" +
             "  },\n" +
             "  \"clickRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0    THEN CONCAT( CAST(ROUND((sum(t1.photo_click) / sum(t1.`show`)) * 100,2) AS CHAR) ,'%') else '0%' END AS clickRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0    THEN CONCAT( CAST(ROUND((sum(t1.photo_click) / sum(t1.`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%' END AS 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" +
@@ -628,7 +636,7 @@ public class AccountReportConstants {
             "    \"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%' end AS 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" +
@@ -640,7 +648,7 @@ public class AccountReportConstants {
             "    \"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%' end AS 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" +
@@ -692,7 +700,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -720,7 +728,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -736,7 +744,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -756,7 +764,7 @@ public class AccountReportConstants {
             "    \"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%' end as 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" +
@@ -768,11 +776,11 @@ public class AccountReportConstants {
             "    \"comment\": \"按钮点击成本\"\n" +
             "  },\n" +
             "  \"submitRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.event_button_click) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0%' end as submitRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.event_button_click) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0.00%' end as submitRate \",\n" +
             "    \"comment\": \"按钮点击率\"\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%' end as 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" +
             "  \"play3sCount\": {\n" +
@@ -971,14 +979,17 @@ public class AccountReportConstants {
             "  \"play3sRate\": {\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
+            "  \"keyAction\": {\n" +
+            "    \"comment\": \"关键行为数\"\n" +
+            "  },\n" +
+            "  \"keyActionCost\": {\n" +
+            "    \"comment\": \"关键行为成本\"\n" +
+            "  },\n" +
             "  \"adScene\": {\n" +
             "    \"comment\": \"投放场景\"\n" +
             "  }\n" +
             "}";
 
-    public static void main(String[] args) {
-        System.out.println(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON);
-    }
     public static final String BYTEDANCE_VIDEO_REPORT_MAPPING_JSON = "{\n" +
             "  \"cost\": {\n" +
             "    \"filed\": \"IFNULL(sum(t1.cost),0) as cost \",\n" +
@@ -993,7 +1004,7 @@ public class AccountReportConstants {
             "    \"comment\": \"点击数\"\n" +
             "  },\n" +
             "  \"ctr\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.material_show) != 0 THEN CONCAT(CAST(ROUND((sum(t1.click) / sum(t1.material_show)) * 100,2) AS CHAR) ,'%') ELSE '0%' end  AS ctr\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.material_show) != 0 THEN CONCAT(CAST(ROUND((sum(t1.click) / sum(t1.material_show)) * 100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS ctr\",\n" +
             "    \"comment\": \"点击率\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
@@ -1009,7 +1020,7 @@ public class AccountReportConstants {
             "    \"comment\": \"转化成本\"\n" +
             "  },\n" +
             "  \"convertRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.material_show)!= 0 THEN concat(CAST(round(sum(t1.convert_material) / sum(t1.material_show)*100,2) AS CHAR) ,'%') ELSE '0%' end  AS convertRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.material_show)!= 0 THEN concat(CAST(round(sum(t1.convert_material) / sum(t1.material_show)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS convertRate \",\n" +
             "    \"comment\": \"转化率\"\n" +
             "  },\n" +
             "  \"downloadStart\": {\n" +
@@ -1021,7 +1032,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载成本\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0%' end  AS downloadStartRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS downloadStartRate \",\n" +
             "    \"comment\": \"安卓开始下载率\"\n" +
             "  },\n" +
             "  \"downloadFinish\": {\n" +
@@ -1033,7 +1044,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成成本\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.download_finish) != 0 THEN concat(CAST(round(sum(t1.install_finish) / sum(t1.download_finish)*100,2) AS CHAR),'%') ELSE '0%' end  AS downloadFinishRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.download_finish) != 0 THEN concat(CAST(round(sum(t1.install_finish) / sum(t1.download_finish)*100,2) AS CHAR),'%') ELSE '0.00%' end  AS downloadFinishRate \",\n" +
             "    \"comment\": \"安卓下载完成率\"\n" +
             "  },\n" +
             "  \"active\": {\n" +
@@ -1045,7 +1056,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活成本\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click)!= 0 THEN concat( CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0%' end  as activeRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click)!= 0 THEN concat( CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0.00%' end  as activeRate\",\n" +
             "    \"comment\": \"激活率\"\n" +
             "  },\n" +
             "  \"register\": {\n" +
@@ -1057,7 +1068,7 @@ public class AccountReportConstants {
             "    \"comment\": \"注册成本\"\n" +
             "  },\n" +
             "  \"activeRegisterRate\": {\n" +
-            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end  as activeRegisterRate \",\n" +
+            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as activeRegisterRate \",\n" +
             "    \"comment\": \"注册率\"\n" +
             "  },\n" +
             "  \"gameAddiction\": {\n" +
@@ -1069,7 +1080,7 @@ public class AccountReportConstants {
             "    \"comment\": \"关键行为成本\"\n" +
             "  },\n" +
             "  \"gameAddictionRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.game_addiction) / sum(t1.active)*100,2) AS CHAR),'%') ELSE '0%' end  as gameAddictionRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.game_addiction) / sum(t1.active)*100,2) AS CHAR),'%') ELSE '0.00%' end  as gameAddictionRate\",\n" +
             "    \"comment\": \"关键行为率\"\n" +
             "  },\n" +
             "  \"nextDayOpen\": {\n" +
@@ -1081,7 +1092,7 @@ public class AccountReportConstants {
             "    \"comment\": \"次留成本\"\n" +
             "  },\n" +
             "  \"nextDayOpenRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end  as nextDayOpenRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as nextDayOpenRate \",\n" +
             "    \"comment\": \"次留率\"\n" +
             "  },\n" +
             "  \"activePayAmount\": {\n" +
@@ -1136,6 +1147,163 @@ public class AccountReportConstants {
 
 
 
+    public static final String BYTEDANCE_VIDEO_REPORT_MAPPING_JSON2 = "{\n" +
+            "  \"cost\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.cost),0) as cost \",\n" +
+            "    \"comment\": \"消耗\"\n" +
+            "  },\n" +
+            "  \"cpm\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.`show`) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.`show`)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"comment\": \"平均千次展现费用\"\n" +
+            "  },\n" +
+            "  \"clickMaterial\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.click),0) as clickMaterial \",\n" +
+            "    \"comment\": \"点击数\"\n" +
+            "  },\n" +
+            "  \"ctr\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0 THEN CONCAT(CAST(ROUND((sum(t1.click) / sum(t1.`show`)) * 100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS ctr\",\n" +
+            "    \"comment\": \"点击率\"\n" +
+            "  },\n" +
+            "  \"cpc\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) / sum(t1.cost) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.click)), 2) END AS cpc \",\n" +
+            "    \"comment\": \"平均点击单价\"\n" +
+            "  },\n" +
+            "  \"convertMaterial\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.`convert`),0) as convertMaterial \",\n" +
+            "    \"comment\": \"转化数\"\n" +
+            "  },\n" +
+            "  \"convertCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.`convert`) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.`convert`)), 2 ) END AS convertCost \",\n" +
+            "    \"comment\": \"转化成本\"\n" +
+            "  },\n" +
+            "  \"convertRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`)!= 0 THEN concat(CAST(round(sum(t1.`convert`) / sum(t1.`show`)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS convertRate \",\n" +
+            "    \"comment\": \"转化率\"\n" +
+            "  },\n" +
+            "  \"downloadStart\": {\n" +
+            "    \"filed\": \"IFNULL(sum(download_start),0) as downloadStart \",\n" +
+            "    \"comment\": \"安卓开始下载数\"\n" +
+            "  },\n" +
+            "  \"downloadStartCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / (t1.download_start) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.download_start),3) end AS downloadStartCost \",\n" +
+            "    \"comment\": \"安卓开始下载成本\"\n" +
+            "  },\n" +
+            "  \"downloadStartRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS downloadStartRate \",\n" +
+            "    \"comment\": \"安卓开始下载率\"\n" +
+            "  },\n" +
+            "  \"downloadFinish\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.download_finish),0) as downloadFinish \",\n" +
+            "    \"comment\": \"安卓下载完成数\"\n" +
+            "  },\n" +
+            "  \"downloadFinishCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.download_finish) IS NULL THEN 0 ELSE  ROUND(sum(t1.cost) / sum(t1.download_finish),3) end AS downloadFinishCost \",\n" +
+            "    \"comment\": \"安卓下载完成成本\"\n" +
+            "  },\n" +
+            "  \"downloadFinishRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.download_finish) != 0 THEN concat(CAST(round(sum(t1.install_finish) / sum(t1.download_finish)*100,2) AS CHAR),'%') ELSE '0.00%' end  AS downloadFinishRate \",\n" +
+            "    \"comment\": \"安卓下载完成率\"\n" +
+            "  },\n" +
+            "  \"active\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.active),0) as active \",\n" +
+            "    \"comment\": \"激活数\"\n" +
+            "  },\n" +
+            "  \"activeCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.active) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.active),3) end AS activeCost \",\n" +
+            "    \"comment\": \"激活成本\"\n" +
+            "  },\n" +
+            "  \"activeRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click)!= 0 THEN concat( CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0.00%' end  as activeRate\",\n" +
+            "    \"comment\": \"激活率\"\n" +
+            "  },\n" +
+            "  \"register\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.register),0) as register  \",\n" +
+            "    \"comment\": \"注册数\"\n" +
+            "  },\n" +
+            "  \"activeRegisterCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.register) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.register),3) end as activeRegisterCost \",\n" +
+            "    \"comment\": \"注册成本\"\n" +
+            "  },\n" +
+            "  \"activeRegisterRate\": {\n" +
+            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as activeRegisterRate \",\n" +
+            "    \"comment\": \"注册率\"\n" +
+            "  },\n" +
+            "  \"gameAddiction\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.game_addiction),0) as gameAddiction  \",\n" +
+            "    \"comment\": \"关键行为数\"\n" +
+            "  },\n" +
+            "  \"gameAddictionCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.game_addiction) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.game_addiction),3) end as gameAddictionCost \",\n" +
+            "    \"comment\": \"关键行为成本\"\n" +
+            "  },\n" +
+            "  \"gameAddictionRate\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.game_addiction) / sum(t1.active)*100,2) AS CHAR),'%') ELSE '0.00%' end  as gameAddictionRate\",\n" +
+            "    \"comment\": \"关键行为率\"\n" +
+            "  },\n" +
+            "  \"nextDayOpen\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.next_day_open),0) as nextDayOpen \",\n" +
+            "    \"comment\": \"次留数\"\n" +
+            "  },\n" +
+            "  \"nextDayOpenCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.next_day_open) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.next_day_open),3) end as nextDayOpenCost \",\n" +
+            "    \"comment\": \"次留成本\"\n" +
+            "  },\n" +
+            "  \"nextDayOpenRate\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as nextDayOpenRate \",\n" +
+            "    \"comment\": \"次留率\"\n" +
+            "  },\n" +
+            "  \"activePayAmount\": {\n" +
+            "    \"filed\": \"IFNULL(sum(pay_count),0) as activePayAmount \",\n" +
+            "    \"comment\": \"付费数\"\n" +
+            "  },\n" +
+            "  \"activePayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.pay_count) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.pay_count),3) end as activePayCost \",\n" +
+            "    \"comment\": \"付费成本\"\n" +
+            "  },\n" +
+            "  \"form\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.form),0) as form \",\n" +
+            "    \"comment\": \"表单提交\"\n" +
+            "  },\n" +
+            "  \"validPlayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.valid_play) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.valid_play),3) end as validPlayCost \",\n" +
+            "    \"comment\": \"有效播放成本\"\n" +
+            "  },\n" +
+            "  \"play25FeedBreak\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.play_25_feed_break),0) as play25FeedBreak \",\n" +
+            "    \"comment\": \"25%进度播放数\"\n" +
+            "  },\n" +
+            "  \"play50FeedBreak\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.play_50_feed_break),0) as play50FeedBreak\",\n" +
+            "    \"comment\": \"50%进度播放数\"\n" +
+            "  },\n" +
+            "  \"play75FeedBreak\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.play_75_feed_break),0) as play75FeedBreak\",\n" +
+            "    \"comment\": \"75%进度播放数\"\n" +
+            "  },\n" +
+            "  \"play100FeedBreak\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.play_100_feed_break),0) as play100FeedBreak\",\n" +
+            "    \"comment\": \"100%进度播放数\"\n" +
+            "  },\n" +
+            "  \"follow\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.follow),0) as follow \",\n" +
+            "    \"comment\": \"新增关注数\"\n" +
+            "  },\n" +
+            "  \"likeMaterial\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.`like`),0) as likeMaterial \",\n" +
+            "    \"comment\": \"点赞数\"\n" +
+            "  },\n" +
+            "  \"shareMaterial\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.share),0) as shareMaterial \",\n" +
+            "    \"comment\": \"分享数\"\n" +
+            "  },\n" +
+            "  \"showMaterial\": {\n" +
+            "    \"filed\": \"IFNULL(t1.`show`, 0 ) AS materialShow \",\n" +
+            "    \"comment\": \"展示数\"\n" +
+            "  }\n" +
+            "}";
+
+
+
     public static final String BYTEDANCE_VIDEO_REPORT_MAPPING_JSON_NEW = "{\n" +
             "  \"cost\": {\n" +
             "    \"filed\": \"IFNULL(sum(t1.cost),0) as cost \",\n" +
@@ -1150,7 +1318,7 @@ public class AccountReportConstants {
             "    \"comment\": \"点击数\"\n" +
             "  },\n" +
             "  \"ctr\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0 THEN CONCAT(CAST(ROUND((sum(t1.click) / sum(t1.`show`)) * 100,2) AS CHAR) ,'%') ELSE '0%' end  AS ctr\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0 THEN CONCAT(CAST(ROUND((sum(t1.click) / sum(t1.`show`)) * 100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS ctr\",\n" +
             "    \"comment\": \"点击率\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
@@ -1166,7 +1334,7 @@ public class AccountReportConstants {
             "    \"comment\": \"转化成本\"\n" +
             "  },\n" +
             "  \"convertRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.`show`)!= 0 THEN concat(CAST(round(sum(t1.`convert`) / sum(t1.`show`)*100,2) AS CHAR) ,'%') ELSE '0%' end  AS convertRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`)!= 0 THEN concat(CAST(round(sum(t1.`convert`) / sum(t1.`show`)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS convertRate \",\n" +
             "    \"comment\": \"转化率\"\n" +
             "  },\n" +
             "  \"downloadStart\": {\n" +
@@ -1178,7 +1346,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载成本\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0%' end  AS downloadStartRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click) != 0 THEN concat(CAST(round(sum(t1.download_start) / sum(t1.click)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  AS downloadStartRate \",\n" +
             "    \"comment\": \"安卓开始下载率\"\n" +
             "  },\n" +
             "  \"downloadFinish\": {\n" +
@@ -1190,7 +1358,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成成本\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.download_start) != 0 THEN concat(CAST(round(sum(t1.download_finish) / sum(t1.download_start)*100,2) AS CHAR),'%') ELSE '0%' end  AS downloadFinishRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.download_start) != 0 THEN concat(CAST(round(sum(t1.download_finish) / sum(t1.download_start)*100,2) AS CHAR),'%') ELSE '0.00%' end  AS downloadFinishRate \",\n" +
             "    \"comment\": \"安卓下载完成率\"\n" +
             "  },\n" +
             "  \"active\": {\n" +
@@ -1202,7 +1370,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活成本\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.click)!= 0 THEN concat( CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0%' end  as activeRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.click)!= 0 THEN concat( CAST(round(sum(t1.active) / sum(t1.click)*100,2) AS CHAR),'%') ELSE '0.00%' end  as activeRate\",\n" +
             "    \"comment\": \"激活率\"\n" +
             "  },\n" +
             "  \"register\": {\n" +
@@ -1214,7 +1382,7 @@ public class AccountReportConstants {
             "    \"comment\": \"注册成本\"\n" +
             "  },\n" +
             "  \"activeRegisterRate\": {\n" +
-            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end  as activeRegisterRate \",\n" +
+            "    \"filed\": \" CASE WHEN sum(t1.active) != 0 THEN concat(CAST(round(sum(t1.register) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as activeRegisterRate \",\n" +
             "    \"comment\": \"注册率\"\n" +
             "  },\n" +
             "  \"gameAddiction\": {\n" +
@@ -1226,7 +1394,7 @@ public class AccountReportConstants {
             "    \"comment\": \"关键行为成本\"\n" +
             "  },\n" +
             "  \"gameAddictionRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.game_addiction) / sum(t1.active)*100,2) AS CHAR),'%') ELSE '0%' end  as gameAddictionRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.game_addiction) / sum(t1.active)*100,2) AS CHAR),'%') ELSE '0.00%' end  as gameAddictionRate\",\n" +
             "    \"comment\": \"关键行为率\"\n" +
             "  },\n" +
             "  \"nextDayOpen\": {\n" +
@@ -1238,7 +1406,7 @@ public class AccountReportConstants {
             "    \"comment\": \"次留成本\"\n" +
             "  },\n" +
             "  \"nextDayOpenRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0%' end  as nextDayOpenRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.active)!= 0 THEN concat(CAST(round(sum(t1.next_day_open) / sum(t1.active)*100,2) AS CHAR) ,'%') ELSE '0.00%' end  as nextDayOpenRate \",\n" +
             "    \"comment\": \"次留率\"\n" +
             "  },\n" +
             "  \"activePayAmount\": {\n" +
@@ -1302,6 +1470,10 @@ public class AccountReportConstants {
         Object jsonByVideo = JSON.parseObject(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON);
         return JsonResourceUtil.jsonToMap(jsonByVideo);
     }
+    public static Map<String, Map<String, Object>> getDicMapByVideo2(){
+        Object jsonByVideo = JSON.parseObject(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON2);
+        return JsonResourceUtil.jsonToMap(jsonByVideo);
+    }
     public static Map<String, Map<String, Object>> getDicMapByVideoNew(){
         Object jsonByVideo = JSON.parseObject(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON_NEW);
         return JsonResourceUtil.jsonToMap(jsonByVideo);