|
@@ -48,11 +48,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.OutputStream;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -287,6 +283,27 @@ public class MsgAlarmController extends BaseController {
|
|
|
}
|
|
|
List<AlarmStatisticMonthDto> list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
|
|
|
alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
+ List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
|
|
|
+ List<Integer> list1 = new ArrayList<>();
|
|
|
+ list.forEach(l -> {
|
|
|
+ list1.add(l.getMonthsta());
|
|
|
+ });
|
|
|
+ AlarmStatisticMonthDto dto;
|
|
|
+ for (int i = 0; i < numbs.size(); i++) {
|
|
|
+ if (!list1.contains(numbs.get(i))) {
|
|
|
+ dto = new AlarmStatisticMonthDto();
|
|
|
+ dto.setMonthsta(numbs.get(i));
|
|
|
+ dto.setFrequency(0);
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
|
|
|
+ @Override
|
|
|
+ public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
|
|
|
+
|
|
|
+ return o1.getMonthsta().compareTo(o2.getMonthsta());
|
|
|
+ }
|
|
|
+ });
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
|
|
@@ -353,6 +370,27 @@ public class MsgAlarmController extends BaseController {
|
|
|
}
|
|
|
try {
|
|
|
List<AlarmStatisticMonthDto> list = msgAlarmService.exportExcelMonth(alarmStatisticResVo, userId);
|
|
|
+ List<Integer> numbs = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
|
|
|
+ List<Integer> list1 = new ArrayList<>();
|
|
|
+ list.forEach(l -> {
|
|
|
+ list1.add(l.getMonthsta());
|
|
|
+ });
|
|
|
+ AlarmStatisticMonthDto dto;
|
|
|
+ for (int i = 0; i < numbs.size(); i++) {
|
|
|
+ if (!list1.contains(numbs.get(i))) {
|
|
|
+ dto = new AlarmStatisticMonthDto();
|
|
|
+ dto.setMonthsta(numbs.get(i));
|
|
|
+ dto.setFrequency(0);
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Collections.sort(list, new Comparator<AlarmStatisticMonthDto>() {
|
|
|
+ @Override
|
|
|
+ public int compare(AlarmStatisticMonthDto o1, AlarmStatisticMonthDto o2) {
|
|
|
+
|
|
|
+ return o1.getMonthsta().compareTo(o2.getMonthsta());
|
|
|
+ }
|
|
|
+ });
|
|
|
ExcelUtil<AlarmStatisticMonthDto> util = new ExcelUtil<>(AlarmStatisticMonthDto.class);
|
|
|
util.exportExcel(response, list, "报警月统计数据");
|
|
|
} catch (Exception e) {
|