| 
					
				 | 
			
			
				@@ -2,6 +2,7 @@ package com.tzld.piaoquan.ad.engine.service.score.strategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.piaoquan.ad.engine.commons.redis.AdRedisHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.commons.score.ScorerUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.commons.thread.ThreadPoolFactory; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.MapUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.xm.Similarity; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -59,6 +61,9 @@ public class RankStrategyBy688 extends RankStrategyBasic { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     Set<String> sparseFeatureSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private AdRedisHelper adRedisHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostConstruct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void afterInit() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.readBucketFile(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -158,18 +163,21 @@ public class RankStrategyBy688 extends RankStrategyBasic { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 userFeatureMap.put("root_source_channel", rootSourceChannel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> adVerIdList = request.getAdIdList().stream().map(AdPlatformCreativeDTO::getAdVerId).distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> values = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, GuaranteeView> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (int i = 0; i < adVerIdList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String value = values.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (value != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                GuaranteeView guaranteeView = JSONObject.parseObject(value, GuaranteeView.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                map.put(adVerIdList.get(i), guaranteeView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (scoreParam.getExpCodeSet().contains(guaranteeExp)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> adVerIdList = request.getAdIdList().stream().map(AdPlatformCreativeDTO::getAdVerId).distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> values = adRedisHelper.mget(adVerIdList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (CollectionUtils.isNotEmpty(values)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int i = 0; i < adVerIdList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String value = values.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (value != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        GuaranteeView guaranteeView = JSONObject.parseObject(value, GuaranteeView.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        map.put(adVerIdList.get(i), guaranteeView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long time1 = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -195,13 +203,13 @@ public class RankStrategyBy688 extends RankStrategyBasic { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         adRankItem.getExt().put("isApi", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    GuaranteeView guaranteeView = map.get(dto.getAdVerId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    double guaranteeWeight = getGuaranteeWeight(guaranteeView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     adRankItem.getExt().put("recallsources", dto.getRecallSources()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    adRankItem.getExt().put("alpha", alpha); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    adRankItem.getExt().put("guaranteeView", guaranteeView.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    adRankItem.getExt().put("guaranteeWeight", guaranteeWeight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (MapUtils.isNotEmpty(map)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        GuaranteeView guaranteeView = map.get(dto.getAdVerId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        double guaranteeWeight = getGuaranteeWeight(guaranteeView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        adRankItem.getExt().put("guaranteeView", guaranteeView.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        adRankItem.getExt().put("guaranteeWeight", guaranteeWeight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String cidStr = dto.getCreativeId().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Map<String, String> cidFeatureMap = adRankItem.getFeatureMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(cidStr, new HashMap<>()); 
			 |