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 a26811419..f8c9c03ca 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 @@ -1265,9 +1265,13 @@ public class Operation { */ CTC_READ_DIS_COMMAND(new Label[]{Label.OTHER}), /** - * 签收调度命令 + * 正常签收调度命令 */ CTC_SIGN_DIS_COMMAND(new Label[]{Label.OTHER}), + /** + * 发令单位代签调度命令 + */ + CTC_SIGN_PROXY_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 4da3bdbfc..1ab51343f 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 @@ -7,10 +7,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.service.DisCmdFindService; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.service.DisCmdReceiptService; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.service.DisCmdService; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.service.DisCmdSignService; -import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.DisCmdHolderEnum; -import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.DisCmdSrcVo; -import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.FindAllDisCmdForHolderRspVo; -import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.ReceiptVo; +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; @@ -54,7 +51,7 @@ public class RailCtcDisCmdOperateHandler { disCmdService.send(simulation, disCmdCode); } /** - * 处理前端发送来的签收指令 + * 处理前端发送来的正常签收指令 * @param disCmdCode 调度命令号 * @param rcId 对于该调度命令的受令单位id * @param signer 实际签收人(仿真成员) @@ -63,6 +60,15 @@ public class RailCtcDisCmdOperateHandler { public void sign(Simulation simulation, String disCmdCode, String rcId, SimulationMember signer) { disCmdSignService.sign(simulation, disCmdCode, rcId, signer); } + /** + * 处理前端发送来的代签签收指令 + * @param proxySignReqVo 代签信息 + * @param signer 实际签收人(仿真成员) + */ + @OperateHandlerMapping(type = Operation.Type.CTC_SIGN_PROXY_DIS_COMMAND) + public void signProxy(Simulation simulation, DisCmdProxySignReqVo proxySignReqVo, SimulationMember signer){ + disCmdSignService.signProxy(simulation,proxySignReqVo,signer); + } /** * 处理前端发送来的拒签指令 * @param disCmdCode 调度命令号 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 93d0dd777..c6487dd97 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 @@ -114,7 +114,7 @@ public class DisCmdApiController { @Data public static class FindReqVo{ /** - * 持有者类型 + * 持有者类型[Dispatcher(调度台) Station(车站) Train(无线机车) Tsr(列控服务器)] * @see DisCmdHolderEnum */ private String holderType; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdRcvCompany.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdRcvCompany.java index cebdbdc7e..a737bf569 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdRcvCompany.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/DisCmdRcvCompany.java @@ -76,6 +76,12 @@ public class DisCmdRcvCompany { * @see SimulationMember#getUserId() */ private String signBy; + /** + * 被代签收人姓名即实际期望的签收者 + *

+ * 当受令单位由于某种原因无法正常签收时,发令方通过电话与受令单位的“这个被代签收人即接电话者”确认后代签 + */ + private String nameOfExpectedSigner; /** * 最终受令端对于调度命令的拒签时间 */ 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 5d511a030..c111775ef 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 @@ -68,8 +68,7 @@ public class DisCmdReceiptService { if(null!=rc.getSignTime()){ ReceiptVo rtv = new ReceiptVo(); rtv.setDisCmdCode(cmd.getCode()); - rtv.setState(ReceiptVo.Status.Signed.name()); - rtv.setTime(rc.getReceiveTime()); + rtv.setTime(rc.getSignTime()); rtv.setSignedBy(rc.getSignBy());//todo:暂时 switch (rc.getType()){ case Train:{ @@ -84,6 +83,12 @@ public class DisCmdReceiptService { }break; case Tsr:rtv.setTsr(rc.getTsrCode());//todo:暂时 } + if(null!=rc.getNameOfExpectedSigner()&&rc.getNameOfExpectedSigner().length()>0){//代签 + rtv.setState(ReceiptVo.Status.ProxySigned.name()); + rtv.setNameOfExpectedSigner(rc.getNameOfExpectedSigner()); + }else{ + rtv.setState(ReceiptVo.Status.Signed.name()); + } rsp.add(rtv); } if(null!=rc.getReadTime()){ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdSignService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdSignService.java index f7d009dbc..a6a27d544 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdSignService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/service/DisCmdSignService.java @@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.service; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.DisCmd; import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.DisCmdRcvCompany; +import club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo.DisCmdProxySignReqVo; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import lombok.extern.slf4j.Slf4j; @@ -17,7 +18,7 @@ public class DisCmdSignService { @Autowired private DisCmdService disCmdService; /** - * 处理前端发送来的签收指令 + * 处理前端发送来的正常签收指令 * @param disCmdCode 调度命令号 * @param rcId 对于该调度命令的受令单位id * @param signer 实际签收人(仿真成员) @@ -36,6 +37,33 @@ public class DisCmdSignService { rc.setSignBy(signer.getUserId()); } } + /** + * 处理前端发送来的代签签收指令 + * @param proxySignReqVo 代签信息 + * @param signer 实际签收人(仿真成员) + */ + public void signProxy(Simulation simulation, DisCmdProxySignReqVo proxySignReqVo, SimulationMember signer){ + final String disCmdCode = proxySignReqVo.getDisCmdCode(); + final String rcId = proxySignReqVo.getRcId(); + final String nameOfExpectedSigner = proxySignReqVo.getNameOfExpectedSigner(); + // + DisCmd cmd = simulation.getCtcRepository().getDisCmdMap().get(disCmdCode); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != cmd, String.format("仿真(%s),调度命令(%s)不存在", simulation.getId(), disCmdCode)); + List rcs = cmd.getRcvCompanies().values().stream().filter(rc -> { return rcId.equals(rc.getId()); }).collect(Collectors.toList()); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != rcs && !rcs.isEmpty(), String.format("仿真(%s),调度命令(%s)的受令单位(%s)不存在", simulation.getId(), disCmdCode, rcId)); + DisCmdRcvCompany rc = rcs.get(0); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(DisCmdRcvCompany.Status.Received.equals(rc.getState()),String.format("仿真(%s),调度命令(%s)的受令单位(%s)非接收状态,不能签收", simulation.getId(), disCmdCode, rcId)); + // + rc.setState(DisCmdRcvCompany.Status.Signed); + rc.setSignTime(disCmdService.getNow(simulation)); + rc.setNameOfExpectedSigner(nameOfExpectedSigner); + if(null!=signer){ + rc.setSignBy(signer.getUserId()); + } + } + /** + * 处理前端发送来的 代 签收指令 + */ /** * 处理前端发送来的拒签指令 * @param disCmdCode 调度命令号 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdProxySignReqVo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdProxySignReqVo.java new file mode 100644 index 000000000..370ee62cc --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/cmd/vo/DisCmdProxySignReqVo.java @@ -0,0 +1,22 @@ +package club.joylink.rtss.simulation.cbtc.CTC.rail.cmd.vo; + +import lombok.Data; + +/** + * 调度命令代签请求 + */ +@Data +public class DisCmdProxySignReqVo { + /** + * 调度命令唯一id + */ + private String disCmdCode; + /** + * 受令单位记录唯一id + */ + private String rcId; + /** + * 被代签收人姓名即实际期望的签收者 + */ + private String nameOfExpectedSigner; +} 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 316605408..3b25b199d 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 @@ -34,6 +34,12 @@ public class ReceiptVo { * 签收人 */ private String signedBy; + /** + * 被代签收人姓名即实际期望的签收者 + *

+ * 当受令单位由于某种原因无法正常签收时,发令方通过电话与受令单位的“这个被代签收人即接电话者”确认后代签 + */ + private String nameOfExpectedSigner; /** * 车站受令者 */