| 
					
				 | 
			
			
				@@ -0,0 +1,45 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.tzld.longarticle.recommend.server.service.recommend.filter.strategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.dto.Content; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.service.recommend.filter.FilterStrategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.util.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.stereotype.Component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Component 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class OldStrategy implements FilterStrategy { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Value("${filter.old.strategy.days:60}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Integer filterOldStrategyDays; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public FilterResult filter(FilterParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FilterResult filterResult = new FilterResult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Content> contents = param.getContents(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Content> filterContents = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (Content content : contents) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ContentPoolEnum.autoArticlePoolLevel4.getContentPool().equals(content.getContentPoolType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && Objects.nonNull(content.getRootPublishTimestamp()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    && content.getRootPublishTimestamp() < DateUtils.getTodayStart() - filterOldStrategyDays * 86400000L) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                content.setFilterReason("冷启老文章过滤"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                filterContents.add(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result.add(content.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        filterResult.setContentIds(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        filterResult.setFilterContent(filterContents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return filterResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |