故障测试调整

This commit is contained in:
tiger_zhou 2023-12-22 11:20:06 +08:00
parent 37402ba638
commit b2894c960b

View File

@ -16,6 +16,7 @@ import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station; import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Turnout;
import club.joylink.xiannccda.mock.message.occ.req.MockDeviceStatusReq; import club.joylink.xiannccda.mock.message.occ.req.MockDeviceStatusReq;
import club.joylink.xiannccda.mock.message.occ.req.MockTrainRecordReq; import club.joylink.xiannccda.mock.message.occ.req.MockTrainRecordReq;
import club.joylink.xiannccda.mock.message.occ.req.MockTrainUpdateReq; import club.joylink.xiannccda.mock.message.occ.req.MockTrainUpdateReq;
@ -149,13 +150,17 @@ public class MockOccServer {
private Integer findDeviceRtuId(Integer lineId, DeviceType dt, String deviceName, AlertType alertType) { private Integer findDeviceRtuId(Integer lineId, DeviceType dt, String deviceName, AlertType alertType) {
if (alertType == AlertType.AXLE_LED_RED || alertType == AlertType.AXLE_LED_ORANGE) { if (alertType == AlertType.AXLE_LED_RED || alertType == AlertType.AXLE_LED_ORANGE) {
MessageOrBuilder t = LineGraphicDataRepository.getDeviceByCodeNotException(lineId, deviceName);
if (t instanceof Turnout) {
Integer stationId = DeviceStatusDataOperate.findFieldVal(t, "centralizedStationId", Integer.class);
return this.findRtuStation(lineId, stationId);
} else {
String axleSectionCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, deviceName); String axleSectionCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, deviceName);
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleSectionCode); MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleSectionCode);
Integer stationId = DeviceStatusDataOperate.findFieldVal(section, "centralizedStationId", Integer.class); Integer stationId = DeviceStatusDataOperate.findFieldVal(section, "centralizedStationId", Integer.class);
// LayoutGraphicsProto.Station station = LineGraphicDataRepository.getDeviceByCode(lineId, stationId.toString(), LayoutGraphicsProto.Station.class);
// System.out.println(section);
// return Integer.parseInt(station.getCode());
return this.findRtuStation(lineId, stationId); return this.findRtuStation(lineId, stationId);
}
} else if (alertType == AlertType.BLUE_DISPLAY) { } else if (alertType == AlertType.BLUE_DISPLAY) {
Optional<LayoutGraphicsProto.Station> stationOptional = LineGraphicDataRepository.getDevices(lineId, LayoutGraphicsProto.Station.class).filter(d -> StringUtils.equals(d.getCode(), deviceName)) Optional<LayoutGraphicsProto.Station> stationOptional = LineGraphicDataRepository.getDevices(lineId, LayoutGraphicsProto.Station.class).filter(d -> StringUtils.equals(d.getCode(), deviceName))
.findFirst(); .findFirst();
@ -163,12 +168,9 @@ public class MockOccServer {
return this.findRtuStation(lineId, stationOptional.get().getCommon().getId()); return this.findRtuStation(lineId, stationOptional.get().getCommon().getId());
} }
} else if (alertType == AlertType.SWITCH_LOST) { } else if (alertType == AlertType.SWITCH_LOST) {
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, deviceName); MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineId, deviceName);
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode); Integer stationId = DeviceStatusDataOperate.findFieldVal(mb, "centralizedStationId", Integer.class);
Integer stationId = DeviceStatusDataOperate.findFieldVal(section, "centralizedStationId", Integer.class); System.out.println(mb);
System.out.println(section);
// LayoutGraphicsProto.Station station = LineGraphicDataRepository.getDeviceByCode(lineId, stationId.toString(), LayoutGraphicsProto.Station.class);
// return Integer.parseInt(station.getCode());
return this.findRtuStation(lineId, stationId); return this.findRtuStation(lineId, stationId);
} }
return null; return null;