Selaa lähdekoodia

添加更新时间

zhaoxian 4 vuotta sitten
vanhempi
commit
6172edcfab

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java

@@ -25,4 +25,5 @@ public interface EtlKuaishouReportAccountDailyMapper extends BaseMapper<EtlKuais
 
     JSONObject getMaxChargeAccountId(@Param("userId") String userId);
 
+    String getNewlyUpdateTime();
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountHourlyMapper.java

@@ -24,4 +24,5 @@ public interface EtlKuaishouReportAccountHourlyMapper extends BaseMapper<EtlKuai
 
     List<JSONObject> getOnedayEtlReportList(@Param("startTime") String startTime, @Param("accountId") Long accountId,@Param("value") String value,@Param("type") String type);
 
+    String getNewlyUpdateTime();
 }

+ 11 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -257,11 +257,18 @@
         SELECT t1.account_id as 'accountId',
         t1.auth_name as 'accountName'
         FROM ctop_user_allocation t1
-                 LEFT JOIN ctop_etl_kuaishou_report_account_hourly t2 ON t1.account_id = t2.account_id
+        LEFT JOIN ctop_etl_kuaishou_report_account_hourly t2 ON t1.account_id = t2.account_id
         where t2.stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
-          <if test="userId!=null">
-          AND t1.user_id = #{userId}
-          </if>
+        <if test="userId!=null">
+            AND t1.user_id = #{userId}
+        </if>
         order by charge desc limit 1
     </select>
+
+    <select id="getNewlyUpdateTime" resultType="java.lang.String">
+        select update_time
+        FROM ctop_etl_kuaishou_report_account_daily
+        ORDER BY update_time desc LIMIT 1
+    </select>
+
 </mapper>

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountHourlyMapper.xml

@@ -220,4 +220,10 @@
         GROUP BY stat_hour
     </select>
 
+    <select id="getNewlyUpdateTime" resultType="java.lang.String">
+        select update_time
+        FROM ctop_etl_kuaishou_report_account_hourly
+        ORDER BY update_time desc LIMIT 1
+    </select>
+
 </mapper>

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountHourlyServiceImpl.java

@@ -123,11 +123,14 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
         JSONObject obj = new JSONObject();
         List<JSONObject> todayList = null;
         List<JSONObject> yesterdayList = null;
+        String updateTime = "";
         if (endTime.equals(startTime)) {
+            updateTime = etlHourlyAccountMapper.getNewlyUpdateTime();
             todayList = etlHourlyAccountMapper.getOnedayEtlReportList(startTime, accountId, value, type);
             String lastDay = DateUtils.getLastDay(startTime, 1);
             yesterdayList = etlHourlyAccountMapper.getOnedayEtlReportList(lastDay, accountId, value, type);
         } else {
+            updateTime = etlDailyAccountMapper.getNewlyUpdateTime();
             todayList = etlDailyAccountMapper.getOnedayEtlReportList(startTime, endTime, accountId, value, type);
             int days = DateUtils.dateDiff(startTime, endTime);
             String endTime2 = DateUtils.getLastDay(startTime, 1);
@@ -149,6 +152,7 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
         }
         obj.put("today", todayList);
         obj.put("yesterday", yesterdayList);
+        obj.put("updateTime", updateTime);
         return Result.ok(obj);
     }