修改:IBP盘bug

This commit is contained in:
joylink_zhangsai 2021-06-16 13:41:29 +08:00
parent 344275fb68
commit b0bc56dd81

View File

@ -21,6 +21,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.ibp.IbpData; import club.joylink.rtss.vo.client.ibp.IbpData;
import club.joylink.rtss.vo.client.ibp.IbpQueryVO;
import club.joylink.rtss.vo.client.ibp.IbpVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -199,8 +201,11 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
VirtualRealityIbp ibp = station.getVrIbp(); VirtualRealityIbp ibp = station.getVrIbp();
if (ibp == null) if (ibp == null)
continue; continue;
List<VirtualRealityIbp.IbpElement> buttons = ibp.queryByType(VirtualRealityIbp.Mean.PRERESET_Z);
if (CollectionUtils.isEmpty(buttons))
continue;
VirtualRealityIbp.SquareButton preResetButton = VirtualRealityIbp.SquareButton preResetButton =
(VirtualRealityIbp.SquareButton) ibp.queryByType(VirtualRealityIbp.Mean.PRERESET_Z).get(0); (VirtualRealityIbp.SquareButton) buttons.get(0);
if (!preResetButton.isDown()) if (!preResetButton.isDown())
continue; continue;
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
@ -223,7 +228,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
throw new SimulationException(SimulationExceptionType.System_Fault, "车辆段没有IBP盘"); throw new SimulationException(SimulationExceptionType.System_Fault, "车辆段没有IBP盘");
} }
if (station.getVrIbp() == null) { if (station.getVrIbp() == null) {
Ibp ibp = ibpService.queryEntityBy(simulation.getBuildParams().getMap().getId(), station.getCode()); IbpVO ibp = ibpService.getBy(new IbpQueryVO(simulation.getBuildParams().getMap().getId(), station.getCode()));
IbpData ibpData = JsonUtils.read(ibp.getData(), IbpData.class); IbpData ibpData = JsonUtils.read(ibp.getData(), IbpData.class);
VirtualRealityIbp vrIbp = new VirtualRealityIbp(ibpData); VirtualRealityIbp vrIbp = new VirtualRealityIbp(ibpData);
station.setVrIbp(vrIbp); station.setVrIbp(vrIbp);