代码调整
This commit is contained in:
parent
6fdb913d2c
commit
922cb14c08
@ -39,8 +39,8 @@ public class AlertMockController {
|
|||||||
@SecurityRequirement(name = "jwt")
|
@SecurityRequirement(name = "jwt")
|
||||||
@Operation(summary = "设置模拟故障")
|
@Operation(summary = "设置模拟故障")
|
||||||
@ApiResponse(description = "设置模拟故障")
|
@ApiResponse(description = "设置模拟故障")
|
||||||
@PostMapping("/set2/{alertType}")
|
@PostMapping("/localDemoTest/{alertType}")
|
||||||
public void setAlert2(@RequestBody String json, @PathVariable("alertType") AlertType alertType) {
|
public void localDemoTest(@RequestBody String json, @PathVariable("alertType") AlertType alertType) {
|
||||||
alertMockService.newSetAlert(json, alertType);
|
alertMockService.newSetAlert(json, alertType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class AlertMockService {
|
|||||||
bb.setTimestamp(System.currentTimeMillis() / 1000);
|
bb.setTimestamp(System.currentTimeMillis() / 1000);
|
||||||
bb.setId(dto.getFrist());
|
bb.setId(dto.getFrist());
|
||||||
bb.setIpRtuStusDown(true);
|
bb.setIpRtuStusDown(true);
|
||||||
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_RTU, station.getCommon().getId(), bb, station.getName(), AlertDeviceType.DEVICE_TYPE_RTU, true);
|
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_RTU, station.getCommon().getId(), bb, station.getName(), AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||||
}
|
}
|
||||||
case PLATFORM_DOOR_CANNOT_OPEN -> {
|
case PLATFORM_DOOR_CANNOT_OPEN -> {
|
||||||
Optional<Platform> pfOptional = LineGraphicDataRepository.getDevices(lineId, Platform.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
Optional<Platform> pfOptional = LineGraphicDataRepository.getDevices(lineId, Platform.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
||||||
@ -121,7 +121,7 @@ public class AlertMockService {
|
|||||||
platform.setTimestamp(System.currentTimeMillis() / 1000);
|
platform.setTimestamp(System.currentTimeMillis() / 1000);
|
||||||
Platform pf = pfOptional.orElse(null);
|
Platform pf = pfOptional.orElse(null);
|
||||||
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_PLATFORM, pf.getCommon().getId(), platform, platform.getId(), AlertDeviceType.DEVICE_TYPE_PLATFORM,
|
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_PLATFORM, pf.getCommon().getId(), platform, platform.getId(), AlertDeviceType.DEVICE_TYPE_PLATFORM,
|
||||||
true);
|
false);
|
||||||
}
|
}
|
||||||
case PLATFORM_DOOR_CANNOT_CLOSE -> {
|
case PLATFORM_DOOR_CANNOT_CLOSE -> {
|
||||||
Optional<Platform> pfOptional = LineGraphicDataRepository.getDevices(lineId, Platform.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
Optional<Platform> pfOptional = LineGraphicDataRepository.getDevices(lineId, Platform.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
||||||
@ -133,7 +133,7 @@ public class AlertMockService {
|
|||||||
platform.setTimestamp(System.currentTimeMillis() / 1000);
|
platform.setTimestamp(System.currentTimeMillis() / 1000);
|
||||||
Platform pf = pfOptional.orElse(null);
|
Platform pf = pfOptional.orElse(null);
|
||||||
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_PLATFORM, pf.getCommon().getId(), platform, platform.getId(), AlertDeviceType.DEVICE_TYPE_PLATFORM,
|
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_PLATFORM, pf.getCommon().getId(), platform, platform.getId(), AlertDeviceType.DEVICE_TYPE_PLATFORM,
|
||||||
true);
|
false);
|
||||||
}
|
}
|
||||||
/* case SWITCH_LOST -> {
|
/* case SWITCH_LOST -> {
|
||||||
Optional<Turnout> turnoutOptional = LineGraphicDataRepository.getDevices(lineId, Turnout.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
Optional<Turnout> turnoutOptional = LineGraphicDataRepository.getDevices(lineId, Turnout.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
||||||
@ -155,7 +155,7 @@ public class AlertMockService {
|
|||||||
switchs.setReceiveTime(System.currentTimeMillis());
|
switchs.setReceiveTime(System.currentTimeMillis());
|
||||||
switchs.setIpSingleSwitchStusLostIndication(true);
|
switchs.setIpSingleSwitchStusLostIndication(true);
|
||||||
Turnout turnout = turnoutOptional.orElse(null);
|
Turnout turnout = turnoutOptional.orElse(null);
|
||||||
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_SWITCH, turnout.getCommon().getId(), switchs, dto.getAll(), AlertDeviceType.DEVICE_TYPE_SWITCH, true);
|
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_SWITCH, turnout.getCommon().getId(), switchs, dto.getAll(), AlertDeviceType.DEVICE_TYPE_SWITCH, false);
|
||||||
}
|
}
|
||||||
case AXLE_LED_RED, AXLE_LED_ORANGE, AXLE_LED_ORANGE_MOST, AXLE_LED_RED_MOST -> {
|
case AXLE_LED_RED, AXLE_LED_ORANGE, AXLE_LED_ORANGE_MOST, AXLE_LED_RED_MOST -> {
|
||||||
Optional<LogicSection> lsOptional = LineGraphicDataRepository.getDevices(lineId, LogicSection.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
Optional<LogicSection> lsOptional = LineGraphicDataRepository.getDevices(lineId, LogicSection.class).filter(d -> dto.getDeviceCodes().contains(d.getCode())).findAny();
|
||||||
@ -164,7 +164,7 @@ public class AlertMockService {
|
|||||||
track.setLineId(dto.getLineId());
|
track.setLineId(dto.getLineId());
|
||||||
track.setTimestamp(System.currentTimeMillis() / 1000);
|
track.setTimestamp(System.currentTimeMillis() / 1000);
|
||||||
LogicSection ls = lsOptional.orElse(null);
|
LogicSection ls = lsOptional.orElse(null);
|
||||||
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_TRACK, ls.getCommon().getId(), track, dto.getAll(), AlertDeviceType.DEVICE_TYPE_TRACK, true);
|
return this.alertInfoService.createAlert(dto.getAlertType(), AlertDeviceType.DEVICE_TYPE_TRACK, ls.getCommon().getId(), track, dto.getAll(), AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||||
}
|
}
|
||||||
case TRAIN_EB_ATP -> {
|
case TRAIN_EB_ATP -> {
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ public class AlertMockService {
|
|||||||
track.setTimestamp(System.currentTimeMillis() / 1000);
|
track.setTimestamp(System.currentTimeMillis() / 1000);
|
||||||
LogicSection ls = lsOptional.orElse(null);
|
LogicSection ls = lsOptional.orElse(null);
|
||||||
|
|
||||||
return this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRAIN, ls.getCommon().getId(), track, "测试车组号", AlertDeviceType.DEVICE_TYPE_TRAIN, true);
|
return this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRAIN, ls.getCommon().getId(), track, "测试车组号", AlertDeviceType.DEVICE_TYPE_TRAIN, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
default -> throw new IllegalStateException("Unexpected value: " + dto.getAlertType());
|
default -> throw new IllegalStateException("Unexpected value: " + dto.getAlertType());
|
||||||
|
Loading…
Reference in New Issue
Block a user