|
@@ -18,8 +18,6 @@ import org.springframework.stereotype.Component;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import static com.tzld.piaoquan.ad.engine.commons.score.model.ThompsonSamplingModel.alpha;
|
|
|
|
-
|
|
|
|
@Component
|
|
@Component
|
|
public class VideoAdThompsonScorerV2 {
|
|
public class VideoAdThompsonScorerV2 {
|
|
Logger log = LoggerFactory.getLogger(VideoAdThompsonScorerV2.class);
|
|
Logger log = LoggerFactory.getLogger(VideoAdThompsonScorerV2.class);
|
|
@@ -561,23 +559,26 @@ public class VideoAdThompsonScorerV2 {
|
|
public List<AdRankItem> thompsonScorerByExp672(ScoreParam param, List<AdPlatformCreativeDTO> adIdList) {
|
|
public List<AdRankItem> thompsonScorerByExp672(ScoreParam param, List<AdPlatformCreativeDTO> adIdList) {
|
|
String cidRedisKey = exp672Param.getOrDefault("cidActionRedisKey", redisCidActionKeyV1);
|
|
String cidRedisKey = exp672Param.getOrDefault("cidActionRedisKey", redisCidActionKeyV1);
|
|
String vidCidRedisKey = exp672Param.getOrDefault("vidCidActionRedisKey", redisCidVidActionKeyV1);
|
|
String vidCidRedisKey = exp672Param.getOrDefault("vidCidActionRedisKey", redisCidVidActionKeyV1);
|
|
- double viewThreshold = Double.parseDouble(exp672Param.getOrDefault("viewThreshold", "7000"));
|
|
|
|
|
|
|
|
|
|
|
|
Map<Long, CreativeStatistic> paramCidRedisCache = this.batchFindCreativeRedisCache(cidRedisKey, adIdList);
|
|
Map<Long, CreativeStatistic> paramCidRedisCache = this.batchFindCreativeRedisCache(cidRedisKey, adIdList);
|
|
Map<Long, CreativeStatistic> paramVidCidRedisCache = this.batchFindCreativeRedisCache(vidCidRedisKey, adIdList);
|
|
Map<Long, CreativeStatistic> paramVidCidRedisCache = this.batchFindCreativeRedisCache(vidCidRedisKey, adIdList);
|
|
|
|
|
|
- Map<Long, CreativeStatistic> defaultCidCache = this.batchFindCreativeRedisCache(redisCidActionKeyV1, adIdList);
|
|
|
|
- Map<Long, CreativeStatistic> defaultVidCidCache = this.batchFindCreativeRedisCache(redisCidVidActionKeyV1, adIdList);
|
|
|
|
|
|
+ // 兜底逻辑
|
|
|
|
+ if (MapUtils.isEmpty(paramCidRedisCache) && MapUtils.isEmpty(paramVidCidRedisCache)) {
|
|
|
|
|
|
- for (AdPlatformCreativeDTO dto : adIdList) {
|
|
|
|
- Long cid = dto.getCreativeId();
|
|
|
|
- paramCidRedisCache.putIfAbsent(cid, defaultCidCache.getOrDefault(cid, new CreativeStatistic()));
|
|
|
|
- paramVidCidRedisCache.putIfAbsent(cid, defaultVidCidCache.getOrDefault(cid, new CreativeStatistic()));
|
|
|
|
|
|
+ Map<Long, CreativeStatistic> defaultCidCache = this.batchFindCreativeRedisCache(redisCidActionKeyV1, adIdList);
|
|
|
|
+ Map<Long, CreativeStatistic> defaultVidCidCache = this.batchFindCreativeRedisCache(redisCidVidActionKeyV1, adIdList);
|
|
|
|
+
|
|
|
|
+ for (AdPlatformCreativeDTO dto : adIdList) {
|
|
|
|
+ Long cid = dto.getCreativeId();
|
|
|
|
+ paramCidRedisCache.putIfAbsent(cid, defaultCidCache.getOrDefault(cid, new CreativeStatistic()));
|
|
|
|
+ paramVidCidRedisCache.putIfAbsent(cid, defaultVidCidCache.getOrDefault(cid, new CreativeStatistic()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ double viewThreshold = Double.parseDouble(exp672Param.getOrDefault("viewThreshold", "7000"));
|
|
List<AdRankItem> result = new ArrayList<>(adIdList.size());
|
|
List<AdRankItem> result = new ArrayList<>(adIdList.size());
|
|
-
|
|
|
|
for (AdPlatformCreativeDTO dto : adIdList) {
|
|
for (AdPlatformCreativeDTO dto : adIdList) {
|
|
Map<String, Object> ext = new HashMap<>();
|
|
Map<String, Object> ext = new HashMap<>();
|
|
double score = 0.0;
|
|
double score = 0.0;
|