Browse Source

feat:修改日志路径

zhaohaipeng 10 months ago
parent
commit
2fd739a6db

+ 5 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/log/impl/LogHubServiceImpl.java

@@ -12,6 +12,7 @@ import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
 import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRequestContext;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -71,6 +72,7 @@ public class LogHubServiceImpl implements LogHubService {
                     JSONObject json = new JSONObject();
                     json.put("cid", rankItem.getAdId());
                     json.put("score", rankItem.getScore());
+                    json.put("scoremap", rankItem.getScoreMap());
                     JSONObject featureJson = new JSONObject();
                     for (Map.Entry<String, String> entry : rankItem.getFeatureMap().entrySet()) {
                         if (FEATURE_FIELD_SET.contains(entry.getKey())) {
@@ -82,7 +84,9 @@ public class LogHubServiceImpl implements LogHubService {
                             featureJson.put(entry.getKey(), entry.getValue());
                         }
                     }
-                    json.put("feature", featureJson);
+                    if (MapUtils.isNotEmpty(featureJson)) {
+                        json.put("feature", featureJson);
+                    }
                     scoreResult.add(json);
                 }