代码调整
This commit is contained in:
parent
9923d4bc9a
commit
0f3c9b1d00
@ -1,10 +1,8 @@
|
||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
|
@ -4,29 +4,14 @@ import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.warn.AllLineBlueAlertListener.AllLineBlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -15,15 +15,11 @@ import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType;
|
||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
@ -11,14 +11,12 @@ import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch.Builder;
|
||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Turnout;
|
||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
|
@ -17,9 +17,7 @@ import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class TrainReacrdAlertListener implements AlertSourceEventListener<TrainRecordAlertEvent> {
|
||||
|
||||
private PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
||||
private final PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
||||
|
||||
public TrainReacrdAlertListener(PlatformAlertMonitoringTask platformAlertMonitoringTask) {
|
||||
this.platformAlertMonitoringTask = platformAlertMonitoringTask;
|
||||
|
@ -80,6 +80,6 @@ public class AlertRecordController {
|
||||
@Operation(summary = "报警统计")
|
||||
@ApiResponse(description = "报警统计")
|
||||
public List<AlertRecordReportResponseDTO> reportStatistics(@PathVariable("lineId") Integer lineId, @RequestBody AlertRecordReportDTO reportDTO) {
|
||||
return this.alertRecordService.report(lineId, reportDTO);
|
||||
return this.alertRecordRepository.report(lineId, reportDTO);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package club.joylink.xiannccda.repository;
|
||||
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordQueryDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportResponseDTO;
|
||||
import club.joylink.xiannccda.entity.AlertRecord;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -16,4 +19,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface IAlertRecordRepository extends IService<AlertRecord> {
|
||||
|
||||
Page<AlertRecord> page(AlertRecordQueryDTO queryDTO);
|
||||
|
||||
List<AlertRecordReportResponseDTO> report(Integer lineId, AlertRecordReportDTO reportDTO);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package club.joylink.xiannccda.repository.impl;
|
||||
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordQueryDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportResponseDTO;
|
||||
import club.joylink.xiannccda.entity.AlertRecord;
|
||||
import club.joylink.xiannccda.mapper.AlertRecordMapper;
|
||||
import club.joylink.xiannccda.repository.IAlertRecordRepository;
|
||||
@ -8,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -33,4 +36,9 @@ public class AlertRecordRepository extends ServiceImpl<AlertRecordMapper, AlertR
|
||||
queryWrapper.orderByDesc(AlertRecord::getAlertTime);
|
||||
return page(queryDTO, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlertRecordReportResponseDTO> report(Integer lineId, AlertRecordReportDTO reportDTO) {
|
||||
return this.getBaseMapper().report(reportDTO, lineId);
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,13 @@ package club.joylink.xiannccda.service;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordQueryDTO;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordReportResponseDTO;
|
||||
import club.joylink.xiannccda.dto.record.AlertRecordQueryDTO;
|
||||
import club.joylink.xiannccda.entity.AlertRecord;
|
||||
import club.joylink.xiannccda.entity.AlertTip;
|
||||
import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
||||
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.xiannccda.repository.IAlertRecordRepository;
|
||||
import club.joylink.xiannccda.repository.impl.AlertRecordRepository;
|
||||
import club.joylink.xiannccda.repository.impl.AlertTipRepository;
|
||||
import club.joylink.xiannccda.service.config.DeviceAreaConfigService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -31,14 +28,14 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class AlertRecordService {
|
||||
|
||||
private final AlertRecordRepository alertRecordRepository;
|
||||
private final IAlertRecordRepository alertRecordRepository;
|
||||
|
||||
|
||||
private final AlertTipRepository alertTipRepository;
|
||||
private final DeviceAreaConfigService areaConfigService;
|
||||
|
||||
|
||||
public AlertRecordService(AlertRecordRepository alertRecordRepository, AlertTipRepository alertTipRepository, DeviceAreaConfigService areaConfigService) {
|
||||
public AlertRecordService(IAlertRecordRepository alertRecordRepository, AlertTipRepository alertTipRepository, DeviceAreaConfigService areaConfigService) {
|
||||
this.alertRecordRepository = alertRecordRepository;
|
||||
this.alertTipRepository = alertTipRepository;
|
||||
this.areaConfigService = areaConfigService;
|
||||
@ -125,11 +122,4 @@ public class AlertRecordService {
|
||||
return nccPage;
|
||||
}
|
||||
|
||||
public List<AlertRecordReportResponseDTO> report(Integer lineId, AlertRecordReportDTO reportDTO) {
|
||||
/* if (Objects.nonNull(reportDTO.getBeginDateTime()) && Objects.nonNull(reportDTO.getEndDateTime())) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(reportDTO.getEndDateTime().isAfter(reportDTO.getBeginDateTime()), "开始时间不能大于结束时间");
|
||||
}*/
|
||||
|
||||
return this.alertRecordRepository.getBaseMapper().report(reportDTO, lineId);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class AlertRecordServiceTest {
|
||||
public void reportDate() {
|
||||
AlertRecordReportDTO dto = new AlertRecordReportDTO();
|
||||
// dto.setAlertTypes(List.of(AlertType.AXLE_LED_RED));
|
||||
dto.setBeginDateTime(LocalDateTime.parse("2023-09-05 13:21:46", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
// dto.setBeginDateTime(LocalDateTime.parse("2023-09-05 13:21:46", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
dto.setEndDateTime(LocalDateTime.now());
|
||||
List<AlertRecordReportResponseDTO> list = this.alertRecordService.report(3, dto);
|
||||
System.out.println(JSON.toJSONString(list, Feature.PrettyFormat, Feature.WriteEnumsUsingName));
|
||||
|
Loading…
Reference in New Issue
Block a user