Commit 242e5786 authored by mxx's avatar mxx

正负反馈

parent dd6c5ed6
...@@ -13,59 +13,62 @@ public class BlackWhiteNameListRule { ...@@ -13,59 +13,62 @@ public class BlackWhiteNameListRule {
CostConvertInfo costConvertInfo=infoList.get(i); CostConvertInfo costConvertInfo=infoList.get(i);
String type = costConvertInfo.type; String type = costConvertInfo.type;
String tag = costConvertInfo.tag; String tag = costConvertInfo.tag;
String key = costConvertInfo.appId + "_" + costConvertInfo.slotId + "_" + costConvertInfo.activityId + "_" + costConvertInfo.orientationId + "_" + costConvertInfo.advertId; Integer grained = costConvertInfo.grained;
String whiteBlackKey = costConvertInfo.appId + "_" + costConvertInfo.slotId + "_" + costConvertInfo.activityId + "_" + costConvertInfo.orientationId + "_" + costConvertInfo.advertId;
String fuseKey = costConvertInfo.orientationId + "_" + costConvertInfo.advertId;
Float costConvertAd = costConvertInfo.adCostConvert; //某广告的全局成本 为空会默认成0 所以条件要>0
long luanch_cnt = costConvertInfo.launchCnt; //某广告的全局成本 if (type.equals("day") && tag.equals("2") && grained==1 && costConvertAd>0) {
Float costConvertAd = costConvertInfo.adCostConvert; //某广告的全局成本 long luanch_cnt = costConvertInfo.launchCnt;
Long costKey1dZ = costConvertInfo.cost;
if (type == "hour" && tag == "all" && luanch_cnt>5) { Long convertKey1dZ = costConvertInfo.convert;
if (convertKey1dZ==0 && costKey1dZ>1000) {
nameListMap.put(fuseKey, "fuse_1");
}
else if (convertKey1dZ>0) {
Long costConvertKey1dZ = costKey1dZ / convertKey1dZ;
Float diffR1dZ = costConvertKey1dZ / costConvertAd;
if (diffR1dZ >= 3) {
nameListMap.put(fuseKey, "fuse_1");
}
}
} else if (type.equals("hour") && tag.equals("2") && grained==0 && costConvertAd>0) {
long luanch_cnt = costConvertInfo.launchCnt;
Long costKey1h = costConvertInfo.cost; Long costKey1h = costConvertInfo.cost;
Long convertKey1h = costConvertInfo.convert; Long convertKey1h = costConvertInfo.convert;
if (convertKey1h==0 && costKey1h>1.5*costConvertAd) { if (convertKey1h==0 && costKey1h>1000) {
nameListMap.put(key, "b3_1"); nameListMap.put(whiteBlackKey, "b3_1");
} }
else if (convertKey1h>0) { else if (convertKey1h>0) {
Long costConvertKey1h = costKey1h / convertKey1h; Long costConvertKey1h = costKey1h / convertKey1h;
Float diffR1h = costConvertKey1h / costConvertAd; Float diffR1h = costConvertKey1h / costConvertAd;
if (diffR1h >= 1.5) { if (diffR1h >= 2) {
nameListMap.put(key, "b3_1"); nameListMap.put(whiteBlackKey, "b3_1");
} }
} }
} else if (type == "day" && tag == "all" && luanch_cnt>10) { } else if (type.equals("day") && tag.equals("2") && grained==0 && costConvertAd>0) {
long luanch_cnt = costConvertInfo.launchCnt;
Long costKey1d = costConvertInfo.cost; Long costKey1d = costConvertInfo.cost;
Long convertKey1d = costConvertInfo.convert; Long convertKey1d = costConvertInfo.convert;
if (convertKey1d==0 && costKey1d>2.5*costConvertAd && costKey1d<=3.5*costConvertAd) { if (convertKey1d==0 && costKey1d>5000) {
nameListMap.put(key, "b1_5"); nameListMap.put(whiteBlackKey, "b1_5");
} }
else if (convertKey1d==0 && costKey1d>2*costConvertAd && costKey1d<=2.5*costConvertAd) { else if (convertKey1d==0 && costKey1d>1000) {
nameListMap.put(key, "b2_3"); nameListMap.put(whiteBlackKey, "b2_3");
} }
else if (convertKey1d>0) { else if (convertKey1d>0) {
Long costConvertKey1d = costKey1d / convertKey1d; Long costConvertKey1d = costKey1d / convertKey1d;
Float diffR1d = (costConvertKey1d - costConvertAd) / costConvertAd; Float diffR1d = costConvertKey1d/ costConvertAd;
if (diffR1d > 2.5 && diffR1d <= 3.5) { if (diffR1d > 2.5 && diffR1d <= 3.5) {
nameListMap.put(key, "b1_5"); nameListMap.put(whiteBlackKey, "b1_5");
} else if (diffR1d >= 2 && diffR1d < 2.5) { } else if (diffR1d >= 1.5 && diffR1d < 2.5) {
nameListMap.put(key, "b2_3"); nameListMap.put(whiteBlackKey, "b2_3");
} else if (diffR1d < 0.5) { } else if (diffR1d < 0.5) {
nameListMap.put(key, "w_1"); nameListMap.put(whiteBlackKey, "w_1");
} }
} }
} else if (tag == "2" && luanch_cnt>10) {
Long costKey1hZ = costConvertInfo.cost;
Long convertKey1hZ = costConvertInfo.convert;
if (convertKey1hZ==0 && costKey1hZ>3.5*costConvertAd) {
nameListMap.put(key, "fuse_1");
}
else if (convertKey1hZ>0) {
Long costConvertKey1hZ = costKey1hZ / convertKey1hZ;
Float diffR1hZ = costConvertKey1hZ / costConvertAd;
if (diffR1hZ >= 3.5 && costKey1hZ>100) {
nameListMap.put(key, "fuse_1");
}
}
} }
} }
return nameListMap; return nameListMap;
......
...@@ -8,15 +8,16 @@ public class CostConvertInfo { ...@@ -8,15 +8,16 @@ public class CostConvertInfo {
String advertId; String advertId;
String type; //type=hour:表示小时数据, day :表示1天粒度的指标数据 String type; //type=hour:表示小时数据, day :表示1天粒度的指标数据
String tag;//tag=all :表示所有广告,2:表示走智能匹配的广告 String tag;//tag=all :表示所有广告,2:表示走智能匹配的广告
Long cost; Integer grained; // 0:最细粒度 1:广告配置粒度
Long convert; Long cost; //最细粒度消耗
Long launchCnt; Long convert; //最细粒度转化
Long launchCnt; //最细粒度发券量
Float adCostConvert;//每个广告配置全局成本,读离线数据获取 Float adCostConvert;//每个广告配置全局成本,读离线数据获取
public CostConvertInfo() { public CostConvertInfo() {
} }
public CostConvertInfo(String appId, String slotId, String activityId, String orientationId, String advertId, String type, String tag, Long cost, Long convert, Long launchCnt, Float adCostConvert) { public CostConvertInfo(String appId, String slotId, String activityId, String orientationId, String advertId, String type, String tag, Integer grained, Long cost, Long convert, Long launchCnt, Float adCostConvert) {
this.appId = appId; this.appId = appId;
this.slotId = slotId; this.slotId = slotId;
this.activityId = activityId; this.activityId = activityId;
...@@ -24,6 +25,7 @@ public class CostConvertInfo { ...@@ -24,6 +25,7 @@ public class CostConvertInfo {
this.advertId = advertId; this.advertId = advertId;
this.type = type; this.type = type;
this.tag = tag; this.tag = tag;
this.grained = grained;
this.cost = cost; this.cost = cost;
this.convert = convert; this.convert = convert;
this.launchCnt = launchCnt; this.launchCnt = launchCnt;
...@@ -86,6 +88,14 @@ public class CostConvertInfo { ...@@ -86,6 +88,14 @@ public class CostConvertInfo {
this.tag = tag; this.tag = tag;
} }
public Integer getGrained() {
return grained;
}
public void setGrained(Integer grained) {
this.grained = grained;
}
public Long getCost() { public Long getCost() {
return cost; return cost;
} }
......
...@@ -9,31 +9,16 @@ public class Test { ...@@ -9,31 +9,16 @@ public class Test {
public static void main(String[] args) { public static void main(String[] args) {
CostConvertInfo costConvertInfo1= new CostConvertInfo( CostConvertInfo costConvertInfo1= new CostConvertInfo(
"46360", "185086", "5255", "27192", "18938", "44474", "8675", "7403", "0", "31320",
"day", "all", 11760L, 0L, 140L,4886.129F "hour", "2",0, 1020L, 0L,
37L,69.37984F
); );
CostConvertInfo costConvertInfo2= new CostConvertInfo(
"24504", "3440", "246", "33166", "17080",
"day", "all", 11191L, 5L, 450L,1789.415F
CostConvertInfo costConvertInfo2= new CostConvertInfo(
"11111", "22222", "5255", "27192", "30886",
"day", "2",1, 2680L, 0L,
88888L,1677.3059F
); );
//
// CostConvertInfo costConvertInfo3= new CostConvertInfo(
// "28168", "1497", "6976", "42337", "28525",
// "day", "all", 25L, 2L, 100L,26.0F
//
// );
// CostConvertInfo costConvertInfo4= new CostConvertInfo(
// "40548", "6244", "5538", "42579", "28629",
// "day", "all", 20L, 8L,22L, 259.0F
//
// );
// CostConvertInfo costConvertInfo5= new CostConvertInfo(
// "23898", "8888", "6826", "42337", "28525",
// "day", "2", 28275L, 64L,300L, 1.0F
//
// );
List infoList = new ArrayList(); List infoList = new ArrayList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment