瀏覽代碼

Merge branch '20250509-wyp-videoAgg' of Server/growth-manager into master

wangyunpeng 2 月之前
父節點
當前提交
7bc546bcd2

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java

@@ -64,4 +64,6 @@ public interface ContentPlatformPlanMapperExt {
     List<ContentPlatformVideoAgg> getVideoAggList(@Param("dtList") List<String> dtList);
 
     List<ContentPlatformVideo> getVideoListByIds(@Param("videoIds") List<Long> videoIds);
+
+    void deleteContentPlatformVideoAgg(@Param("dt") String dt);
 }

+ 6 - 2
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformVideoJob.java

@@ -18,6 +18,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.util.*;
@@ -39,10 +40,13 @@ public class ContentPlatformVideoJob {
     @Autowired
     private MessageAttachmentService messageAttachmentService;
 
+    @Value("${video.agg.days:3}")
+    private Integer videoAggDays;
+
     @XxlJob("syncContentPlatformVideoJob")
     public ReturnT<String> syncContentPlatformVideoJob(String param) {
         String aggDt = DateUtil.getBeforeDayDateString("yyyyMMdd");
-        List<String> dtList = DateUtil.getBeforeDays(14);
+        List<String> dtList = DateUtil.getBeforeDays(videoAggDays);
         // 轮询查询大数据获取最近14天视频
         for (String dt : dtList) {
             long videoCount = getVideoCount(dt);
@@ -113,7 +117,7 @@ public class ContentPlatformVideoJob {
         }
         long videoAggCount = getVideoAggCount(aggDt);
         if (videoAggCount > 0) {
-            return ReturnT.SUCCESS;
+            planMapperExt.deleteContentPlatformVideoAgg(aggDt);
         }
         // 聚合最近14天视频
         List<ContentPlatformVideoAgg> saveAggList = planMapperExt.getVideoAggList(dtList);

+ 4 - 0
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -253,4 +253,8 @@
         ORDER BY t1.dt DESC
     </select>
 
+    <delete id="deleteContentPlatformVideoAgg">
+        delete from content_platform_video_agg where dt = #{dt}
+    </delete>
+
 </mapper>