仿真存储数据结构修改、补全
This commit is contained in:
parent
39ab1f9c0b
commit
f7cb5fca15
@ -1,13 +1,13 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Catenary;
|
import club.joylink.rtss.simulation.cbtc.data.map.Catenary;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
||||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -15,7 +15,7 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StorageCatenary extends StorageDevice {
|
public class StorageCatenary extends StorageMayOutOfOrderDevice {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否带电
|
* 是否带电
|
||||||
@ -24,21 +24,32 @@ public class StorageCatenary extends StorageDevice {
|
|||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
private Boolean on;
|
private Boolean on;
|
||||||
|
|
||||||
public StorageCatenary(String code) {
|
public StorageCatenary(Catenary catenary) {
|
||||||
super(code);
|
super(catenary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageCatenary convert2Storage(Catenary catenary) {
|
public static StorageCatenary convert2Storage(Catenary catenary) {
|
||||||
StorageCatenary storageCatenary = new StorageCatenary(catenary.getCode());
|
StorageCatenary storageCatenary = new StorageCatenary(catenary);
|
||||||
if (!catenary.isOn()) {
|
if (storageCatenary.convert(catenary)) {
|
||||||
storageCatenary.setOn(catenary.isOn());
|
|
||||||
return storageCatenary;
|
return storageCatenary;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
Catenary catenary = (Catenary) element;
|
||||||
|
if (!catenary.isOn()) {
|
||||||
|
change = true;
|
||||||
|
this.setOn(catenary.isOn());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
|
super.recover2Simulation(element, simulation, repository);
|
||||||
Catenary catenary = (Catenary) element;
|
Catenary catenary = (Catenary) element;
|
||||||
catenary.setOn(on != null ? on : false);
|
catenary.setOn(on != null ? on : false);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StorageCycle extends StorageMayOutOfOrderDevice {
|
public class StorageCycle extends StorageDevice {
|
||||||
|
|
||||||
|
|
||||||
/** 是否已经设置 */
|
/** 是否已经设置 */
|
||||||
@ -22,23 +22,29 @@ public class StorageCycle extends StorageMayOutOfOrderDevice {
|
|||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
private Boolean setUp;
|
private Boolean setUp;
|
||||||
|
|
||||||
public StorageCycle(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
public StorageCycle(Cycle cycle) {
|
||||||
super(code, fault);
|
super(cycle.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageCycle convert2Storage(Cycle cycle) {
|
public static StorageCycle convert2Storage(Cycle cycle) {
|
||||||
boolean change = false;
|
StorageCycle storageCycle = new StorageCycle(cycle);
|
||||||
StorageCycle storageCycle = new StorageCycle(cycle.getCode(), null);
|
if (storageCycle.convert(cycle)) {
|
||||||
if (cycle.isSetUp()) {
|
|
||||||
change = true;
|
|
||||||
storageCycle.setSetUp(cycle.isSetUp());
|
|
||||||
}
|
|
||||||
if (change) {
|
|
||||||
return storageCycle;
|
return storageCycle;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = false;
|
||||||
|
Cycle cycle = (Cycle) element;
|
||||||
|
if (cycle.isSetUp()) {
|
||||||
|
change = true;
|
||||||
|
this.setSetUp(cycle.isSetUp());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
Cycle cycle = (Cycle) element;
|
Cycle cycle = (Cycle) element;
|
||||||
|
@ -1,27 +1,46 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.DelayUnlockDevice;
|
import club.joylink.rtss.simulation.cbtc.data.map.DelayUnlockDevice;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StorageDelayUnlockDevice extends StorageMayOutOfOrderDevice {
|
public class StorageDelayUnlockDevice extends StorageMayOutOfOrderDevice {
|
||||||
private int remain;
|
private int remain;
|
||||||
|
|
||||||
public StorageDelayUnlockDevice(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
public StorageDelayUnlockDevice(DelayUnlockDevice device) {
|
||||||
super(code, fault);
|
super(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveFrom(DelayUnlockDevice device) {
|
// public void saveFrom(DelayUnlockDevice device) {
|
||||||
|
// this.remain = device.getRemain();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// protected void recoverTo(DelayUnlockDevice device, SimulationDataRepository repository) {
|
||||||
|
// device.recover(this.remain);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
DelayUnlockDevice device = (DelayUnlockDevice) element;
|
||||||
|
if (device.getRemain() > 0) {
|
||||||
|
change = true;
|
||||||
this.remain = device.getRemain();
|
this.remain = device.getRemain();
|
||||||
}
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
protected void recoverTo(DelayUnlockDevice device, SimulationDataRepository repository) {
|
@Override
|
||||||
device.recover(this.remain);
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
|
super.recover2Simulation(element, simulation, repository);
|
||||||
|
DelayUnlockDevice device = (DelayUnlockDevice) element;
|
||||||
|
device.recover(remain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,7 @@ public abstract class StorageDevice {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract boolean convert(MapElement element);
|
||||||
|
|
||||||
public abstract void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository);
|
public abstract void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository);
|
||||||
}
|
}
|
||||||
|
@ -29,18 +29,22 @@ public class StorageESP extends StorageDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static StorageESP convert2Storage(ESP esp) {
|
public static StorageESP convert2Storage(ESP esp) {
|
||||||
boolean change = false;
|
|
||||||
StorageESP storageESP = new StorageESP(esp.getCode());
|
StorageESP storageESP = new StorageESP(esp.getCode());
|
||||||
if (esp.isEffective()) {
|
if (storageESP.convert(esp)) {
|
||||||
change = true;
|
|
||||||
storageESP.setEffective(esp.isEffective());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageESP;
|
return storageESP;
|
||||||
} else {
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = false;
|
||||||
|
ESP esp = (ESP) element;
|
||||||
|
if (esp.isEffective()) {
|
||||||
|
change = true;
|
||||||
|
this.setEffective(esp.isEffective());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,4 +52,5 @@ public class StorageESP extends StorageDevice {
|
|||||||
ESP esp = (ESP) element;
|
ESP esp = (ESP) element;
|
||||||
esp.setEffective(effective != null ? effective : false);
|
esp.setEffective(effective != null ? effective : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,27 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StorageMayOutOfOrderDevice extends StorageDevice {
|
public class StorageMayOutOfOrderDevice extends StorageStatusDevice {
|
||||||
private MayOutOfOrderDevice.DeviceFault fault;
|
private MayOutOfOrderDevice.DeviceFault fault;
|
||||||
|
|
||||||
public StorageMayOutOfOrderDevice(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
public StorageMayOutOfOrderDevice(MayOutOfOrderDevice device) {
|
||||||
super(code);
|
super(device);
|
||||||
this.fault = fault;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
MayOutOfOrderDevice device = (MayOutOfOrderDevice) element;
|
||||||
|
if (device.getFault() != null) {
|
||||||
|
change = true;
|
||||||
|
this.fault = device.getFault();
|
||||||
|
}
|
||||||
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
|
super.recover2Simulation(element, simulation, repository);
|
||||||
MayOutOfOrderDevice mayOutOfOrderDevice = (MayOutOfOrderDevice) element;
|
MayOutOfOrderDevice mayOutOfOrderDevice = (MayOutOfOrderDevice) element;
|
||||||
mayOutOfOrderDevice.setFault(fault);
|
mayOutOfOrderDevice.setFault(fault);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StoragePSD extends StorageDevice {
|
public class StoragePSD extends StorageStatusDevice {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 屏蔽门是否关闭
|
* 屏蔽门是否关闭
|
||||||
@ -38,13 +38,6 @@ public class StoragePSD extends StorageDevice {
|
|||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
private Boolean interlockRelease;
|
private Boolean interlockRelease;
|
||||||
|
|
||||||
/**
|
|
||||||
* 无状态
|
|
||||||
*/
|
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
|
||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
|
||||||
private Boolean noStatus;
|
|
||||||
|
|
||||||
// public StoragePSD(PSD psd) {
|
// public StoragePSD(PSD psd) {
|
||||||
// super(psd.getCode());
|
// super(psd.getCode());
|
||||||
// if (!psd.isClose()) {
|
// if (!psd.isClose()) {
|
||||||
@ -58,43 +51,43 @@ public class StoragePSD extends StorageDevice {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public StoragePSD(String code) {
|
public StoragePSD(PSD psd) {
|
||||||
super(code);
|
super(psd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StoragePSD convert2Storage(PSD psd) {
|
public static StoragePSD convert2Storage(PSD psd) {
|
||||||
boolean change = false;
|
StoragePSD storagePSD = new StoragePSD(psd);
|
||||||
StoragePSD storagePSD = new StoragePSD(psd.getCode());
|
if (storagePSD.convert(psd)) {
|
||||||
|
return storagePSD;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
PSD psd = (PSD) element;
|
||||||
if (!psd.isClose()) {
|
if (!psd.isClose()) {
|
||||||
change = true;
|
change = true;
|
||||||
storagePSD.setClose(psd.isClose());
|
this.setClose(psd.isClose());
|
||||||
}
|
}
|
||||||
if (!psd.isLock()) {
|
if (!psd.isLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storagePSD.setLock(psd.isLock());
|
this.setLock(psd.isLock());
|
||||||
}
|
}
|
||||||
if (psd.isInterlockRelease()) {
|
if (psd.isInterlockRelease()) {
|
||||||
change = true;
|
change = true;
|
||||||
storagePSD.setInterlockRelease(psd.isInterlockRelease());
|
this.setInterlockRelease(psd.isInterlockRelease());
|
||||||
}
|
|
||||||
if (psd.isNoStatus()) {
|
|
||||||
change = true;
|
|
||||||
storagePSD.setNoStatus(psd.isNoStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storagePSD;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
|
super.recover2Simulation(element, simulation, repository);
|
||||||
PSD psd = (PSD) element;
|
PSD psd = (PSD) element;
|
||||||
psd.setClose(close != null ? close : true);
|
psd.setClose(close != null ? close : true);
|
||||||
psd.setLock(lock != null ? lock : true);
|
psd.setLock(lock != null ? lock : true);
|
||||||
psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false);
|
psd.setInterlockRelease(interlockRelease != null ? interlockRelease : false);
|
||||||
psd.setNoStatus(noStatus != null ? noStatus : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,52 +104,57 @@ public class StorageRoute extends StorageDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static StorageRoute convert2Storage(Route route) {
|
public static StorageRoute convert2Storage(Route route) {
|
||||||
boolean change = false;
|
|
||||||
StorageRoute storageRoute = new StorageRoute(route.getCode());
|
StorageRoute storageRoute = new StorageRoute(route.getCode());
|
||||||
if (!route.isAtsControl()) {
|
if (storageRoute.convert(route)) {
|
||||||
change = true;
|
|
||||||
storageRoute.setAtsControl(route.isAtsControl());
|
|
||||||
}
|
|
||||||
if (route.isFleetMode()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setFleetMode(route.isFleetMode());
|
|
||||||
}
|
|
||||||
if (route.isCiControl()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setCiControl(route.isCiControl());
|
|
||||||
}
|
|
||||||
if (route.isSetting()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setSetting(route.isSetting());
|
|
||||||
storageRoute.setSettingStartTime(route.getSettingStartTime());
|
|
||||||
}
|
|
||||||
if (route.isGuideSetting()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setSettingGuide(route.isGuideSetting());
|
|
||||||
}
|
|
||||||
if (route.isLock()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setLock(route.isLock());
|
|
||||||
}
|
|
||||||
if (route.getDelayUnlockDevice() != null) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setDelayUnlockDevice(route.getDelayUnlockDevice().getCode());
|
|
||||||
}
|
|
||||||
if (route.isNormalUnlock()) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setNormalUnlock(route.isNormalUnlock());
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(route.getUnlockedSection())) {
|
|
||||||
change = true;
|
|
||||||
storageRoute.setUnlockedSection(route.getUnlockedSection().getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageRoute;
|
return storageRoute;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = false;
|
||||||
|
Route route = (Route) element;
|
||||||
|
if (!route.isAtsControl()) {
|
||||||
|
change = true;
|
||||||
|
this.setAtsControl(route.isAtsControl());
|
||||||
|
}
|
||||||
|
if (route.isFleetMode()) {
|
||||||
|
change = true;
|
||||||
|
this.setFleetMode(route.isFleetMode());
|
||||||
|
}
|
||||||
|
if (route.isCiControl()) {
|
||||||
|
change = true;
|
||||||
|
this.setCiControl(route.isCiControl());
|
||||||
|
}
|
||||||
|
if (route.isSetting()) {
|
||||||
|
change = true;
|
||||||
|
this.setSetting(route.isSetting());
|
||||||
|
this.setSettingStartTime(route.getSettingStartTime());
|
||||||
|
}
|
||||||
|
if (route.isGuideSetting()) {
|
||||||
|
change = true;
|
||||||
|
this.setSettingGuide(route.isGuideSetting());
|
||||||
|
}
|
||||||
|
if (route.isLock()) {
|
||||||
|
change = true;
|
||||||
|
this.setLock(route.isLock());
|
||||||
|
}
|
||||||
|
if (route.getDelayUnlockDevice() != null) {
|
||||||
|
change = true;
|
||||||
|
this.setDelayUnlockDevice(route.getDelayUnlockDevice().getCode());
|
||||||
|
}
|
||||||
|
if (route.isNormalUnlock()) {
|
||||||
|
change = true;
|
||||||
|
this.setNormalUnlock(route.isNormalUnlock());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(route.getUnlockedSection())) {
|
||||||
|
change = true;
|
||||||
|
this.setUnlockedSection(route.getUnlockedSection().getCode());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
Route route = (Route) element;
|
Route route = (Route) element;
|
||||||
@ -168,4 +173,5 @@ public class StorageRoute extends StorageDevice {
|
|||||||
route.setUnlockedSection(repository.getByCode(this.unlockedSection, Section.class));
|
route.setUnlockedSection(repository.getByCode(this.unlockedSection, Section.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,36 +49,40 @@ public class StorageRouteOverlap extends StorageDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static StorageRouteOverlap convert2Storage(RouteOverlap overlap) {
|
public static StorageRouteOverlap convert2Storage(RouteOverlap overlap) {
|
||||||
boolean change = false;
|
|
||||||
StorageRouteOverlap storageOverlap = new StorageRouteOverlap(overlap.getCode());
|
StorageRouteOverlap storageOverlap = new StorageRouteOverlap(overlap.getCode());
|
||||||
if (overlap.isReleasing()) {
|
if (storageOverlap.convert(overlap)) {
|
||||||
change = true;
|
|
||||||
storageOverlap.setReleasing(overlap.isReleasing());
|
|
||||||
}
|
|
||||||
if (overlap.isSetting()) {
|
|
||||||
change = true;
|
|
||||||
storageOverlap.setSetting(overlap.isSetting());
|
|
||||||
}
|
|
||||||
if (overlap.isLock()) {
|
|
||||||
change = true;
|
|
||||||
storageOverlap.setLock(overlap.isLock());
|
|
||||||
}
|
|
||||||
if (overlap.getRemainTime() > 0) {
|
|
||||||
change = true;
|
|
||||||
storageOverlap.setRemainTime(overlap.getRemainTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.nonNull(overlap.getSettingStartTime())) {
|
|
||||||
change = true;
|
|
||||||
storageOverlap.setSettingStartTime(overlap.getSettingStartTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageOverlap;
|
return storageOverlap;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = false;
|
||||||
|
RouteOverlap overlap = (RouteOverlap) element;
|
||||||
|
if (overlap.isReleasing()) {
|
||||||
|
change = true;
|
||||||
|
this.setReleasing(overlap.isReleasing());
|
||||||
|
}
|
||||||
|
if (overlap.isSetting()) {
|
||||||
|
change = true;
|
||||||
|
this.setSetting(overlap.isSetting());
|
||||||
|
}
|
||||||
|
if (overlap.isLock()) {
|
||||||
|
change = true;
|
||||||
|
this.setLock(overlap.isLock());
|
||||||
|
}
|
||||||
|
if (overlap.getRemainTime() > 0) {
|
||||||
|
change = true;
|
||||||
|
this.setRemainTime(overlap.getRemainTime());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(overlap.getSettingStartTime())) {
|
||||||
|
change = true;
|
||||||
|
this.setSettingStartTime(overlap.getSettingStartTime());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
RouteOverlap overlap = (RouteOverlap) element;
|
RouteOverlap overlap = (RouteOverlap) element;
|
||||||
|
@ -15,6 +15,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ -88,103 +89,79 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
|||||||
*/
|
*/
|
||||||
private Integer speedUpLimit;
|
private Integer speedUpLimit;
|
||||||
|
|
||||||
|
private Integer speedLimitBeforeFault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区故解第一根延时解锁剩余时间
|
* 区故解第一根延时解锁剩余时间
|
||||||
*/
|
*/
|
||||||
private Integer delayTime;
|
private Integer delayTime;
|
||||||
|
|
||||||
/**
|
public StorageSection(Section section) {
|
||||||
* 无状态
|
super(section);
|
||||||
*/
|
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
|
||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
|
||||||
private Boolean noStatus;
|
|
||||||
|
|
||||||
public StorageSection(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
|
||||||
super(code, fault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public StorageSection(Section section) {
|
|
||||||
// super(section.getCode());
|
|
||||||
// blockade = section.isBlockade();
|
|
||||||
// routeCode = section.getRouteCode();
|
|
||||||
// routeLock = section.isRouteLock();
|
|
||||||
// overlapLock = section.isOverlapLock();
|
|
||||||
// ctOccupied = section.isCtOccupied();
|
|
||||||
// nctOccupied = section.isNctOccupied();
|
|
||||||
// cutOff = section.isCutOff();
|
|
||||||
// invalid = section.isInvalid();
|
|
||||||
// faultLock = section.isFaultLock();
|
|
||||||
// speedUpLimit = section.getSpeedUpLimit();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static StorageSection convert2Storage(Section section) {
|
public static StorageSection convert2Storage(Section section) {
|
||||||
boolean change = false;
|
StorageSection storageSection = new StorageSection(section);
|
||||||
StorageSection storageSection = new StorageSection(section.getCode(), section.getFault());
|
if (storageSection.convert(section)) {
|
||||||
if (storageSection.isFault()) {
|
return storageSection;
|
||||||
change = true;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
Section section = (Section) element;
|
||||||
if (section.isBlockade()) {
|
if (section.isBlockade()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setBlockade(section.isBlockade());
|
this.setBlockade(section.isBlockade());
|
||||||
}
|
}
|
||||||
if (section.isRouteLock()) {
|
if (section.isRouteLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setRouteLock(section.isRouteLock());
|
this.setRouteLock(section.isRouteLock());
|
||||||
}
|
}
|
||||||
Route route = section.getRoute();
|
Route route = section.getRoute();
|
||||||
if (route != null) {
|
if (route != null) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setRoute(route.getCode());
|
this.setRoute(route.getCode());
|
||||||
}
|
}
|
||||||
if (section.isLockRight()) {
|
if (section.isLockRight()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setLockRight(section.isLockRight());
|
this.setLockRight(section.isLockRight());
|
||||||
}
|
}
|
||||||
if (section.isOverlapLock()) {
|
if (section.isOverlapLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setOverlapLock(section.isOverlapLock());
|
this.setOverlapLock(section.isOverlapLock());
|
||||||
}
|
}
|
||||||
if (section.isCtOccupied()) {
|
if (section.isCtOccupied()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setCtOccupied(section.isCtOccupied());
|
this.setCtOccupied(section.isCtOccupied());
|
||||||
}
|
}
|
||||||
if (section.isNctOccupied()) {
|
if (section.isNctOccupied()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setNctOccupied(section.isNctOccupied());
|
this.setNctOccupied(section.isNctOccupied());
|
||||||
}
|
}
|
||||||
if (section.isCutOff()) {
|
if (section.isCutOff()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setCutOff(section.isCutOff());
|
this.setCutOff(section.isCutOff());
|
||||||
}
|
}
|
||||||
if (section.isInvalid()) {
|
if (section.isInvalid()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setInvalid(section.isInvalid());
|
this.setInvalid(section.isInvalid());
|
||||||
}
|
}
|
||||||
if (section.isFaultLock()) {
|
if (section.isFaultLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setFaultLock(section.isFaultLock());
|
this.setFaultLock(section.isFaultLock());
|
||||||
}
|
}
|
||||||
if (!Objects.equals(section.getSpeedUpLimit(), -1)) {
|
if (!Objects.equals(section.getSpeedUpLimit(), -1)) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.setSpeedUpLimit(section.getSpeedUpLimit());
|
this.setSpeedUpLimit(section.getSpeedUpLimit());
|
||||||
}
|
}
|
||||||
if (section.getRemain() > 0) {
|
if (section.getSpeedLimitBeforeFault() != null) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSection.saveFrom(section);
|
this.speedLimitBeforeFault = section.getSpeedLimitBeforeFault();
|
||||||
}
|
}
|
||||||
if (section.isNoStatus()) {
|
return change;
|
||||||
change = true;
|
|
||||||
storageSection.setNoStatus(section.isNoStatus());
|
|
||||||
}
|
|
||||||
if (section.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageSection;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -202,9 +179,6 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
|||||||
section.setInvalid(invalid != null? invalid : false);
|
section.setInvalid(invalid != null? invalid : false);
|
||||||
section.setFaultLock(faultLock != null ? faultLock : false);
|
section.setFaultLock(faultLock != null ? faultLock : false);
|
||||||
section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1);
|
section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1);
|
||||||
if (this.getRemain() > 0) {
|
section.setSpeedLimitBeforeFault(speedLimitBeforeFault);
|
||||||
this.recoverTo(section, repository);
|
|
||||||
}
|
|
||||||
section.setNoStatus(noStatus != null ? noStatus : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,73 +81,57 @@ public class StorageSignal extends StorageDelayUnlockDevice {
|
|||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
private Boolean redOpen;
|
private Boolean redOpen;
|
||||||
|
|
||||||
/**
|
public StorageSignal(Signal signal) {
|
||||||
* 无状态
|
super(signal);
|
||||||
*/
|
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
|
||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
|
||||||
private Boolean noStatus;
|
|
||||||
|
|
||||||
public StorageSignal(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
|
||||||
super(code, fault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageSignal convert2Storage(Signal signal) {
|
public static StorageSignal convert2Storage(Signal signal) {
|
||||||
boolean change = false;
|
StorageSignal storageSignal = new StorageSignal(signal);
|
||||||
StorageSignal storageSignal = new StorageSignal(signal.getCode(), signal.getFault());
|
if (storageSignal.convert(signal)) {
|
||||||
if (storageSignal.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
if (signal.getLockedRouteCode() != null) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setLockedRouteCode(signal.getLockedRouteCode());
|
|
||||||
}
|
|
||||||
if (signal.isBlockade()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setBlockade(signal.isBlockade());
|
|
||||||
}
|
|
||||||
if (signal.getLevel() != 1) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setLevel(signal.getLevel());
|
|
||||||
}
|
|
||||||
if (signal.isReblockade()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setReblockade(signal.isReblockade());
|
|
||||||
}
|
|
||||||
if (signal.isFpl()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setFpl(signal.isFpl());
|
|
||||||
}
|
|
||||||
if (!signal.isLogicLight()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setLogicLight(signal.isLogicLight());
|
|
||||||
}
|
|
||||||
if (!signal.getSignalModel().getDefaultAspect().equals(signal.getAspect())) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setAspect(signal.getAspect());
|
|
||||||
}
|
|
||||||
if (signal.isForbidden()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setForbidden(signal.isForbidden());
|
|
||||||
}
|
|
||||||
if (signal.getRemain() > 0) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.saveFrom(signal);
|
|
||||||
}
|
|
||||||
if (signal.isNoStatus()) {
|
|
||||||
change = true;
|
|
||||||
storageSignal.setNoStatus(signal.isNoStatus());
|
|
||||||
}
|
|
||||||
if (signal.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageSignal;
|
return storageSignal;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
Signal signal = (Signal) element;
|
||||||
|
if (signal.getLockedRouteCode() != null) {
|
||||||
|
change = true;
|
||||||
|
this.setLockedRouteCode(signal.getLockedRouteCode());
|
||||||
|
}
|
||||||
|
if (signal.isBlockade()) {
|
||||||
|
change = true;
|
||||||
|
this.setBlockade(signal.isBlockade());
|
||||||
|
}
|
||||||
|
if (signal.getLevel() != 1) {
|
||||||
|
change = true;
|
||||||
|
this.setLevel(signal.getLevel());
|
||||||
|
}
|
||||||
|
if (signal.isReblockade()) {
|
||||||
|
change = true;
|
||||||
|
this.setReblockade(signal.isReblockade());
|
||||||
|
}
|
||||||
|
if (signal.isFpl()) {
|
||||||
|
change = true;
|
||||||
|
this.setFpl(signal.isFpl());
|
||||||
|
}
|
||||||
|
if (!signal.isLogicLight()) {
|
||||||
|
change = true;
|
||||||
|
this.setLogicLight(signal.isLogicLight());
|
||||||
|
}
|
||||||
|
if (!signal.getSignalModel().getDefaultAspect().equals(signal.getAspect())) {
|
||||||
|
change = true;
|
||||||
|
this.setAspect(signal.getAspect());
|
||||||
|
}
|
||||||
|
if (signal.isForbidden()) {
|
||||||
|
change = true;
|
||||||
|
this.setForbidden(signal.isForbidden());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
super.recover2Simulation(element, simulation, repository);
|
super.recover2Simulation(element, simulation, repository);
|
||||||
@ -163,9 +147,5 @@ public class StorageSignal extends StorageDelayUnlockDevice {
|
|||||||
signal.setAspect(aspect);
|
signal.setAspect(aspect);
|
||||||
}
|
}
|
||||||
signal.setForbidden(this.forbidden == null ? false : this.forbidden);
|
signal.setForbidden(this.forbidden == null ? false : this.forbidden);
|
||||||
if (this.getRemain() > 0) {
|
|
||||||
this.recoverTo(signal, repository);
|
|
||||||
}
|
|
||||||
signal.setNoStatus(noStatus != null ? noStatus : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,15 +105,8 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
|||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
private Boolean parkingAlwaysValid;
|
private Boolean parkingAlwaysValid;
|
||||||
|
|
||||||
/**
|
public StorageStand(Stand stand) {
|
||||||
* 无状态
|
super(stand);
|
||||||
*/
|
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
|
||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
|
||||||
private Boolean noStatus;
|
|
||||||
|
|
||||||
public StorageStand(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
|
||||||
super(code, fault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public StorageStand(Stand stand) {
|
// public StorageStand(Stand stand) {
|
||||||
@ -133,78 +126,73 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public static StorageStand convert2Storage(Stand stand) {
|
public static StorageStand convert2Storage(Stand stand) {
|
||||||
boolean change = false;
|
StorageStand storageStand = new StorageStand(stand);
|
||||||
StorageStand storageStand = new StorageStand(stand.getCode(), stand.getFault());
|
if (storageStand.convert(stand)) {
|
||||||
if (storageStand.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
StorageESP storageESP = StorageESP.convert(stand.getEsp());
|
|
||||||
if (storageESP != null) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setEsp(storageESP);
|
|
||||||
}
|
|
||||||
if (stand.isTrainParking()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setTrainParking(stand.isTrainParking());
|
|
||||||
}
|
|
||||||
if (stand.isEmergencyClosed()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setEmergencyClosed(stand.isEmergencyClosed());
|
|
||||||
}
|
|
||||||
if (stand.getRemainTime() > 0) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setRemainTime(stand.getRemainTime());
|
|
||||||
}
|
|
||||||
if (stand.isStationHoldTrain()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setStationHoldTrain(stand.isStationHoldTrain());
|
|
||||||
}
|
|
||||||
if (stand.isCenterHoldTrain()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setCenterHoldTrain(stand.isCenterHoldTrain());
|
|
||||||
}
|
|
||||||
if (stand.isAutoHoldTrain()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setAutoHoldTrain(stand.isAutoHoldTrain());
|
|
||||||
}
|
|
||||||
if (stand.isAllSkip()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setAllSkip(stand.isAssignSkip());
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(stand.getSkipSet())) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setSkipSet(stand.getSkipSet());
|
|
||||||
}
|
|
||||||
if (!Objects.equals(stand.getRunLevelTime(), 0)) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setRunLevelTime(stand.getRunLevelTime());
|
|
||||||
}
|
|
||||||
if (stand.isRunLevelTimeForever()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setRunLevelTimeForever(stand.isRunLevelTimeForever());
|
|
||||||
}
|
|
||||||
if (!Objects.equals(stand.getParkingTime(), -1)) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setParkingTime(stand.getParkingTime());
|
|
||||||
}
|
|
||||||
if (stand.isParkingAlwaysValid()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setParkingAlwaysValid(stand.isParkingAlwaysValid());
|
|
||||||
}
|
|
||||||
if (stand.isNoStatus()) {
|
|
||||||
change = true;
|
|
||||||
storageStand.setNoStatus(stand.isNoStatus());
|
|
||||||
}
|
|
||||||
if (stand.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageStand;
|
return storageStand;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
Stand stand = (Stand) element;
|
||||||
|
StorageESP storageESP = StorageESP.convert(stand.getEsp());
|
||||||
|
if (storageESP != null) {
|
||||||
|
change = true;
|
||||||
|
this.setEsp(storageESP);
|
||||||
|
}
|
||||||
|
if (stand.isTrainParking()) {
|
||||||
|
change = true;
|
||||||
|
this.setTrainParking(stand.isTrainParking());
|
||||||
|
}
|
||||||
|
if (stand.isEmergencyClosed()) {
|
||||||
|
change = true;
|
||||||
|
this.setEmergencyClosed(stand.isEmergencyClosed());
|
||||||
|
}
|
||||||
|
if (stand.getRemainTime() > 0) {
|
||||||
|
change = true;
|
||||||
|
this.setRemainTime(stand.getRemainTime());
|
||||||
|
}
|
||||||
|
if (stand.isStationHoldTrain()) {
|
||||||
|
change = true;
|
||||||
|
this.setStationHoldTrain(stand.isStationHoldTrain());
|
||||||
|
}
|
||||||
|
if (stand.isCenterHoldTrain()) {
|
||||||
|
change = true;
|
||||||
|
this.setCenterHoldTrain(stand.isCenterHoldTrain());
|
||||||
|
}
|
||||||
|
if (stand.isAutoHoldTrain()) {
|
||||||
|
change = true;
|
||||||
|
this.setAutoHoldTrain(stand.isAutoHoldTrain());
|
||||||
|
}
|
||||||
|
if (stand.isAllSkip()) {
|
||||||
|
change = true;
|
||||||
|
this.setAllSkip(stand.isAssignSkip());
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(stand.getSkipSet())) {
|
||||||
|
change = true;
|
||||||
|
this.setSkipSet(stand.getSkipSet());
|
||||||
|
}
|
||||||
|
if (!Objects.equals(stand.getRunLevelTime(), 0)) {
|
||||||
|
change = true;
|
||||||
|
this.setRunLevelTime(stand.getRunLevelTime());
|
||||||
|
}
|
||||||
|
if (stand.isRunLevelTimeForever()) {
|
||||||
|
change = true;
|
||||||
|
this.setRunLevelTimeForever(stand.isRunLevelTimeForever());
|
||||||
|
}
|
||||||
|
if (!Objects.equals(stand.getParkingTime(), -1)) {
|
||||||
|
change = true;
|
||||||
|
this.setParkingTime(stand.getParkingTime());
|
||||||
|
}
|
||||||
|
if (stand.isParkingAlwaysValid()) {
|
||||||
|
change = true;
|
||||||
|
this.setParkingAlwaysValid(stand.isParkingAlwaysValid());
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
super.recover2Simulation(element, simulation, repository);
|
super.recover2Simulation(element, simulation, repository);
|
||||||
@ -221,7 +209,6 @@ public class StorageStand extends StorageMayOutOfOrderDevice {
|
|||||||
stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false);
|
stand.setRunLevelTimeForever(runLevelTimeForever != null ? runLevelTimeForever : false);
|
||||||
stand.setParkingTime(parkingTime != null ? parkingTime : -1);
|
stand.setParkingTime(parkingTime != null ? parkingTime : -1);
|
||||||
stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false);
|
stand.setParkingAlwaysValid(parkingAlwaysValid != null ? parkingAlwaysValid : false);
|
||||||
stand.setNoStatus(noStatus != null ? noStatus : false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StorageStation extends StorageDevice {
|
public class StorageStation extends StorageStatusDevice {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有控制模式
|
* 是否有控制模式
|
||||||
@ -65,8 +65,8 @@ public class StorageStation extends StorageDevice {
|
|||||||
|
|
||||||
private Integer preResetValidDuration;
|
private Integer preResetValidDuration;
|
||||||
|
|
||||||
public StorageStation(String code) {
|
public StorageStation(Station station) {
|
||||||
super(code);
|
super(station);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public StorageStation(Station station) {
|
// public StorageStation(Station station) {
|
||||||
@ -76,35 +76,42 @@ public class StorageStation extends StorageDevice {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public static StorageStation convert2Storage(Station station) {
|
public static StorageStation convert2Storage(Station station) {
|
||||||
StorageStation storageStation = new StorageStation(station.getCode());
|
StorageStation storageStation = new StorageStation(station);
|
||||||
storageStation.setControlMode(station.getControlMode());
|
storageStation.convert(station);
|
||||||
storageStation.setTbStrategyId(station.getTbStrategyId());
|
return storageStation;
|
||||||
if (station.isTotalGuideLock()) {
|
|
||||||
storageStation.setTotalGuideLock(station.isTotalGuideLock());
|
|
||||||
}
|
|
||||||
if (station.getApplicant() != null) {
|
|
||||||
storageStation.setApplicant(station.getApplicant().getId());
|
|
||||||
}
|
|
||||||
if (station.getApply2TheControlMode() != null) {
|
|
||||||
storageStation.setApply2TheControlMode(station.getApply2TheControlMode());
|
|
||||||
}
|
|
||||||
if (station.getValidDuration() != null) {
|
|
||||||
storageStation.setValidDuration(station.getValidDuration());
|
|
||||||
}
|
|
||||||
if (station.isInterlockMachineStarting()) {
|
|
||||||
storageStation.setInterlockMachineStarting(station.isInterlockMachineStarting());
|
|
||||||
}
|
|
||||||
storageStation.setRestartTime(station.getRestartTime());
|
|
||||||
storageStation.setController(station.getControllerId());
|
|
||||||
if (station.isEmergencyController()) {
|
|
||||||
storageStation.setEmergencyController(station.isEmergencyController());
|
|
||||||
}
|
|
||||||
storageStation.setControlApplicant(station.getControlApplicantId());
|
|
||||||
if (station.getPreResetValidDuration() != null && station.getPreResetValidDuration().get() != 0) {
|
|
||||||
storageStation.setPreResetValidDuration(station.getPreResetValidDuration().get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return storageStation;
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
super.convert(element);
|
||||||
|
Station station = (Station) element;
|
||||||
|
this.setControlMode(station.getControlMode());
|
||||||
|
this.setTbStrategyId(station.getTbStrategyId());
|
||||||
|
if (station.isTotalGuideLock()) {
|
||||||
|
this.setTotalGuideLock(station.isTotalGuideLock());
|
||||||
|
}
|
||||||
|
if (station.getApplicant() != null) {
|
||||||
|
this.setApplicant(station.getApplicant().getId());
|
||||||
|
}
|
||||||
|
if (station.getApply2TheControlMode() != null) {
|
||||||
|
this.setApply2TheControlMode(station.getApply2TheControlMode());
|
||||||
|
}
|
||||||
|
if (station.getValidDuration() != null) {
|
||||||
|
this.setValidDuration(station.getValidDuration());
|
||||||
|
}
|
||||||
|
if (station.isInterlockMachineStarting()) {
|
||||||
|
this.setInterlockMachineStarting(station.isInterlockMachineStarting());
|
||||||
|
}
|
||||||
|
this.setRestartTime(station.getRestartTime());
|
||||||
|
this.setController(station.getControllerId());
|
||||||
|
if (station.isEmergencyController()) {
|
||||||
|
this.setEmergencyController(station.isEmergencyController());
|
||||||
|
}
|
||||||
|
this.setControlApplicant(station.getControlApplicantId());
|
||||||
|
if (station.getPreResetValidDuration() != null && station.getPreResetValidDuration().get() != 0) {
|
||||||
|
this.setPreResetValidDuration(station.getPreResetValidDuration().get());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.StatusDevice;
|
||||||
|
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
||||||
|
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class StorageStatusDevice extends StorageDevice{
|
||||||
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
|
private Boolean noStatus;
|
||||||
|
|
||||||
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
|
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||||
|
private Boolean atsNoStatus;
|
||||||
|
|
||||||
|
public StorageStatusDevice(StatusDevice device) {
|
||||||
|
super(device.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
StatusDevice device = (StatusDevice) element;
|
||||||
|
boolean change = false;
|
||||||
|
if (device.isNoStatus()) {
|
||||||
|
change = true;
|
||||||
|
this.noStatus = true;
|
||||||
|
}
|
||||||
|
if (device.isAtsNoStatus()) {
|
||||||
|
change = true;
|
||||||
|
this.setAtsNoStatus(true);
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||||
|
StatusDevice device = (StatusDevice) element;
|
||||||
|
device.setNoStatus(this.noStatus == null ? false : this.noStatus);
|
||||||
|
device.setAtsNoStatus(this.atsNoStatus == null ? false : this.atsNoStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -76,75 +76,62 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
|||||||
*/
|
*/
|
||||||
private SwitchIndication pos;
|
private SwitchIndication pos;
|
||||||
|
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
public StorageSwitch(Switch aSwitch) {
|
||||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
super(aSwitch);
|
||||||
private Boolean noStatus;
|
|
||||||
|
|
||||||
public StorageSwitch(String code, MayOutOfOrderDevice.DeviceFault fault) {
|
|
||||||
super(code, fault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageSwitch convert2Storage(Switch s) {
|
public static StorageSwitch convert2Storage(Switch s) {
|
||||||
boolean change = false;
|
StorageSwitch storageSwitch = new StorageSwitch(s);
|
||||||
StorageSwitch storageSwitch = new StorageSwitch(s.getCode(), s.getFault());
|
if (storageSwitch.convert(s)) {
|
||||||
if (storageSwitch.isFault()) {
|
return storageSwitch;
|
||||||
change = true;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean convert(MapElement element) {
|
||||||
|
boolean change = super.convert(element);
|
||||||
|
Switch s = (Switch) element;
|
||||||
if (s.isSingleLock()) {
|
if (s.isSingleLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setSingleLock(s.isSingleLock());
|
this.setSingleLock(s.isSingleLock());
|
||||||
}
|
}
|
||||||
if (s.isBlockade()) {
|
if (s.isBlockade()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setBlockade(s.isBlockade());
|
this.setBlockade(s.isBlockade());
|
||||||
}
|
}
|
||||||
if (s.isRouteLock()) {
|
if (s.isRouteLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setRouteLock(s.isRouteLock());
|
this.setRouteLock(s.isRouteLock());
|
||||||
}
|
}
|
||||||
// Route route = s.getRoutes();
|
// Route route = s.getRoutes();
|
||||||
// if (route != null) {
|
// if (route != null) {
|
||||||
// change = true;
|
// change = true;
|
||||||
// storageSwitch.setRoute(route.getCode());
|
// this.setRoute(route.getCode());
|
||||||
// }
|
// }
|
||||||
Set<Route> routes = s.getRoutes();
|
Set<Route> routes = s.getRoutes();
|
||||||
if (!CollectionUtils.isEmpty(routes)) {
|
if (!CollectionUtils.isEmpty(routes)) {
|
||||||
change = true;
|
change = true;
|
||||||
Set<String> routeCodes = routes.stream().map(MapElement::getCode).collect(Collectors.toSet());
|
Set<String> routeCodes = routes.stream().map(MapElement::getCode).collect(Collectors.toSet());
|
||||||
storageSwitch.setRoutes(routeCodes);
|
this.setRoutes(routeCodes);
|
||||||
}
|
}
|
||||||
if (s.isFpLock()) {
|
if (s.isFpLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setFpLock(s.isFpLock());
|
this.setFpLock(s.isFpLock());
|
||||||
}
|
}
|
||||||
if (s.isOverlapLock()) {
|
if (s.isOverlapLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setOverlapLock(s.isOverlapLock());
|
this.setOverlapLock(s.isOverlapLock());
|
||||||
}
|
}
|
||||||
if (s.isMasterGuideLock()) {
|
if (s.isMasterGuideLock()) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setMasterGuideLock(s.isMasterGuideLock());
|
this.setMasterGuideLock(s.isMasterGuideLock());
|
||||||
}
|
}
|
||||||
if (!SwitchIndication.N.equals(s.getPos())) {
|
if (!SwitchIndication.N.equals(s.getPos())) {
|
||||||
change = true;
|
change = true;
|
||||||
storageSwitch.setPos(s.getPos());
|
this.setPos(s.getPos());
|
||||||
}
|
}
|
||||||
if (s.getRemain() > 0) {
|
return change;
|
||||||
change = true;
|
|
||||||
storageSwitch.saveFrom(s);
|
|
||||||
}
|
|
||||||
if (s.isNoStatus()) {
|
|
||||||
change = true;
|
|
||||||
storageSwitch.setNoStatus(s.isNoStatus());
|
|
||||||
}
|
|
||||||
if (s.isFault()) {
|
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageSwitch;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -171,9 +158,5 @@ public class StorageSwitch extends StorageDelayUnlockDevice {
|
|||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
s.setPos(pos);
|
s.setPos(pos);
|
||||||
}
|
}
|
||||||
if (this.getRemain() > 0) {
|
|
||||||
this.recoverTo(s, repository);
|
|
||||||
}
|
|
||||||
s.setNoStatus(noStatus != null ? noStatus : false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,12 @@ import lombok.Setter;
|
|||||||
public class StorageZC extends StorageMayOutOfOrderDevice {
|
public class StorageZC extends StorageMayOutOfOrderDevice {
|
||||||
|
|
||||||
private StorageZC (ZC zc) {
|
private StorageZC (ZC zc) {
|
||||||
super(zc.getCode(), zc.getFault());
|
super(zc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageZC convert2Storage(ZC zc) {
|
public static StorageZC convert2Storage(ZC zc) {
|
||||||
boolean change = false;
|
|
||||||
StorageZC storageZC = new StorageZC(zc);
|
StorageZC storageZC = new StorageZC(zc);
|
||||||
if (zc.isFault()) {
|
if (storageZC.convert(zc)) {
|
||||||
change = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
return storageZC;
|
return storageZC;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user