Просмотр исходного кода

Merge branch 'feature_20260622_zhaohaipeng_feature_optimize_adaptive' of algorithm/ad-engine into master

zhaohaipeng 4 недель назад
Родитель
Сommit
69cb3d5fbb

+ 31 - 26
ad-engine-server/src/test/java/com/tzld/piaoquan/ad/engine/service/FeatureServiceTest.java

@@ -1,26 +1,31 @@
-package com.tzld.piaoquan.ad.engine.service;
-
-import com.tzld.piaoquan.ad.engine.server.Application;
-import com.tzld.piaoquan.ad.engine.service.feature.FeatureService;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest(classes = Application.class)
-public class FeatureServiceTest {
-
-
-    @Autowired
-    private FeatureService featureService;
-
-    @Test
-    public void featureV3OptimizeTest() {
-
-        // List<FeatureKeyProto> protos = new ArrayList<>();
-        // protos.add(featureService.genWithKeyMap("o:%s:%s", "alg_videoid_feature", "10035427", ImmutableMap.of("videoid", "68781839")));
-
-        // System.out.println(featureService.invokeFeatureService(protos));
-    }
-
-
-}
+// package com.tzld.piaoquan.ad.engine.service;
+//
+// import com.google.common.collect.ImmutableMap;
+// import com.tzld.piaoquan.ad.engine.server.Application;
+// import com.tzld.piaoquan.ad.engine.service.feature.FeatureService;
+// 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(classes = Application.class)
+// public class FeatureServiceTest {
+//
+//
+//     @Autowired
+//     private FeatureService featureService;
+//
+//     @Test
+//     public void featureV3OptimizeTest() {
+//
+//         List<FeatureKeyProto> protos = new ArrayList<>();
+//         protos.add(featureService.genWithKeyMap("o:%s:%s", "alg_videoid_feature", "10035427", ImmutableMap.of("videoid", "68781839")));
+//         //
+//         System.out.println(featureService.invokeFeatureService(protos));
+//     }
+//
+//
+// }

+ 0 - 23
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/feature/FeatureService.java

@@ -22,9 +22,6 @@ import java.util.*;
 @Component
 public class FeatureService {
 
-    @Value("${feature.service.optimize.switch}")
-    private Boolean featureServiceOptimizeSwtich;
-
     @Autowired
     private FeatureV2RemoteService remoteService;
 
@@ -257,7 +254,6 @@ public class FeatureService {
             log.warn("invokeFeatureService: featureMap is null, return empty feature");
             return new Feature();
         }
-        featureMap = this.featureStrCover(featureMap);
 
         Feature feature = new Feature();
 
@@ -429,23 +425,4 @@ public class FeatureService {
                 .build();
     }
 
-    private Map<String, String> featureStrCover(Map<String, String> metaFeatureMap) {
-        Map<String, String> newFeatureMap = new HashMap<>();
-        for (Map.Entry<String, String> entry : metaFeatureMap.entrySet()) {
-            String key = entry.getKey();
-            try {
-                if (Boolean.TRUE.equals(featureServiceOptimizeSwtich)) {
-                    newFeatureMap.put(key, entry.getValue());
-                } else {
-                    Map<String, String> valueMap = JSONUtils.fromJson(entry.getValue(), new TypeToken<Map<String, String>>() {
-                    }, Collections.emptyMap());
-                    String value = valueMap.getOrDefault("feature", "{}");
-                    newFeatureMap.put(key, value);
-                }
-            } catch (Exception e) {
-                log.error("featureStrCover error: ", e);
-            }
-        }
-        return newFeatureMap;
-    }
 }

+ 1 - 0
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy851.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.ad.engine.service.score.strategy;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;