| 
					
				 | 
			
			
				@@ -145,14 +145,25 @@ 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(PidLambdaContainer.getPidLambda(item.getAdId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lambda=PidLambdaContainer.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(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -165,10 +176,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(PidLambdaContainer.getPidLambda(item.getAdId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                lambda=PidLambdaContainer.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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -198,6 +220,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()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -210,7 +233,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=adBidRank {}", JSONObject.toJSONString(object)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         object.remove("lrsamples"); 
			 |