|  | @@ -51,6 +51,13 @@ public class RankStrategyBy688 extends RankStrategyBasic {
 | 
	
		
			
				|  |  |      @ApolloJsonValue("${rank.score.weight.680:{}}")
 | 
	
		
			
				|  |  |      private Map<String, Double> weightMap;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 人群分层&创意的权重
 | 
	
		
			
				|  |  | +     * 格式:{layer_creativeId: weight}
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApolloJsonValue("${rank.score.weight.layer.and.creative:{}}")
 | 
	
		
			
				|  |  | +    private Map<String, Double> layerAndCreativeWeightMap;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApolloJsonValue("${rank.score.neg_sample_rate:0.01}")
 | 
	
		
			
				|  |  |      Double negSampleRate;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -298,6 +305,8 @@ public class RankStrategyBy688 extends RankStrategyBasic {
 | 
	
		
			
				|  |  |          // loop
 | 
	
		
			
				|  |  |          double cpmCoefficient = weightParam.getOrDefault("cpmCoefficient", 0.9);
 | 
	
		
			
				|  |  |          boolean isGuaranteeType = false;
 | 
	
		
			
				|  |  | +        // 查询人群分层信息
 | 
	
		
			
				|  |  | +        String peopleLayer = getUserLayerAfterHandle(request);
 | 
	
		
			
				|  |  |          for (AdRankItem item : result) {
 | 
	
		
			
				|  |  |              double bid = item.getCpa();
 | 
	
		
			
				|  |  |              if (scoreParam.getExpCodeSet().contains(correctCpaExp1) || scoreParam.getExpCodeSet().contains(correctCpaExp2)) {
 | 
	
	
		
			
				|  | @@ -309,9 +318,13 @@ public class RankStrategyBy688 extends RankStrategyBasic {
 | 
	
		
			
				|  |  |              if (isGuaranteedFlow && item.getExt().get("isGuaranteed") != null && (boolean) item.getExt().get("isGuaranteed")) {
 | 
	
		
			
				|  |  |                  isGuaranteeType = true;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String layerAndCreativeWeightMapKey = getLayerAndCreativeWeightMapKey(peopleLayer, String.valueOf(item.getAdId()));
 | 
	
		
			
				|  |  | +            // 人群分层&创意的权重
 | 
	
		
			
				|  |  | +            double layerAndCreativeWeight = getLayerAndCreativeWeight(layerAndCreativeWeightMapKey);
 | 
	
		
			
				|  |  |              double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
 | 
	
		
			
				|  |  |              double guaranteeScoreCoefficient = getGuaranteeScoreCoefficient(isGuaranteedFlow, item.getExt());
 | 
	
		
			
				|  |  | -            double score = item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient;
 | 
	
		
			
				|  |  | +            double score = item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight;
 | 
	
		
			
				|  |  |              item.getScoreMap().put("guaranteeScoreCoefficient", guaranteeScoreCoefficient);
 | 
	
		
			
				|  |  |              item.getScoreMap().put("cpa", item.getCpa());
 | 
	
		
			
				|  |  |              item.getScoreMap().put("cpm", item.getCpm());
 | 
	
	
		
			
				|  | @@ -346,6 +359,47 @@ public class RankStrategyBy688 extends RankStrategyBasic {
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取人群分层和创意的权重
 | 
	
		
			
				|  |  | +     * @param key
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private Double getLayerAndCreativeWeight(String key){
 | 
	
		
			
				|  |  | +        if (StringUtils.isBlank(key)) {
 | 
	
		
			
				|  |  | +            return 1d;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return layerAndCreativeWeightMap.getOrDefault(key, 1d);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取人群分层和创意的权重key
 | 
	
		
			
				|  |  | +     * @param layer
 | 
	
		
			
				|  |  | +     * @param creativeId
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private String getLayerAndCreativeWeightMapKey(String layer, String creativeId){
 | 
	
		
			
				|  |  | +        if ( StringUtils.isBlank(layer) || StringUtils.isBlank(creativeId)) {
 | 
	
		
			
				|  |  | +            return null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return layer + "_" + creativeId;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取处理后的人群分层
 | 
	
		
			
				|  |  | +     * @param request
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private String getUserLayerAfterHandle(RankRecommendRequestParam request){
 | 
	
		
			
				|  |  | +        Map<String, String> userLayer = this.getUserLayer(request.getMid());
 | 
	
		
			
				|  |  | +        String layer = userLayer.getOrDefault("layer", "无曝光");
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(layer) && layer.equals("已转化")) {
 | 
	
		
			
				|  |  | +            layer = "有转化";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return layer;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private void handleB1Feature(Map<String, String> b1Feature, Map<String, String> cidFeatureMap, String cid) {
 | 
	
		
			
				|  |  |          cidFeatureMap.put("cid_" + cid, "0.1");
 | 
	
		
			
				|  |  |          // if (StringUtils.isNotBlank(b1Feature.get("adid"))) {
 |