Selaa lähdekoodia

统计报表-销售报表 日报表换成application库的表

zhaoxian 11 kuukautta sitten
vanhempi
commit
636a88eec8

+ 9 - 9
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -933,7 +933,7 @@
         )
         ) as 'designResponsibleName',
         ifnull(round(sum(a.charge),3),0) as 'charge',
-        ifnull(sum(a.photo_show),0) as 'photoShow',
+        ifnull(sum(a.show),0) as 'photoShow',
         ifnull(sum(a.photo_click),0) as 'photoClick',
         ifnull(sum(a.aclick),0) as 'aclick',
         ifnull(sum(a.bclick),0) as 'bclick',
@@ -942,13 +942,13 @@
         ifnull(sum(a.event_register),0) as 'eventRegister',
         ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay',
         ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',
-        case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then
-        concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',
+        case when (sum(a.show) is not null and sum(a.show)!=0) then
+        concat(round(ifnull(sum(a.photo_click),0)/sum(a.show) * 100 ,2),'%') else 0 end as 'photoClickRate',
         case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then
         concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate',
         (case
-        when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
-        then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
+        when (sum(a.show) is not null and sum(a.show) != 0)
+        then round((ifnull(sum(a.charge),0) / sum(a.show)) * 1000,2)
         else 0
         end
         ) as 'impression1kCost',
@@ -964,9 +964,9 @@
         ELSE 0
         end
         ) as 'actionCost',
-        ifnull(sum(a.photo_share),0) as 'photoShare',
-        ifnull(sum(a.photo_comment),0) as 'photoComment',
-        ifnull(sum(a.photo_like),0) as 'photoLike',
+        ifnull(sum(a.share),0) as 'photoShare',
+        ifnull(sum(a.comment),0) as 'photoComment',
+        ifnull(sum(a.like),0) as 'photoLike',
         ifnull(sum(a.follow),0) as 'follow',
         ifnull(sum(a.report),0) as 'report',
         ifnull(sum(a.cancel_follow),0) as 'cancelFollow',
@@ -981,7 +981,7 @@
         end
         ) as 'eventNextDayStayCost'
         from
-        ctop_kuaishou_report_daily_account a
+        application.kuaishou_account_report_daily_dw a
         left join ctop_user_allocation b
         on a.account_id = b.account_id
         where

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

@@ -13,11 +13,11 @@
         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>
+            AND account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
     </select>
 
@@ -40,11 +40,11 @@
         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>
+            AND t1.account_id IN
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         group by t1.account_id
         order by ${target} ${order}
@@ -62,11 +62,11 @@
         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>
+            AND account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
     </select>
 
@@ -79,11 +79,11 @@
         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>
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
     </select>
 
@@ -99,11 +99,11 @@
         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>
+            AND account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         GROUP BY
         `hour`
@@ -114,15 +114,15 @@
     <select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         ${filed}
-        FROM application.bytedance_advertiser_report_hourly_dw  t1
+        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>
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
     </select>
 
@@ -136,11 +136,11 @@
         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>
+            AND account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
     </select>
 
@@ -150,16 +150,16 @@
         t1.account_id as accountId,
         t1.account_name as authName,
         ${filed}
-        FROM application.bytedance_advertiser_report_hourly_dw  t1
+        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>
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         group by t1.account_id
         order by ${target} ${order}
@@ -172,16 +172,16 @@
         t1.account_name as authName,
         ${filed}
         FROM
-        FROM application.bytedance_advertiser_report_hourly_dw  t1
+        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>
+            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}
@@ -199,11 +199,11 @@
         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>
+            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
@@ -220,11 +220,11 @@
         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>
+            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
@@ -266,64 +266,174 @@
         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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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,
+        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
+        end
+        as activeRegisterCost
+    </sql>
+    <sql id="selectSql1">
+        ifnull
+        (sum(a.show),0)                          as showMaterial,
+        ifnull(sum(a.click),0)                             as clickMaterial,
+        ifnull(sum(a.convert),0)                       as convertMaterial,
+        ifnull(sum(a.cost),0)                              as cost,
+        ifnull(sum(a.active),0)                            as active,
+        ifnull(sum(a.download_finish),0)                   as downloadFinish,
+        ifnull(sum(a.download_start),0)                    as downloadStart,
+		ifnull(sum(a.click_install),0)                     as clickInstall,
+		ifnull(sum(a.install_finish),0)                    as installFinish,
+		ifnull(sum(a.register),0)                          as register,
+        ifnull(sum(a.pay_count),0)                         as payCount,
+		ifnull(sum(a.form),0)                              as form,
+		ifnull(sum(a.total_play),0)                        as totalPlay,
+        ifnull(sum(a.valid_play),0)                        as validPlay,
+        ifnull(sum(a.wifi_play),0)                         as wifiPlay,
+        ifnull(sum(a.play_25_feed_break),0)                 as play25FeedBreak,
+        ifnull(sum(a.play_50_feed_break),0)                 as play50FeedBreak,
+        ifnull(sum(a.play_75_feed_break),0)                 as play75FeedBreak,
+        ifnull(sum(a.play_100_feed_break),0)                as play100FeedBreak,
+		ifnull(sum(a.share),0)                             as shareMaterial,
+		ifnull(sum(a.like),0)                          as likeMaterial,
+		case
+        when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play_25_feed_break) is not null
+        then round(sum(a.play_25_feed_break) / sum(a.total_play),2)
+        else 0
+        end
+        as play25FeedBreakRate,
+		case
+        when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert) is not null
+        then round(sum(a.convert) / sum(a.click),2)
+        else 0
+        end
+        as convertRate,
+        case
+        when sum(a.convert) != 0 and sum(a.convert) is not null and sum(a.cost) is not null
+        then round(sum(a.cost)/sum(a.convert),2)
+        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,
+        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,
+		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,
+        case
+        when sum(a.show) != 0 and sum(a.show) is not null and sum(a.click) is not null
+        then round(sum(a.click) / sum(a.show),2)
+        else 0
+        end
+        as ctr,
+        case
+        when sum(a.show) != 0 and sum(a.cost) is not null and sum(a.show) is not null
+        then round(sum(a.cost) / sum(a.show) * 1000,2)
+        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,
+		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,
+        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,
+        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
     </sql>
 
     <select id="getBytedanceAccountInfoByProjectId"
@@ -408,9 +518,9 @@
         ) as 'saleName',
         (select project_name from ctop_project where id = b.project_id) as 'projectName',
         c.media_id as 'mediaId',
-        <include refid="selectSql"></include>
+        <include refid="selectSql1"></include>
         from
-        ctop_bytedance_report_advertiser_daily a
+        application.bytedance_advertiser_report_daily_dw a
         left join ctop_user_allocation b on a.advertiser_id = b.account_id
         left join ctop_project c on b.project_id = c.id
         where