| 
					
				 | 
			
			
				@@ -1,11 +1,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.tzld.piaoquan.ad.engine.service.predict.model.threshold; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.piaoquan.ad.engine.commons.redis.AlgorithmRedisHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.commons.score.AdConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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.util.CommonCollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.piaoquan.ad.engine.service.predict.param.RuleParamHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.service.predict.param.ThresholdPredictModelParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.ad.engine.service.remote.FeatureRemoteService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,10 +61,15 @@ public class ScoreV2ThresholdPredictModel extends ThresholdPredictModel { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         scoreParam.setRequestContext(context); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         scoreParam.getRequestContext().setRegion(modelParam.getRegion().replace("省", "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         scoreParam.getRequestContext().setCity(modelParam.getCity().replace("市", "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        scoreParam.setVideoId(modelParam.getVideoId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        scoreParam.setMid(modelParam.getMid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        scoreParam.setUid(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        scoreParam.setProvince(modelParam.getRegion()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        scoreParam.setCity(modelParam.getCity()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<AdRankItem> scoreResult = ScorerUtils 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .getScorerPipeline("feeds_score_config_break") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .getScorerPipeline("feeds_score_config_break.conf") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .scoring(scoreParam, userAdFeature, rankItems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 找出ctr*cvr最大的 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -82,7 +85,7 @@ public class ScoreV2ThresholdPredictModel extends ThresholdPredictModel { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int adPredict; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (maxItem.getScore() < threshold) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (maxItem != null && maxItem.getScore() < threshold) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // If final score is below threshold, show the ad 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             adPredict = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -90,6 +93,7 @@ public class ScoreV2ThresholdPredictModel extends ThresholdPredictModel { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             adPredict = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put("score", maxItem == null ? -1 : maxItem.getScore()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.put("ad_predict", adPredict); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |