Ver Fonte

修改文章匹配

xueyiming há 5 meses atrás
pai
commit
a323273bcc

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CrawlerVideoServiceImpl.java

@@ -66,6 +66,7 @@ public class CrawlerVideoServiceImpl {
                 }
             }
         }
+        log.info("addCrawlerVideo contentId={} rootContentId={} kimiText={}", contentId, rootContentId, kimiText);
         List<CrawlerVideo> crawlerVideoList = searchVideosFromWeb(kimiText);
         if (!CollectionUtils.isEmpty(crawlerVideoList)) {
             CrawlerVideoExample example = new CrawlerVideoExample();
@@ -150,6 +151,7 @@ public class CrawlerVideoServiceImpl {
                 crawlerVideoList.add(baiduVideoProduce(jsonObject));
             }
         }
+        log.info("searchVideosFromWeb crawlerVideoList={}", crawlerVideoList);
         return crawlerVideoList;
     }
 

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

@@ -260,7 +260,7 @@ public class MatchVideoServiceImpl {
                 page.setPageSize(pageSize);
                 example.setPage(page);
                 matchVideos = matchVideoMapper.selectByExample(example);
-                matchKimiVideoQueue.addAll(matchVideos);
+                matchCrawlerVideoQueue.addAll(matchVideos);
                 pageNum++;
             } while (CollectionUtils.isEmpty(matchVideos));
             countDownLatch.await();
@@ -269,11 +269,13 @@ public class MatchVideoServiceImpl {
 
 
     public void processCrawlerMatchContent(MatchVideo matchVideo) {
-        if (matchVideo.getContentStatus() != 1 || matchVideo.getContentStatus() != 2) {
+        if (matchVideo.getContentStatus() != 1 && matchVideo.getContentStatus() != 2) {
             return;
         }
         boolean existCrawlerVideo = crawlerVideoService.existCrawlerVideo(matchVideo.getContentId());
+        log.info("processCrawlerMatchContent contentId={} existCrawlerVideo={}", matchVideo.getContentId(), existCrawlerVideo);
         if (!existCrawlerVideo) {
+            //查询相同的contentId,如果已经匹配失败,则直接更新状态为失败
             MatchVideoExample example = new MatchVideoExample();
             example.createCriteria().andContentIdEqualTo(matchVideo.getContentId());
             List<MatchVideo> matchVideos = matchVideoMapper.selectByExample(example);
@@ -296,7 +298,7 @@ public class MatchVideoServiceImpl {
                 String rootContentId = getRootContentId(matchVideo.getContentId());
                 boolean res = crawlerVideoService.addCrawlerVideo(matchVideo.getContentId(), rootContentId, kimiText);
                 if (res) {
-                    updateStatus(matchVideo.getId(), 3);
+                    updateStatus(matchVideo.getId(), ContentStatusEnum.SUCCESS_3.getStatusCode());
                 } else {
                     //匹配失败记录
                     String countKey = String.format(CRAWLER_COUNT_KEY, matchVideo.getContentId());