| 
					
				 | 
			
			
				@@ -9,6 +9,8 @@ import com.tzld.piaoquan.recommend.server.repository.WxVideoTagRelRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.filter.FilterParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.filter.FilterStrategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.piaoquan.recommend.server.util.JSONUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.MapUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,13 +26,16 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @author dyp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class SecurityStrategy implements FilterStrategy { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Value("#{'${block.hotscenetype.list:}'.split(',')}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private Set<Integer> excludeScenes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Set<Long> excludeScenes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApolloJsonValue("${video.filter.city.tagid.json:{}}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Map<String, List<Long>> videoFilterCityTagIdMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Value("${securityAbExpCode:625}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String securityAbExpCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Value("${securityGlobalSwitch:false}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private boolean securityGlobalSwitch; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private WxVideoTagRelRepository wxVideoTagRelRepository; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -62,7 +67,8 @@ public class SecurityStrategy implements FilterStrategy { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (String cityCode : videoFilterCityTagIdMap.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            videoCache.getUnchecked(cityCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Set<Long> result = videoCache.getUnchecked(cityCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("SecurityStrategy result {}", JSONUtils.toJson(result)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,16 +81,20 @@ public class SecurityStrategy implements FilterStrategy { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(param.getVideoIds())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return param.getVideoIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 未命中实验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(param.getAbExpCodes()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                || !param.getAbExpCodes().contains(securityAbExpCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(param.getAbExpCodes())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return param.getVideoIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean hit = securityGlobalSwitch || param.getAbExpCodes().contains(securityAbExpCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!hit) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return param.getVideoIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isNotEmpty(excludeScenes) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 && param.getHotSceneType() != null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 && !excludeScenes.contains(param.getHotSceneType()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                && Objects.nonNull(videoFilterCityTagIdMap) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && MapUtils.isNotEmpty(videoFilterCityTagIdMap) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 && videoFilterCityTagIdMap.containsKey(param.getCityCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Set<Long> filterVideos = videoCache.getUnchecked(param.getCityCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (CollectionUtils.isEmpty(filterVideos)) { 
			 |