提交 668f9f66 作者: 布红亮

修复事件分析bug 当事件为0时资讯数增量数应为0,,

上级 59ad9772
......@@ -9,6 +9,7 @@ import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.EventExcelVO;
import com.zzsn.event.vo.EventRegionVO;
import com.zzsn.event.vo.EventTopVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -57,6 +58,7 @@ public class EventHomeController {
Map<String, Integer> map = new HashMap<>();
List<EventExcelVO> eventList = eventService.frontAllList(projectId, username, null, null,null,null,null,null, tenant);
map.put("eventCount", eventList.size());
if (!CollectionUtils.isEmpty(eventList)) {
List<String> eventIdList = eventList.stream().map(EventExcelVO::getId).collect(Collectors.toList());
long total = esStatisticsService.totalCount(eventIdList, null, null);
map.put("total", (int) total);
......@@ -65,6 +67,10 @@ public class EventHomeController {
LocalDateTime previousHour = now.minus(1, ChronoUnit.DAYS);
long totalAdd = esStatisticsService.totalCount(eventIdList, previousHour.format(formatter), now.format(formatter));
map.put("totalAdd", (int) totalAdd);
} else {
map.put("total", 0);
map.put("totalAdd", 0);
}
return Result.OK(map);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论