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 f8c9c03ca..6a7c6eb5e 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 @@ -1292,6 +1292,14 @@ public class Operation { * 保存调度命令 */ CTC_SAVE_DIS_COMMAND(new Label[]{Label.OTHER}), + /** + * 删除缓存箱某条调度命令 + */ + CTC_DELETE_DIS_COMMAND(new Label[]{Label.OTHER}), + /** + * 清空缓存箱调度命令 + */ + CTC_CLEAR_DIS_COMMAND(new Label[]{Label.OTHER}), //---------------------------- 行车簿册 ------------------------- /** * 填写行车簿册 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcDisCmdOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcDisCmdOperateHandler.java index 1ab51343f..a77702a4b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcDisCmdOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcDisCmdOperateHandler.java @@ -11,7 +11,6 @@ import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.*; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import org.springframework.beans.factory.annotation.Autowired; - import java.util.List; /** @@ -108,4 +107,21 @@ public class RailCtcDisCmdOperateHandler { public FindAllDisCmdForHolderRspVo findAllForHolder(Simulation simulation, String holderType, String holderCode, String trainNum) { return disCmdFindService.findAllForHolder(simulation, DisCmdHolderEnum.valueOf(holderType), holderCode, trainNum); } + /** + * 删除缓存箱中的某条调度命令 + * @param cpId 调度命令的创建平台识别号 + * @param disCmdCode + */ + @OperateHandlerMapping(type = Operation.Type.CTC_DELETE_DIS_COMMAND) + public void deleteFromCache(Simulation simulation,String cpId,String disCmdCode){ + disCmdService.deleteFromCache(simulation,cpId,disCmdCode); + } + /** + * 清空缓存箱中的所有调度命令 + * @param cpId 调度命令的创建平台识别号 + */ + @OperateHandlerMapping(type = Operation.Type.CTC_CLEAR_DIS_COMMAND) + public void clearCache(Simulation simulation,String cpId){ + disCmdService.clearCache(simulation,cpId); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmd.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmd.java index ee931f5de..4b59e13e2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmd.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmd.java @@ -10,6 +10,10 @@ import java.util.Map; */ @Data public class DisCmd { + /** + * 调度命令的创建平台识别号 + */ + private String cpId; /** * 标题 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdApiController.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdApiController.java index c6487dd97..e38e8abcf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdApiController.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdApiController.java @@ -1,5 +1,7 @@ package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd; +import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; +import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.*; import club.joylink.rtss.simulation.cbtc.Simulation; import lombok.Data; @@ -100,9 +102,44 @@ public class DisCmdApiController { public FindAllDisCmdForHolderRspVo findAllForHolder(@RequestBody FindReqVo param) { return null; } + /** + * 删除缓存箱中的某条调度命令 + */ + @PostMapping("/1-5471-194-903/operate/CTC_DELETE_DIS_COMMAND") + public void deleteFromCache(@RequestBody DeleteFromCacheReqVo param){ + } + /** + * 清空缓存箱中的所有调度命令 + */ + @PostMapping("/1-5471-194-903/operate/CTC_CLEAR_DIS_COMMAND") + public void clearCache(@RequestBody ClearCacheReqVo param){ + } /////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// + /** + * 清空缓存箱中的所有调度命令 + */ + public static class ClearCacheReqVo{ + /** + * 调度命令的创建平台识别号 + */ + private String cpId; + } + /** + * 删除缓存箱中的某条调度命令 + */ + @Data + public static class DeleteFromCacheReqVo{ + /** + * 调度命令的创建平台识别号 + */ + private String cpId; + /** + * 要删除的调度命令号 + */ + private String disCmdCode; + } @Data public static class FindReceiptsReqVo{ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/convertor/DisCmdConvertor.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/convertor/DisCmdConvertor.java index 9e24ca380..2406f8906 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/convertor/DisCmdConvertor.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/convertor/DisCmdConvertor.java @@ -100,6 +100,7 @@ public class DisCmdConvertor { } public static DisCmd convert(DisCmdSrcVo from,DisCmd to){ // + to.setCpId(from.getCpId()); to.setAuthState(from.getAuthState()); to.setCode(from.getCode()); to.setContent(from.getContent()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdReceiptService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdReceiptService.java index 3d3ebe2c1..b6bd667b3 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdReceiptService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdReceiptService.java @@ -65,6 +65,22 @@ public class DisCmdReceiptService { } rsp.add(rtv); } + if(null!=rc.getTransReceiveTime()){ + ReceiptVo rtv = new ReceiptVo(); + rtv.setDisCmdCode(cmd.getCode()); + rtv.setTime(rc.getTransReceiveTime()); + rtv.setState(ReceiptVo.Status.TrainSrmReceived.name()); + rtv.setSrmStation(rc.getTransStationCode()); + rsp.add(rtv); + } + if(null!=rc.getTransSendTime()){ + ReceiptVo rtv = new ReceiptVo(); + rtv.setDisCmdCode(cmd.getCode()); + rtv.setTime(rc.getTransSendTime()); + rtv.setState(ReceiptVo.Status.TrainSrmSent.name()); + rtv.setSrmStation(rc.getTransStationCode()); + rsp.add(rtv); + } if(null!=rc.getSignTime()){ ReceiptVo rtv = new ReceiptVo(); rtv.setDisCmdCode(cmd.getCode()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdService.java index bf5d0027d..daab4a85b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdService.java @@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -40,6 +41,36 @@ public class DisCmdService { int id = ctcRepository.getDispatchCommandIdGenerator().getAndIncrement(); return String.valueOf(id); } + /** + * 删除缓存箱中的某条调度命令 + * @param cpId 调度命令的创建平台识别号 + * @param disCmdCode + */ + public void deleteFromCache(Simulation simulation,String cpId,String disCmdCode){ + CtcRepository ctcRepository = simulation.getCtcRepository(); + DisCmd cmd = ctcRepository.getDisCmdMap().get(disCmdCode); + if(null != cmd){ + final boolean can = cpId.equals(cmd.getCpId())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState()); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(can, String.format("仿真(%s),调度命令(%s)的删除校验失败", simulation.getId(),disCmdCode)); + ctcRepository.getDisCmdMap().remove(disCmdCode); + } + } + /** + * 清空缓存箱中的所有调度命令 + * @param cpId 调度命令的创建平台识别号 + */ + public void clearCache(Simulation simulation,String cpId){ + CtcRepository ctcRepository = simulation.getCtcRepository(); + List clearList = new ArrayList<>(); + ctcRepository.getDisCmdMap().values().forEach(cmd->{ + if(cpId.equals(cmd.getCpId())&&DisCmdSendCompany.Status.Cache.equals(cmd.getSendCompany().getState())){ + clearList.add(cmd.getCode()); + } + }); + clearList.forEach(cmdId->{ + ctcRepository.getDisCmdMap().remove(cmdId); + }); + } /** * 保存调度命令,保存到发送方缓存箱(保存到仓库) */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdNewReqVo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdNewReqVo.java new file mode 100644 index 000000000..65d29b2cc --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdNewReqVo.java @@ -0,0 +1,23 @@ +package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo; + +import lombok.Data; + +/** + * 新建调度命令请求 + */ +@Data +public class DisCmdNewReqVo { + /** + * 是否启用根据调度命令类型独立滚号模式 + *

+ * 默认值 - false
+ * 当按类型独立滚号启用时,每个类型一个号段,这样调度命令号仍然唯一。 + */ + private Boolean enableByType = false; + /** + * 调度命令类型 + *

+ * 当enableByType=true时有效 + */ + private String cmdType; +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdSrcVo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdSrcVo.java index ee23548a0..abd0ef6a2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdSrcVo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdSrcVo.java @@ -10,6 +10,10 @@ import java.util.List; */ @Data public class DisCmdSrcVo { + /** + * 调度命令的创建平台识别号 + */ + private String cpId; /** * 标题 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/ReceiptVo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/ReceiptVo.java index 3b25b199d..4dd6f5380 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/ReceiptVo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/ReceiptVo.java @@ -14,7 +14,7 @@ public class ReceiptVo { */ private String disCmdCode; /** - * 回执状态[Sent(已发送) AllSigned(已全部签收) Received(已接收) Signed(已签收) ProxySigned(已代签) Read(已阅读) Rejected(已拒签)] + * 回执状态[Sent(已发送) AllSigned(已全部签收) Received(已接收) Signed(已签收) ProxySigned(已代签) Read(已阅读) Rejected(已拒签) TrainSrmReceived(车站自律机中转接收无线调令) TrainSrmSent(车站自律机中转发送无线调令)] * @see ReceiptVo.Status */ private String state; @@ -75,6 +75,10 @@ public class ReceiptVo { AllSigned, //已接收 Received, + //无线调令车站自律机接收 + TrainSrmReceived, + //无线调令车站自律机发送 + TrainSrmSent, //已签收 Signed, //已代签