| 
														
															@@ -95,6 +95,7 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private final CrawlerVideoExtMapper crawlerVideoExtMapper; 
														 | 
														
														 | 
														
															     private final CrawlerVideoExtMapper crawlerVideoExtMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private final CrawlerUserV3Mapper crawlerUserV3Mapper; 
														 | 
														
														 | 
														
															     private final CrawlerUserV3Mapper crawlerUserV3Mapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Value("${download.file.path:/data/crawler/videos}") 
														 | 
														
														 | 
														
															     @Value("${download.file.path:/data/crawler/videos}") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private String downloadPath; 
														 | 
														
														 | 
														
															     private String downloadPath; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Value("${aliyun.oss.video.bucket:art-pubbucket}") 
														 | 
														
														 | 
														
															     @Value("${aliyun.oss.video.bucket:art-pubbucket}") 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -145,9 +146,10 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         long id = 0L; 
														 | 
														
														 | 
														
															         long id = 0L; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         try { 
														 | 
														
														 | 
														
															         try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 参数校验 
														 | 
														
														 | 
														
															             // 参数校验 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            String errorMessage = CustomValidator.validate(param); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (!Strings.isNullOrEmpty(errorMessage)) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                throw new CommonException(ExceptionEnum.PARAM_ERROR, "param validate failed." + errorMessage); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CustomValidator.Result result = CustomValidator.validate(param); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (result.notSuccess()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                log.error("param validate failed. {}", result.getMessage()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 保存数据库(去重校验) 
														 | 
														
														 | 
														
															             // 保存数据库(去重校验) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -177,7 +179,7 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 crawlerVideo.setVideoId(videoId); 
														 | 
														
														 | 
														
															                 crawlerVideo.setVideoId(videoId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 crawlerVideo.setTitleScore(data.getTitleScore()); 
														 | 
														
														 | 
														
															                 crawlerVideo.setTitleScore(data.getTitleScore()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return crawlerVideoMapper.updateByPrimaryKeySelective(crawlerVideo) > 0; 
														 | 
														
														 | 
														
															                 return crawlerVideoMapper.updateByPrimaryKeySelective(crawlerVideo) > 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            }, "synthesis", String.format("update video info [%s] to db", crawlerVideo)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }, "video2db", String.format("update video info [%s] to db", crawlerVideo)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 视频写入飞书 
														 | 
														
														 | 
														
															             // 视频写入飞书 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             async2Feishu(data, videoId); 
														 | 
														
														 | 
														
															             async2Feishu(data, videoId); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -187,9 +189,16 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             log.error("etl server deal {} failed.", param, e); 
														 | 
														
														 | 
														
															             log.error("etl server deal {} failed.", param, e); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 回滚数据 
														 | 
														
														 | 
														
															             // 回滚数据 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             if (id > 0) { 
														 | 
														
														 | 
														
															             if (id > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                crawlerVideoMapper.deleteByPrimaryKey(id); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    int i = crawlerVideoMapper.deleteByPrimaryKey(id); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    if (i <= 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        log.error("delete data from db failed of {}", id); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } catch (Exception e1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    log.error("delete data from db failed of {}", id, e1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            throw new CommonException(ExceptionEnum.SYSTEM_ERROR, "etl server deal error: " + e.getMessage()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            throw new CommonException(ExceptionEnum.SYSTEM_ERROR, "etl server deal error: " + e.getMessage()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } finally { 
														 | 
														
														 | 
														
															         } finally { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             metric(MetricTypeEnum.DURATION, sw.stop()); 
														 | 
														
														 | 
														
															             metric(MetricTypeEnum.DURATION, sw.stop()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             tlParam.remove(); 
														 | 
														
														 | 
														
															             tlParam.remove(); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -317,10 +326,10 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String strategy = data.getStrategy(); 
														 | 
														
														 | 
														
															         String strategy = data.getStrategy(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String audioUrl = data.getAudioUrl(); 
														 | 
														
														 | 
														
															         String audioUrl = data.getAudioUrl(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String videoPath = urlDownload(data.getVideoUrl(), "longvideo/crawler_local/video", title); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String videoPath = urlDownload(data.getVideoUrl(), "longvideo/crawler_local/video", title, data.getOutVideoId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 音、视频合成 
														 | 
														
														 | 
														
															         // 音、视频合成 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (!Strings.isNullOrEmpty(audioUrl)) { 
														 | 
														
														 | 
														
															         if (!Strings.isNullOrEmpty(audioUrl)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            String audioPath = urlDownload(data.getAudioUrl(), "longvideo/crawler_local/audio", title); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String audioPath = urlDownload(data.getAudioUrl(), "longvideo/crawler_local/audio", title, data.getOutVideoId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             retryFunc(t -> { 
														 | 
														
														 | 
														
															             retryFunc(t -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 try { 
														 | 
														
														 | 
														
															                 try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     VideoUtils.videoSynthesis(ffmpegPath, downloadPath + File.separator + t, 
														 | 
														
														 | 
														
															                     VideoUtils.videoSynthesis(ffmpegPath, downloadPath + File.separator + t, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -357,7 +366,7 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Files.deleteIfExists(Paths.get(new File(tempFilePath).getPath())); 
														 | 
														
														 | 
														
															         Files.deleteIfExists(Paths.get(new File(tempFilePath).getPath())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 视频封面下载、上传 OSS 
														 | 
														
														 | 
														
															         // 视频封面下载、上传 OSS 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String coverPath = urlDownload(data.getCoverUrl(), "longvideo/crawler_local/image", title); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String coverPath = urlDownload(data.getCoverUrl(), "longvideo/crawler_local/image", title, data.getOutVideoId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         file2oss(downloadPath + File.separator + coverPath, coverPath, platform, strategy); 
														 | 
														
														 | 
														
															         file2oss(downloadPath + File.separator + coverPath, coverPath, platform, strategy); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         data.setCoverOssPath(coverPath); 
														 | 
														
														 | 
														
															         data.setCoverOssPath(coverPath); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         tempFilePath = downloadPath + File.separator + coverPath; 
														 | 
														
														 | 
														
															         tempFilePath = downloadPath + File.separator + coverPath; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -367,21 +376,24 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Files.deleteIfExists(Paths.get(new File(tempFilePath).getPath())); 
														 | 
														
														 | 
														
															         Files.deleteIfExists(Paths.get(new File(tempFilePath).getPath())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private String urlDownload(String fileUrl, String filePath, String title) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String titleMmd5 = MD5Util.md5(title); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private String urlDownload(String fileUrl, String filePath, String title, String outVideoId) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String fileName = MD5Util.md5(title) + outVideoId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String curDate = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); 
														 | 
														
														 | 
														
															         String curDate = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String videoFilePath = filePath + File.separator + env + File.separator + curDate; 
														 | 
														
														 | 
														
															         String videoFilePath = filePath + File.separator + env + File.separator + curDate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String localFilePath = downloadPath + File.separator + videoFilePath; 
														 | 
														
														 | 
														
															         String localFilePath = downloadPath + File.separator + videoFilePath; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         File localFile = new File(localFilePath); 
														 | 
														
														 | 
														
															         File localFile = new File(localFilePath); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (!localFile.exists() && (!localFile.mkdirs())) { 
														 | 
														
														 | 
														
															         if (!localFile.exists() && (!localFile.mkdirs())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            log.warn("mkdir dir [{}] failed!", localFilePath); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            log.error("mkdir dir [{}] failed!", localFilePath); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            localFilePath = "/data"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String finalLocalFilePath = localFilePath; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         retrySupplier(() -> { 
														 | 
														
														 | 
														
															         retrySupplier(() -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             try { 
														 | 
														
														 | 
														
															             try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 // 下载文件 
														 | 
														
														 | 
														
															                 // 下载文件 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                FileUtils.download(fileUrl, localFilePath + File.separator + titleMmd5); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                FileUtils.download(fileUrl, finalLocalFilePath + File.separator + fileName); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 return false; 
														 | 
														
														 | 
														
															                 return false; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } catch (CommonException e) { 
														 | 
														
														 | 
														
															             } catch (CommonException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 if (e.getCode() == ExceptionEnum.URL_FORBIDDEN.getCode()) { 
														 | 
														
														 | 
														
															                 if (e.getCode() == ExceptionEnum.URL_FORBIDDEN.getCode()) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -394,7 +406,7 @@ public class EtlServiceImpl implements EtlService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }, "download", String.format("download file from [%s] to [%s]", fileUrl, filePath)); 
														 | 
														
														 | 
														
															         }, "download", String.format("download file from [%s] to [%s]", fileUrl, filePath)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return videoFilePath + File.separator + titleMmd5; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return videoFilePath + File.separator + fileName; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private void file2oss(String localFile, String ossBucketKey, String crawler, String mode) { 
														 | 
														
														 | 
														
															     private void file2oss(String localFile, String ossBucketKey, String crawler, String mode) { 
														 |