|
@@ -31,6 +31,7 @@ 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.ArticleDeleteParam;
|
|
|
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;
|
|
@@ -511,9 +512,9 @@ public class ArticleAuditService {
|
|
|
List<PublishAccountTypeDTO> accountTypeList = publishContentMapper.getAccountTypeList(ghIds);
|
|
|
Map<String, PublishAccountTypeDTO> accountTypeMap = accountTypeList.stream()
|
|
|
.collect(Collectors.toMap(PublishAccountTypeDTO::getGhId, Function.identity()));
|
|
|
- List<JSONObject> alarmList = Collections.synchronizedList(new ArrayList<>());
|
|
|
+ List<JSONObject> alarmList = Collections.synchronizedList(new ArrayList<>());
|
|
|
Map<String, List<LongArticleAuditDelete>> dealMap = dealList.stream().collect(Collectors.groupingBy(LongArticleAuditDelete::getGhId));
|
|
|
- ExecutorService pool = new CommonThreadPoolExecutor( 10, 10, 0L, TimeUnit.SECONDS,
|
|
|
+ ExecutorService pool = new CommonThreadPoolExecutor(10, 10, 0L, TimeUnit.SECONDS,
|
|
|
new LinkedBlockingQueue<>(10000),
|
|
|
new ThreadFactoryBuilder().setNameFormat("ArticleVideoDelete-%d").build(),
|
|
|
new ThreadPoolExecutor.AbortPolicy());
|
|
@@ -529,7 +530,7 @@ public class ArticleAuditService {
|
|
|
List<String> msgIds = new ArrayList<>(msgIdMap.keySet());
|
|
|
List<LongArticleAuditDelete> accountAllDeleteList = longArticleAuditDeleteRepository.getByGhIdAndMsgIdIn(entry.getKey(), msgIds);
|
|
|
Map<String, List<LongArticleAuditDelete>> accountAllDeleteMap = accountAllDeleteList.stream()
|
|
|
- .collect(Collectors.groupingBy(LongArticleAuditDelete::getMsgId));
|
|
|
+ .collect(Collectors.groupingBy(LongArticleAuditDelete::getMsgId));
|
|
|
for (Map.Entry<String, List<LongArticleAuditDelete>> msgIdEntry : msgIdMap.entrySet()) {
|
|
|
String msgId = msgIdEntry.getKey();
|
|
|
List<LongArticleAuditDelete> msgIdList = msgIdEntry.getValue();
|
|
@@ -842,4 +843,66 @@ public class ArticleAuditService {
|
|
|
pageNum++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @XxlJob("articleDeleteJob")
|
|
|
+ public ReturnT<String> articleDeleteJob(String param) {
|
|
|
+ articleDelete(null);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void articleDelete(ArticleDeleteParam param) {
|
|
|
+ Long startTime = DateUtils.getBeforeDayStart(7);
|
|
|
+ Long endTime = DateUtils.getBeforeDayStart(3);
|
|
|
+ if (Objects.nonNull(param) && StringUtils.hasText(param.getDateStrBegin())) {
|
|
|
+ startTime = DateUtils.dateStrToTimestamp(param.getDateStrBegin(), "yyyyMMdd");
|
|
|
+ endTime = DateUtils.dateStrToTimestamp(param.getDateStrEnd(), "yyyyMMdd");
|
|
|
+ }
|
|
|
+ List<PublishGzhPushDTO> pushList = publishContentMapper.getPushByPushTimeBetween(startTime * 1000, endTime * 1000);
|
|
|
+ List<String> pushIds = pushList.stream().map(PublishGzhPushDTO::getPushId).collect(Collectors.toList());
|
|
|
+ Map<String, String> pushIdMap = pushList.stream().filter(o -> StringUtils.hasText(o.getGroupPushMsgId()))
|
|
|
+ .collect(Collectors.toMap(PublishGzhPushDTO::getPushId, PublishGzhPushDTO::getGroupPushMsgId));
|
|
|
+ List<String> publishAccountIds = pushList.stream().map(PublishGzhPushDTO::getPublishAccountId).collect(Collectors.toList());
|
|
|
+ Map<String, String> pushAccountMap = pushList.stream()
|
|
|
+ .collect(Collectors.toMap(PublishGzhPushDTO::getPushId, PublishGzhPushDTO::getPublishAccountId));
|
|
|
+ List<PublishAccount> publishAccountList = publishAccountRepository.getByIdIn(publishAccountIds);
|
|
|
+ Map<String, String> publishAccountMap = publishAccountList.stream()
|
|
|
+ .collect(Collectors.toMap(PublishAccount::getId, PublishAccount::getGhId));
|
|
|
+ List<PublishGzhPushContentRelDTO> groupPushRelList = publishContentMapper.getGroupPushRelByPushIdIn(pushIds);
|
|
|
+ List<String> publishContentIds = groupPushRelList.stream().map(PublishGzhPushContentRelDTO::getPublishContentId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<LongArticleAuditDelete> exists = longArticleAuditDeleteRepository.getByPublishContentIdIn(publishContentIds);
|
|
|
+ List<String> existsIds = exists.stream().map(LongArticleAuditDelete::getPublishContentId).collect(Collectors.toList());
|
|
|
+ Map<String, List<PublishGzhPushContentRelDTO>> groupPushRelMap = groupPushRelList.stream()
|
|
|
+ .collect(Collectors.groupingBy(PublishGzhPushContentRelDTO::getPushId));
|
|
|
+ for (PublishGzhPushDTO push : pushList) {
|
|
|
+ List<LongArticleAuditDelete> deleteList = new ArrayList<>();
|
|
|
+ String groupPushMsgId = pushIdMap.get(push.getPushId());
|
|
|
+ String publishAccountId = pushAccountMap.get(push.getPushId());
|
|
|
+ String ghId = publishAccountMap.get(publishAccountId);
|
|
|
+ List<PublishGzhPushContentRelDTO> relList = groupPushRelMap.get(push.getPushId()).stream()
|
|
|
+ .sorted(Comparator.comparing(PublishGzhPushContentRelDTO::getId)).collect(Collectors.toList());
|
|
|
+ Map<String, Integer> articleIndexMap = new HashMap<>();
|
|
|
+ for (int i = 0; i < relList.size(); i++) {
|
|
|
+ articleIndexMap.put(relList.get(i).getPublishContentId(), i + 1);
|
|
|
+ }
|
|
|
+ for (PublishGzhPushContentRelDTO pushContentRelDTO : relList) {
|
|
|
+ if (existsIds.contains(pushContentRelDTO.getPublishContentId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ LongArticleAuditDelete delete = new LongArticleAuditDelete();
|
|
|
+ delete.setGhId(ghId);
|
|
|
+ delete.setMsgId(groupPushMsgId);
|
|
|
+ delete.setPushId(push.getPushId());
|
|
|
+ delete.setPushType(push.getPushType());
|
|
|
+ delete.setPublishContentId(pushContentRelDTO.getPublishContentId());
|
|
|
+ delete.setIndex(articleIndexMap.get(delete.getPublishContentId()));
|
|
|
+ delete.setStatus(StatusEnum.ZERO.getCode());
|
|
|
+ delete.setCreateTimestamp(System.currentTimeMillis());
|
|
|
+ deleteList.add(delete);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(deleteList)) {
|
|
|
+ longArticleBaseMapper.batchInsertLongArticleAuditDelete(deleteList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|