From 9d1a8c2fa544813c1134097b57514b5defe4f8f1 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Thu, 25 Aug 2022 15:26:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E5=8A=A1=E7=AE=A1=E7=90=86=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E5=8A=9F=E8=83=BD=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8F=8A=E5=BE=84=E8=B7=AF=E6=9B=B4=E6=96=B0=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/20220825-zhouyin.sql | 3 +++ .../cbtc/ATS/operation/Operation.java | 1 + .../simulation/cbtc/CTC/data/vo/FZkVO.java | 20 +++++++++++++++++++ .../operation/CtcManageOperateHandler.java | 3 ++- ...cManageRegularTrainLineOperateHandler.java | 7 +++++-- .../CTC/service/runplan/CtcManageService.java | 17 ++++++++++++---- 6 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 sql/20220825-zhouyin.sql create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/FZkVO.java diff --git a/sql/20220825-zhouyin.sql b/sql/20220825-zhouyin.sql new file mode 100644 index 000000000..05605bf39 --- /dev/null +++ b/sql/20220825-zhouyin.sql @@ -0,0 +1,3 @@ +-- 出入口方向添加方向属性,需要重新编辑地图中出入口方向的属性 +ALTER TABLE `draft_map_station_direction_label` + ADD COLUMN `io_direction` varchar(20) NULL COMMENT '出入口方向'; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index bc05a39df..5916541d6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -1311,6 +1311,7 @@ public class Operation { * 车辆固定经路修改 */ REGULAR_TRAIN_LINE_EDIT(new Label[]{Label.CLIENT}), + REGULAR_TRAIN_LINE_SAVE(new Label[]{Label.CLIENT}), /** * 车辆固定经路删除 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/FZkVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/FZkVO.java new file mode 100644 index 000000000..d38a55277 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/FZkVO.java @@ -0,0 +1,20 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class FZkVO { + private int version; + private T data; + + + public static FZkVO of(int version,T d){ + FZkVO vo = new FZkVO<>(); + vo.setVersion(version); + vo.setData(d); + return vo; + } + +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/CtcManageOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/CtcManageOperateHandler.java index cbcacbb51..6a1b95279 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/CtcManageOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/CtcManageOperateHandler.java @@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.CTC.operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.FZkVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RegularTrainLineVO; import club.joylink.rtss.simulation.cbtc.CTC.param.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.CTC.service.runplan.CtcManageService; @@ -110,7 +111,7 @@ public class CtcManageOperateHandler { * @return */ @OperateHandlerMapping(type = Operation.Type.REGULAR_TRAIN_LINE_STATION_UPDATE_LIST) - public List loadUpdateTrainLineData(Simulation simulation, String stationCode){ + public FZkVO> loadUpdateTrainLineData(Simulation simulation, String stationCode){ return this.ctcManageService.loadUpdateRegularTrainLineList(simulation,stationCode); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/fck/CtcManageRegularTrainLineOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/fck/CtcManageRegularTrainLineOperateHandler.java index 0e07d90f3..852b26b2e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/fck/CtcManageRegularTrainLineOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/fck/CtcManageRegularTrainLineOperateHandler.java @@ -29,11 +29,14 @@ public class CtcManageRegularTrainLineOperateHandler { * @param stationCode 车站编码 * @param runPlanParamList 运行计划 */ + @OperateHandlerMapping(type = Operation.Type.REGULAR_TRAIN_LINE_SAVE) + public void saveTrainLine(Simulation simulation, String stationCode, RegularTrainLineVO runPlanParamList) { + this.ctcManageService.editRegularTrain(simulation,stationCode,runPlanParamList,true); + } @OperateHandlerMapping(type = Operation.Type.REGULAR_TRAIN_LINE_EDIT) public void editTrainLine(Simulation simulation, String stationCode, RegularTrainLineVO runPlanParamList) { - this.ctcManageService.editRegularTrain(simulation,stationCode,runPlanParamList); + this.ctcManageService.editRegularTrain(simulation,stationCode,runPlanParamList,false); } - /** * 保存固定列车经路批量处理 * @param simulation diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/runplan/CtcManageService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/runplan/CtcManageService.java index 560cec4b8..6178ff767 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/runplan/CtcManageService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/service/runplan/CtcManageService.java @@ -4,6 +4,7 @@ import club.joylink.rtss.exception.BaseException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CI.data.StationDirection; import club.joylink.rtss.simulation.cbtc.CTC.data.*; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.FZkVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RegularTrainLineVO; import club.joylink.rtss.simulation.cbtc.CTC.param.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.Simulation; @@ -11,10 +12,12 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Station; import com.google.common.base.Strings; +import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.Resource; @@ -209,14 +212,18 @@ public class CtcManageService { * @param stationCode * @param rt */ - public void editRegularTrain(Simulation simulation, String stationCode, RegularTrainLineVO rt){ + public void editRegularTrain(Simulation simulation, String stationCode, RegularTrainLineVO rt,boolean isSave){ BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(Objects.isNull(stationCode), String.format("车站号不能为空")); + if(!isSave && Strings.isNullOrEmpty(rt.getCode())){ + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(Objects.isNull(stationCode), String.format("固定列车径路code 不能为空")); + } CtcManageRepository repository = simulation.getCtcRepository().getCtcManageRepository(); CtcEffectRepository.RegularTrainLineRepository tLRepository = repository.getRegularTrainLineMap().get(stationCode); if(tLRepository == null){ tLRepository = new CtcEffectRepository.RegularTrainLineRepository(); repository.getRegularTrainLineMap().put(stationCode,tLRepository); } + if(Strings.isNullOrEmpty(rt.getCode())){ rt.setCode(simulation.getCtcRepository().createCode(CtcRepository.CtcFZKType.REGULAR_TRAIN,simulation.getId())); }else{ @@ -273,7 +280,7 @@ public class CtcManageService { RegularTrainLineVO newRt = rt.clone(); String tipNum = rt.getPrefixTrain().concat(start.toString()); newRt.setArriveTipNum(tipNum); - this.editRegularTrain(simulation,stationCode,newRt); + this.editRegularTrain(simulation,stationCode,newRt,true); } } @@ -423,11 +430,13 @@ public class CtcManageService { * @param stationCode * @return */ - public List loadUpdateRegularTrainLineList(Simulation simulation, String stationCode){ + public FZkVO> loadUpdateRegularTrainLineList(Simulation simulation, String stationCode){ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(Objects.isNull(stationCode), String.format("车站号不能为空")); CtcEffectRepository repository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository.RegularTrainLineRepository tLRepository = repository.getUpdateReguarTrainLineMap().get(stationCode); - return this.loadRegularTrainLineData(tLRepository); + + List list = this.loadRegularTrainLineData(tLRepository); + return FZkVO.of(CollectionUtils.isEmpty(list)?0:tLRepository.version(),list); } /**