|
@@ -133,14 +133,28 @@ public class ArticleAuditService {
|
|
|
}
|
|
|
|
|
|
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<PublishGzhPushContentRelDTO> pushContentRelList = aigcBaseMapper.getPushContentRelByPublishContentIdIn(publishContentIds);
|
|
|
+ if (CollectionUtils.isEmpty(pushContentRelList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
List<String> pushIds = pushContentRelList.stream().map(PublishGzhPushContentRelDTO::getPushId).collect(Collectors.toList());
|
|
|
Map<String, String> publishPushIdMap = pushContentRelList.stream()
|
|
|
- .collect(Collectors.toMap(PublishGzhPushContentRelDTO::getPublishContentId, PublishGzhPushContentRelDTO::getPushId));
|
|
|
+ .collect(Collectors.toMap(PublishGzhPushContentRelDTO::getPublishContentId,
|
|
|
+ PublishGzhPushContentRelDTO::getPushId,
|
|
|
+ (o1, o2) -> o2));
|
|
|
List<PublishGzhPushDTO> pushList = aigcBaseMapper.getPushByPushIdIn(pushIds);
|
|
|
Map<String, PublishGzhPushDTO> pushDTOMap = pushList.stream()
|
|
|
.collect(Collectors.toMap(PublishGzhPushDTO::getPushId, Function.identity()));
|
|
|
- Map<String, String> pushIdMap = pushList.stream()
|
|
|
+ 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()
|
|
@@ -155,13 +169,24 @@ public class ArticleAuditService {
|
|
|
for (String publishContentId : publishContentIds) {
|
|
|
String pushId = publishPushIdMap.get(publishContentId);
|
|
|
if (!StringUtils.hasText(pushId)) {
|
|
|
+ deleteFailAlarm(publishContentId, "无推送记录", 0);
|
|
|
continue;
|
|
|
}
|
|
|
PublishGzhPushDTO publishGzhPushDTO = pushDTOMap.get(pushId);
|
|
|
if (Objects.isNull(publishGzhPushDTO)) {
|
|
|
+ deleteFailAlarm(publishContentId, "无推送记录", 0);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!publishGzhPushDTO.getPushType().equals(PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
|
|
|
+ PushTypeEnum pushTypeEnum = PushTypeEnum.from(publishGzhPushDTO.getPushType());
|
|
|
+ deleteFailAlarm(publishContentId, "推送类型为" + pushTypeEnum.getDescription(), 0);
|
|
|
continue;
|
|
|
}
|
|
|
String groupPushMsgId = pushIdMap.get(pushId);
|
|
|
+ if (!StringUtils.hasText(groupPushMsgId)) {
|
|
|
+ deleteFailAlarm(publishContentId, "无推送MsgId", 0);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
String publishAccountId = pushAccountMap.get(pushId);
|
|
|
String ghId = publishAccountMap.get(publishAccountId);
|
|
|
List<PublishGzhPushContentRelDTO> relList = groupPushRelMap.get(pushId).stream()
|
|
@@ -203,28 +228,32 @@ public class ArticleAuditService {
|
|
|
} else {
|
|
|
delete.setStatus(ArticleDeleteStatusEnum.FAIL.getCode());
|
|
|
delete.setFailReason(result.getFailReason());
|
|
|
- delete.setFinishTimestamp(System.currentTimeMillis());
|
|
|
}
|
|
|
- longArticleAuditDeleteRepository.save(delete);
|
|
|
} else {
|
|
|
- PublishAccount publishAccount = publishAccountRepository.getByGhId(delete.getGhId());
|
|
|
- PublishContentDTO publishContent = aigcBaseMapper.getPublishContentById(delete.getPublishContentId());
|
|
|
- String publishTime = DateUtils.timestampToYMDStr(publishContent.getPublishTimestamp() / 1000, "yyyyMMdd");
|
|
|
- // 无法自动删除 发送飞书通知 人工删除
|
|
|
- FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.ARTICLE_DELETE.getRobotId(),
|
|
|
- "视频审核不通过文章删除\n"
|
|
|
- + "账号名称: " + publishAccount.getName() + "\n"
|
|
|
- + "发布日期: " + publishTime + "\n"
|
|
|
- + "位置: " + delete.getIndex() + "\n"
|
|
|
- + "标题: " + publishContent.getTitle());
|
|
|
-
|
|
|
+ deleteFailAlarm(delete.getPublishContentId(), "非自动群发", delete.getIndex());
|
|
|
delete.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
|
|
|
- longArticleAuditDeleteRepository.save(delete);
|
|
|
}
|
|
|
+ delete.setFinishTimestamp(System.currentTimeMillis());
|
|
|
+ longArticleAuditDeleteRepository.save(delete);
|
|
|
}
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ private void deleteFailAlarm(String publishContentId, String typeMsg, Integer index) {
|
|
|
+ PublishContentDTO publishContent = aigcBaseMapper.getPublishContentById(publishContentId);
|
|
|
+ PublishAccount publishAccount = publishAccountRepository.getById(publishContent.getPublishAccountId());
|
|
|
+ String publishTime = DateUtils.timestampToYMDStr(publishContent.getPublishTimestamp() / 1000, "yyyyMMdd");
|
|
|
+ // 无法自动删除 发送飞书通知 人工删除
|
|
|
+ FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.ARTICLE_DELETE.getRobotId(),
|
|
|
+ "【文章删除失败】\n"
|
|
|
+ + "账号名称: " + publishAccount.getName() + "\n"
|
|
|
+ + "账号ghId: " + publishAccount.getGhId() + "\n"
|
|
|
+ + "发布日期: " + publishTime + "\n"
|
|
|
+ + "位置: " + index + "\n"
|
|
|
+ + "标题: " + publishContent.getTitle() + "\n"
|
|
|
+ + "原因: " + typeMsg);
|
|
|
+ }
|
|
|
+
|
|
|
public void titleDangerFindDelete(ArticleDangerFindDeleteParam param) {
|
|
|
String titleMd5 = Md5Util.encoderByMd5(param.getTitle());
|
|
|
// 根据标题查找已发布文章
|