|
@@ -3,12 +3,9 @@ package com.tzld.piaoquan.ad.engine.service.predict.impl;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
-import com.google.common.reflect.TypeToken;
|
|
|
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;
|
|
@@ -89,6 +86,7 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
//该用户所有实验合集
|
|
|
Set<String> expCodes=new HashSet<>();
|
|
|
boolean isHit = false;
|
|
|
+// String randomModelExpCode=null;
|
|
|
for(Map<String,Object> map:mapList){
|
|
|
String expCode=map.getOrDefault("abExpCode","").toString();
|
|
|
expCodes.add(expCode);
|
|
@@ -99,6 +97,9 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
if (StringUtils.equals(expCode, adPredictBreakExpCode)) {
|
|
|
isHit = true;
|
|
|
}
|
|
|
+// if(ExpCodeEnum.EXP_599.getCode().equals(expCode)||ExpCodeEnum.EXP_600.getCode().equals(expCode)){
|
|
|
+// randomModelExpCode=expCode;
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
int hourOfDay= DateUtils.getCurrentHour();
|
|
@@ -121,27 +122,6 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- //人群选择算法判定-570
|
|
|
-// try {
|
|
|
-// JSONObject object = requestParam.getAbExpInfo();
|
|
|
-// if (object != null) {
|
|
|
-// JSONArray array = object.getJSONArray("ab_test002");
|
|
|
-// if (array != null) {
|
|
|
-// List<Map<String, String>> abExps = JSONUtils.fromJson(array.toJSONString(),
|
|
|
-// new TypeToken<List<Map<String, String>>>() {
|
|
|
-// }, Collections.emptyList());
|
|
|
-// for (Map<String, String> abExpMap : abExps) {
|
|
|
-// if (StringUtils.equals(abExpMap.get("abExpCode"), adPredictBreakExpCode)) {
|
|
|
-// isHit = true;
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error("adPredict hit error", e);
|
|
|
-// }
|
|
|
-
|
|
|
String[] abParamArr = abConfig.getAbParams(requestParam.getAbTestCode(), requestParam.getAbExpInfo());
|
|
|
if (abParamArr == null) {
|
|
|
result.put("msg", "abConfig_error");
|
|
@@ -220,7 +200,19 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
modelParam.setExtraParam(new HashMap<>());
|
|
|
modelParam.addUserExtraFuture("shareType",shareType);
|
|
|
setExtraParam(modelParam);
|
|
|
- if(expCodes.contains("599")){
|
|
|
+ if(expCodes.contains("602")){
|
|
|
+ String userEngineFuture=redisHelper.getString(RuleRedisKeyConst.AD_ENGINE_USER_FUTURE_KEY+requestParam.getMid());
|
|
|
+ if(userEngineFuture!=null){
|
|
|
+ modelParam.addAllIntoUserExtraFuture(JSONObject.parseObject(userEngineFuture,Map.class));
|
|
|
+ }else {
|
|
|
+ modelParam.addUserExtraFuture("30rp","0");
|
|
|
+ }
|
|
|
+ result = ThresholdModelContainer.
|
|
|
+ getThresholdPredictModel("random602")
|
|
|
+ .predict(modelParam);
|
|
|
+ } else if(expCodes.contains("599")){
|
|
|
+// if(randomModelExpCode!=null){
|
|
|
+// modelParam.addUserExtraFuture("randomModelKey",ExpCodeEnum.valueOfExpCode(randomModelExpCode).getRandomModelKey());
|
|
|
result = ThresholdModelContainer.
|
|
|
getThresholdPredictModel("random")
|
|
|
.predict(modelParam);
|
|
@@ -298,4 +290,5 @@ public class PredictModelServiceImpl implements PredictModelService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|