|
@@ -6,8 +6,10 @@ import com.google.common.collect.Lists;
|
|
|
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.ArticleDeleteStatusEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoAuditResultENum;
|
|
|
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.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.crawler.Article;
|
|
@@ -17,6 +19,7 @@ import com.tzld.longarticle.recommend.server.model.param.ArticleVideoAuditResult
|
|
|
import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
|
|
|
import com.tzld.longarticle.recommend.server.remote.WxAccessTokenRemoteService;
|
|
|
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.crawler.ArticleRepository;
|
|
@@ -64,6 +67,8 @@ public class ArticleAuditService {
|
|
|
private ArticleUnsafeTitleRepository articleUnsafeTitleRepository;
|
|
|
@Autowired
|
|
|
private PQVideoAuditStartProcessService pqVideoAuditStartProcessService;
|
|
|
+ @Autowired
|
|
|
+ private PQVideoAuditResultService pqVideoAuditResultService;
|
|
|
|
|
|
|
|
|
@XxlJob("articleVideoAudit")
|
|
@@ -102,10 +107,14 @@ public class ArticleAuditService {
|
|
|
// 调用PQ 审核视频
|
|
|
try {
|
|
|
Long taskId = pqVideoAuditStartProcessService.startProcess(response.getVideoID());
|
|
|
- videoAudit.setTaskId(taskId);
|
|
|
- longArticleVideoAuditRepository.save(videoAudit);
|
|
|
+ if (Objects.nonNull(taskId)) {
|
|
|
+ videoAudit.setTaskId(taskId);
|
|
|
+ longArticleVideoAuditRepository.save(videoAudit);
|
|
|
+ } else {
|
|
|
+ log.error("PQVideoAuditStartProcess start process error videoId:{} ", response.getVideoID());
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
- log.error("PQVideoAuditStartProcess start process error:{}", e.getMessage());
|
|
|
+ log.error("PQVideoAuditStartProcess start process videoId:{} error:{}", response.getVideoID(), e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -113,20 +122,28 @@ public class ArticleAuditService {
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 视频审核结果处理
|
|
|
- */
|
|
|
- public void articleVideoAuditResult(ArticleVideoAuditResultParam param) {
|
|
|
- LongArticleVideoAudit longArticleVideoAudit = longArticleVideoAuditRepository.getByVideoId(param.getVideoId());
|
|
|
- if (param.getResult() == 1) {
|
|
|
+ @XxlJob("articleVideoAuditResult")
|
|
|
+ public ReturnT<String> articleVideoAuditResult(String param) {
|
|
|
+ List<LongArticleVideoAudit> list = longArticleVideoAuditRepository.getByStatusAndTaskIdIsNotNull(StatusEnum.ZERO.getCode());
|
|
|
+ for (List<LongArticleVideoAudit> partition : Lists.partition(list, 10)) {
|
|
|
+ List<Long> taskIds = partition.stream().map(LongArticleVideoAudit::getTaskId).collect(Collectors.toList());
|
|
|
+ Map<Long, LongArticleVideoAudit> map = partition.stream().collect(Collectors.toMap(LongArticleVideoAudit::getTaskId, Function.identity()));
|
|
|
+ List<PQVideoAuditResult> resultList = pqVideoAuditResultService.getResult(taskIds);
|
|
|
+ resultList.forEach(result -> saveVideoAuditResult(map.get(result.getTaskId()), result.getAuditResult()));
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void saveVideoAuditResult(LongArticleVideoAudit longArticleVideoAudit, Integer auditResult) {
|
|
|
+ if (Objects.equals(auditResult, PQVideoAuditResultENum.PASS.getStatus())) {
|
|
|
// 审核通过,更新文章状态
|
|
|
- longArticleVideoAudit.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
|
|
|
+ longArticleVideoAudit.setStatus(PQVideoAuditResultENum.PASS.getStatus());
|
|
|
longArticleVideoAudit.setFinishTimestamp(System.currentTimeMillis());
|
|
|
longArticleVideoAuditRepository.save(longArticleVideoAudit);
|
|
|
- } else {
|
|
|
+ } else if (Objects.equals(auditResult, PQVideoAuditResultENum.REJECT.getStatus())) {
|
|
|
// 审核不通过,删除文章
|
|
|
- longArticleVideoAudit.setStatus(ArticleDeleteStatusEnum.FAIL.getCode());
|
|
|
- longArticleVideoAudit.setFailReason(param.getFailReason());
|
|
|
+ longArticleVideoAudit.setStatus(PQVideoAuditResultENum.REJECT.getStatus());
|
|
|
longArticleVideoAudit.setFinishTimestamp(System.currentTimeMillis());
|
|
|
longArticleVideoAuditRepository.save(longArticleVideoAudit);
|
|
|
// 构建删除文章记录 并保存
|