zhaohaipeng hai 1 mes
pai
achega
42239699e6

+ 26 - 22
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/FeatureService.java

@@ -389,28 +389,32 @@ public class FeatureService {
     private Feature getFeatureByProto(List<FeatureKeyProto> protos) {
         Map<String, String> result = remoteService.getFeature(protos);
         Feature feature = new Feature();
-        result.entrySet().forEach(e -> {
-            String[] uk = StringUtils.split(e.getKey(), ":");
-            String prefix = uk[0];
-            String table = uk[1];
-            Map<String, String> colMap = JSONUtils.fromJson(e.getValue(), new TypeToken<Map<String, String>>() {
-            }, Collections.emptyMap());
-
-            String featureStr = colMap.get("feature");
-            switch (prefix) {
-                case "v":
-                    String vid = uk[2];
-                    Map<String, Map<String, String>> tableFeatureMap = feature.getVideoFeature().getOrDefault(vid, new HashMap<>());
-                    tableFeatureMap.put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
-                    }, Collections.emptyMap()));
-                    feature.getVideoFeature().put(vid, tableFeatureMap);
-                    break;
-                case "u":
-                    feature.getUserFeature().put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
-                    }, Collections.emptyMap()));
-                    break;
-                default:
-                    break;
+        result.forEach((key, value) -> {
+            try {
+                String[] uk = StringUtils.split(key, ":");
+                String prefix = uk[0];
+                String table = uk[1];
+                Map<String, String> colMap = JSONUtils.fromJson(value, new TypeToken<Map<String, String>>() {
+                }, Collections.emptyMap());
+
+                String featureStr = colMap.get("feature");
+                switch (prefix) {
+                    case "v":
+                        String vid = uk[2];
+                        Map<String, Map<String, String>> tableFeatureMap = feature.getVideoFeature().getOrDefault(vid, new HashMap<>());
+                        tableFeatureMap.put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
+                        }, Collections.emptyMap()));
+                        feature.getVideoFeature().put(vid, tableFeatureMap);
+                        break;
+                    case "u":
+                        feature.getUserFeature().put(table, JSONUtils.fromJson(featureStr, new TypeToken<Map<String, String>>() {
+                        }, Collections.emptyMap()));
+                        break;
+                    default:
+                        break;
+                }
+            } catch (Exception e) {
+                log.error("getFeatureByProto error key {}", key, e);
             }
         });
         return feature;

+ 1 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/strategy/RankStrategy4RegionMergeModelV562.java

@@ -106,6 +106,7 @@ public class RankStrategy4RegionMergeModelV562 extends RankStrategy4RegionMergeM
         List<String> allVids = Stream.of(actVidSeq, netVidSeq, vids)
                 .flatMap(Collection::stream)
                 .distinct()
+                .filter(StringUtils::isNotBlank)
                 .collect(Collectors.toList());
 
         Map<String, Map<String, Map<String, String>>> videoBaseInfoMap = featureService.getVideoBaseInfo("", allVids);