|
@@ -17,16 +17,15 @@ import com.tzld.longarticle.recommend.server.model.param.videoAudit.VideoAuditPa
|
|
|
import com.tzld.longarticle.recommend.server.model.vo.ArticleVideoAuditListVO;
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.*;
|
|
|
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;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -180,4 +179,37 @@ public class ArticleVideoAuditService {
|
|
|
public List<String> getFilterValue(AuditFilterParam param) {
|
|
|
return articleAuditMapper.searchFilterValueByItemName(param.getItemName(), param.getSearchKeyword());
|
|
|
}
|
|
|
+
|
|
|
+ @XxlJob("rematchVideoAudit")
|
|
|
+ public ReturnT<String> rematchVideoAudit(String param) {
|
|
|
+ List<LongArticleTitleAudit> rejectList = titleAuditRepository.getByStatus(ArticleVideoAuditStatusEnum.REJECT.getCode());
|
|
|
+ if (CollectionUtils.isEmpty(rejectList)) {
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+ List<String> contentIds = rejectList.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
|
|
|
+ List<ArticleReMatchRecord> reMatchRecordList = articleReMatchRecordRepository.getByContentIdIn(contentIds);
|
|
|
+ if (CollectionUtils.isEmpty(reMatchRecordList)) {
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+ Map<String, List<ArticleReMatchRecord>> reMatchRecordMap = reMatchRecordList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ArticleReMatchRecord::getContentId));
|
|
|
+ for (LongArticleTitleAudit audit : rejectList) {
|
|
|
+ List<ArticleReMatchRecord> records = reMatchRecordMap.get(audit.getContentId());
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ records = records.stream().filter(o -> Objects.isNull(o.getTraceId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<ArticleReMatchRecord> failList = records.stream()
|
|
|
+ .filter(o -> o.getStatus().equals(2) || o.getStatus().equals(0)).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(failList)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ audit.setStatus(ArticleVideoAuditStatusEnum.WAITING.getCode());
|
|
|
+ titleAuditRepository.save(audit);
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
}
|