Kaynağa Gözat

feat:特征服务优化适配

zhaohaipeng 1 hafta önce
ebeveyn
işleme
28648986e8

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

@@ -403,7 +403,7 @@ public class FeatureService {
         return feature.getUserFeature().getOrDefault("alg_recsys_user_social_recall_feature_day", new HashMap<>());
     }
 
-    public Feature getFeatureByProto(List<FeatureKeyProto> protos) {
+    private Feature getFeatureByProto(List<FeatureKeyProto> protos) {
         Map<String, String> result = remoteService.getFeature(protos);
         Feature feature = new Feature();
         result.forEach((key, value) -> {
@@ -504,7 +504,7 @@ public class FeatureService {
                 .build();
     }
 
-    public FeatureKeyProto genWithKeyMap(String table, String uniqKey, Map<String, String> map) {
+    private FeatureKeyProto genWithKeyMap(String table, String uniqKey, Map<String, String> map) {
         FeatureKeyProto.Builder builder = FeatureKeyProto.newBuilder()
                 .setUniqueKey(String.format(kvUkFormat, table, uniqKey))
                 .setTableName(table);

+ 4 - 9
recommend-server-service/src/test/java/com/tzld/piaoquan/recommend/server/service/FeatureServiceTest.java

@@ -1,14 +1,9 @@
 package com.tzld.piaoquan.recommend.server.service;
 
-import com.google.common.collect.ImmutableMap;
-import com.tzld.piaoquan.recommend.feature.model.feature.FeatureKeyProto;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
-import java.util.ArrayList;
-import java.util.List;
-
 @SpringBootTest
 public class FeatureServiceTest {
 
@@ -18,10 +13,10 @@ public class FeatureServiceTest {
     @Test
     public void featureV3OptimizeTest() {
 
-        List<FeatureKeyProto> protos = new ArrayList<>();
-        protos.add(featureService.genWithKeyMap("alg_videoid_feature", "10035427", ImmutableMap.of("videoid", "68781839")));
-
-        System.out.println(featureService.getFeatureByProto(protos));
+        // List<FeatureKeyProto> protos = new ArrayList<>();
+        // protos.add(featureService.genWithKeyMap("alg_videoid_feature", "10035427", ImmutableMap.of("videoid", "68781839")));
+        //
+        // System.out.println(featureService.getFeatureByProto(protos));
     }
 
 }