|
@@ -139,7 +139,7 @@ public class ArticlePromotionService {
|
|
|
// 获取内部表现
|
|
|
List<DatastatSortStrategy> list;
|
|
|
if (pos.equals("【2】")) {
|
|
|
- list = longArticleBaseMapper.getArticlePromotionV2(10000, dateStrFilter, positionFilter);
|
|
|
+ list = longArticleBaseMapper.getArticlePromotionCandidates(10000, dateStrFilter, positionFilter);
|
|
|
|
|
|
// 使用阅读均值倍数+阅读量晋级
|
|
|
List<DatastatSortStrategy> listStrategy1 = list.stream()
|
|
@@ -150,37 +150,23 @@ public class ArticlePromotionService {
|
|
|
List<DatastatSortStrategy> listStrategy2 = list.stream()
|
|
|
.filter(o -> {
|
|
|
try {
|
|
|
- return abZTestCorrected(
|
|
|
- o.getAvgViewCount() * 1.1 * 30,
|
|
|
- o.getFans() * 30,
|
|
|
- o.getViewCount(),
|
|
|
- o.getFans(),
|
|
|
- 0.95
|
|
|
- );
|
|
|
- } catch (IllegalArgumentException e) {
|
|
|
- // 记录异常日志(包含对象标识)
|
|
|
- log.error("显著性检验,传入数值错误: {}", e.getMessage());
|
|
|
- return false; // 异常时过滤掉该对象
|
|
|
- } catch (Exception e) {
|
|
|
- // 捕获其他未预期异常
|
|
|
- log.error("显著性检验, 其他异常: {}", e.getMessage());
|
|
|
+ return abZTestCorrected(o.getAvgViewCount() * 1.1 * 30, o.getFans() * 30,
|
|
|
+ o.getViewCount(), o.getFans(), 0.95);
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ log.error("显著性检验, 出现异常: {}", e.getMessage());
|
|
|
return false;
|
|
|
}
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- // merge 两个 list, 通过wx_sn去重
|
|
|
- // 临时用 Map 存储去重(保留第一个出现的元素)
|
|
|
list = Stream.concat(listStrategy1.stream(), listStrategy2.stream())
|
|
|
- // 使用标题作为去重标识
|
|
|
.collect(Collectors.collectingAndThen(
|
|
|
- // 临时用 Map 存储去重(保留第一个出现的元素)
|
|
|
Collectors.toMap(
|
|
|
DatastatSortStrategy::getWxSn,
|
|
|
Function.identity(),
|
|
|
- (existing, replacement) -> existing // 冲突时保留已有元素
|
|
|
+ (existing, replacement) -> existing
|
|
|
),
|
|
|
- // 从 Map 的 values 中提取结果
|
|
|
map -> new ArrayList<>(map.values())
|
|
|
));
|
|
|
} else {
|