Commit 973ce022 by shentao

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

parent b993b864
...@@ -267,5 +267,5 @@ public interface EventService { ...@@ -267,5 +267,5 @@ public interface EventService {
* @param aggTitle * @param aggTitle
* @return * @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 { ...@@ -601,23 +601,32 @@ public class EventServiceImpl implements EventService {
} }
@Override @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)); Query query = new Query(Criteria.where("eventId").is(eventId).and("type").is(type));
if (!Objects.equals("全部", emotion)) { if (!Objects.equals("全部", emotion)) {
query.addCriteria(Criteria.where("emotion").is(emotion)); query.addCriteria(Criteria.where("emotion").is(emotion));
} }
List<EventTopArticlesAnalysis> eventTopArticlesAnalyses = eventTopArticlesAnalysisDao.findList(query); List<EventTopArticlesAnalysis> eventTopArticlesAnalyses = eventTopArticlesAnalysisDao.findList(query);
switch (type){ switch (type) {
case "按时间": case "按时间":
Map<String, List<EventTopArticlesAnalysisVO>> collect = eventTopArticlesAnalyses.stream() Map<String, List<EventTopArticlesAnalysisVO>> collect = eventTopArticlesAnalyses.stream()
.map(eventTopArticlesAnalysis -> { .map(eventTopArticlesAnalysis -> {
boolean highLight = Objects.equals(aggTitle, eventTopArticlesAnalysis.getAggTitle()); boolean highLight = Objects.equals(aggTitle, eventTopArticlesAnalysis.getAggTitle());
return new EventTopArticlesAnalysisVO(eventTopArticlesAnalysis, highLight); return new EventTopArticlesAnalysisVO(eventTopArticlesAnalysis, highLight);
}).collect(Collectors.groupingBy(EventTopArticlesAnalysisVO::getTimePoint)); }).collect(Collectors.groupingBy(EventTopArticlesAnalysisVO::getTimePoint));
return collect; res.put("dataDay", collect);
res.put("dataAmount", null);
return res;
case "按数量": case "按数量":
// TODO: 2022/8/4 res.put("dataDay", null);
return null; res.put("dataAmount", eventTopArticlesAnalyses);
return res;
default: default:
throw new IllegalStateException("Unexpected value: " + type); 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