|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoAuditResultEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoSensitiveLevelEnum;
|
|
@@ -14,6 +15,7 @@ import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseM
|
|
|
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;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.ArticleDangerFindDeleteParam;
|
|
@@ -23,6 +25,7 @@ import com.tzld.longarticle.recommend.server.remote.WxArticleDeleteService;
|
|
|
import com.tzld.longarticle.recommend.server.remote.pq.PQVideoAuditResultService;
|
|
|
import com.tzld.longarticle.recommend.server.remote.pq.PQVideoAuditStartProcessService;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.*;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
@@ -73,6 +76,10 @@ public class ArticleAuditService {
|
|
|
private PQVideoAuditResultService pqVideoAuditResultService;
|
|
|
@Autowired
|
|
|
private LongArticleBaseMapper longArticleBaseMapper;
|
|
|
+ @Autowired
|
|
|
+ private PublishContentRepository publishContentRepository;
|
|
|
+ @Autowired
|
|
|
+ private LongArticlesTextRepository longArticlesTextRepository;
|
|
|
|
|
|
|
|
|
@XxlJob("articleVideoAudit")
|
|
@@ -198,24 +205,44 @@ public class ArticleAuditService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void saveDeleteRecord(String ossPath) {
|
|
|
+ public void saveDeleteRecord(String ossPath) {
|
|
|
List<LongArticleCrawlerVideo> crawlerVideoList = longArticleCrawlerVideoRepository.getByVideoOssPath(ossPath);
|
|
|
- List<String> traceIds = crawlerVideoList.stream().map(LongArticleCrawlerVideo::getTraceId).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(crawlerVideoList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<String> contentIds = crawlerVideoList.stream().map(LongArticleCrawlerVideo::getContentId).collect(Collectors.toList());
|
|
|
+ List<LongArticlesMatchVideo> matchVideoList = longArticlesMatchVideoRepository.getByContentIdIn(contentIds);
|
|
|
+ List<String> traceIds = matchVideoList.stream().map(LongArticlesMatchVideo::getTraceId).collect(Collectors.toList());
|
|
|
List<PublishContentMiniprogramDTO> publishContentList = aigcBaseMapper.getPublishContentByTraceIdIn(traceIds);
|
|
|
List<String> publishContentIds = publishContentList.stream().map(PublishContentMiniprogramDTO::getPublishContentId).collect(Collectors.toList());
|
|
|
buildArticleAuditDelete(publishContentIds);
|
|
|
+ List<LongArticlesText> textList = longArticlesTextRepository.getByContentIdIn(contentIds);
|
|
|
+ for (LongArticlesText text : textList) {
|
|
|
+ String titleMd5 = Md5Util.encoderByMd5(text.getArticleTitle());
|
|
|
+ buildArticleUnsafeTitle(titleMd5, text.getArticleTitle());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void buildArticleAuditDelete(List<String> publishContentIds) {
|
|
|
if (CollectionUtils.isEmpty(publishContentIds)) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 过滤已删除数据
|
|
|
List<LongArticleAuditDelete> existList = longArticleAuditDeleteRepository.getByPublishContentIdIn(publishContentIds);
|
|
|
List<String> existContentIds = existList.stream().map(LongArticleAuditDelete::getPublishContentId).collect(Collectors.toList());
|
|
|
publishContentIds = publishContentIds.stream().filter(id -> !existContentIds.contains(id)).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(publishContentIds)) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 过滤状态非已发布内容
|
|
|
+ List<PublishContent> publishContentList = publishContentRepository.getByIdIn(publishContentIds);
|
|
|
+ List<String> publishedIds = publishContentList.stream()
|
|
|
+ .filter(o -> Objects.equals(o.getStatus(), PublishContentStatusEnum.published.getVal()))
|
|
|
+ .map(PublishContent::getId).collect(Collectors.toList());
|
|
|
+ publishContentIds = publishContentIds.stream().filter(publishedIds::contains).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(publishContentIds)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
List<PublishGzhPushContentRelDTO> pushContentRelList = aigcBaseMapper.getPushContentRelByPublishContentIdIn(publishContentIds);
|
|
|
if (CollectionUtils.isEmpty(pushContentRelList)) {
|
|
|
return;
|
|
@@ -241,7 +268,7 @@ public class ArticleAuditService {
|
|
|
.collect(Collectors.groupingBy(PublishGzhPushContentRelDTO::getPushId));
|
|
|
List<PublishAccountTypeDTO> accountTypeList = aigcBaseMapper.getAccountTypeList();
|
|
|
Map<String, PublishAccountTypeDTO> accountTypeMap = accountTypeList.stream()
|
|
|
- .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity()));
|
|
|
+ .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity()));
|
|
|
// 删除文章
|
|
|
for (String publishContentId : publishContentIds) {
|
|
|
String pushId = publishPushIdMap.get(publishContentId);
|