Commit 973ce022 by shentao

2022/8/5 事件详情热门文章分析补全

parent b993b864
......@@ -267,5 +267,5 @@ public interface EventService {
* @param aggTitle
* @return
*/
Map<String, List<EventTopArticlesAnalysisVO>> getEventTopArticlesAnalysis(String id, String type, String emotion, String aggTitle);
JSONObject getEventTopArticlesAnalysis(String id, String type, String emotion, String aggTitle);
}
......@@ -601,23 +601,32 @@ public class EventServiceImpl implements EventService {
}
@Override
public Map<String, List<EventTopArticlesAnalysisVO>> getEventTopArticlesAnalysis(String eventId, String type, String emotion, String aggTitle) {
public JSONObject getEventTopArticlesAnalysis(String eventId, String type, String emotion, String aggTitle) {
JSONObject res = new JSONObject();
// 传播方向
Event event = getEventById(eventId);
res.put("detail", event.getEventTopArticlesAnalysisDetail());
// 分析结果
res.put("type", type);
Query query = new Query(Criteria.where("eventId").is(eventId).and("type").is(type));
if (!Objects.equals("全部", emotion)) {
query.addCriteria(Criteria.where("emotion").is(emotion));
}
List<EventTopArticlesAnalysis> eventTopArticlesAnalyses = eventTopArticlesAnalysisDao.findList(query);
switch (type){
switch (type) {
case "按时间":
Map<String, List<EventTopArticlesAnalysisVO>> collect = eventTopArticlesAnalyses.stream()
.map(eventTopArticlesAnalysis -> {
boolean highLight = Objects.equals(aggTitle, eventTopArticlesAnalysis.getAggTitle());
return new EventTopArticlesAnalysisVO(eventTopArticlesAnalysis, highLight);
}).collect(Collectors.groupingBy(EventTopArticlesAnalysisVO::getTimePoint));
return collect;
res.put("dataDay", collect);
res.put("dataAmount", null);
return res;
case "按数量":
// TODO: 2022/8/4
return null;
res.put("dataDay", null);
res.put("dataAmount", eventTopArticlesAnalyses);
return res;
default:
throw new IllegalStateException("Unexpected value: " + type);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment