|  | @@ -7,6 +7,7 @@ import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.ad.engine.commons.score.ScorerUtils;
 |  |  import com.tzld.piaoquan.ad.engine.commons.score.ScorerUtils;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.ad.engine.commons.thread.ThreadPoolFactory;
 |  |  import com.tzld.piaoquan.ad.engine.commons.thread.ThreadPoolFactory;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.ad.engine.commons.util.*;
 |  |  import com.tzld.piaoquan.ad.engine.commons.util.*;
 | 
											
												
													
														|  | 
 |  | +import com.tzld.piaoquan.ad.engine.service.entity.GuaranteeView;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.ad.engine.service.feature.Feature;
 |  |  import com.tzld.piaoquan.ad.engine.service.feature.Feature;
 | 
											
												
													
														|  |  import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
 |  |  import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
 | 
											
												
													
														|  |  import lombok.extern.slf4j.Slf4j;
 |  |  import lombok.extern.slf4j.Slf4j;
 | 
											
										
											
												
													
														|  | @@ -88,7 +89,7 @@ public class RankStrategyBy679 extends RankStrategyBasic {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
 |  |          Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
 | 
											
												
													
														|  |          long time1 = System.currentTimeMillis();
 |  |          long time1 = System.currentTimeMillis();
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Map<String, GuaranteeView> map = getGuaranteeViewMap(request, scoreParam);
 | 
											
												
													
														|  |          List<AdRankItem> adRankItems = new ArrayList<>();
 |  |          List<AdRankItem> adRankItems = new ArrayList<>();
 | 
											
												
													
														|  |          Random random = new Random();
 |  |          Random random = new Random();
 | 
											
												
													
														|  |          List<Future<AdRankItem>> futures = new ArrayList<>();
 |  |          List<Future<AdRankItem>> futures = new ArrayList<>();
 | 
											
										
											
												
													
														|  | @@ -112,7 +113,14 @@ public class RankStrategyBy679 extends RankStrategyBasic {
 | 
											
												
													
														|  |                          adRankItem.getExt().put("isApi", "1");
 |  |                          adRankItem.getExt().put("isApi", "1");
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |                      adRankItem.getExt().put("recallsources", dto.getRecallSources());
 |  |                      adRankItem.getExt().put("recallsources", dto.getRecallSources());
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (MapUtils.isNotEmpty(map)) {
 | 
											
												
													
														|  | 
 |  | +                        GuaranteeView guaranteeView = map.get(dto.getAdVerId());
 | 
											
												
													
														|  | 
 |  | +                        if (guaranteeView != null) {
 | 
											
												
													
														|  | 
 |  | +                            double guaranteeWeight = getGuaranteeWeight(guaranteeView);
 | 
											
												
													
														|  | 
 |  | +                            adRankItem.getExt().put("guaranteeView", guaranteeView.toString());
 | 
											
												
													
														|  | 
 |  | +                            adRankItem.getExt().put("guaranteeWeight", guaranteeWeight);
 | 
											
												
													
														|  | 
 |  | +                        }
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  |                      String cidStr = dto.getCreativeId().toString();
 |  |                      String cidStr = dto.getCreativeId().toString();
 | 
											
												
													
														|  |                      Map<String, String> cidFeatureMap = adRankItem.getFeatureMap();
 |  |                      Map<String, String> cidFeatureMap = adRankItem.getFeatureMap();
 | 
											
												
													
														|  |                      Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(cidStr, new HashMap<>());
 |  |                      Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(cidStr, new HashMap<>());
 | 
											
										
											
												
													
														|  | @@ -211,7 +219,18 @@ public class RankStrategyBy679 extends RankStrategyBasic {
 | 
											
												
													
														|  |          for (AdRankItem item : result) {
 |  |          for (AdRankItem item : result) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
 |  |              double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
 | 
											
												
													
														|  | -            item.setScore(item.getLrScore() * scoreCoefficient * item.getCpa());
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (scoreParam.getExpCodeSet().contains(guaranteeExp)) {
 | 
											
												
													
														|  | 
 |  | +                double guaranteeScoreCoefficient;
 | 
											
												
													
														|  | 
 |  | +                if (item.getExt().get("guaranteeWeight") == null) {
 | 
											
												
													
														|  | 
 |  | +                    guaranteeScoreCoefficient = 1.0;
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  | 
 |  | +                    guaranteeScoreCoefficient = Math.pow((double) item.getExt().get("guaranteeWeight"), alpha);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                item.setScore(item.getLrScore() * scoreCoefficient * item.getCpa() * guaranteeScoreCoefficient);
 | 
											
												
													
														|  | 
 |  | +                item.getScoreMap().put("guaranteeScoreCoefficient", guaranteeScoreCoefficient);
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +                item.setScore(item.getLrScore() * scoreCoefficient * item.getCpa());
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              item.getScoreMap().put("cpa", item.getCpa());
 |  |              item.getScoreMap().put("cpa", item.getCpa());
 | 
											
												
													
														|  |              item.getScoreMap().put("cpm", item.getCpm());
 |  |              item.getScoreMap().put("cpm", item.getCpm());
 |