Ver código fonte

Merge branch 'feature_20240516_supeng_supply_ab_v2' of algorithm/recommend-server into master

qingqu-git 11 meses atrás
pai
commit
0b91d0e481

+ 5 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/common/base/Constant.java

@@ -19,4 +19,9 @@ public class Constant {
      * 供给流量池实验 648 random
      */
     public static final String SUPPLY_AB_CODE = "60600";
+    /**
+     * 供给流量池实验 648 random
+     */
+    public static final String SUPPLY_AB_CODE_ID= "648";
+
 }

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

@@ -346,7 +346,9 @@ public class RecommendService {
         // 流量池分发实验组划分
         int flowPoolIdChoice = flowPoolIds.get(RandomUtils.nextInt(0, flowPoolIds.size()));
         Map<String, List<Integer>> flowPoolConfig = flowPoolConfigService.getFlowPoolConfig();
-        if (Objects.equals(Constant.SUPPLY_AB_CODE, param.getAbCode())) {
+        Set<String> abExpCodes = param.getAbExpCodes();
+        if (Objects.nonNull(abExpCodes) && abExpCodes.contains(Constant.SUPPLY_AB_CODE_ID)) {
+//        if (Objects.equals(Constant.SUPPLY_AB_CODE, param.getAbCode())) {
             List<Integer> supplyFlowPoolIdList = flowPoolConfig.get(FlowPoolConstants.SUPPLY_FLOW_SET_LEVEL);
             if (Objects.nonNull(supplyFlowPoolIdList) && !supplyFlowPoolIdList.isEmpty()) {
                 flowPoolIdChoice = supplyFlowPoolIdList.get(0);
@@ -362,7 +364,6 @@ public class RecommendService {
                 }
             }
         }
-
         // @desc 新的流量池分发实验组划分,每个尾号不同策略分组。 @time 20240318 @author 张博
         int lastDigit = RandomUtils.nextInt(0, 10);
         param.setLastDigit(lastDigit);

+ 3 - 2
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/filter/FlowPoolWithLevelFilterService.java

@@ -44,12 +44,13 @@ public class FlowPoolWithLevelFilterService extends AbstractFilterService {
 
         Map<Long, Integer> distributeCountMap;
         //供给流量池实验
-        if (Objects.equals(Constant.SUPPLY_AB_CODE, param.getAbCode())) {
+        Set<String> abExpCodes = param.getAbExpCodes();
+        if (Objects.nonNull(abExpCodes) && abExpCodes.contains(Constant.SUPPLY_AB_CODE_ID)) {
+//        if (Objects.equals(Constant.SUPPLY_AB_CODE, param.getAbCode())) {
             distributeCountMap = flowPoolService.getSupplyDistributeCountWithLevel(flowPoolMap);
         } else {
             distributeCountMap = flowPoolService.getDistributeCountWithLevel(flowPoolMap);
         }
-
 //        Map<Long, Integer> distributeCountMap = flowPoolService.getDistributeCountWithLevel(flowPoolMap);
 
         List<Long> remainVideoIds = new ArrayList<>();

+ 0 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/flowpool/FlowPoolConstants.java

@@ -10,7 +10,6 @@ public class FlowPoolConstants {
 
     public static final String PUSH_FORM = "flow_pool";
     public static final String QUICK_PUSH_FORM = "quick_flow_pool";
-    public static final String SUPPLY_PUSH_FORM = "supply_flow_pool";
 
     public static final String KEY_WITH_LEVEL_FORMAT = "flow:pool:level:item:%s:%s";
     public static final String KEY_WITH_LEVEL_SUPPLY_FORMAT = "flow:pool:level:item:supply:%s:%s";

+ 1 - 8
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/RankService.java

@@ -347,14 +347,7 @@ public class RankService {
         if (CollectionUtils.isNotEmpty(quickFlowPoolVideos)) {
             return quickFlowPoolVideos;
         } else {
-//            return extractAndSort(param, FlowPoolConstants.PUSH_FORM);
-            //供给流量池 新增pushForm;由于供给流量池占比小,先判断 正常流量池
-            List<Video> flowPoolVideos = extractAndSort(param, FlowPoolConstants.PUSH_FORM);
-            if (CollectionUtils.isNotEmpty(flowPoolVideos)) {
-                return flowPoolVideos;
-            } else {
-                return extractAndSort(param, FlowPoolConstants.SUPPLY_PUSH_FORM);
-            }
+            return extractAndSort(param, FlowPoolConstants.PUSH_FORM);
         }
     }
 

+ 3 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/RecallService.java

@@ -172,7 +172,9 @@ public class RecallService implements ApplicationContextAware {
         }
         // 命中用户黑名单不走流量池
         if (!hitUserBlacklist || !isInBlacklist) {
-            if (Objects.equals(Constant.SUPPLY_AB_CODE, abCode)) {
+            Set<String> abExpCodes = param.getAbExpCodes();
+            if (Objects.nonNull(abExpCodes) && abExpCodes.contains(Constant.SUPPLY_AB_CODE_ID)) {
+//            if (Objects.equals(Constant.SUPPLY_AB_CODE, abCode)) {
                 // 供给流量池策略 648 实验 random
                 strategies.add(strategyMap.get(FlowPoolWithLevelSupplyRecallStrategy.class.getSimpleName()));
                 //2:通过“流量池标记”控制“流量池召回子策略” 其中有9组会走EXPERIMENTAL_FLOW_SET_LEVEL 有1组会走EXPERIMENTAL_FLOW_SET_LEVEL_SCORE

+ 1 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/strategy/FlowPoolWithLevelSupplyRecallStrategy.java

@@ -93,6 +93,6 @@ public class FlowPoolWithLevelSupplyRecallStrategy extends AbstractFlowPoolWithL
 
     @Override
     public String pushFrom() {
-        return FlowPoolConstants.SUPPLY_PUSH_FORM;
+        return FlowPoolConstants.PUSH_FORM;
     }
 }