提交 86177b65 作者: 925993793@qq.com

事件总体分析接口改造-兼容自定义组件数据结构

上级 985668f9
...@@ -68,20 +68,22 @@ public class EventAnalysisController { ...@@ -68,20 +68,22 @@ public class EventAnalysisController {
private String SERVICE_PROJECT_URL; private String SERVICE_PROJECT_URL;
/** /**
* 3.4 总体分析 * 3.4 总体分析
* *
* @param subjectId 专题id * @param subjectId 专题id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param type 结束时间
* @param category 风险评估项目使用(统战部)
* @author lkg * @author lkg
* @date 2024/1/24 * @date 2024/1/24
*/ */
@GetMapping("/total") @GetMapping("/total")
public Result<?> totalAndMax(@RequestParam String subjectId, @RequestParam String startTime, public Result<?> totalAndMax(@RequestParam String subjectId, @RequestParam String startTime,
@RequestParam(required = false) String endTime, @RequestParam(required = false) String endTime,
@RequestParam(defaultValue = "1") Integer type) { @RequestParam(defaultValue = "1") Integer type,
@RequestParam(required = false) String category) {
Map<String, String> map = esStatisticsService.totalAndMax(subjectId, null, null, type); Map<String, String> map = esStatisticsService.totalAndMax(subjectId, null, null, type);
if (StringUtils.isEmpty(endTime)) { if (StringUtils.isEmpty(endTime)) {
endTime = DateUtil.now(); endTime = DateUtil.now();
...@@ -98,7 +100,31 @@ public class EventAnalysisController { ...@@ -98,7 +100,31 @@ public class EventAnalysisController {
DateTime beforeHour = DateUtil.offsetHour(DateUtil.parseDateTime(endTime), -1); DateTime beforeHour = DateUtil.offsetHour(DateUtil.parseDateTime(endTime), -1);
long lastHour = esStatisticsService.totalCount(subjectIdList, DateUtil.formatDateTime(beforeHour), endTime); long lastHour = esStatisticsService.totalCount(subjectIdList, DateUtil.formatDateTime(beforeHour), endTime);
map.put("lastHour", String.valueOf(lastHour)); map.put("lastHour", String.valueOf(lastHour));
return Result.OK(map); if ("TZB".equalsIgnoreCase(category)) {
List<Map<String, Object>> dataList = new ArrayList<>();
Map<String, Object> totalCountMap = new HashMap<>();
totalCountMap.put("name", "信息总量");
totalCountMap.put("value", count);
totalCountMap.put("unit", "条");
dataList.add(totalCountMap);
Map<String, Object> maxCountMap = new HashMap<>();
maxCountMap.put("name", "波峰值");
maxCountMap.put("value", map.get("max"));
maxCountMap.put("unit", "条");
dataList.add(maxCountMap);
Map<String, Object> spreadMap = new HashMap<>();
spreadMap.put("name", "平均传播速度");
spreadMap.put("value", divide);
spreadMap.put("unit", "条/小时");
dataList.add(spreadMap);
Map<String, Object> mainReportMap = new HashMap<>();
mainReportMap.put("name", "主流报道");
mainReportMap.put("value", mainReport);
dataList.add(mainReportMap);
return Result.OK(dataList);
} else {
return Result.OK(map);
}
} }
/** /**
...@@ -161,7 +187,7 @@ public class EventAnalysisController { ...@@ -161,7 +187,7 @@ public class EventAnalysisController {
} }
List<SubjectAnalysis> eventContextList = analysisService.eventContext(subjectId, fakeNum); List<SubjectAnalysis> eventContextList = analysisService.eventContext(subjectId, fakeNum);
if (CollectionUtils.isNotEmpty(eventContextList)) { if (CollectionUtils.isNotEmpty(eventContextList)) {
eventContextList.forEach(e->e.setOrigin(Constants.getRealOrigin(e.getOrigin()))); eventContextList.forEach(e -> e.setOrigin(Constants.getRealOrigin(e.getOrigin())));
} }
return Result.OK(eventContextList); return Result.OK(eventContextList);
} }
...@@ -178,7 +204,7 @@ public class EventAnalysisController { ...@@ -178,7 +204,7 @@ public class EventAnalysisController {
@RequestParam(name = "relationId") String relationId) { @RequestParam(name = "relationId") String relationId) {
List<EventViewVO> viewpointList = esService.viewpointList(eventId, relationId); List<EventViewVO> viewpointList = esService.viewpointList(eventId, relationId);
if (CollectionUtils.isNotEmpty(viewpointList)) { if (CollectionUtils.isNotEmpty(viewpointList)) {
viewpointList.forEach(e->e.setOrigin(Constants.getRealOrigin(e.getOrigin()))); viewpointList.forEach(e -> e.setOrigin(Constants.getRealOrigin(e.getOrigin())));
} }
return Result.OK(viewpointList); return Result.OK(viewpointList);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论