| | |
| | | package com.panzhihua.service_grid.service.impl; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | statisticsVO.setDrawEventPopulationTotalVO(drawEventPopulationTotalVO); |
| | | statisticsVO.setAgeGroupStatistics(ageGroupStatistics); |
| | | statisticsVO.generateStatisticsData(); |
| | | List<StatisticsCommVO> eventTypeCircleDrawData = new ArrayList<>(); |
| | | if (!eventResultList.isEmpty()) { |
| | | Map<Integer, List<EventGridIncidentStatisticsVO>> collect = eventResultList.stream().collect(Collectors.groupingBy(EventGridIncidentStatisticsVO::getType)); |
| | | for (Map.Entry<Integer, List<EventGridIncidentStatisticsVO>> entry : collect.entrySet()) { |
| | | StatisticsCommVO temp = new StatisticsCommVO(); |
| | | int size = entry.getValue().size(); |
| | | Integer eventTotal = statisticsVO.getEventTotal(); |
| | | temp.setFiled(entry.getKey().toString()); |
| | | temp.setNum(size); |
| | | temp.setPercent(new BigDecimal(size/eventTotal).setScale(2)); |
| | | eventTypeCircleDrawData.add(temp); |
| | | } |
| | | } |
| | | statisticsVO.setEventTypeCircleDrawData(eventTypeCircleDrawData); |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |