From 6dee8dfa314eb171579450fe662e417355daa2eb Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 6 Aug 2021 14:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=82=B9=E7=99=BB=E5=BD=95=E8=A2=AB?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E5=90=8E=E5=8F=91=E9=80=81socket=E6=B6=88?= =?UTF-8?q?=E6=81=AF=EF=BC=9BARB=E6=95=85=E9=9A=9C=E5=9C=A8=E6=9C=89?= =?UTF-8?q?=E9=9D=9E=E9=80=9A=E4=BF=A1=E8=BD=A6=E6=8E=A5=E8=BF=91=E6=97=B6?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=AE=A1=E8=BD=B4=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/services/DraftMapService.java | 1 - .../rtss/services/auth/AuthenticateService.java | 8 ++++++++ .../cbtc/ATP/ground/AtpSectionService.java | 14 +++++++------- .../rtss/simulation/cbtc/ATS/ATSLogicLoop.java | 1 + .../cbtc/ATS/service/AtsStationService.java | 2 +- .../simulation/cbtc/onboard/ATP/ATPLogicLoop.java | 2 ++ .../vo/client/factory/SocketMessageFactory.java | 5 +++++ 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/DraftMapService.java b/src/main/java/club/joylink/rtss/services/DraftMapService.java index c46f6aff9..9dba9d13c 100644 --- a/src/main/java/club/joylink/rtss/services/DraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/DraftMapService.java @@ -570,7 +570,6 @@ public class DraftMapService implements IDraftMapService { this.draftMapRouteFlankProtectionDAO.insert(entity); }); } - } private void deleteMapLogicData(Long id) { diff --git a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java index e97291401..c355bf86e 100644 --- a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java +++ b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java @@ -21,9 +21,12 @@ import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.LoginStatusVO; import club.joylink.rtss.vo.client.LoginUserVO; +import club.joylink.rtss.vo.client.SocketMessageVO; +import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.project.ProjectDeviceVO; import club.joylink.rtss.vo.client.project.RelationLoginConfigVO; import club.joylink.rtss.vo.wx.WmUserSession; +import club.joylink.rtss.websocket.StompMessageService; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -74,6 +77,9 @@ public class AuthenticateService implements IAuthenticateService { @Autowired private ProjectSimulationService projectSimulationService; + @Autowired + private StompMessageService stompMessageService; + @Override public LoginStatusVO getWmLoginUrl(String clientId, String secret, Project project, String deviceCode) { String envId = SystemEnv.getSystemEnvIdByName(this.otherConfig.getEnv()); @@ -322,6 +328,8 @@ public class AuthenticateService implements IAuthenticateService { } } for (LoginUserInfoVO infoVO : removeList) { + SocketMessageVO message = SocketMessageFactory.buildLoginSomewhereElseMessage(infoVO); + stompMessageService.sendToUser(infoVO.getAccountVO().getIdStr(), message); this.logout(infoVO); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/AtpSectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/AtpSectionService.java index b7ff1d3b2..53a3e4877 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/AtpSectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/AtpSectionService.java @@ -144,11 +144,11 @@ public class AtpSectionService { */ public void sectionARBCheck(Simulation simulation, Section section, List
sectionList) { //目前ARB故障才会导致ARB判定 - if (Section.AxleFault.ARB.equals(section.getFault())) { - if (section.getVirtualAxleCounter().isOccupy() && !sectionList.contains(section)) { + if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) { + if (!sectionList.contains(section)) { section.judgeAsARB(); - } else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) { - section.judgeAsNctOccupied(); + } else { + section.setFault(Section.AxleFault.FAULT); } } else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) { section.judgeAsNctOccupied(); @@ -174,9 +174,9 @@ public class AtpSectionService { public List
getTrainExistAxleSectionsUnderDelay(Simulation simulation, List trainList) { List
list = new ArrayList<>(); for (VirtualRealityTrain train : trainList) { -// //只统计非通信车 -// if (train.isCBTC()) -// continue; + //只统计非通信车 + if (train.isCommunicable()) + continue; boolean right = train.isRight(); SectionPosition headPosition = train.getHeadPosition(); float offset = 50; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSLogicLoop.java index 0a08b92d9..e133d9f2e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSLogicLoop.java @@ -68,6 +68,7 @@ public class ATSLogicLoop { this.trainOutboundLoadTool.loadOutboundTrain(simulation); this.atsStandService.countDown(simulation); this.atsTrainMonitorService.monitor(simulation); + this.atsStationService.updateFieldThatChangeOverTime(simulation); } public void addJobs(Simulation simulation) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index c375e9e9d..4c4230df4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -401,7 +401,7 @@ public class AtsStationService { /** * 更新车站随时间变化的属性 */ - public void updateField(Simulation simulation) { + public void updateFieldThatChangeOverTime(Simulation simulation) { List stations = simulation.getRepository().getStationList(); for (Station station : stations) { //更新车站控制权转换倒计时及有效性 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java index 1ea3d899d..cb3133f8e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java @@ -191,6 +191,7 @@ public class ATPLogicLoop { // EB 触发速度计算 SpeedCurve ebTriggerCurve = ma.getEbTriggerCurve(); float ebTriggerRemain = ma.calculateDistanceOfEbTriggerEnd(); + ma.setEbTriggerCurve(ebTriggerCurve); float totalDistance = ebTriggerCurve.getTotalDistance(); if (totalDistance < ebTriggerRemain) { ebTriggerRemain = totalDistance; @@ -198,6 +199,7 @@ public class ATPLogicLoop { float atpSpeed = ebTriggerCurve.getSpeedOf(ebTriggerRemain); // ATO推荐速度计算 SpeedCurve speedCurve = SpeedCurve.calculateAtoStopCurveAndUpdate(train, ma); + ma.setAtoStopCurve(speedCurve); float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); train.setAtpSpeed(atpSpeed); train.setAtoSpeed(atoSpeed); diff --git a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java index 26e4989f3..c765be268 100644 --- a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java +++ b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java @@ -10,6 +10,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.*; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationUser; import club.joylink.rtss.simulation.cbtc.message.websocket.SimulationSubscribeTopic; +import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.passenger.PassengerFlowMessage2TD; @@ -269,6 +270,10 @@ public class SocketMessageFactory { return build(WebSocketMessageType.STATION_PFI_NUM, group, data); } + public static SocketMessageVO buildLoginSomewhereElseMessage(LoginUserInfoVO infoVO) { + return build(WebSocketMessageType.Be_Logged_Out, null, infoVO); + } + @Component private static class SpringContextUtil implements ApplicationContextAware {