|
@@ -3,6 +3,8 @@ package com.tzld.longarticle.recommend.server.service.recommend;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum;
|
|
|
+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.model.dto.*;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
@@ -13,6 +15,7 @@ import com.tzld.longarticle.recommend.server.remote.WxArticleDeleteService;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.*;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
+import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -22,6 +25,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -85,8 +89,6 @@ public class ArticleAuditService {
|
|
|
|
|
|
/**
|
|
|
* 视频审核结果处理
|
|
|
- * @param param
|
|
|
- * @return
|
|
|
*/
|
|
|
public void articleVideoAuditResult(ArticleVideoAuditResultParam param) {
|
|
|
LongArticleVideoAudit longArticleVideoAudit = longArticleVideoAuditRepository.getByVideoId(param.getVideoId());
|
|
@@ -117,6 +119,8 @@ public class ArticleAuditService {
|
|
|
Map<String, String> publishPushIdMap = pushContentRelList.stream()
|
|
|
.collect(Collectors.toMap(PublishGzhPushContentRelDTO::getPublishContentId, PublishGzhPushContentRelDTO::getPushId));
|
|
|
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()
|
|
|
.collect(Collectors.toMap(PublishGzhPushDTO::getPushId, PublishGzhPushDTO::getGroupPushMsgId));
|
|
|
List<String> publishAccountIds = pushList.stream().map(PublishGzhPushDTO::getPublishAccountId).collect(Collectors.toList());
|
|
@@ -131,6 +135,11 @@ public class ArticleAuditService {
|
|
|
for (String traceId : traceIds) {
|
|
|
String publishContentId = publishContentIdMap.get(traceId);
|
|
|
String pushId = publishPushIdMap.get(publishContentId);
|
|
|
+ if (!StringUtils.hasText(pushId)) {
|
|
|
+ // todo 未发布文章如何进行小程序替换
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ PublishGzhPushDTO publishGzhPushDTO = pushDTOMap.get(pushId);
|
|
|
String groupPushMsgId = pushIdMap.get(pushId);
|
|
|
String publishAccountId = pushAccountMap.get(pushId);
|
|
|
String ghId = publishAccountMap.get(publishAccountId);
|
|
@@ -145,6 +154,9 @@ public class ArticleAuditService {
|
|
|
LongArticleAuditDelete delete = new LongArticleAuditDelete();
|
|
|
delete.setGhId(ghId);
|
|
|
delete.setMsgId(groupPushMsgId);
|
|
|
+ delete.setPushId(pushId);
|
|
|
+ delete.setPushType(publishGzhPushDTO.getPushType());
|
|
|
+ delete.setPublishContentId(publishContentId);
|
|
|
delete.setIndex(index);
|
|
|
delete.setStatus(StatusEnum.ZERO.getCode());
|
|
|
delete.setCreateTimestamp(System.currentTimeMillis());
|
|
@@ -154,25 +166,38 @@ public class ArticleAuditService {
|
|
|
|
|
|
/**
|
|
|
* 删除审核不通过,已发布文章
|
|
|
- *
|
|
|
- * @param param
|
|
|
- * @return
|
|
|
*/
|
|
|
@XxlJob("articleVideoDelete")
|
|
|
public ReturnT<String> articleVideoDelete(String param) {
|
|
|
List<LongArticleAuditDelete> dealList = longArticleAuditDeleteRepository.getByStatus(StatusEnum.ZERO.getCode());
|
|
|
for (LongArticleAuditDelete delete : dealList) {
|
|
|
- // 获取token
|
|
|
- String token = wxAccessTokenRemoteService.getAccessToken(delete.getGhId());
|
|
|
- // 删除文章
|
|
|
- RequestResult<String> result = wxArticleDeleteService.deleteArticle(token, delete.getMsgId(), delete.getIndex());
|
|
|
- if (result.isSuccess()) {
|
|
|
- delete.setStatus(StatusEnum.ONE.getCode());
|
|
|
+ if (Objects.equals(delete.getPushType(), PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
|
|
|
+ // 获取token
|
|
|
+ String token = wxAccessTokenRemoteService.getAccessToken(delete.getGhId());
|
|
|
+ // 删除文章
|
|
|
+ RequestResult<String> result = wxArticleDeleteService.deleteArticle(token, delete.getMsgId(), delete.getIndex());
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ delete.setStatus(StatusEnum.ONE.getCode());
|
|
|
+ } else {
|
|
|
+ delete.setStatus(StatusEnum.TWO.getCode());
|
|
|
+ delete.setFinishTimestamp(System.currentTimeMillis());
|
|
|
+ }
|
|
|
+ longArticleAuditDeleteRepository.save(delete);
|
|
|
} else {
|
|
|
- delete.setStatus(StatusEnum.TWO.getCode());
|
|
|
- delete.setFinishTimestamp(System.currentTimeMillis());
|
|
|
+ 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());
|
|
|
+
|
|
|
+ delete.setStatus(StatusEnum.ONE.getCode());
|
|
|
+ longArticleAuditDeleteRepository.save(delete);
|
|
|
}
|
|
|
- longArticleAuditDeleteRepository.save(delete);
|
|
|
}
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|