| 
					
				 | 
			
			
				@@ -8,18 +8,25 @@ import com.ctrip.framework.apollo.model.ConfigChangeEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.ContentCountMonitor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.common.enums.recommend.RankStrategyEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.dto.Content; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.ServiceBeanFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.recommend.rank.strategy.FwhColdStartRankStrategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.recommend.score.AccountIndexReplacePoolConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.RandomUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.InitializingBean; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Objects; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,6 +41,12 @@ import static com.tzld.longarticle.recommend.server.common.constant.SceneConstan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class RankService implements InitializingBean { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    PublishContentRepository publishContentRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    LongArticleBaseMapper longArticleBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static Map<String, Map<String, Integer>> staticStrategyPoolSourceTypeMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static Map<String, Double> staticSafeReduceConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -196,4 +209,48 @@ public class RankService implements InitializingBean { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void checkPublishContentStatus(List<Content> result, Map<String, List<Content>> contentMap, String[] publishPool) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> titles = result.stream().map(Content::getTitle).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> publishContentIds = result.stream().map(Content::getId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PublishContent> publishContentList = publishContentRepository.getByIdIn(publishContentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Integer> publishContentStatusMap = publishContentList.stream().collect(Collectors.toMap(PublishContent::getId, PublishContent::getStatus)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> removeContentIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i = 0; i < result.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (publishContentStatusMap.get(result.get(i).getId()).equals(PublishContentStatusEnum.waiting_publish.getVal())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                removeContentIds.add(result.get(i).getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (i == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (Content content : contentMap.get(publishPool[0])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!TitleSimilarCheckUtil.isDuplicateContent(content.getTitle(), titles, TitleSimilarCheckUtil.SIMILARITY_THRESHOLD)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result.set(i, content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        titles.add(content.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (i == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (Content content : contentMap.get(publishPool[1])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!TitleSimilarCheckUtil.isDuplicateContent(content.getTitle(), titles, TitleSimilarCheckUtil.SIMILARITY_THRESHOLD)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result.set(i, content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        titles.add(content.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (Content content : contentMap.get(publishPool[2])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!TitleSimilarCheckUtil.isDuplicateContent(content.getTitle(), titles, TitleSimilarCheckUtil.SIMILARITY_THRESHOLD)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result.set(i, content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        titles.add(content.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(removeContentIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            long updateTimestamp = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            longArticleBaseMapper.updatePublishContentGzhWaitingStatusByIds(removeContentIds, 0, updateTimestamp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |