|
@@ -1,5 +1,7 @@
|
|
|
package com.tzld.piaoquan.ad.engine.service.feature;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.util.JSONUtils;
|
|
@@ -71,6 +73,7 @@ public class FeatureService {
|
|
|
protos.add(genWithMid("alg_mid_feature_share_tags", param.getMid()));
|
|
|
|
|
|
Map<String, String> featureMap = remoteService.getFeature(protos);
|
|
|
+ featureMap = this.featureStrCover(featureMap);
|
|
|
Feature feature = new Feature();
|
|
|
|
|
|
for (Map.Entry<String, String> entry : featureMap.entrySet()) {
|
|
@@ -202,4 +205,19 @@ 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 {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|