ソースを参照

Merge branch 'wyp/0220-addArticleAudit' of Server/long-article-recommend into master

wangyunpeng 3 ヶ月 前
コミット
0944b9eda2

+ 9 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/param/videoAudit/ArticleVideoAuditAddAuditParam.java

@@ -0,0 +1,9 @@
+package com.tzld.longarticle.recommend.server.model.param.videoAudit;
+
+import lombok.Data;
+
+@Data
+public class ArticleVideoAuditAddAuditParam {
+    private String contentId;
+    private String flowPoolLevel;
+}

+ 29 - 11
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleVideoAuditService.java

@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.recommend;
 import com.alibaba.fastjson.JSONArray;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
 import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
 import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
 import com.tzld.longarticle.recommend.server.mapper.longArticle.ArticleAuditMapper;
@@ -278,18 +279,35 @@ public class ArticleVideoAuditService {
             audit.setAuditAccount(auditUser.get(per));
             titleAuditRepository.save(audit);
         }
-        // 内容生成计划id处理
-        List<LongArticleTitleAudit> list = titleAuditRepository.getByProducePlanIdIsNull();
-        List<String> ids = list.stream().map(LongArticleTitleAudit::getContentId).collect(Collectors.toList());
-        List<ProducePlanExeRecord> exeRecordList = producePlanExeRecordRepository.findByPlanExeIdIn(ids);
-        Map<String, String> map = exeRecordList.stream().collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, ProducePlanExeRecord::getPlanId));
-        for (LongArticleTitleAudit titleAudit : list) {
-            String planId = map.get(titleAudit.getContentId());
-            if (StringUtils.hasText(planId)) {
-                titleAudit.setProducePlanId(planId);
-                titleAuditRepository.save(titleAudit);
+        return ReturnT.SUCCESS;
+    }
+
+    public void addAudit(ArticleVideoAuditAddAuditParam param) {
+        ProducePlanExeRecord exeRecord = producePlanExeRecordRepository.getByPlanExeId(param.getContentId());
+        List<String> auditUser = Arrays.asList("a","b","c","d","e","f","g","h","i","j");
+        Random random = new Random();
+        int index = random.nextInt(auditUser.size());
+        String auditAccount = auditUser.get(index);
+        int status = ArticleVideoAuditStatusEnum.WAITING.getCode();
+        if (!Objects.equals(param.getFlowPoolLevel(), ContentPoolEnum.autoArticlePoolLevel4.getContentPool())) {
+            if (Objects.nonNull(exeRecord)) {
+                String channelContentId = exeRecord.getChannelContentId();
+                ArticlePoolPromotionSource source = articlePoolPromotionSourceRepository.getByChannelContentId(channelContentId);
+                if (Objects.nonNull(source) && source.getStatus() == 1 && source.getDeleted() == 0) {
+                    status = ArticleVideoAuditStatusEnum.PASS.getCode();
+                    auditAccount = "sys";
+                }
             }
         }
-        return ReturnT.SUCCESS;
+        LongArticleTitleAudit item = new LongArticleTitleAudit();
+        item.setContentId(param.getContentId());
+        item.setStatus(status);
+        item.setFlowPoolLevel(param.getFlowPoolLevel());
+        item.setCreateTimestamp(System.currentTimeMillis());
+        if (Objects.nonNull(exeRecord)) {
+            item.setProducePlanId(exeRecord.getPlanId());
+        }
+        item.setAuditAccount(auditAccount);
+        titleAuditRepository.save(item);
     }
 }

+ 6 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/recommend/ArticleVideoAuditController.java

@@ -69,4 +69,10 @@ public class ArticleVideoAuditController {
         return CommonResponse.success();
     }
 
+    @PostMapping("/addAudit")
+    public CommonResponse<Void> addAudit(@RequestBody ArticleVideoAuditAddAuditParam param) {
+        service.addAudit(param);
+        return CommonResponse.success();
+    }
+
 }