提交 7b04ab7f 作者: zgz

多个主题的保留分数最高的

上级 3e103538
...@@ -198,6 +198,20 @@ public class InformationServiceImpl implements InformationService { ...@@ -198,6 +198,20 @@ public class InformationServiceImpl implements InformationService {
//标签处理 //标签处理
List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId()); List<LabelModelVo> modelVoList = modelMap.get(info.getSubjectId());
formatLabel(modelVoList, info); formatLabel(modelVoList, info);
try{
//多个主题的保留分数最高的
List<Label> listLabel = info.getLabels();
// 使用流操作找到score最大的Label
Optional<Label> maxLabel = listLabel.stream()
.filter(label -> searchCondition.getLabelMark().equals(label.getLabelMark())) // 过滤labelMark
.peek(label -> label.setStatus(label.getStatus() == null ? 0 : label.getStatus())) // 将null赋值为0
.max(Comparator.comparingDouble(Label::getStatus));
List<Label> maxLabelList = maxLabel.map(Collections::singletonList).orElse(Collections.emptyList());
info.setLabels(maxLabelList);
}catch (Exception e){
log.error("处理得分最高标签异常",e);
}
dataList.add(info); dataList.add(info);
} }
Map<String, List<DisplayInfo>> mapList = groupedByLabelMark(dataList,searchCondition); Map<String, List<DisplayInfo>> mapList = groupedByLabelMark(dataList,searchCondition);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论