|
@@ -153,6 +153,65 @@ public class ArticleAuditService {
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ @XxlJob("articleVideoAuditCover")
|
|
|
+ public ReturnT<String> articleVideoAuditCover(String param) {
|
|
|
+ long publishTime = DateUtils.getTodayStart() / 1000;
|
|
|
+ if (StringUtils.hasText(param)) {
|
|
|
+ publishTime = DateUtils.getStartOfDay(param, "yyyyMMdd");
|
|
|
+ }
|
|
|
+ List<GetOffVideoArticle> getOffVideoArticleList = getOffVideoArticleRepository.getByPublishTimeGreaterThanEqual(publishTime);
|
|
|
+ List<String> traceIds = getOffVideoArticleList.stream()
|
|
|
+ .filter(o -> !o.getTraceId().startsWith("direct"))
|
|
|
+ .map(GetOffVideoArticle::getTraceId).distinct().collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isEmpty(traceIds)) {
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+ List<LongArticlesMatchVideo> longArticlesMatchVideoList = longArticlesMatchVideoRepository.getByTraceIdIn(traceIds);
|
|
|
+ Map<String, LongArticlesMatchVideo> longarticlesMatchVideoMap = longArticlesMatchVideoList.stream()
|
|
|
+ .collect(Collectors.toMap(LongArticlesMatchVideo::getTraceId, Function.identity()));
|
|
|
+ List<String> existsOssPath = longArticleBaseMapper.getExistsOssPath();
|
|
|
+ for (String traceId : traceIds) {
|
|
|
+ try {
|
|
|
+ LongArticlesMatchVideo longArticlesMatchVideo = longarticlesMatchVideoMap.get(traceId);
|
|
|
+ List<LongArticlesMatchVideoResponse> responseList = JSONArray.parseArray(longArticlesMatchVideo.getResponse()
|
|
|
+ , LongArticlesMatchVideoResponse.class);
|
|
|
+ for (LongArticlesMatchVideoResponse response : responseList) {
|
|
|
+ String ossPath = response.getVideoOSS();
|
|
|
+ if (StringUtils.hasText(ossPath)) {
|
|
|
+ if (existsOssPath.contains(ossPath)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ existsOssPath.add(ossPath);
|
|
|
+ }
|
|
|
+ LongArticleVideoAudit videoAudit = new LongArticleVideoAudit();
|
|
|
+ videoAudit.setVideoId(response.getVideoID());
|
|
|
+ videoAudit.setTraceId(traceId);
|
|
|
+ videoAudit.setContentId(longArticlesMatchVideo.getContentId());
|
|
|
+ videoAudit.setOssPath(ossPath);
|
|
|
+ videoAudit.setStatus(StatusEnum.ZERO.getCode());
|
|
|
+ videoAudit.setCreateTimestamp(System.currentTimeMillis());
|
|
|
+ longArticleVideoAuditRepository.save(videoAudit);
|
|
|
+ // 调用封面检测
|
|
|
+ try {
|
|
|
+ Long taskId = pqVideoAuditStartProcessService.startProcess(response.getVideoID());
|
|
|
+ if (Objects.nonNull(taskId)) {
|
|
|
+ videoAudit.setTaskId(taskId);
|
|
|
+ longArticleVideoAuditRepository.save(videoAudit);
|
|
|
+ } else {
|
|
|
+ log.error("PQVideoAuditStartProcess start process error videoId:{} ", response.getVideoID());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("PQVideoAuditStartProcess start process videoId:{} error:{}", response.getVideoID(), e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("articleVideoAudit traceId:{} error:{}", traceId, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
private String getOssPath(String ossUrl) {
|
|
|
String result = "";
|
|
|
if (ossUrl == null || ossUrl.isEmpty()) {
|