Browse Source

Merge branch 'dev-xym-fix-del' of Server/long-article-manage into master

xueyiming 1 day ago
parent
commit
98d4fbd93c

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

@@ -280,7 +280,7 @@ public class CrawlerVideoServiceImpl {
         CrawlerVideoExample example = new CrawlerVideoExample();
         example.createCriteria().andContentIdEqualTo(contentId).andDownloadStatusEqualTo(0);
         example.setOrderByClause("score desc");
-        example.setPage(new Page(1,MAX_NUM));
+        example.setPage(new Page(1, MAX_NUM));
         List<CrawlerVideo> crawlerVideoList = crawlerVideoMapper.selectByExampleWithBLOBs(example);
         if (CollectionUtils.isEmpty(crawlerVideoList)) {
             return false;
@@ -311,16 +311,6 @@ public class CrawlerVideoServiceImpl {
                     udpateCrawlerVideo.setDownloadStatus(2);
                     crawlerVideoMapper.updateByPrimaryKeySelective(udpateCrawlerVideo);
                     count++;
-                    try {
-                        if (StringUtils.isNotEmpty(videoOssPath)) {
-                            Files.delete(Paths.get(videoPath));
-                        }
-                        if (StringUtils.isNotEmpty(coverPath)) {
-                            Files.delete(Paths.get(coverPath));
-                        }
-                    } catch (Exception e) {
-                        log.error("pushOss del file error", e);
-                    }
                 } else {
                     //下载失败
                     CrawlerVideo udpateCrawlerVideo = new CrawlerVideo();
@@ -328,6 +318,16 @@ public class CrawlerVideoServiceImpl {
                     udpateCrawlerVideo.setDownloadStatus(3);
                     crawlerVideoMapper.updateByPrimaryKeySelective(udpateCrawlerVideo);
                 }
+                try {
+                    if (StringUtils.isNotEmpty(videoPath)) {
+                        Files.delete(Paths.get(videoPath));
+                    }
+                    if (StringUtils.isNotEmpty(coverPath)) {
+                        Files.delete(Paths.get(coverPath));
+                    }
+                } catch (Exception e) {
+                    log.error("pushOss del file error", e);
+                }
             }
             if (count >= MAX_NUM) {
                 return true;