From 04f09e52ffd4681bdfd85e51acd3da0d1280c3d3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 16 四月 2022 16:07:10 +0800
Subject: [PATCH] bug修复

---
 src/main/java/com/yeshi/buwan/job/video/VideoUpdateJob.java |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/job/video/VideoUpdateJob.java b/src/main/java/com/yeshi/buwan/job/video/VideoUpdateJob.java
index c8fb8fb..0462b5e 100644
--- a/src/main/java/com/yeshi/buwan/job/video/VideoUpdateJob.java
+++ b/src/main/java/com/yeshi/buwan/job/video/VideoUpdateJob.java
@@ -2,16 +2,31 @@
 
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
+import com.yeshi.buwan.domain.VideoType;
+import com.yeshi.buwan.service.imp.ClearService;
+import com.yeshi.buwan.service.imp.VideoTypeService;
 import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager;
+import com.yeshi.buwan.util.StringUtil;
+import com.yeshi.buwan.util.TimeUtil;
+import com.yeshi.buwan.util.video.VideoConstant;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 @Component
 public class VideoUpdateJob {
 
     @Resource
     private SolrAlbumVideoDataManager solrAlbumDataManager;
+
+    @Resource
+    private ClearService clearService;
+
+    @Resource
+    private VideoTypeService videoTypeService;
 
     /**
      * 鍚屾鎵�鏈変笓杈�
@@ -25,4 +40,51 @@
         solrAlbumDataManager.syncAllAlbum();
         return ReturnT.SUCCESS;
     }
+
+
+    /**
+     * @return com.xxl.job.core.biz.model.ReturnT<java.lang.String>
+     * @author hxh
+     * @description 鍒犻櫎杩囨湡鐨勬暟鎹�
+     * 鏌ヨ鐨勬暟鎹啑浣欑殑鍒嗙被鐨剆ql锛� SELECT GROUP_CONCAT(a.videotypeid) FROM (SELECT COUNT(*) c,cv.`videotypeid` FROM wk_category_video cv GROUP BY cv.`videotypeid` ORDER BY c DESC) a WHERE a.c>20000
+     * @date 17:09 2022/3/18
+     * @param: param
+     **/
+    //鍒犻櫎杩囨湡鏁版嵁
+    @XxlJob("video-update-delete-outofdate-video")
+    public ReturnT<String> deleteOutOfDateVideo(String param) throws Exception {
+        List<Long> typeList = new ArrayList<>();
+        if (StringUtil.isNullOrEmpty(param)) {
+            typeList = Arrays.asList(new Long[]{212L, 213L, 214L, 282L, 283L});
+        } else {
+            String[] sts = param.split(",");
+            for (String st : sts) {
+                typeList.add(Long.parseLong(st));
+            }
+        }
+        for (Long type : typeList) {
+            VideoType videoType = videoTypeService.getVideoType(type);
+            while (videoType.getParent() != null) {
+                videoType = videoType.getParent();
+            }
+
+            int leftNum = 2000;
+            //涓诲垎绫讳笅闈㈢殑灏忚棰戞暟閲忕暀10000
+            if (VideoConstant.isMainCategory(videoType.getId())) {
+                leftNum = 10000;
+            }
+            clearService.clearOldVideo(type, leftNum);
+        }
+        return ReturnT.SUCCESS;
+    }
+
+
+    //鍒犻櫎渚濊禆
+    @XxlJob("video-update-clear-depend-video")
+    public ReturnT<String> clearDependVideo(String param) throws Exception {
+        clearService.clearDependVideo();
+        return ReturnT.SUCCESS;
+    }
+
+
 }

--
Gitblit v1.8.0