|
@@ -8,6 +8,7 @@ import com.tzld.piaoquan.ad.engine.commons.enums.AppTypeEnum;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.redis.AlgorithmRedisHelper;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.util.DateUtils;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.util.JSONUtils;
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.util.TimerWatchUtil;
|
|
|
import com.tzld.piaoquan.ad.engine.service.predict.config.RoiModelConfig;
|
|
|
import com.tzld.piaoquan.ad.engine.service.predict.constant.RuleRedisKeyConst;
|
|
|
import com.tzld.piaoquan.ad.engine.service.predict.PredictModelService;
|
|
@@ -64,6 +65,10 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
private String withoutAdVideoIds;
|
|
|
|
|
|
public Map<String, Object> adPredict(ThresholdPredictModelRequestParam requestParam) {
|
|
|
+ long startTime=System.currentTimeMillis();
|
|
|
+ String methodName="adPredictNew";
|
|
|
+ int step=1;
|
|
|
+
|
|
|
String[] withoutAdVideoIdsArr=withoutAdVideoIds.split(",");
|
|
|
for(String videoId:withoutAdVideoIdsArr){
|
|
|
if(videoId.equals(requestParam.getVideoId()+"")){
|
|
@@ -79,6 +84,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
//先判断是否开启实验 和是否不出广告时间 而后判断默认0-8
|
|
|
//不出广告时间判定
|
|
|
Map<String,Object> result=new HashMap<>();
|
|
@@ -98,6 +104,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
isHit = true;
|
|
|
}
|
|
|
}
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
int hourOfDay= DateUtils.getCurrentHour();
|
|
|
Boolean condition1=abTestConfigContainer.inAdTimeTest(requestParam.getAbExpInfo());
|
|
|
Boolean condition2=abTestConfigContainer.containsCode(configMap,requestParam.getAbTestCode());
|
|
@@ -117,7 +124,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
result.put("no_ad_strategy", "no_ad_time_with_fixed_time");
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
//人群选择算法判定-570
|
|
|
// try {
|
|
|
// JSONObject object = requestParam.getAbExpInfo();
|
|
@@ -138,7 +145,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
// } catch (Exception e) {
|
|
|
// log.error("adPredict hit error", e);
|
|
|
// }
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
String[] abParamArr = abConfig.getAbParams(requestParam.getAbTestCode(), requestParam.getAbExpInfo());
|
|
|
if (abParamArr == null) {
|
|
|
result.put("msg", "abConfig_error");
|
|
@@ -162,7 +169,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
//市-中文
|
|
|
requestParam.setRegion(requestParam.getRegion().replace("省", ""));
|
|
|
requestParam.setCity(requestParam.getCity().replace("市", ""));
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
// Determine the group to which mid belongs
|
|
|
String groupClassKey = (String) abtestParam.get("group_class_key");
|
|
|
String midGroupKeyName = RuleRedisKeyConst.KEY_NAME_PREFIX_MID_GROUP + groupClassKey + ":" + requestParam.getMid();
|
|
@@ -173,7 +180,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
midGroup = "mean_group";
|
|
|
shareType="noShare";
|
|
|
}
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
String[] noAdMidGroupList = new String[0];
|
|
|
noAdMidGroupList = ((JSONArray) abtestParam.get("no_ad_mid_group_list")).toArray(noAdMidGroupList);
|
|
|
|
|
@@ -192,7 +199,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
result.put("no_ad_strategy", "no_ad_mid_group_with_video");
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
//top1广告不出视频
|
|
|
Map<String, List<String>> noAdGroupWithVideoMapping = (Map) abtestParam.getOrDefault("no_ad_group_with_video_mapping", new HashMap<>());
|
|
|
if (noAdGroupWithVideoMapping.keySet().contains(midGroup)
|
|
@@ -204,7 +211,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
result.put("no_ad_strategy", "no_ad_mid_group_with_video");
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
//设置信息
|
|
|
ThresholdPredictModelParam modelParam = ThresholdPredictModelParam.builder()
|
|
|
.build();
|
|
@@ -238,6 +245,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
getThresholdPredictModel(thresholdMixFunc.toString())
|
|
|
.predict(modelParam);
|
|
|
}
|
|
|
+ TimerWatchUtil.printCost(methodName,step++,startTime);
|
|
|
return result;
|
|
|
}
|
|
|
|