Procházet zdrojové kódy

Merge branch 'V2.0.1' into test

zhaoxian před 3 roky
rodič
revize
c7ca79f607

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

@@ -101,14 +101,20 @@ 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());
-
+            filedAll = filedAll.replace("like_material", "`like`").
+                    replace("material_show", "`show`").
+                    replace("convert_material", "`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").
+                    replace("share_material", "share");
             try {
                 if (accountIds.isEmpty()) {
                     accountIds = null;

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

@@ -12,11 +12,13 @@
         FROM
         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">
@@ -37,11 +39,13 @@
         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>
+        </if>
         group by t1.account_id
         order by ${target} ${order}
     </select>
@@ -57,11 +61,13 @@
         WHERE
         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">
@@ -72,11 +78,13 @@
         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>
+        </if>
     </select>
 
     <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
@@ -90,11 +98,13 @@
         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>
         GROUP BY
         `hour`
         ORDER BY
@@ -107,11 +117,13 @@
         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">
@@ -123,11 +135,13 @@
         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')
-        AND account_id in
+        <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">
@@ -140,11 +154,13 @@
         WHERE
         t1.stat_datetime &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
         AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
-        AND t1.account_id in
+        <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.account_id
         order by ${target} ${order}
     </select>
@@ -160,11 +176,13 @@
         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 t1.stat_datetime
         order by ${target} ${order}
     </select>
@@ -180,11 +198,13 @@
         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
     </select>
@@ -199,11 +219,13 @@
         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
     </select>

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

@@ -48,20 +48,20 @@
 
     <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"
@@ -69,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>