| 
					
				 | 
			
			
				@@ -8,7 +8,6 @@ import com.tzld.piaoquan.recommend.server.model.MachineInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.model.Video; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.FeatureService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.rank.RankParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.piaoquan.recommend.server.service.rank.bo.UserSRBO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.rank.bo.UserShareReturnProfile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.rank.extractor.ExtractVideoMergeCate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.recommend.server.service.rank.tansform.FeatureV6; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -45,6 +44,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long currentMs = System.currentTimeMillis(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Set<Long> setVideo = new HashSet<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setVideo.add(param.getHeadVid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Video> rovRecallRank = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // -------------------5路特殊旧召回------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecallUtils.extractOldSpecialRecall(param, setVideo, rovRecallRank); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -68,6 +68,16 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecallUtils.extractRecall(mergeWeight.getOrDefault("headCate2Rov", 5.0).intValue(), param, HeadCate2RovRecallStrategy.PUSH_FROM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //-------------------city rovn------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecallUtils.extractRecall(mergeWeight.getOrDefault("cityRov", 5.0).intValue(), param, CityRovnRecallStrategy.PUSH_FROM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //-------------------priori province rovn------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceRov", 3.0).intValue(), param, PrioriProvinceRovnRecallStrategy.PUSH_FROM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //-------------------priori province str------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceStr", 1.0).intValue(), param, PrioriProvinceStrRecallStrategy.PUSH_FROM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //-------------------priori province ros------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecallUtils.extractRecall(mergeWeight.getOrDefault("prioriProvinceRos", 1.0).intValue(), param, PrioriProvinceRosRecallStrategy.PUSH_FROM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //-------------------return1 cate2 ros------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecallUtils.extractRecall(mergeWeight.getOrDefault("return1Cate2Ros", 5.0).intValue(), param, Return1Cate2RosRecallStrategy.PUSH_FORM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //-------------------return1 cate2 str------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RecallUtils.extractRecall(mergeWeight.getOrDefault("return1Cate2Str", 5.0).intValue(), param, Return1Cate2StrRecallStrategy.PUSH_FORM, setVideo, rovRecallRank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //-------------------排------------------- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //-------------------序------------------- 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -77,24 +87,24 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 1. 批量获取特征  省份参数要对齐  headvid  要传递过来! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // k1:视频、k2:表、k3:特征、v:特征值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, String> headVideoInfo = param.getHeadInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<String> vids = CommonCollectionUtils.toListDistinct(rovRecallRank, v -> String.valueOf(v.getVideoId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String headVid = String.valueOf(param.getHeadVid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo(headVid, vids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FeatureService.Feature feature = featureService.getFeatureV3(param, videoBaseInfoMap, vids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo("", vids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FeatureService.Feature feature = featureService.getFeatureV4(param, headVideoInfo, videoBaseInfoMap, vids); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Map<String, String>> featureOriginUser = feature.getUserFeature(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Map<String, Map<String, String>>> featureOriginVideo = feature.getVideoFeature(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, String> headVideoInfo = videoBaseInfoMap.getOrDefault(headVid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 2. 用户信息预处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Map<String, String[]>> newC7Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_sharecf", new HashMap<>())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Map<String, String[]>> newC8Map = FeatureV6.parseUCFScore(featureOriginUser.getOrDefault("alg_mid_feature_returncf", new HashMap<>())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         UserShareReturnProfile userProfile = parseUserProfile(featureOriginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Map<String, String>> userBehaviorVideoMap = getUserBehaviorVideoMap(userProfile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Map<String, String>> userBehaviorVideoMap = param.getBehaviorVideos(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, String> creativeInfo = param.getCreativeInfoFeature(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 3. 特征处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<RankItem> rankItems = CommonCollectionUtils.toList(rovRecallRank, RankItem::new); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Float> userFeatureMap = getUserFeature(currentMs, param, headVideoInfo, userProfile, featureOriginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        batchGetVideoFeature(currentMs, userProfile, headVideoInfo, videoBaseInfoMap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Float> userFeatureMap = getUserFeature(currentMs, param, creativeInfo, headVideoInfo, userProfile, featureOriginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        batchGetVideoFeature(currentMs, userProfile, creativeInfo, headVideoInfo, videoBaseInfoMap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 newC7Map, newC8Map, featureOriginUser, userBehaviorVideoMap, featureOriginVideo, rankItems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 4. 排序模型计算 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -118,6 +128,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             cate2Coefficient.putAll(simCateScore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Double cate2CoefficientDenominator = mergeWeight.getOrDefault("cate2CoefficientDenominator", 1d); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, String> regionMap = getUserRegion(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Video> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (RankItem item : items) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -166,6 +177,12 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (null != rtFeatureDumpsMap && !rtFeatureDumpsMap.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 video.getMetaFeatureMap().put("rt", rtFeatureDumpsMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (MapUtils.isNotEmpty(param.getCreativeInfoFeature())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                video.getMetaFeatureMap().put("creativeInfo", param.getCreativeInfoFeature()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (MapUtils.isNotEmpty(regionMap)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                video.getMetaFeatureMap().put("region", regionMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             result.add(video); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ExtractVideoMergeCate.addOtherParam(result, videoBaseInfoMap); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -190,42 +207,13 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private Map<String, Map<String, String>> getUserBehaviorVideoMap(UserShareReturnProfile userProfile) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Set<String> vidSet = new HashSet<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null != userProfile) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (List<UserSRBO> list : Arrays.asList(userProfile.getM_s_s(), userProfile.getM_r_s(), userProfile.getL_s_s(), userProfile.getL_r_s())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (null != list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (UserSRBO u : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (null != u) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            vidSet.add(u.getId() + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Map<String, String>> historyVideoMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!vidSet.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Map<String, Map<String, String>>> videoMap = featureService.getVideoBaseInfo("", new ArrayList<>(vidSet)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (null != videoMap && !videoMap.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (Map.Entry<String, Map<String, Map<String, String>>> entry : videoMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String vid = entry.getKey(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Map<String, Map<String, String>> map = entry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (null != map && map.containsKey("alg_vid_feature_basic_info")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        historyVideoMap.put(vid, map.get("alg_vid_feature_basic_info")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return historyVideoMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private Map<String, Float> getUserFeature(long currentMs, RankParam param, Map<String, String> headInfo, UserShareReturnProfile userProfile, Map<String, Map<String, String>> userOriginInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Map<String, Float> getUserFeature(long currentMs, RankParam param, Map<String, String> creativeInfo, Map<String, String> headInfo, UserShareReturnProfile userProfile, Map<String, Map<String, String>> userOriginInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Double> featMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // context feature 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String appType = String.valueOf(param.getAppType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String hotSceneType = String.valueOf(param.getHotSceneType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FeatureV6.getContextFeature(currentMs, appType, hotSceneType, featMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FeatureV6.getCreativeBaseFeature("e1", creativeInfo, featMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // head video feature 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FeatureV6.getVideoBaseFeature("h", currentMs, headInfo, featMap); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -240,6 +228,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Map<String, Float> getVideoFeature(long currentMs, String vid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                UserShareReturnProfile userProfile, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                               Map<String, String> creativeInfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                Map<String, String> headInfo, Map<String, String> rankInfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                Map<String, Map<String, String[]>> c7Map, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                Map<String, Map<String, String[]>> c8Map, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -259,6 +248,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // head&rank cross feature 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FeatureV6.getHeadRankVideoCrossFeature(headInfo, rankInfo, featMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FeatureV6.getCreativeCrossFeature("e1", creativeInfo, rankInfo, featMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // user profile & rank cross 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FeatureV6.getProfileVideoCrossFeature(currentMs, userProfile, rankInfo, historyVideoMap, featMap); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -268,6 +258,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void batchGetVideoFeature(long currentMs, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       UserShareReturnProfile userProfile, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      Map<String, String> creativeInfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       Map<String, String> headInfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       Map<String, Map<String, Map<String, String>>> videoBaseInfoMap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                       Map<String, Map<String, String[]>> c7Map, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -282,7 +273,7 @@ public class RankStrategy4RegionMergeModelV567 extends RankStrategy4RegionMergeM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 String vid = item.getVideoId() + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Map<String, String> rankInfo = videoBaseInfoMap.getOrDefault(vid, new HashMap<>()).getOrDefault("alg_vid_feature_basic_info", new HashMap<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Future<Integer> future = ThreadPoolFactory.defaultPool().submit(() -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.featureMap = getVideoFeature(currentMs, vid, userProfile, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.featureMap = getVideoFeature(currentMs, vid, userProfile, creativeInfo, headInfo, rankInfo, c7Map, c8Map, userOriginInfo, historyVideoMap, videoOriginInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.norFeatureMap = item.featureMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 |