Kaynağa Gözat

销售盯盘V1-2功能版本更新

zhaoxian 2 yıl önce
ebeveyn
işleme
ca7a862634

+ 28 - 72
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/ManagerSaleValueMapper.xml

@@ -129,7 +129,7 @@
         CAST(IFNULL(ROUND((t.charge - y.charge) / y.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         <where>
             <if test="accountIds !=null and accountIds.size()>0">
                 AND account_id in
@@ -140,15 +140,12 @@
             </if>
             and company_id = #{companyId}
             and stat_date = DATE_FORMAT(#{statDay}, '%Y%m%d')
-            <if test="hour !=null">
-                AND hour &lt;= #{hour}
-            </if>
         </where>
         ) t
         LEFT JOIN
         (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         where stat_date = DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -1 day), '%Y%m%d')
         and company_id = #{companyId}
         <if test="accountIds !=null and accountIds.size()>0">
@@ -158,9 +155,6 @@
                 #{id}
             </foreach>
         </if>
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) y on 1 = 1
     </select>
 
@@ -170,7 +164,7 @@
         CAST(IFNULL(ROUND((t.charge - y.charge) / y.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         <where>
             <if test="accountIds !=null and accountIds.size()>0">
                 AND account_id in
@@ -182,15 +176,12 @@
             and company_id = #{companyId}
             and stat_date >= DATE_FORMAT(#{statDay}, '%Y%m%d')
             and stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
-            <if test="hour !=null">
-                AND hour &lt;= #{hour}
-            </if>
         </where>
         ) t
         LEFT JOIN
         (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         where stat_date >= DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -#{days} day), '%Y%m%d')
         AND stat_date &lt;= DATE_FORMAT(DATE_ADD(#{endTime},INTERVAL -#{days} day), '%Y%m%d')
         and company_id = #{companyId}
@@ -201,9 +192,6 @@
                 #{id}
             </foreach>
         </if>
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) y on 1 = 1
     </select>
 
@@ -212,7 +200,7 @@
         CAST(IFNULL(ROUND((t.charge - y.charge) / y.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         where account_id in (
         SELECT
         account_id
@@ -251,14 +239,11 @@
         and company_id = #{companyId}
         and stat_date >= DATE_FORMAT(#{statDay}, '%Y%m%d')
         and stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) t
         LEFT JOIN
         (
         SELECT sum(charge) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         where stat_date >= DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -#{days} day), '%Y%m%d')
         AND stat_date &lt;= DATE_FORMAT(DATE_ADD(#{endTime},INTERVAL -#{days} day), '%Y%m%d')
         and company_id = #{companyId}
@@ -297,10 +282,6 @@
         GROUP BY
         account_id
         )
-
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) y on 1 = 1
     </select>
 
@@ -309,7 +290,7 @@
         CAST(IFNULL(ROUND((t.charge - tt.charge) / tt.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         where stat_datetime = DATE_FORMAT(#{statDay}, '%Y%m%d')
         and company_id = #{companyId}
         <if test="accountIds !=null and accountIds.size()>0">
@@ -319,15 +300,11 @@
                 #{id}
             </foreach>
         </if>
-
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) t
         LEFT JOIN
         (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime = DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -1 day), '%Y%m%d')
         <if test="accountIds !=null and accountIds.size()>0">
             and account_id in
@@ -336,9 +313,6 @@
                 #{id}
             </foreach>
         </if>
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) tt on 1 = 1
     </select>
 
@@ -347,7 +321,7 @@
         CAST(IFNULL(ROUND((t.charge - tt.charge) / tt.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         where stat_datetime >= DATE_FORMAT(#{statDay}, '%Y%m%d')
         AND stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
         and company_id = #{companyId}
@@ -358,15 +332,11 @@
                 #{id}
             </foreach>
         </if>
-
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) t
         LEFT JOIN
         (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -#{days} day), '%Y%m%d')
         AND stat_datetime &lt;=DATE_FORMAT(DATE_ADD(#{endTime},INTERVAL -#{days} day), '%Y%m%d')
         <if test="accountIds !=null and accountIds.size()>0">
@@ -376,9 +346,6 @@
                 #{id}
             </foreach>
         </if>
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) tt on 1 = 1
     </select>
 
@@ -387,7 +354,7 @@
         CAST(IFNULL(ROUND((t.charge - tt.charge) / tt.charge * 100, 2), 0) as CHAR), '%') as 'chargeRoi'
         FROM (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         where stat_datetime >= DATE_FORMAT(#{statDay}, '%Y%m%d')
         AND stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
         and company_id = #{companyId}
@@ -427,15 +394,11 @@
         GROUP BY
         account_id
         )
-
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) t
         LEFT JOIN
         (
         SELECT sum(cost) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(DATE_ADD(#{statDay},INTERVAL -#{days} day), '%Y%m%d')
         AND stat_datetime &lt;=DATE_FORMAT(DATE_ADD(#{endTime},INTERVAL -#{days} day), '%Y%m%d')
         and account_id in
@@ -474,15 +437,12 @@
         GROUP BY
         account_id
         )
-        <if test="hour !=null">
-            AND hour &lt;= #{hour}
-        </if>
         ) tt on 1 = 1
     </select>
 
     <select id="queryTtManydaysTotalCharge" resultType="String">
         SELECT IFNULL(sum(cost), 0.00)
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(#{startDay}, '%Y%m%d')
         and stat_datetime &lt;= DATE_FORMAT(#{endDay}, '%Y%m%d')
         and company_id = #{companyId}
@@ -497,7 +457,7 @@
 
     <select id="queryTtManydaysCharge" resultType="com.alibaba.fastjson.JSONObject">
         SELECT DATE_FORMAT(stat_datetime,'%Y-%m-%d') as 'statDate', IFNULL(sum(cost), 0.00) as 'charge'
-        FROM application.bytedance_advertiser_report_hourly_dw
+        FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
         and stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
         and company_id = #{companyId}
@@ -514,7 +474,7 @@
 
     <select id="queryKsManydaysCharge" resultType="com.alibaba.fastjson.JSONObject">
         SELECT DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate', IFNULL(sum(charge), 0.00) as 'charge'
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         WHERE
         stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
         and stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
@@ -532,7 +492,7 @@
 
     <select id="queryKsManydaysTotalCharge" resultType="String">
         SELECT IFNULL(sum(charge), 0.00)
-        FROM application.kuaishou_account_report_hourly_dw
+        FROM application.kuaishou_account_report_daily_dw
         WHERE
         stat_date >= DATE_FORMAT(#{startDay}, '%Y%m%d')
         and stat_date &lt;= DATE_FORMAT(#{endDay}, '%Y%m%d')
@@ -712,7 +672,7 @@
         SELECT
         IFNULL( sum(cost), 0.00 ) AS 'charge'
         FROM
-        application.bytedance_advertiser_report_hourly_dw
+        application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
         AND stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d' )
         and company_id = #{companyId}
@@ -728,7 +688,7 @@
         SELECT
         IFNULL( sum(cost), 0.00 ) AS 'charge'
         FROM
-        application.bytedance_advertiser_report_hourly_dw
+        application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
         AND stat_datetime &lt;= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
         and company_id = #{companyId}
@@ -753,7 +713,7 @@
         SELECT
         IFNULL( sum(charge), 0.00 ) AS 'charge'
         FROM
-        application.kuaishou_account_report_hourly_dw
+        application.kuaishou_account_report_daily_dw
         WHERE stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d' )
         AND stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d' )
         and company_id = #{companyId}
@@ -769,7 +729,7 @@
         SELECT
         IFNULL( sum(charge), 0.00 ) AS 'charge'
         FROM
-        application.kuaishou_account_report_hourly_dw
+        application.kuaishou_account_report_daily_dw
         WHERE stat_date >= DATE_FORMAT( #{lastTimeStart}, '%Y%m%d' )
         AND stat_date &lt;= DATE_FORMAT( #{lastTimeEnd}, '%Y%m%d' )
         and company_id = #{companyId}
@@ -787,7 +747,7 @@
     <select id="queryKsHourProjectTopTotal" resultType="Long">
         SELECT count(1)
         FROM
-        (select 1 from application.kuaishou_account_report_hourly_dw t1
+        (select 1 from application.kuaishou_account_report_daily_dw t1
         where t1.stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
         and t1.stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
         and company_id = #{companyId}
@@ -805,7 +765,7 @@
     <select id="queryTtHourProjectTopTotal" resultType="Long">
         SELECT count(1)
         FROM
-        (select 1 from application.bytedance_advertiser_report_hourly_dw t1
+        (select 1 from application.bytedance_advertiser_report_daily_dw t1
         where t1.stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
         and t1.stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
         and company_id = #{companyId}
@@ -833,7 +793,7 @@
         IFNULL(t2.jlCharge,0.00) AS 'jlCharge',
         row_number() over(order by SUM( t1.charge ) desc) AS 'number'
         FROM
-        application.kuaishou_account_report_hourly_dw t1
+        application.kuaishou_account_report_daily_dw t1
         LEFT JOIN(
         SELECT project_id,
         SUM(real_charged_in_yuan) as 'realCharge',
@@ -852,9 +812,8 @@
         GROUP BY project_id
         )t2 ON t1.project_id = t2.project_id
         LEFT JOIN (
-        SELECT project_id, SUM( charge ) AS 'charge' FROM application.kuaishou_account_report_hourly_dw
-        WHERE hour &lt;= #{hour}
-        and company_id = #{companyId}
+        SELECT project_id, SUM( charge ) AS 'charge' FROM application.kuaishou_account_report_daily_dw
+        WHERE company_id = #{companyId}
         <if test="accountIds !=null and accountIds.size()>0">
             and account_id IN
             <foreach collection="accountIds" item="id" separator=","
@@ -868,8 +827,7 @@
         left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
         LEFT JOIN ( SELECT t1.id, realname FROM `jeecg-boot`.ctop_project t1 LEFT JOIN `jeecg-boot`.sys_user t2 ON
         t1.responsible_id = t2.id ) t5 ON t1.project_id = t5.id
-        WHERE hour &lt;= #{hour}
-        and company_id = #{companyId}
+        WHERE company_id = #{companyId}
         <if test="accountIds !=null and accountIds.size()>0">
             and t1.account_id IN
             <foreach collection="accountIds" item="id" separator=","
@@ -896,7 +854,7 @@
         IFNULL(t2.jlCharge,0.00) AS 'jlCharge',
         row_number() over(order by SUM( t1.cost ) desc) AS 'number'
         FROM
-        application.bytedance_advertiser_report_hourly_dw t1
+        application.bytedance_advertiser_report_daily_dw t1
         LEFT JOIN(
         SELECT project_id,
         SUM(cash_cost) as 'realCharge',
@@ -915,7 +873,7 @@
         GROUP BY project_id
         )t2 ON t1.project_id = t2.project_id
         LEFT JOIN (
-        SELECT project_id, SUM( cost ) AS 'charge' FROM application.bytedance_advertiser_report_hourly_dw
+        SELECT project_id, SUM( cost ) AS 'charge' FROM application.bytedance_advertiser_report_daily_dw
         WHERE stat_datetime >= DATE_FORMAT(DATE_ADD(#{startTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
         AND stat_datetime &lt;= DATE_FORMAT(DATE_ADD(#{endTime}, INTERVAL - ${days} DAY ), '%Y%m%d' )
         and company_id = #{companyId}
@@ -926,7 +884,6 @@
                 #{id}
             </foreach>
         </if>
-        AND hour &lt;= #{hour}
         GROUP BY project_id ) t3 ON t1.project_id = t3.project_id
         left join(select id,realname from `jeecg-boot`.sys_user )t4 on t1.sale_id=t4.id
         LEFT JOIN ( SELECT t1.id, realname FROM `jeecg-boot`.ctop_project t1 LEFT JOIN `jeecg-boot`.sys_user t2 ON
@@ -941,7 +898,6 @@
                 #{id}
             </foreach>
         </if>
-        AND hour &lt;= #{hour}
         GROUP BY t1.project_id
     </select>