|
@@ -8,9 +8,11 @@ import com.tzld.piaoquan.recommend.server.service.filter.VideoFilterService;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.FilterParamFactory;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallParam;
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallStrategy;
|
|
|
+import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
|
|
|
import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -45,8 +47,12 @@ public abstract class AbstractVideoRecallStrategy implements RecallStrategy {
|
|
|
if (StringUtils.isBlank(value)) {
|
|
|
return null;
|
|
|
}
|
|
|
- Map<Long, Double> videoScoreMap = JSONUtils.fromJson(value, new TypeToken<Map<Long, Double>>() {
|
|
|
- }, Collections.emptyMap());
|
|
|
+ List<List<String>> videoScores = JSONUtils.fromJson(value, new TypeToken<List<List<String>>>() {
|
|
|
+ }, Collections.emptyList());
|
|
|
+
|
|
|
+
|
|
|
+ Map<Long, Double> videoScoreMap = CommonCollectionUtils.toMap(videoScores, v -> NumberUtils.toLong(v.get(0)),
|
|
|
+ v -> NumberUtils.toDouble(v.get(1)));
|
|
|
List<Video> results = new ArrayList<>();
|
|
|
|
|
|
FilterResult filterResult = filterService.filter(FilterParamFactory.create(param, Lists.newArrayList(videoScoreMap.keySet())));
|