|
@@ -272,6 +272,32 @@ public abstract class RankStrategyBasic implements RankStrategy {
|
|
|
|
|
|
|
|
|
protected Map<String, GuaranteeView> getGuaranteeViewMap(RankRecommendRequestParam request, ScoreParam scoreParam) {
|
|
|
+ Map<String, GuaranteeView> map = new HashMap<>();
|
|
|
+ try {
|
|
|
+ if (scoreParam.getExpCodeSet().contains(guaranteeExp)) {
|
|
|
+ String thatDayDateString = DateUtils.getThatDayDateString();
|
|
|
+ String redisKey = adPlatformGuaranteeKey.replace("{date}", thatDayDateString);
|
|
|
+ List<String> adVerIds = request.getAdIdList().stream().map(AdPlatformCreativeDTO::getAdVerId).distinct()
|
|
|
+ .filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<String> redisKeys = adVerIds.stream().map(e -> redisKey.replace("{adverId}", e)).collect(Collectors.toList());
|
|
|
+ List<String> values = adRedisHelper.mget(redisKeys);
|
|
|
+ if (CollectionUtils.isNotEmpty(values)) {
|
|
|
+ for (int i = 0; i < redisKeys.size(); i++) {
|
|
|
+ String value = values.get(i);
|
|
|
+ if (value != null) {
|
|
|
+ GuaranteeView guaranteeView = JSONObject.parseObject(value, GuaranteeView.class);
|
|
|
+ map.put(adVerIds.get(i), guaranteeView);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("getGuaranteeViewMap error", e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
protected boolean getIsGuaranteedFlow(ScoreParam scoreParam) {
|
|
|
if (System.currentTimeMillis() < guaranteeSwitchingTime) {
|
|
|
return scoreParam.getExpCodeSet().contains(guaranteeExp);
|