|
@@ -19,6 +19,7 @@ public class RuleParamHelper {
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
//避免空指异常及重复创建过多Obj
|
|
|
Map<String,Object> defaultMap=new HashMap<>();
|
|
|
+ final Double zeroDefaultValue=new Double(0);
|
|
|
public Double getGroupShareRate( Map<String, Object> abTestParam,Date nowDate,String midGroup){
|
|
|
String nowDt = dateFormat.format(nowDate);
|
|
|
String shareUserDataKey = (String) ((Map<String,Object>)
|
|
@@ -39,6 +40,9 @@ public class RuleParamHelper {
|
|
|
}
|
|
|
|
|
|
Double groupShareRate = redisHelper.zScore(groupShareRateKey, midGroup);
|
|
|
+ if(Objects.isNull(groupShareRate)){
|
|
|
+ groupShareRate=zeroDefaultValue;
|
|
|
+ }
|
|
|
return groupShareRate;
|
|
|
}
|
|
|
|
|
@@ -62,7 +66,9 @@ public class RuleParamHelper {
|
|
|
if (videoShareRate == null) {
|
|
|
videoShareRate = redisHelper.zScore(videoShareRateKey, -1+"");
|
|
|
}
|
|
|
-
|
|
|
+ if(Objects.isNull(videoShareRate)){
|
|
|
+ videoShareRate=zeroDefaultValue;
|
|
|
+ }
|
|
|
return videoShareRate;
|
|
|
}
|
|
|
|
|
@@ -85,9 +91,11 @@ public class RuleParamHelper {
|
|
|
String redisDt = dateFormat.format(yesterday);
|
|
|
groupOutRateKey = RuleRedisKeyConst.KEY_NAME_PREFIX_AD_GROUP + outUserDataKey + ":" + outUserRuleKey + ":" + redisDt;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- return redisHelper.zScore(groupOutRateKey, midGroup);
|
|
|
+ Double groupOutRate=redisHelper.zScore(groupOutRateKey, midGroup);
|
|
|
+ if(Objects.isNull(groupOutRate)){
|
|
|
+ groupOutRate=zeroDefaultValue;
|
|
|
+ }
|
|
|
+ return groupOutRate;
|
|
|
}
|
|
|
|
|
|
public Double getVideoOutRate(Map<String, Object> abTestParam,Date nowDate,Long videoId){
|
|
@@ -106,9 +114,12 @@ public class RuleParamHelper {
|
|
|
}
|
|
|
|
|
|
Double videoOutRate = redisHelper.zScore(videoOutRateKey, videoId.toString());
|
|
|
- if (videoOutRate == null) {
|
|
|
+ if (Objects.isNull(videoOutRate) ) {
|
|
|
videoOutRate = redisHelper.zScore(videoOutRateKey, -1+"");
|
|
|
}
|
|
|
+ if(Objects.isNull(videoOutRate)){
|
|
|
+ videoOutRate=zeroDefaultValue;
|
|
|
+ }
|
|
|
return videoOutRate;
|
|
|
}
|
|
|
|
|
@@ -122,7 +133,7 @@ public class RuleParamHelper {
|
|
|
) {
|
|
|
// Check if it is a care model experiment
|
|
|
// Map<String, Object> careModelStatusParam = (Map<String, Object>) abtestParam.get("care_model_status_param");
|
|
|
- Map<String, Object> careModelStatusParam = (Map<String, Object>) abtestParam.get("care_model_status_param");
|
|
|
+ Integer careModelStatusParam = (Integer) abtestParam.get("care_model_status_param");
|
|
|
List<String> careModelAbMidGroup = (List<String>) abtestParam.get("care_model_ab_mid_group");
|
|
|
|
|
|
String thresholdKeyNamePrefix;
|
|
@@ -134,7 +145,7 @@ public class RuleParamHelper {
|
|
|
if (careModelStatus == null || careModelAbMidGroup.isEmpty() || "null".equals(careModelStatus)) {
|
|
|
// Missing parameters, use default
|
|
|
thresholdKeyNamePrefix = RuleRedisKeyConst.KEY_NAME_PREFIX_AD_THRESHOLD;
|
|
|
- } else if (careModelStatus == (Long) careModelStatusParam.get("value") && careModelAbMidGroup.contains(midGroup)) {
|
|
|
+ } else if (careModelStatusParam.equals(careModelStatus.intValue()) && careModelAbMidGroup.contains(midGroup)) {
|
|
|
// Experiment matches, get the corresponding threshold
|
|
|
thresholdKeyNamePrefix = RuleRedisKeyConst.KEY_NAME_PREFIX_AD_THRESHOLD_CARE_MODEL;
|
|
|
} else {
|