|
@@ -141,37 +141,28 @@ public class ArticlePromotionService {
|
|
|
}
|
|
|
|
|
|
public List<DatastatSortStrategy> promotionWithReadOpenFissionRate(double threshold, List<DatastatSortStrategy> list) {
|
|
|
- // 参数校验
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
throw new IllegalArgumentException("List cannot be empty");
|
|
|
}
|
|
|
|
|
|
return list.stream().filter(o -> {
|
|
|
- // 处理分母部分(各级别之和)
|
|
|
double denominator =
|
|
|
nullSafe(o.getFirstLevel()) +
|
|
|
nullSafe(o.getSecondFirstLevel()) +
|
|
|
nullSafe(o.getThirdFirstLevel());
|
|
|
-
|
|
|
- // 分母为零处理
|
|
|
if (denominator == 0) return false;
|
|
|
|
|
|
- // 处理分子部分(所有裂变值求和)
|
|
|
double numerator =
|
|
|
nullSafe(o.getFission0()) + nullSafe(o.getFission1()) + nullSafe(o.getFission2()) +
|
|
|
nullSafe(o.getSecondFission0()) + nullSafe(o.getSecondFission1()) + nullSafe(o.getSecondFission2()) +
|
|
|
nullSafe(o.getThirdFission0()) + nullSafe(o.getThirdFission1()) + nullSafe(o.getThirdFission2());
|
|
|
|
|
|
- // 处理可能为空的阅读率参数
|
|
|
double readRate = nullSafe(o.getReadRate());
|
|
|
double firstReadRate = nullSafe(o.getFirstReadRate());
|
|
|
-
|
|
|
- // 计算 log10 阅读量
|
|
|
+ // 计算 log10(阅读量)
|
|
|
double logViewCount = (nullSafe(o.getViewCount()) > 0) ? Math.log10(nullSafe(o.getViewCount())) : 0;
|
|
|
-
|
|
|
// 计算完整公式 score = 阅读均值倍数 * 阅读率 * T2裂变率 * log10(阅读量)
|
|
|
double result = readRate * firstReadRate * (numerator / denominator) * logViewCount;
|
|
|
-
|
|
|
return result > threshold;
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|