소스 검색

增加过滤当日发布失败内容

wangyunpeng 1 주 전
부모
커밋
59029467ca

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/aigc/AigcBaseMapper.java

@@ -93,6 +93,8 @@ public interface AigcBaseMapper {
 
     List<PublishContent> getTodayPublishContentList(String accountId, Long todayStart);
 
+    List<PublishContent> getTodayPublishFailContentList(String accountId, Long todayStart);
+
     List<String> getAllAuditProducePlan();
 
     void topContentDeprecate(String topProducePlanId);

+ 6 - 15
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/filter/strategy/TodayPublishStrategy.java

@@ -41,23 +41,14 @@ public class TodayPublishStrategy implements FilterStrategy {
         List<String> result = Collections.synchronizedList(param.getContents().stream().map(Content::getId).collect(Collectors.toList()));
         Long todayStart = DateUtils.getTodayStart();
         List<PublishContent> todayPublishContentList = aigcBaseMapper.getTodayPublishContentList(param.getAccountId(), todayStart);
+        List<PublishContent> todayPublishFailList = aigcBaseMapper.getTodayPublishFailContentList(param.getAccountId(), todayStart);
         if (CollectionUtils.isNotEmpty(todayPublishContentList)) {
             List<String> todayPublishContentIdList = todayPublishContentList.stream().map(PublishContent::getId).collect(Collectors.toList());
-            CountDownLatch cdl = new CountDownLatch(todayPublishContentIdList.size());
-            for (String todayPublishContentId : todayPublishContentIdList) {
-                pool.submit(() -> {
-                    try {
-                        result.remove(todayPublishContentId);
-                    } finally {
-                        cdl.countDown();
-                    }
-                });
-            }
-            try {
-                cdl.await();
-            } catch (InterruptedException e) {
-                log.error("TodayPublishStrategy filter error", e);
-            }
+            result.removeAll(todayPublishContentIdList);
+        }
+        if (CollectionUtils.isNotEmpty(todayPublishFailList)) {
+            List<String> todayPublishFailIdList = todayPublishFailList.stream().map(PublishContent::getId).collect(Collectors.toList());
+            result.removeAll(todayPublishFailIdList);
         }
         filterResult.setContentIds(result);
         log.info("TodayPublishStrategy filter cost time:{}", System.currentTimeMillis() - start);

+ 5 - 0
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -441,6 +441,11 @@
         select id from publish_content where publish_account_id = #{accountId} and publish_timestamp > #{todayStart}
     </select>
 
+    <select id="getTodayPublishFailContentList"
+            resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent">
+        select id from publish_content where publish_account_id = #{accountId} and status = 5 and update_timestamp > #{todayStart}
+    </select>
+
     <select id="getAllAuditProducePlan" resultType="java.lang.String">
         select id from produce_plan where plan_status = 1 and produce_modal = 3
     </select>