|
@@ -15,6 +15,7 @@ import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleDelet
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleMatchContentStatusEnum;
|
|
|
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.crawler.ArticleMapper;
|
|
|
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.*;
|
|
@@ -22,8 +23,10 @@ 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.ArticleCategoryListParam;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.ArticleDangerFindDeleteParam;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
|
|
|
+import com.tzld.longarticle.recommend.server.model.vo.ArticleDeleteListVO;
|
|
|
import com.tzld.longarticle.recommend.server.model.vo.FeishuTableDTO;
|
|
|
import com.tzld.longarticle.recommend.server.remote.WxAccessTokenRemoteService;
|
|
|
import com.tzld.longarticle.recommend.server.remote.WxArticleDeleteService;
|
|
@@ -31,11 +34,13 @@ 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.aigc.PublishPlanRepository;
|
|
|
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;
|
|
|
import com.tzld.longarticle.recommend.server.util.Md5Util;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
|
|
|
+import com.tzld.longarticle.recommend.server.util.page.Page;
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -84,7 +89,9 @@ public class ArticleAuditService {
|
|
|
@Autowired
|
|
|
private PublishContentRepository publishContentRepository;
|
|
|
@Autowired
|
|
|
- private LongArticlesTextRepository longArticlesTextRepository;
|
|
|
+ private ArticleMapper articleMapper;
|
|
|
+ @Autowired
|
|
|
+ private PublishPlanRepository publishPlanRepository;
|
|
|
|
|
|
|
|
|
@XxlJob("articleVideoAudit")
|
|
@@ -204,7 +211,7 @@ public class ArticleAuditService {
|
|
|
// 暂时不做删除 先发送通知
|
|
|
if (longArticleVideoAudit.getStatus().equals(PQVideoAuditResultEnum.REJECT.getStatus())) {
|
|
|
FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.ARTICLE_DELETE.getRobotId(),
|
|
|
- "视频审核不通过【"+sensitiveLevelEnum.getDescription()+"】\n" +
|
|
|
+ "视频审核不通过【" + sensitiveLevelEnum.getDescription() + "】\n" +
|
|
|
"traceId:" + longArticleVideoAudit.getTraceId() + "\n" +
|
|
|
"视频id:" + longArticleVideoAudit.getVideoId() + "\n" +
|
|
|
"管理后台地址:https://admin.piaoquantv.com/cms/post-detail/" + longArticleVideoAudit.getVideoId() + "/detail\n" +
|
|
@@ -540,4 +547,95 @@ public class ArticleAuditService {
|
|
|
articleUnsafeTitleRepository.save(unsafeTitle);
|
|
|
}
|
|
|
|
|
|
+ public Page<ArticleDeleteListVO> articleDeleteList(ArticleCategoryListParam param) {
|
|
|
+ int offset = (param.getPageNum() - 1) * param.getPageSize();
|
|
|
+ int count = articleMapper.articleDeleteListCount(param.getTitle());
|
|
|
+ List<ArticleDeleteListVO> list = articleMapper.articleDeleteList(param.getTitle(), offset, param.getPageSize());
|
|
|
+ buildArticleDeleteListVO(list);
|
|
|
+ Page<ArticleDeleteListVO> page = new Page<>(param.getPageNum(), param.getPageSize());
|
|
|
+ page.setTotalSize(count);
|
|
|
+ page.setObjs(list);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildArticleDeleteListVO(List<ArticleDeleteListVO> list) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<PublishAccountTypeDTO> accountTypeList = aigcBaseMapper.getAccountTypeList();
|
|
|
+ Map<String, PublishAccountTypeDTO> accountTypeMap = accountTypeList.stream()
|
|
|
+ .collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity()));
|
|
|
+ List<String> ghIds = list.stream().map(ArticleDeleteListVO::getGhId).distinct().collect(Collectors.toList());
|
|
|
+ List<PublishAccount> publishAccountList = publishAccountRepository.getAllByGhIdIn(ghIds);
|
|
|
+ Map<String, PublishAccount> publishAccountMap = publishAccountList.stream().collect(Collectors.toMap(PublishAccount::getGhId, o -> o));
|
|
|
+ // 获取发布内容
|
|
|
+ List<PublishContentParam> publishContentParamList = list.stream().map(article -> {
|
|
|
+ PublishContentParam item = new PublishContentParam();
|
|
|
+ item.setTitle(article.getTitle());
|
|
|
+ PublishAccount account = publishAccountMap.get(article.getGhId());
|
|
|
+ if (Objects.nonNull(account)) {
|
|
|
+ item.setPublishAccountId(account.getId());
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<PublishContentDTO> publishContents = new ArrayList<>();
|
|
|
+ for (List<PublishContentParam> partitions : Lists.partition(publishContentParamList, 100)) {
|
|
|
+ publishContents.addAll(aigcBaseMapper.getPublishContentByTitle(partitions));
|
|
|
+ }
|
|
|
+ Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap = publishContents.stream()
|
|
|
+ .filter(o -> Objects.nonNull(o.getPublishTimestamp()))
|
|
|
+ .sorted(Comparator.comparingLong(PublishContentDTO::getPublishTimestamp))
|
|
|
+ .collect(Collectors.groupingBy(PublishContentDTO::getPublishAccountId,
|
|
|
+ Collectors.groupingBy(PublishContentDTO::getTitle,
|
|
|
+ Collectors.toMap(PublishContentDTO::getPublishTimestamp, o -> o,
|
|
|
+ (existing, replacement) -> replacement))));
|
|
|
+ List<String> publishContentIds = publishContents.stream().map(PublishContentDTO::getId).collect(Collectors.toList());
|
|
|
+ List<PublishGzhPushContentRelDTO> pushContentRelList = aigcBaseMapper.getPushContentRelByPublishContentIdIn(publishContentIds);
|
|
|
+ Map<String, String> publishPushIdMap = pushContentRelList.stream()
|
|
|
+ .collect(Collectors.toMap(PublishGzhPushContentRelDTO::getPublishContentId,
|
|
|
+ PublishGzhPushContentRelDTO::getPushId,
|
|
|
+ (o1, o2) -> o2));
|
|
|
+ List<String> pushIds = pushContentRelList.stream().map(PublishGzhPushContentRelDTO::getPushId).collect(Collectors.toList());
|
|
|
+ List<PublishGzhPushDTO> pushList = aigcBaseMapper.getPushByPushIdIn(pushIds);
|
|
|
+ Map<String, PublishGzhPushDTO> pushDTOMap = pushList.stream()
|
|
|
+ .collect(Collectors.toMap(PublishGzhPushDTO::getPushId, Function.identity()));
|
|
|
+ for (ArticleDeleteListVO item : list) {
|
|
|
+ PublishAccountTypeDTO accountTypeDTO = accountTypeMap.get(item.getGhId());
|
|
|
+ if (Objects.nonNull(accountTypeDTO)) {
|
|
|
+ item.setAccountSourceType(accountTypeDTO.getAccountSourceName());
|
|
|
+ }
|
|
|
+ PublishAccount account = publishAccountMap.get(item.getGhId());
|
|
|
+ if (Objects.isNull(account)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Map<Long, PublishContentDTO>> titleMap = publishContentMap.get(account.getId());
|
|
|
+ if (Objects.isNull(titleMap)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<Long, PublishContentDTO> publishTimeContentMap = titleMap.get(item.getTitle());
|
|
|
+ if (Objects.isNull(publishTimeContentMap)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ PublishContentDTO publishContent = null;
|
|
|
+ List<String> hisPublishTimeStrList = publishTimeContentMap.keySet().stream()
|
|
|
+ .map(o -> DateUtils.timestampToYMDStr(o / 1000, "yyyyMMdd")).collect(Collectors.toList());
|
|
|
+ String publishTime = DateUtils.findNearestDate(hisPublishTimeStrList, item.getDateStr(), "yyyyMMdd");
|
|
|
+ for (Map.Entry<Long, PublishContentDTO> entry : publishTimeContentMap.entrySet()) {
|
|
|
+ String str = DateUtils.timestampToYMDStr(entry.getKey() / 1000, "yyyyMMdd");
|
|
|
+ if (publishTime.equals(str)) {
|
|
|
+ publishContent = entry.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Objects.isNull(publishContent)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String pushId = publishPushIdMap.get(publishContent.getId());
|
|
|
+ PublishGzhPushDTO pushDTO = pushDTOMap.get(pushId);
|
|
|
+ if (Objects.isNull(pushDTO)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ item.setPlanType(PushTypeEnum.from(pushDTO.getPushType()).getDescription());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|