代码调整

This commit is contained in:
tiger_zhou 2023-09-20 16:48:21 +08:00
parent 6fdb913d2c
commit 922cb14c08
2 changed files with 8 additions and 8 deletions

View File

@ -39,8 +39,8 @@ public class AlertMockController {
@SecurityRequirement(name = "jwt")
@Operation(summary = "设置模拟故障")
@ApiResponse(description = "设置模拟故障")
@PostMapping("/set2/{alertType}")
public void setAlert2(@RequestBody String json, @PathVariable("alertType") AlertType alertType) {
@PostMapping("/localDemoTest/{alertType}")
public void localDemoTest(@RequestBody String json, @PathVariable("alertType") AlertType alertType) {
alertMockService.newSetAlert(json, alertType);
}

View File

@ -110,7 +110,7 @@ public class AlertMockService {
bb.setTimestamp(System.currentTimeMillis() / 1000);
bb.setId(dto.getFrist());
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 -> {
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 pf = pfOptional.orElse(null);
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 -> {
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 pf = pfOptional.orElse(null);
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 -> {
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.setIpSingleSwitchStusLostIndication(true);
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 -> {
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.setTimestamp(System.currentTimeMillis() / 1000);
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 -> {
@ -176,7 +176,7 @@ public class AlertMockService {
track.setTimestamp(System.currentTimeMillis() / 1000);
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());