|
@@ -543,81 +543,17 @@ public class MsgAlarmController extends BaseController {
|
|
|
if (user.isAdmin(user.getId())) {
|
|
|
userId = "";
|
|
|
}
|
|
|
- List<Integer> numbs = new ArrayList<>();
|
|
|
- Integer listSize;
|
|
|
+
|
|
|
List<AlarmStatisticMonthDto> list = null;
|
|
|
List<AlarmStatisticDayDto> listDay = null;
|
|
|
if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
|
|
|
list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- listSize = 12;
|
|
|
- } else {
|
|
|
- if (alarmStatisticResVo.getCurrentMonth().equals(2)) {//2
|
|
|
- listSize = 28;
|
|
|
- } else if (alarmStatisticResVo.getCurrentMonth().equals(4) || alarmStatisticResVo.getCurrentMonth().equals(6) ||
|
|
|
- alarmStatisticResVo.getCurrentMonth().equals(9) || alarmStatisticResVo.getCurrentMonth().equals(11)) {//4,6,9,11
|
|
|
- listSize = 30;
|
|
|
- } else {//1,3,5,7,8,10,12
|
|
|
- listSize = 31;
|
|
|
- }
|
|
|
- listDay = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
- alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
- }
|
|
|
- for (int i = 1; i <= listSize; i++) {
|
|
|
- numbs.add(i);
|
|
|
- }
|
|
|
-
|
|
|
- List<Integer> list1 = new ArrayList<>();
|
|
|
- if (ObjectUtils.isEmpty(alarmStatisticResVo.getCurrentMonth())) {
|
|
|
- if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
|
|
|
- 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, "报警月统计数据");
|
|
|
} else {
|
|
|
- if (!CollectionUtils.isEmpty(listDay) && Objects.nonNull(listDay.get(0))) {
|
|
|
- listDay.forEach(l -> {
|
|
|
- list1.add(l.getDaysta());
|
|
|
- });
|
|
|
- }
|
|
|
- AlarmStatisticDayDto dto;
|
|
|
- for (int i = 0; i < numbs.size(); i++) {
|
|
|
- if (!list1.contains(numbs.get(i))) {
|
|
|
- dto = new AlarmStatisticDayDto();
|
|
|
- dto.setDaysta(numbs.get(i));
|
|
|
- dto.setFrequency(0);
|
|
|
- listDay.add(dto);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(listDay) && Objects.nonNull(listDay.get(0))) {
|
|
|
- Collections.sort(listDay, new Comparator<AlarmStatisticDayDto>() {
|
|
|
- @Override
|
|
|
- public int compare(AlarmStatisticDayDto o1, AlarmStatisticDayDto o2) {
|
|
|
-
|
|
|
- return o1.getDaysta().compareTo(o2.getDaysta());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ listDay = msgAlarmService.getDayCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
|
|
|
+ alarmStatisticResVo.getCurrentMonth(), alarmStatisticResVo.getAlarmType(), userId);
|
|
|
ExcelUtil<AlarmStatisticDayDto> util = new ExcelUtil<>(AlarmStatisticDayDto.class);
|
|
|
util.exportExcel(response, listDay, "报警月统计数据");
|
|
|
}
|