Browse Source

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

zhaohaipeng 14 hours ago
parent
commit
678d5e2ac1

+ 13 - 9
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/predict/v2/UserLayerRootSessionIdPredict.java

@@ -10,10 +10,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Slf4j
 @Component
@@ -46,13 +43,20 @@ public class UserLayerRootSessionIdPredict extends BasicPredict {
             if (item.getAppType().contains(appType) && item.getTail().contains(tail)) {
                 Map<String, Object> returnMap = new HashMap<>();
                 double threshold;
-                String thresholdKey = userLayer + "_" + shareType;
-                if (item.getConfig().containsKey(thresholdKey)) {
-                    threshold = item.getConfig().getOrDefault(thresholdKey, 0.0);
-                } else {
-                    threshold = item.getConfig().getOrDefault("default_" + shareType, 0.0);
+                String thresholdKey = "";
+
+                // 生成可用的Key列表
+                List<String> keys = Arrays.asList(userLayer + "_" + shareType, "default_" + shareType, "default_threshold");
+                for (String key : keys) {
+                    if (item.getConfig().containsKey(key)) {
+                        thresholdKey = key;
+                        break;
+                    }
                 }
 
+
+                threshold = item.getConfig().getOrDefault(thresholdKey, 0.0);
+
                 if (score < threshold) {
                     returnMap.putAll(rtnAdPredict(ctx));
                     returnMap.put("model", "userLayerRootSessionIdTailModel");