|
@@ -10,6 +10,7 @@ import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoSensitiveLe
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleDeleteStatusEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.FeishuRobotIdEnum;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
+import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.cgi.PQVideoAuditResult;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.*;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
@@ -69,6 +70,8 @@ public class ArticleAuditService {
|
|
|
private PQVideoAuditStartProcessService pqVideoAuditStartProcessService;
|
|
|
@Autowired
|
|
|
private PQVideoAuditResultService pqVideoAuditResultService;
|
|
|
+ @Autowired
|
|
|
+ private LongArticleBaseMapper longArticleBaseMapper;
|
|
|
|
|
|
|
|
|
@XxlJob("articleVideoAudit")
|
|
@@ -85,22 +88,22 @@ public class ArticleAuditService {
|
|
|
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) {
|
|
|
LongArticlesMatchVideo longArticlesMatchVideo = longarticlesMatchVideoMap.get(traceId);
|
|
|
List<LongArticlesMatchVideoResponse> responseList = JSONArray.parseArray(longArticlesMatchVideo.getResponse()
|
|
|
, LongArticlesMatchVideoResponse.class);
|
|
|
- List<Long> videoIds = responseList.stream().map(LongArticlesMatchVideoResponse::getVideoID).collect(Collectors.toList());
|
|
|
- List<LongArticleVideoAudit> existsList = longArticleVideoAuditRepository.getByVideoIdIn(videoIds);
|
|
|
- List<Long> existsVideoIds = existsList.stream().map(LongArticleVideoAudit::getVideoId).collect(Collectors.toList());
|
|
|
for (LongArticlesMatchVideoResponse response : responseList) {
|
|
|
- if (existsVideoIds.contains(response.getVideoID())) {
|
|
|
+ String ossPath = getOssPath(response.getVideoPath());
|
|
|
+ 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(response.getVideoOSS());
|
|
|
+ videoAudit.setOssPath(ossPath);
|
|
|
videoAudit.setStatus(StatusEnum.ZERO.getCode());
|
|
|
videoAudit.setCreateTimestamp(System.currentTimeMillis());
|
|
|
longArticleVideoAuditRepository.save(videoAudit);
|
|
@@ -122,6 +125,25 @@ public class ArticleAuditService {
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ private String getOssPath(String ossUrl) {
|
|
|
+ if (ossUrl == null || ossUrl.isEmpty()) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ // 找到 ".com/" 后面的部分
|
|
|
+ String keyword = ".com/";
|
|
|
+ int startIndex = ossUrl.indexOf(keyword);
|
|
|
+ if (startIndex == -1) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ // 提取从 ".com/" 之后的部分,去掉文件后缀名
|
|
|
+ startIndex += keyword.length();
|
|
|
+ int endIndex = ossUrl.lastIndexOf(".");
|
|
|
+ if (endIndex == -1) {
|
|
|
+ endIndex = ossUrl.length();
|
|
|
+ }
|
|
|
+ return ossUrl.substring(startIndex, endIndex);
|
|
|
+ }
|
|
|
+
|
|
|
@XxlJob("articleVideoAuditResult")
|
|
|
public ReturnT<String> articleVideoAuditResult(String param) {
|
|
|
List<LongArticleVideoAudit> list = longArticleVideoAuditRepository.getByStatusAndTaskIdIsNotNull(StatusEnum.ZERO.getCode());
|