From 47a9e54e1655b4596aa327ec2a857f8409b3234d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 10 Feb 2023 17:09:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E5=9F=BA=E7=A1=80=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E8=81=94=E5=8A=A8=E9=81=93=E5=B2=94?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/SimulationV1Controller.java | 25 ------------------- .../simulation/cbtc/data/vo/SimulationVO.java | 18 ++++++++++--- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java index 33ce307fc..8de0a8ddc 100644 --- a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java +++ b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java @@ -17,7 +17,6 @@ import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.script.ScriptBO; -import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; import club.joylink.rtss.simulation.vo.SimulationInfoVO; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.LoginUserInfoVO; @@ -264,14 +263,6 @@ public class SimulationV1Controller { this.groupSimulationService.planOver(group); } -// /** -// * 清除仿真 -// */ -// @DeleteMapping("/{group}/clear") -// public void clearSimulation(@PathVariable String group, @RequestAttribute AccountVO user) { -// this.groupSimulationService.clearSimulation(group, user); -// } - /** * 退出仿真(主要是非房主用户退出综合演练用) */ @@ -317,22 +308,6 @@ public class SimulationV1Controller { return this.groupSimulationService.getSimulationMembers(group); } -// /** -// * 仿真暂停 -// */ -// @PutMapping(path = "/{group}/pause") -// public void pause(@PathVariable String group) { -// groupSimulationService.pauseSimulation(group); -// } - -// /** -// * 仿真恢复运行 -// */ -// @PutMapping(path = "/{group}/resume") -// public void resume(@PathVariable String group) { -// groupSimulationService.resumeSimulation(group); -// } - /** * 获取仿真设备故障列表 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SimulationVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SimulationVO.java index 2cd4585e5..4cb43bc18 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SimulationVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/SimulationVO.java @@ -1,6 +1,7 @@ package club.joylink.rtss.simulation.cbtc.data.vo; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO; @@ -11,9 +12,7 @@ import lombok.Setter; import org.springframework.util.CollectionUtils; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; @Builder @Getter @@ -58,6 +57,8 @@ public class SimulationVO { private SimulationWorkParamVO paramVO; + private Map linkSwitchMap; + public static SimulationVO buildBasicInfo(Simulation simulation) { MapVO map = simulation.getBuildParams().getMap(); MapVO mapVO = new MapVO(); @@ -75,6 +76,16 @@ public class SimulationVO { creator.setName(user.getName()); creator.setNickname(user.getNickname()); SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO(); + Map linkSwitchMap = new HashMap<>(); + if (simulation.getRepository().getConfig().isSwitchLossChain()) { + List switchList = simulation.getRepository().getSwitchList(); + switchList.forEach(aSwitch -> { + Switch linkedSwitch = aSwitch.queryLinkedSwitch(); + if (linkedSwitch != null) { + linkSwitchMap.put(aSwitch.getCode(), linkedSwitch.getCode()); + } + }); + } return SimulationVO.builder() .group(simulation.getId()) .map(mapVO) @@ -91,6 +102,7 @@ public class SimulationVO { .error(simulation.isError()) .delTime(simulation.getDelBaseTime()) .paramVO(workParamVO) + .linkSwitchMap(linkSwitchMap) .build(); }