Kaynağa Gözat

增加匹配小程序定时任务

xueyiming 5 ay önce
ebeveyn
işleme
9c64865843

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/controller/IndexController.java

@@ -33,6 +33,6 @@ public class IndexController {
 
     @GetMapping("/kimi")
     public void kimi() throws InterruptedException {
-        matchVideoService.matchKimiVideo();
+        matchVideoService.kimiContent();
     }
 }

+ 40 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/job/MatchVideoJob.java

@@ -0,0 +1,40 @@
+package com.tzld.piaoquan.longarticle.job;
+
+import com.tzld.piaoquan.longarticle.service.local.impl.MatchVideoServiceImpl;
+import com.tzld.piaoquan.longarticle.utils.LarkRobotUtil;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class MatchVideoJob {
+
+    @Autowired
+    MatchVideoServiceImpl matchVideoService;
+
+
+    @XxlJob("kimiContentJob")
+    public ReturnT<String> kimiContentJob(String param) {
+        try {
+            matchVideoService.kimiContent();
+        } catch (Exception e) {
+            LarkRobotUtil.sendMessage("kimiContentJob异常,请及时查看,@薛一鸣");
+            log.error("kimiContentJob error", e);
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    @XxlJob("matchCrawlerVideo")
+    public ReturnT<String> matchCrawlerVideoJob(String param) {
+        try {
+            matchVideoService.matchCrawlerVideo();
+        } catch (Exception e) {
+            LarkRobotUtil.sendMessage("matchCrawlerVideoJob异常,请及时查看,@薛一鸣");
+            log.error("matchCrawlerVideoJob error", e);
+        }
+        return ReturnT.SUCCESS;
+    }
+}

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/MatchVideoServiceImpl.java

@@ -110,7 +110,7 @@ public class MatchVideoServiceImpl {
         }
     }
 
-    public void matchKimiVideo() throws InterruptedException {
+    public void kimiContent() throws InterruptedException {
         if (matchKimiVideoPoolExecutor.getCorePoolSize() - matchKimiVideoPoolExecutor.getActiveCount() > 0) {
             int threadSize = matchKimiVideoPoolExecutor.getCorePoolSize() - matchKimiVideoPoolExecutor.getActiveCount();
             log.info("threadNum={}", threadSize);