| 
														
															@@ -66,45 +66,44 @@ public class RankStrategy4RegionMergeModelV569 extends RankService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //-------------------逻------------------- 
														 | 
														
														 | 
														
															         //-------------------逻------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //-------------------辑------------------- 
														 | 
														
														 | 
														
															         //-------------------辑------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------老地域相关召回------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> oldRovs = new ArrayList<>(); 
														 | 
														
														 | 
														
															         List<Video> oldRovs = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionHRecallStrategy.PUSH_FORM)); 
														 | 
														
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionHRecallStrategy.PUSH_FORM)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionHDupRecallStrategy.PUSH_FORM)); 
														 | 
														
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionHDupRecallStrategy.PUSH_FORM)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         oldRovs.addAll(extractAndSort(param, Region24HRecallStrategy.PUSH_FORM)); 
														 | 
														
														 | 
														
															         oldRovs.addAll(extractAndSort(param, Region24HRecallStrategy.PUSH_FORM)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionRelative24HRecallStrategy.PUSH_FORM)); 
														 | 
														
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionRelative24HRecallStrategy.PUSH_FORM)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionRelative24HDupRecallStrategy.PUSH_FORM)); 
														 | 
														
														 | 
														
															         oldRovs.addAll(extractAndSort(param, RegionRelative24HDupRecallStrategy.PUSH_FORM)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        int sizeReturn = param.getSize(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         removeDuplicate(oldRovs); 
														 | 
														
														 | 
														
															         removeDuplicate(oldRovs); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        int sizeReturn = param.getSize(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //-------------------老地域召回------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> v0 = oldRovs.size() <= sizeReturn 
														 | 
														
														 | 
														
															         List<Video> v0 = oldRovs.size() <= sizeReturn 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 ? oldRovs 
														 | 
														
														 | 
														
															                 ? oldRovs 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 : oldRovs.subList(0, sizeReturn); 
														 | 
														
														 | 
														
															                 : oldRovs.subList(0, sizeReturn); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------地域相关召回------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<Video> v2 = extractAndSort(param, RegionRealtimeRecallStrategyV2_sort.PUSH_FORM); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<Video> v3 = extractAndSort(param, RegionRealtimeRecallStrategyV3.PUSH_FORM); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------相关性召回------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> v5 = extractAndSort(param, SimHotVideoRecallStrategy.PUSH_FORM); 
														 | 
														
														 | 
														
															         List<Video> v5 = extractAndSort(param, SimHotVideoRecallStrategy.PUSH_FORM); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> v6 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM); 
														 | 
														
														 | 
														
															         List<Video> v6 = extractAndSort(param, ReturnVideoRecallStrategy.PUSH_FORM); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------节日扶持召回------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //-------------------新地域召回------------------ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<Video> v1 = extractAndSort(param, RegionRealtimeRecallStrategyV1.PUSH_FORM); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //-------------------节日特殊召回------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> v7 = extractAndSort(param, FestivalRecallStrategyV1.PUSH_FORM); 
														 | 
														
														 | 
														
															         List<Video> v7 = extractAndSort(param, FestivalRecallStrategyV1.PUSH_FORM); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------去重------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //-------------------基于title的tag召回------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<Video> v10 = extractAndSort(param, TitleTagRecallStrategyV1.PUSH_FORM); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Set<Long> setVideo = new HashSet<>(); 
														 | 
														
														 | 
														
															         Set<Long> setVideo = new HashSet<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.duplicate(setVideo, v3); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.duplicate(setVideo, v2); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.duplicate(setVideo, v1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.duplicate(setVideo, v0); 
														 | 
														
														 | 
														
															         this.duplicate(setVideo, v0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.duplicate(setVideo, v5); 
														 | 
														
														 | 
														
															         this.duplicate(setVideo, v5); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.duplicate(setVideo, v6); 
														 | 
														
														 | 
														
															         this.duplicate(setVideo, v6); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.duplicate(setVideo, v1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.duplicate(setVideo, v7); 
														 | 
														
														 | 
														
															         this.duplicate(setVideo, v7); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        //-------------------合并------------------- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.duplicate(setVideo, v10); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> rovRecallRank = new ArrayList<>(); 
														 | 
														
														 | 
														
															         List<Video> rovRecallRank = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         rovRecallRank.addAll(v0); 
														 | 
														
														 | 
														
															         rovRecallRank.addAll(v0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 10.0).intValue(), v1.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v2.subList(0, Math.min(mergeWeight.getOrDefault("v2", 25.0).intValue(), v2.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v3.subList(0, Math.min(mergeWeight.getOrDefault("v3", 10.0).intValue(), v3.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v5.subList(0, Math.min(mergeWeight.getOrDefault("v5", 10.0).intValue(), v5.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v6.subList(0, Math.min(mergeWeight.getOrDefault("v6", 10.0).intValue(), v6.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        rovRecallRank.addAll(v7.subList(0, Math.min(mergeWeight.getOrDefault("v7", 10.0).intValue(), v7.size()))); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        rovRecallRank.addAll(v5.subList(0, Math.min(mergeWeight.getOrDefault("v5", 5.0).intValue(), v5.size()))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        rovRecallRank.addAll(v6.subList(0, Math.min(mergeWeight.getOrDefault("v6", 5.0).intValue(), v6.size()))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        rovRecallRank.addAll(v1.subList(0, Math.min(mergeWeight.getOrDefault("v1", 5.0).intValue(), v1.size()))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        rovRecallRank.addAll(v7.subList(0, Math.min(mergeWeight.getOrDefault("v7", 5.0).intValue(), v7.size()))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        rovRecallRank.addAll(v10.subList(0, Math.min(mergeWeight.getOrDefault("v10", 6.0).intValue(), v10.size()))); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //-------------------排------------------- 
														 | 
														
														 | 
														
															         //-------------------排------------------- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //-------------------序------------------- 
														 | 
														
														 | 
														
															         //-------------------序------------------- 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -133,85 +132,38 @@ public class RankStrategy4RegionMergeModelV569 extends RankService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             cur = ExtractorUtils.subtractHours(cur, 1); 
														 | 
														
														 | 
														
															             cur = ExtractorUtils.subtractHours(cur, 1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for (RankItem item : items) { 
														 | 
														
														 | 
														
															         for (RankItem item : items) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Map<String, String> itemBasicMap = item.getItemBasicFeature(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Map<String, Map<String, Double>> itemRealMap = item.getItemRealTimeFeature(); 
														 | 
														
														 | 
														
															             Map<String, Map<String, Double>> itemRealMap = item.getItemRealTimeFeature(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> views = getStaticData(itemRealMap, datehours, "view_pv_list_1h"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> plays = getStaticData(itemRealMap, datehours, "play_pv_list_1h"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> shares = getStaticData(itemRealMap, datehours, "share_pv_list_1h"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> preturns = getStaticData(itemRealMap, datehours, "p_return_uv_list_1h"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<Double> views = getStaticData(itemRealMap, datehours, "view_uv_list_1h"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<Double> shares = getStaticData(itemRealMap, datehours, "share_uv_list_1h"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             List<Double> allreturns = getStaticData(itemRealMap, datehours, "return_uv_list_1h"); 
														 | 
														
														 | 
														
															             List<Double> allreturns = getStaticData(itemRealMap, datehours, "return_uv_list_1h"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> share2return = getRateData(preturns, shares, 1.0, 1000.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Double share2returnScore = calScoreWeightNoTimeDecay(share2return); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> view2return = getRateData(preturns, views, 1.0, 1000.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Double view2returnScore = calScoreWeightNoTimeDecay(view2return); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> view2play = getRateData(plays, views, 1.0, 1000.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Double view2playScore = calScoreWeightNoTimeDecay(view2play); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> play2share = getRateData(shares, plays, 1.0, 1000.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Double play2shareScore = calScoreWeightNoTimeDecay(play2share); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("share2returnScore", share2returnScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("view2returnScore", view2returnScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("view2playScore", view2playScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("play2shareScore", play2shareScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 全部回流的rov和ros 
														 | 
														
														 | 
														
															             // 全部回流的rov和ros 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            List<Double> share2allreturn = getRateData(allreturns, shares, 1.0, 10.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<Double> share2allreturn = getRateData(allreturns, shares, 0.0, 0.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Double share2allreturnScore = calScoreWeightNoTimeDecay(share2allreturn); 
														 | 
														
														 | 
														
															             Double share2allreturnScore = calScoreWeightNoTimeDecay(share2allreturn); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            item.scoresMap.put("share2allreturnScore", share2allreturnScore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             List<Double> view2allreturn = getRateData(allreturns, views, 0.0, 0.0); 
														 | 
														
														 | 
														
															             List<Double> view2allreturn = getRateData(allreturns, views, 0.0, 0.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Double view2allreturnScore = calScoreWeightNoTimeDecay(view2allreturn); 
														 | 
														
														 | 
														
															             Double view2allreturnScore = calScoreWeightNoTimeDecay(view2allreturn); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("share2allreturnScore", share2allreturnScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             item.scoresMap.put("view2allreturnScore", view2allreturnScore); 
														 | 
														
														 | 
														
															             item.scoresMap.put("view2allreturnScore", view2allreturnScore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															             // 全部回流 
														 | 
														
														 | 
														
															             // 全部回流 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Double allreturnsScore = calScoreWeightNoTimeDecay(allreturns); 
														 | 
														
														 | 
														
															             Double allreturnsScore = calScoreWeightNoTimeDecay(allreturns); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             item.scoresMap.put("allreturnsScore", allreturnsScore); 
														 | 
														
														 | 
														
															             item.scoresMap.put("allreturnsScore", allreturnsScore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            // 平台回流 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Double preturnsScore = calScoreWeightNoTimeDecay(preturns); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("preturnsScore", preturnsScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            // rov的趋势 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double trendScore = calTrendScore(view2return); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("trendScore", trendScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            // 新视频提取 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double newVideoScore = calNewVideoScore(itemBasicMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            item.scoresMap.put("newVideoScore", newVideoScore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 3 融合公式 
														 | 
														
														 | 
														
															         // 3 融合公式 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Video> result = new ArrayList<>(); 
														 | 
														
														 | 
														
															         List<Video> result = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double a = mergeWeight.getOrDefault("a", 0.1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double b = mergeWeight.getOrDefault("b", 0.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double c = mergeWeight.getOrDefault("c", 0.000001); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double d = mergeWeight.getOrDefault("d", 1.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double e = mergeWeight.getOrDefault("e", 1.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double f = mergeWeight.getOrDefault("f", 0.6); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double g = mergeWeight.getOrDefault("g", 2.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double h = mergeWeight.getOrDefault("h", 240.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double ifAdd = mergeWeight.getOrDefault("ifAdd", 1.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        double f = mergeWeight.getOrDefault("f", 0.1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        double g = mergeWeight.getOrDefault("g", 1.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for (RankItem item : items) { 
														 | 
														
														 | 
														
															         for (RankItem item : items) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double trendScore = item.scoresMap.getOrDefault("trendScore", 0.0) > 1E-8 ? 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    item.scoresMap.getOrDefault("trendScore", 0.0) : 0.0; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double newVideoScore = item.scoresMap.getOrDefault("newVideoScore", 0.0) > 1E-8 ? 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    item.scoresMap.getOrDefault("newVideoScore", 0.0) : 0.0; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double strScore = item.getScoreStr(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double rosScore = item.scoresMap.getOrDefault("share2returnScore", 0.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             double share2allreturnScore = item.scoresMap.getOrDefault("share2allreturnScore", 0.0); 
														 | 
														
														 | 
														
															             double share2allreturnScore = item.scoresMap.getOrDefault("share2allreturnScore", 0.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             double view2allreturnScore = item.scoresMap.getOrDefault("view2allreturnScore", 0.0); 
														 | 
														
														 | 
														
															             double view2allreturnScore = item.scoresMap.getOrDefault("view2allreturnScore", 0.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            double preturnsScore = Math.log(1 + item.scoresMap.getOrDefault("preturnsScore", 0.0)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             double score = 0.0; 
														 | 
														
														 | 
														
															             double score = 0.0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (ifAdd < 0.5) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                score = Math.pow(strScore, a) * Math.pow(rosScore, b) + c * preturnsScore + 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        (newVideoScore > 1E-8 ? d * trendScore * (e + newVideoScore) : 0.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                score = a * strScore + b * rosScore + c * preturnsScore + 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        (newVideoScore > 1E-8 ? d * trendScore * (e + newVideoScore) : 0.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             double allreturnsScore = item.scoresMap.getOrDefault("allreturnsScore", 0.0); 
														 | 
														
														 | 
														
															             double allreturnsScore = item.scoresMap.getOrDefault("allreturnsScore", 0.0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (allreturnsScore > h) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (allreturnsScore > 50) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 score += (f * share2allreturnScore + g * view2allreturnScore); 
														 | 
														
														 | 
														
															                 score += (f * share2allreturnScore + g * view2allreturnScore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                score += (f * share2allreturnScore + g * view2allreturnScore) * 0.01; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             Video video = item.getVideo(); 
														 | 
														
														 | 
														
															             Video video = item.getVideo(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             video.setScore(score); 
														 | 
														
														 | 
														
															             video.setScore(score); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -220,37 +172,10 @@ public class RankStrategy4RegionMergeModelV569 extends RankService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             video.setScoresMap(item.getScoresMap()); 
														 | 
														
														 | 
														
															             video.setScoresMap(item.getScoresMap()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             result.add(video); 
														 | 
														
														 | 
														
															             result.add(video); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Collections.sort(result, Comparator.comparingDouble(o -> -o.getSortScore())); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        result.sort(Comparator.comparingDouble(o -> -o.getSortScore())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return result; 
														 | 
														
														 | 
														
															         return result; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public double calNewVideoScore(Map<String, String> itemBasicMap) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double existenceDays = Double.valueOf(itemBasicMap.getOrDefault("existence_days", "30")); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (existenceDays > 5) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            return 0.0; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double score = 1.0 / (existenceDays + 10.0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return score; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public double calTrendScore(List<Double> data) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        double sum = 0.0; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        int size = data.size(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        for (int i = 0; i < size - 4; ++i) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            sum += data.get(i) - data.get(i + 4); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (sum * 10 > 0.6) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            sum = 0.6; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            sum = sum * 10; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (sum > 0) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            // 为了打断点 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            sum = sum; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return sum; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public Double calScoreWeightNoTimeDecay(List<Double> data) { 
														 | 
														
														 | 
														
															     public Double calScoreWeightNoTimeDecay(List<Double> data) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Double up = 0.0; 
														 | 
														
														 | 
														
															         Double up = 0.0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Double down = 0.0; 
														 | 
														
														 | 
														
															         Double down = 0.0; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -294,165 +219,18 @@ public class RankStrategy4RegionMergeModelV569 extends RankService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return result; 
														 | 
														
														 | 
														
															             return result; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        RedisStandaloneConfiguration redisSC = new RedisStandaloneConfiguration(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisSC.setPort(6379); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisSC.setPassword("Wqsd@2019"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisSC.setHostName("r-bp1pi8wyv6lzvgjy5z.redis.rds.aliyuncs.com"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        RedisConnectionFactory connectionFactory = new JedisConnectionFactory(redisSC); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        RedisTemplate<String, String> redisTemplate = new RedisTemplate<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisTemplate.setConnectionFactory(connectionFactory); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisTemplate.setDefaultSerializer(new StringRedisSerializer()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        redisTemplate.afterPropertiesSet(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 0: 场景特征处理 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> sceneFeatureMap = this.getSceneFeature(param); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 1: user特征处理 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> userFeatureMap = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (param.getMid() != null && !param.getMid().isEmpty()) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            String midKey = "user_info_4video_" + param.getMid(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            String userFeatureStr = redisTemplate.opsForValue().get(midKey); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (userFeatureStr != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                try { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    userFeatureMap = JSONUtils.fromJson(userFeatureStr, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            new TypeToken<Map<String, String>>() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            }, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            userFeatureMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } catch (Exception e) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    log.error(String.format("parse user json is wrong in {} with {}", this.CLASS_NAME, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        final Set<String> userFeatureSet = new HashSet<>(Arrays.asList( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "machineinfo_brand", "machineinfo_model", "machineinfo_platform", "machineinfo_system", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "u_1day_exp_cnt", "u_1day_click_cnt", "u_1day_share_cnt", "u_1day_return_cnt", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "u_3day_exp_cnt", "u_3day_click_cnt", "u_3day_share_cnt", "u_3day_return_cnt" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        )); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Iterator<Map.Entry<String, String>> iterator = userFeatureMap.entrySet().iterator(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        while (iterator.hasNext()) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            Map.Entry<String, String> entry = iterator.next(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (!userFeatureSet.contains(entry.getKey())) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                iterator.remove(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> f1 = RankExtractorUserFeature.getOriginFeature(userFeatureMap, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                new HashSet<String>(Arrays.asList( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        "machineinfo_brand", "machineinfo_model", "machineinfo_platform", "machineinfo_system" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                )) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        ); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> f2 = RankExtractorUserFeature.getUserRateFeature(userFeatureMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> f3 = RankExtractorUserFeature.cntFeatureChange(userFeatureMap, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                new HashSet<String>(Arrays.asList( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        "u_1day_exp_cnt", "u_1day_click_cnt", "u_1day_share_cnt", "u_1day_return_cnt", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        "u_3day_exp_cnt", "u_3day_click_cnt", "u_3day_share_cnt", "u_3day_return_cnt" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                )) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        ); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        f1.putAll(f2); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        f1.putAll(f3); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 2-1: item特征处理 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        final Set<String> itemFeatureSet = new HashSet<>(Arrays.asList( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "total_time", "play_count_total", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "i_1day_exp_cnt", "i_1day_click_cnt", "i_1day_share_cnt", "i_1day_return_cnt", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "i_3day_exp_cnt", "i_3day_click_cnt", "i_3day_share_cnt", "i_3day_return_cnt" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        )); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<RankItem> rankItems = CommonCollectionUtils.toList(videos, RankItem::new); 
														 | 
														
														 | 
														
															         List<RankItem> rankItems = CommonCollectionUtils.toList(videos, RankItem::new); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<Long> videoIds = CommonCollectionUtils.toListDistinct(videos, Video::getVideoId); 
														 | 
														
														 | 
														
															         List<Long> videoIds = CommonCollectionUtils.toListDistinct(videos, Video::getVideoId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> videoFeatureKeys = videoIds.stream().map(r -> "video_info_" + r) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                .collect(Collectors.toList()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> videoFeatures = redisTemplate.opsForValue().multiGet(videoFeatureKeys); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (videoFeatures != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            for (int i = 0; i < videoFeatures.size(); ++i) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                String vF = videoFeatures.get(i); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                Map<String, String> vfMap = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if (vF == null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    continue; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                try { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    vfMap = JSONUtils.fromJson(vF, new TypeToken<Map<String, String>>() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    }, vfMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Map<String, String> vfMapCopy = new HashMap<>(vfMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    rankItems.get(i).setItemBasicFeature(vfMapCopy); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Iterator<Map.Entry<String, String>> iteratorIn = vfMap.entrySet().iterator(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    while (iteratorIn.hasNext()) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        Map.Entry<String, String> entry = iteratorIn.next(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if (!itemFeatureSet.contains(entry.getKey())) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            iteratorIn.remove(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Map<String, String> f4 = RankExtractorItemFeature.getItemRateFeature(vfMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    Map<String, String> f5 = RankExtractorItemFeature.cntFeatureChange(vfMap, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            new HashSet<String>(Arrays.asList( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    "total_time", "play_count_total", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    "i_1day_exp_cnt", "i_1day_click_cnt", "i_1day_share_cnt", "i_1day_return_cnt", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                                    "i_3day_exp_cnt", "i_3day_click_cnt", "i_3day_share_cnt", "i_3day_return_cnt")) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    ); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    f4.putAll(f5); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    rankItems.get(i).setFeatureMap(f4); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } catch (Exception e) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    log.error(String.format("parse video json is wrong in {} with {}", this.CLASS_NAME, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        // 2-2: item 实时特征处理 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> rtFeaPartKey = new ArrayList<>(Arrays.asList("item_rt_fea_1day_partition", "item_rt_fea_1h_partition")); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> rtFeaPartKeyResult = this.redisTemplate.opsForValue().multiGet(rtFeaPartKey); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Calendar calendar = Calendar.getInstance(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String date = new SimpleDateFormat("yyyyMMdd").format(calendar.getTime()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String hour = new SimpleDateFormat("HH").format(calendar.getTime()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String rtFeaPart1day = date + hour; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String rtFeaPart1h = date + hour; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if (rtFeaPartKeyResult != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (rtFeaPartKeyResult.get(0) != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                rtFeaPart1day = rtFeaPartKeyResult.get(0); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if (rtFeaPartKeyResult.get(1) != null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                rtFeaPart1h = rtFeaPartKeyResult.get(1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> videoRtKeys1 = videoIds.stream().map(r -> "item_rt_fea_1day_" + r) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                .collect(Collectors.toList()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 2-2: item 实时特征处理 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<String> videoRtKeys2 = videoIds.stream().map(r -> "item_rt_fea_1h_" + r) 
														 | 
														
														 | 
														
															         List<String> videoRtKeys2 = videoIds.stream().map(r -> "item_rt_fea_1h_" + r) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 .collect(Collectors.toList()); 
														 | 
														
														 | 
														
															                 .collect(Collectors.toList()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        videoRtKeys1.addAll(videoRtKeys2); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<String> videoRtFeatures = this.redisTemplate.opsForValue().multiGet(videoRtKeys1); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<String> videoRtFeatures = this.redisTemplate.opsForValue().multiGet(videoRtKeys2); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (videoRtFeatures != null) { 
														 | 
														
														 | 
														
															         if (videoRtFeatures != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             int j = 0; 
														 | 
														
														 | 
														
															             int j = 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            for (RankItem item : rankItems) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                String vF = videoRtFeatures.get(j); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                ++j; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if (vF == null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    continue; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                Map<String, String> vfMap = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                Map<String, Map<String, Double>> vfMapNew = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                try { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    vfMap = JSONUtils.fromJson(vF, new TypeToken<Map<String, String>>() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    }, vfMap); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    for (Map.Entry<String, String> entry : vfMap.entrySet()) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        String value = entry.getValue(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        if (value == null) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            continue; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        String[] var1 = value.split(","); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        Map<String, Double> tmp = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        for (String var2 : var1) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            String[] var3 = var2.split(":"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                            tmp.put(var3[0], Double.valueOf(var3[1])); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        vfMapNew.put(entry.getKey(), tmp); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } catch (Exception e) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    log.error(String.format("parse video item_rt_fea_1day_ json is wrong in {} with {}", this.CLASS_NAME, e)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                Map<String, String> f8 = RankExtractorItemFeature.getItemRealtimeRate(vfMapNew, rtFeaPart1day); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                item.getFeatureMap().putAll(f8); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             for (RankItem item : rankItems) { 
														 | 
														
														 | 
														
															             for (RankItem item : rankItems) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 String vF = videoRtFeatures.get(j); 
														 | 
														
														 | 
														
															                 String vF = videoRtFeatures.get(j); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 ++j; 
														 | 
														
														 | 
														
															                 ++j; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -482,44 +260,10 @@ public class RankStrategy4RegionMergeModelV569 extends RankService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } catch (Exception e) { 
														 | 
														
														 | 
														
															                 } catch (Exception e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     log.error(String.format("parse video item_rt_fea_1h_ json is wrong in {} with {}", this.CLASS_NAME, e)); 
														 | 
														
														 | 
														
															                     log.error(String.format("parse video item_rt_fea_1h_ json is wrong in {} with {}", this.CLASS_NAME, e)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 } 
														 | 
														
														 | 
														
															                 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                Map<String, String> f8 = RankExtractorItemFeature.getItemRealtimeRate(vfMapNew, rtFeaPart1h); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                item.getFeatureMap().putAll(f8); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        List<RankItem> rovRecallScore = ScorerUtils.getScorerPipeline(ScorerUtils.BASE_CONF) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                .scoring(sceneFeatureMap, userFeatureMap, rankItems); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return rovRecallScore; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    private Map<String, String> getSceneFeature(RankParam param) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Map<String, String> sceneFeatureMap = new HashMap<>(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String provinceCn = param.getProvince(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        provinceCn = provinceCn.replaceAll("省$", ""); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        sceneFeatureMap.put("ctx_region", provinceCn); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String city = param.getCity(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if ("台北市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "高雄市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "台中市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "桃园市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "新北市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "台南市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "基隆市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "吉林市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "新竹市".equals(city) | 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                "嘉义市".equals(city) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        ) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            city = city.replaceAll("市$", ""); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        sceneFeatureMap.put("ctx_city", city); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Calendar calendar = Calendar.getInstance(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        sceneFeatureMap.put("ctx_week", (calendar.get(Calendar.DAY_OF_WEEK) + 6) % 7 + ""); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        sceneFeatureMap.put("ctx_hour", new SimpleDateFormat("HH").format(calendar.getTime())); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return sceneFeatureMap; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return rankItems; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 |