|  | @@ -88,7 +88,7 @@ public class RankServiceImpl implements RankService {
 | 
	
		
			
				|  |  |              item.setBid1(1d);
 | 
	
		
			
				|  |  |              item.setBid2(1d);
 | 
	
		
			
				|  |  |              item.setCpa(75d);
 | 
	
		
			
				|  |  | -            item.setPidLambda(PidLambdaContainer.getPidLambda(item.getAdId()));
 | 
	
		
			
				|  |  | +            item.setPidLambda(1d);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //兜底方案
 | 
	
	
		
			
				|  | @@ -270,14 +270,27 @@ public class RankServiceImpl implements RankService {
 | 
	
		
			
				|  |  |          if(!cache.isEmpty()){
 | 
	
		
			
				|  |  |              rankItems=new LinkedList<>(cache.values());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        double lambda=-1d;
 | 
	
		
			
				|  |  |          for(AdRankItem item:rankItems){
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  | +//                AdPlatformBidCreativeDTO dto=groupMap.get(item.getAdId()+"").get(0);
 | 
	
		
			
				|  |  |                  AdPlatformBidCreativeDTO dto=groupMap.get(item.getAdId()).get(0);
 | 
	
		
			
				|  |  |                  item.setBid1(dto.getBid1());
 | 
	
		
			
				|  |  |                  item.setBid2(dto.getBid2());
 | 
	
		
			
				|  |  | -                item.setCpa(dto.getCpa());
 | 
	
		
			
				|  |  | -                item.setPidLambda(PidLambdaV2Container.getPidLambda(item.getAdId()));
 | 
	
		
			
				|  |  | +                lambda=PidLambdaV2Container.getPidLambda(item.getAdId());
 | 
	
		
			
				|  |  | +                if(lambda<0){
 | 
	
		
			
				|  |  | +                    item.setCpa(dto.getCpa());
 | 
	
		
			
				|  |  | +                    item.setPidLambda(0.6);
 | 
	
		
			
				|  |  | +                }else {
 | 
	
		
			
				|  |  | +                    if(dto.getCpa()>1&&lambda<=1){
 | 
	
		
			
				|  |  | +                        lambda=2d;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    item.setCpa(lambda);
 | 
	
		
			
				|  |  | +                    item.setPidLambda(1d);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              }catch (Exception e){
 | 
	
		
			
				|  |  | +                log.error("rankItems info error itemId={}",item.getAdId());
 | 
	
		
			
				|  |  |                  e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -288,10 +301,21 @@ public class RankServiceImpl implements RankService {
 | 
	
		
			
				|  |  |                  AdRankItem item=new AdRankItem();
 | 
	
		
			
				|  |  |                  item.setBid1(dto.getBid1());
 | 
	
		
			
				|  |  |                  item.setBid2(dto.getBid2());
 | 
	
		
			
				|  |  | -                item.setCpa(dto.getCpa());
 | 
	
		
			
				|  |  |                  item.setAdId(dto.getCreativeId());
 | 
	
		
			
				|  |  |                  item.setItemFeature(new AdItemFeature());
 | 
	
		
			
				|  |  | -                item.setPidLambda(PidLambdaV2Container.getPidLambda(item.getAdId()));
 | 
	
		
			
				|  |  | +                lambda=PidLambdaV2Container.getPidLambda(item.getAdId());
 | 
	
		
			
				|  |  | +                if(lambda<0){
 | 
	
		
			
				|  |  | +                    item.setCpa(dto.getCpa());
 | 
	
		
			
				|  |  | +                    item.setPidLambda(0.6);
 | 
	
		
			
				|  |  | +                }else {
 | 
	
		
			
				|  |  | +                    if(dto.getCpa()>1&&lambda<=1){
 | 
	
		
			
				|  |  | +                        lambda=2d;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    item.setCpa(lambda);
 | 
	
		
			
				|  |  | +                    item.setPidLambda(1d);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +//                item.setCpa(dto.getCpa());
 | 
	
		
			
				|  |  | +//                item.setPidLambda(PidLambdaContainer.getPidLambda(item.getAdId()));
 | 
	
		
			
				|  |  |                  rankItems.add(item);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              rankResult=rankServiceThompson.rank(param, userAdFeature, rankItems,null);
 | 
	
	
		
			
				|  | @@ -320,6 +344,7 @@ public class RankServiceImpl implements RankService {
 | 
	
		
			
				|  |  |              realECpm=cpmMin/1000d;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          result.setEcpm2(realECpm);
 | 
	
		
			
				|  |  | +        AdPlatformBidCreativeDTO dto=groupMap.get(topItem.getAdId()).get(0);
 | 
	
		
			
				|  |  |          JSONObject object=new JSONObject();
 | 
	
		
			
				|  |  |          object.put("mid",request.getMid());
 | 
	
		
			
				|  |  |          object.put("adid",result.getCreativeId());
 | 
	
	
		
			
				|  | @@ -332,7 +357,8 @@ public class RankServiceImpl implements RankService {
 | 
	
		
			
				|  |  |          //临时加入供pid v2使用
 | 
	
		
			
				|  |  |          object.put("realECpm",realECpm);
 | 
	
		
			
				|  |  |          object.put("creativeId",result.getCreativeId());
 | 
	
		
			
				|  |  | -        object.put("cpa",topItem.getCpa());
 | 
	
		
			
				|  |  | +        //CPA还原
 | 
	
		
			
				|  |  | +        object.put("cpa",dto.getCpa());
 | 
	
		
			
				|  |  |          object.put("dataTime",currentTime.format(timeFormatter));
 | 
	
		
			
				|  |  |          log.info("svc=adBidRankNewPid {}", JSONObject.toJSONString(object));
 | 
	
		
			
				|  |  |          object.remove("lrsamples");
 |