From 5372e55b44f906d984ef4bc9852f6edce7e033fd Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 5 Dec 2023 18:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=BD=A6=E7=AB=99=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=BD=AC=E4=B8=AD=E6=8E=A7=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 1172 ++++++++++--- .../handler/StationOperateHandler.java | 590 +++---- .../cbtc/ATS/service/AtsStationService.java | 1459 +++++++++-------- 3 files changed, 2003 insertions(+), 1218 deletions(-) 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 fa872b1a0..fa3811be6 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 @@ -471,494 +471,834 @@ public class Operation { * 请求中控 */ CM_Apply_For_Center_Control(new Label[]{Label.CLIENT}, true), + /** + * 直接转车站中控 + */ + CM_Direct_Turn_Center_Control(new Label[]{Label.CLIENT}, true), /** * 强制站控 */ - CM_Force_Station_Control(new Label[]{Label.CLIENT}, true), + CM_Force_Station_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 紧急站控 */ - CM_Emergency_Station_Control(new Label[]{Label.CLIENT}, true), + CM_Emergency_Station_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 回复站控请求(同意/拒绝) */ - CM_Reply_Station_Control(new Label[]{Label.CLIENT}, true), + CM_Reply_Station_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 回复中控请求(同意/拒绝) */ - CM_Reply_Center_Control(new Label[]{Label.CLIENT}, true), + CM_Reply_Center_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 接收控制权 */ - CM_Receive_Control(new Label[]{Label.CLIENT}, true), + CM_Receive_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 交出控制权 */ - CM_Surrender_Control(new Label[]{Label.CLIENT}, true), + CM_Surrender_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 连锁控 */ - CM_Interlock_Control(new Label[]{Label.CLIENT}, true), + CM_Interlock_Control(new Label[]{ + Label.CLIENT + }, true), + /** * 回复连锁控请求(同意/拒绝) */ - CM_Reply_Interlock_Control(new Label[]{Label.CLIENT}, true), + CM_Reply_Interlock_Control(new Label[]{ + Label.CLIENT + }, true), /** * 大铁非常站控 */ - CM_Special_Station_Control(new Label[]{Label.CLIENT}, true), + CM_Special_Station_Control(new Label[]{ + Label.CLIENT + }, true), //--------------------------- 集中车站 --------------------------- + /** * 设置折返策略 */ - Station_Set_Turn_Back_Strategy(new Label[]{Label.CLIENT}, true), + Station_Set_Turn_Back_Strategy(new Label[]{ + Label.CLIENT + }, true), + /** * 全站设置联锁自动触发 */ - Station_Set_CI_Auto_Trigger(new Label[]{Label.CLIENT}, true), + Station_Set_CI_Auto_Trigger(new Label[]{ + Label.CLIENT + }, true), + /** * 全站取消联锁自动触发 */ - Station_Cancel_CI_Auto_Trigger(new Label[]{Label.CLIENT}, true), + Station_Cancel_CI_Auto_Trigger(new Label[]{ + Label.CLIENT + }, true), + /** * 所有进路自排开 */ - Station_Open_Auto_Setting(new Label[]{Label.CLIENT}, true), + Station_Open_Auto_Setting(new Label[]{ + Label.CLIENT + }, true), + /** * 所有进路自排关 */ - Station_Close_Auto_Setting(new Label[]{Label.CLIENT}, true), + Station_Close_Auto_Setting(new Label[]{ + Label.CLIENT + }, true), + /** * 执行关键操作测试 */ - Station_Key_Operation_Test(new Label[]{Label.CLIENT}, true), + Station_Key_Operation_Test(new Label[]{ + Label.CLIENT + }, true), + /** * 上电解锁 */ - Station_Power_On_Unlock(new Label[]{Label.CLIENT}, true), + Station_Power_On_Unlock(new Label[]{ + Label.CLIENT + }, true), + /** * 车站信息 */ - Station_Info(new Label[]{Label.CLIENT}, true), + Station_Info(new Label[]{ + Label.CLIENT + }, true), + /** * 设置引导总锁 */ - Station_Set_Master_Guide_Lock(new Label[]{Label.CLIENT}, true), + Station_Set_Master_Guide_Lock(new Label[]{ + Label.CLIENT + }, true), + /** * 取消引导总锁 */ - Station_Cancel_Master_Guide_Lock(new Label[]{Label.CLIENT}, true), + Station_Cancel_Master_Guide_Lock(new Label[]{ + Label.CLIENT + }, true), + /** * 关站信号 */ - Station_Close_AllSignal(new Label[]{Label.CLIENT}, true), + Station_Close_AllSignal(new Label[]{ + Label.CLIENT + }, true), + /** * 关区信号 */ - Station_CIArea_Close_AllSignal(new Label[]{Label.CLIENT}, true), + Station_CIArea_Close_AllSignal(new Label[]{ + Label.CLIENT + }, true), + /** * 释放指令 */ - Station_Release(new Label[]{Label.CLIENT}, true), + Station_Release(new Label[]{ + Label.CLIENT + }, true), + /** * 重启令解 */ - Station_Restart(new Label[]{Label.CLIENT}, true), + Station_Restart(new Label[]{ + Label.CLIENT + }, true), + /** * 全站设置自动通过 */ - Station_Set_CI_Auto(new Label[]{Label.CLIENT}, true), + Station_Set_CI_Auto(new Label[]{ + Label.CLIENT + }, true), + /** * 全站取消自动通过 */ - Station_Cancel_CI_Auto(new Label[]{Label.CLIENT}, true), + Station_Cancel_CI_Auto(new Label[]{ + Label.CLIENT + }, true), + /** * 设置/取消强制点灯 */ - Station_Set_Or_Cancel_Force_Physical_Signal(new Label[]{Label.CLIENT}, true), + Station_Set_Or_Cancel_Force_Physical_Signal(new Label[]{ + Label.CLIENT + }, true), + /** * 预复位(宁波一) */ - Station_Pre_Reset(new Label[]{Label.CLIENT}, true), + Station_Pre_Reset(new Label[]{ + Label.CLIENT + }, true), + /** * 取消预复位 */ - Station_Cancel_Pre_Reset(new Label[]{Label.CLIENT}, true), + Station_Cancel_Pre_Reset(new Label[]{ + Label.CLIENT + }, true), //车站控制授权 + /** * 区域选择(请求区域控制权【泰雷兹】) */ - Station_Control_Apply(new Label[]{Label.CLIENT}, true), + Station_Control_Apply(new Label[]{ + Label.CLIENT + }, true), + /** * 授权转移 */ - Station_Control_Transfer(new Label[]{Label.CLIENT}, true), + Station_Control_Transfer(new Label[]{ + Label.CLIENT + }, true), + /** * 下放站控 */ - Station_Control_Devolve(new Label[]{Label.CLIENT}, true), + Station_Control_Devolve(new Label[]{ + Label.CLIENT + }, true), + /** * 收回站控 */ - Station_Control_Revoke(new Label[]{Label.CLIENT}, true), + Station_Control_Revoke(new Label[]{ + Label.CLIENT + }, true), + /** * 重启联锁机 */ - Station_Restart_Interlock_Machine(new Label[]{Label.CLIENT}, true), + Station_Restart_Interlock_Machine(new Label[]{ + Label.CLIENT + }, true), + /** * 引导总锁(大铁) */ - Station_Master_Lock(new Label[]{Label.CLIENT}, true), + Station_Master_Lock(new Label[]{ + Label.CLIENT + }, true), + /** * 解除引导总锁(大铁) */ - Station_Master_Unlock(new Label[]{Label.CLIENT}, true), + Station_Master_Unlock(new Label[]{ + Label.CLIENT + }, true), /** * 车站处理功能选择 */ - Station_Switch_Route_Set_Model(new Label[]{Label.CLIENT}, true), + Station_Switch_Route_Set_Model(new Label[]{ + Label.CLIENT + }, true), /** * 分散自律操作模式转换 */ - Station_Switch_Control_Operation_Mode(new Label[]{Label.CLIENT}, true), + Station_Switch_Control_Operation_Mode(new Label[]{ + Label.CLIENT + }, true), /** * 分散自律同意、不同意转换 */ - Station_Handle_Operation_Mode_Apply(new Label[]{Label.CLIENT}, true), + Station_Handle_Operation_Mode_Apply(new Label[]{ + Label.CLIENT + }, true), //--------------------------- 列车 --------------------------- + /** * 在指定区段加载一辆计划列车(本地开发使用) */ - Train_Init_Plan(new Label[]{Label.CLIENT}, true), + Train_Init_Plan(new Label[]{ + Label.CLIENT + }, true), + /** * 设置车组号 */ - Train_Add_Train_Trace(new Label[]{Label.CLIENT}, true), + Train_Add_Train_Trace(new Label[]{ + Label.CLIENT + }, true), + /** * 删除车组号 */ - Train_Remove_Train_Trace(new Label[]{Label.CLIENT}, true), + Train_Remove_Train_Trace(new Label[]{ + Label.CLIENT + }, true), + /** * 移动车组号 */ - Train_Move_Train_Trace(new Label[]{Label.CLIENT}, true), + Train_Move_Train_Trace(new Label[]{ + Label.CLIENT + }, true), + /** * 修改列车识别号 */ - Train_Update_Type(new Label[]{Label.CLIENT}, true), + Train_Update_Type(new Label[]{ + Label.CLIENT + }, true), + /** * 设计划车 */ - Train_Set_Plan(new Label[]{Label.CLIENT}, true), + Train_Set_Plan(new Label[]{ + Label.CLIENT + }, true), + /** * 设头码车 */ - Train_Set_Head(new Label[]{Label.CLIENT}, true), + Train_Set_Head(new Label[]{ + Label.CLIENT + }, true), + /** * 设人工车 */ - Train_Set_Manual(new Label[]{Label.CLIENT}, true), + Train_Set_Manual(new Label[]{ + Label.CLIENT + }, true), + /** * 设乘务组号 */ - Train_Set_Crew_Number(new Label[]{Label.CLIENT}, true), + Train_Set_Crew_Number(new Label[]{ + Label.CLIENT + }, true), + /** * 扣车 */ - Train_Hold(new Label[]{Label.CLIENT}, true), + Train_Hold(new Label[]{ + Label.CLIENT + }, true), + /** * 取消扣车 */ - Train_Cancel_Hold(new Label[]{Label.CLIENT}, true), + Train_Cancel_Hold(new Label[]{ + Label.CLIENT + }, true), + /** * 更改车次号 */ - Train_Change_Trip_Number(new Label[]{Label.CLIENT}, true), + Train_Change_Trip_Number(new Label[]{ + Label.CLIENT + }, true), + /** * 加载备用车 */ - Train_Load_Spare_Train(new Label[]{Label.CLIENT}, true), + Train_Load_Spare_Train(new Label[]{ + Label.CLIENT + }, true), + /** * 派接 */ - Train_Dispatch(new Label[]{Label.CLIENT}, true), + Train_Dispatch(new Label[]{ + Label.CLIENT + }, true), + /** * 机器人司机模拟驾驶 */ - Train_Drive(new Label[]{Label.CLIENT}, true), + Train_Drive(new Label[]{ + Label.CLIENT + }, true), + /** * TODO 托管,由于之前剧本中已包含Train_Trust,暂时留下,后续删除 */ - Train_Trust(new Label[]{Label.CLIENT}, true), + Train_Trust(new Label[]{ + Label.CLIENT + }, true), + /** * 连挂 */ - Train_Link(new Label[]{Label.CLIENT}, true), + Train_Link(new Label[]{ + Label.CLIENT + }, true), + /** * 排列进路到【泰雷兹】 */ - Train_Set_Route(new Label[]{Label.CLIENT}, true), + Train_Set_Route(new Label[]{ + Label.CLIENT + }, true), + /** * 设置运行类型【泰雷兹】 */ - Train_Set_Run_Type(new Label[]{Label.CLIENT}, true), + Train_Set_Run_Type(new Label[]{ + Label.CLIENT + }, true), + /** * 下令停车 */ - Train_Order_Stop(new Label[]{Label.CLIENT}, true), + Train_Order_Stop(new Label[]{ + Label.CLIENT + }, true), + /** * 取消停车命令 */ - Train_Cancel_Order_Stop(new Label[]{Label.CLIENT}, true), + Train_Cancel_Order_Stop(new Label[]{ + Label.CLIENT + }, true), + /** * 跳停【泰雷兹】 */ - Train_Skip_Stop(new Label[]{Label.CLIENT}, true), + Train_Skip_Stop(new Label[]{ + Label.CLIENT + }, true), + /** * 取消跳停【泰雷兹】 */ - Train_Cancel_Skip_Stop(new Label[]{Label.CLIENT}, true), + Train_Cancel_Skip_Stop(new Label[]{ + Label.CLIENT + }, true), + /** * 列车发车【泰雷兹】 */ - Train_Departure(new Label[]{Label.CLIENT}, true), + Train_Departure(new Label[]{ + Label.CLIENT + }, true), + /** * 分配【泰雷兹】 */ - Train_Distribute(new Label[]{Label.CLIENT}, true), + Train_Distribute(new Label[]{ + Label.CLIENT + }, true), + /** * 更新偏差【泰雷兹】 */ - Train_Update_Plan_Time(new Label[]{Label.CLIENT}, true), + Train_Update_Plan_Time(new Label[]{ + Label.CLIENT + }, true), + /** * 取消CBTC进路【泰雷兹】 */ - Train_Cancel_CBTC_Route(new Label[]{Label.CLIENT}, true), + Train_Cancel_CBTC_Route(new Label[]{ + Label.CLIENT + }, true), + /** * 设置偏离【泰雷兹】 */ - Train_Set_Deviation(new Label[]{Label.CLIENT}, true), + Train_Set_Deviation(new Label[]{ + Label.CLIENT + }, true), + /** * 取消偏离【泰雷兹】 */ - Train_Cancel_Deviation(new Label[]{Label.CLIENT}, true), + Train_Cancel_Deviation(new Label[]{ + Label.CLIENT + }, true), + /** * 列车调度 */ - Train_Regulation(new Label[]{Label.CLIENT}, true), + Train_Regulation(new Label[]{ + Label.CLIENT + }, true), + /** * 计算行车间隔 */ - Train_Calculate_Interval(new Label[]{Label.CLIENT}, true), + Train_Calculate_Interval(new Label[]{ + Label.CLIENT + }, true), /** * 大铁加载指定车次列车 */ - Train_Load_Trip_Number_Train(new Label[]{Label.CLIENT}, true), + Train_Load_Trip_Number_Train(new Label[]{ + Label.CLIENT + }, true), /** * 大铁修改车次号 */ - Train_Update_Trip_Number_Train(new Label[]{Label.CLIENT}, true), + Train_Update_Trip_Number_Train(new Label[]{ + Label.CLIENT + }, true), /** * 查找指定车次已上线列车信息 */ - Train_Query_Trip_Number_Online_Train(new Label[]{Label.CLIENT}, true), + Train_Query_Trip_Number_Online_Train(new Label[]{ + Label.CLIENT + }, true), //--------------------------- 司机 --------------------------- + /** * 改变列车的牵引/制动力 */ - Driver_Force_Change(new Label[]{Label.CLIENT}, true), + Driver_Force_Change(new Label[]{ + Label.CLIENT + }, true), + /** * 按EB按钮 */ - Driver_EB(new Label[]{Label.OTHER}, true), + Driver_EB(new Label[]{ + Label.OTHER + }, true), + /** * 改变列车档位 */ - Driver_Gear_Change(new Label[]{Label.OTHER}, true), + Driver_Gear_Change(new Label[]{ + Label.OTHER + }, true), + /** * ATO启动 */ - Driver_ATO_Open(new Label[]{Label.OTHER}, true), + Driver_ATO_Open(new Label[]{ + Label.OTHER + }, true), + /** * 改变ATP状态 */ - Driver_ATP_Change(new Label[]{Label.OTHER}, true), + Driver_ATP_Change(new Label[]{ + Label.OTHER + }, true), + /** * 改变列车运行模式 */ - @Deprecated // 场景旧数据反序列化需要 - Driver_Drive_Mode_Change(new Label[]{Label.CLIENT}, true), + @Deprecated + // 场景旧数据反序列化需要 + Driver_Drive_Mode_Change(new Label[]{ + Label.CLIENT + }, true), + /** * 换端 */ - Driver_Change_Head(new Label[]{Label.CLIENT}, true), + Driver_Change_Head(new Label[]{ + Label.CLIENT + }, true), + /** * 列车车门开关 */ - Driver_Door_On_Off(new Label[]{Label.CLIENT}, true), + Driver_Door_On_Off(new Label[]{ + Label.CLIENT + }, true), + /** * 列车门模式 */ - Driver_Door_Mode(new Label[]{Label.OTHER}, true), + Driver_Door_Mode(new Label[]{ + Label.OTHER + }, true), + /** * 列车门选择 */ - Driver_Door_Selection(new Label[]{Label.OTHER}, true), + Driver_Door_Selection(new Label[]{ + Label.OTHER + }, true), + /** * 列车预选模式升 */ - Driver_Preselection_Mode_Up(new Label[]{Label.OTHER}, true), + Driver_Preselection_Mode_Up(new Label[]{ + Label.OTHER + }, true), + /** * 列车预选模式降 */ - Driver_Preselection_Mode_Down(new Label[]{Label.OTHER}, true), + Driver_Preselection_Mode_Down(new Label[]{ + Label.OTHER + }, true), + /** * 确认 */ - Driver_Confirm(new Label[]{Label.OTHER}, true), + Driver_Confirm(new Label[]{ + Label.OTHER + }, true), + /** * 接管列车 */ - Driver_TakeOver(new Label[]{Label.OTHER}, true), + Driver_TakeOver(new Label[]{ + Label.OTHER + }, true), + /** * 停车 */ - Driver_Stop(new Label[]{Label.OTHER}, true), + Driver_Stop(new Label[]{ + Label.OTHER + }, true), /** * 开关门 */ - Open_Or_Close_Door(new Label[]{Label.OTHER}, true), + Open_Or_Close_Door(new Label[]{ + Label.OTHER + }, true), /** * 回库 */ - Inbound(new Label[]{Label.OTHER}, true), + Inbound(new Label[]{ + Label.OTHER + }, true), /** * 修改预选模式 */ - Change_Preselection_Mode(new Label[]{Label.OTHER}, true), + Change_Preselection_Mode(new Label[]{ + Label.OTHER + }, true), /** * 转NRM模式 */ - Apply_NRM(new Label[]{Label.OTHER}, true), + Apply_NRM(new Label[]{ + Label.OTHER + }, true), + /** * 切换ATO操作 */ - Try_Open_Ato(new Label[]{Label.OTHER}, true), + Try_Open_Ato(new Label[]{ + Label.OTHER + }, true), //--------------------------- 特殊操作(多是ATS界面上对列车的操作) --------------------------- + /** * 换端 */ - Special_Change_Head(new Label[]{Label.OTHER}, true), + Special_Change_Head(new Label[]{ + Label.OTHER + }, true), + /** * 受电弓升降 */ - Special_Pantograph_Up_Down(new Label[]{Label.OTHER}, true), + Special_Pantograph_Up_Down(new Label[]{ + Label.OTHER + }, true), //--------------------------- 方向杆 --------------------------- + /** * 方向转换 */ - Direction_Change(new Label[]{Label.OTHER}, true), + Direction_Change(new Label[]{ + Label.OTHER + }, true), //--------------------------- 运行计划 --------------------------- + /** * 添加计划 */ - RunPlan_Add_Trip(new Label[]{Label.CLIENT}, true), + RunPlan_Add_Trip(new Label[]{ + Label.CLIENT + }, true), + /** * 删除计划 */ - RunPlan_Delete_Trip(new Label[]{Label.CLIENT}, true), + RunPlan_Delete_Trip(new Label[]{ + Label.CLIENT + }, true), //--------------------------- 服务器 --------------------------- + /** * ATP系统重启 */ - Server_ATP_Restart(new Label[]{Label.CLIENT}, true), + Server_ATP_Restart(new Label[]{ + Label.CLIENT + }, true), //--------------------------- iscs操作 --------------------------- + /** * ISCS的PA系统播放(发布)消息 */ - ISCS_PA_Play(new Label[]{Label.CLIENT}, true), + ISCS_PA_Play(new Label[]{ + Label.CLIENT + }, true), + /** * ISCS定时播放 */ - ISCS_PA_Timed_Play(new Label[]{Label.CLIENT}, true), + ISCS_PA_Timed_Play(new Label[]{ + Label.CLIENT + }, true), + /** * 移除定时播放 */ - ISCS_PA_Remove_Timed_Play(new Label[]{Label.CLIENT}, true), - ISCS_PA_Stop_Playing(new Label[]{Label.CLIENT}, true), + ISCS_PA_Remove_Timed_Play(new Label[]{ + Label.CLIENT + }, true), + + ISCS_PA_Stop_Playing(new Label[]{ + Label.CLIENT + }, true), + /** * ISCS的PIS系统播放(发布)消息 */ - ISCS_PIS_Play(new Label[]{Label.CLIENT}, true), - ISCS_PIS_Stop_Playing(new Label[]{Label.CLIENT}, true), + ISCS_PIS_Play(new Label[]{ + Label.CLIENT + }, true), + + ISCS_PIS_Stop_Playing(new Label[]{ + Label.CLIENT + }, true), //--------------------------- 大铁CTC操作 --------------------------- //------ 占线板操作 ------ + /** * CTC完成接预 */ - CTC_FINISH_RECEIVING_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_FINISH_RECEIVING_NOTICE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC取消接预 */ - CTC_CANCEL_RECEIVING_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_CANCEL_RECEIVING_NOTICE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC完成到点 */ - CTC_FINISH_ARRIVE(new Label[]{Label.CLIENT}, true), + CTC_FINISH_ARRIVE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC取消到点 */ - CTC_CANCEL_ARRIVE(new Label[]{Label.CLIENT}, true), + CTC_CANCEL_ARRIVE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC完成发预 */ - CTC_FINISH_DEPARTURE_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_FINISH_DEPARTURE_NOTICE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC取消发预 */ - CTC_CANCEL_DEPARTURE_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_CANCEL_DEPARTURE_NOTICE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC完成发点 */ - CTC_FINISH_DEPARTURE(new Label[]{Label.CLIENT}, true), + CTC_FINISH_DEPARTURE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC取消发点 */ - CTC_CANCEL_DEPARTURE(new Label[]{Label.CLIENT}, true), + CTC_CANCEL_DEPARTURE(new Label[]{ + Label.CLIENT + }, true), + /** * CTC进路自触 */ - CTC_AUTO_TRIGGER(new Label[]{Label.CLIENT}, true), + CTC_AUTO_TRIGGER(new Label[]{ + Label.CLIENT + }, true), //------ 站场图操作 ------ - CTC_SET_ROUTE(new Label[]{Label.CLIENT}, true), + CTC_SET_ROUTE(new Label[]{ + Label.CLIENT + }, true), //------ 行车日志操作 ------ + /** * 发送预告(发车预告) */ - CTC_SEND_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_SEND_NOTICE(new Label[]{ + Label.CLIENT + }, true), + /** * 同意预告 */ - CTC_AGREE_NOTICE(new Label[]{Label.CLIENT}, true), + CTC_AGREE_NOTICE(new Label[]{ + Label.CLIENT + }, true), // /** // * 到达 // */ @@ -978,629 +1318,955 @@ public class Operation { /** * 取消红闪 */ - CTC_CANCEL_TWINKLE(new Label[]{Label.CLIENT}, true), + CTC_CANCEL_TWINKLE(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志取消到达 */ - CTC_LOG_CANCEL_ARRIVE(new Label[]{Label.CLIENT}, true), + CTC_LOG_CANCEL_ARRIVE(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志取消出发 */ - CTC_LOG_CANCEL_DEPARTURE(new Label[]{Label.CLIENT}, true), + CTC_LOG_CANCEL_DEPARTURE(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志取消闭塞 */ - CTC_LOG_CANCEL_BLOCK(new Label[]{Label.CLIENT}, true), + CTC_LOG_CANCEL_BLOCK(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志保存运行信息 */ - CTC_LOG_SAVE_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_LOG_SAVE_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志设置运行任务 */ - CTC_LOG_SET_TASK(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_TASK(new Label[]{ + Label.CLIENT + }, true), + /** * 行车日志设置军用属性 */ - CTC_LOG_SET_MILITARY(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_MILITARY(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志设置超限 */ - CTC_LOG_SET_TRANSFINITE(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_TRANSFINITE(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志设置重点列车 */ - CTC_LOG_SET_KEY_TRAINS(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_KEY_TRAINS(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志设置删除标识 */ - CTC_LOG_SET_DELETE_LABEL(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_DELETE_LABEL(new Label[]{ + Label.CLIENT + }, true), /** * 行车日志设置进出入口不一致 */ - CTC_LOG_SET_ENTRY_OUT_DISCORDANT(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_ENTRY_OUT_DISCORDANT(new Label[]{ + Label.CLIENT + }, true), /** * 设置股道不一致 */ - CTC_LOG_SET_TRACK_DISCORDANT(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_TRACK_DISCORDANT(new Label[]{ + Label.CLIENT + }, true), /** * 设置始发车 */ - CTC_LOG_SET_START_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_START_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), + /** * 设置终到车 */ - CTC_LOG_SET_END_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_LOG_SET_END_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 实际时间平移多少分钟 */ - CTC_LOG_ACTUAL_TIME_ADD_MINUTE(new Label[]{Label.CLIENT}, true), + CTC_LOG_ACTUAL_TIME_ADD_MINUTE(new Label[]{ + Label.CLIENT + }, true), /**************调度台******************/ /** * 调度台保存运行计划 */ - CTC_ZONE_SAVE_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_ZONE_SAVE_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 保存股道 */ - CTC_ZONE_SAVE_TRACK_SECTION(new Label[]{Label.CLIENT}, true), + CTC_ZONE_SAVE_TRACK_SECTION(new Label[]{ + Label.CLIENT + }, true), /** * 修改车次 */ - CTC_ZONE_SAVE_TRIP_NUMBER(new Label[]{Label.CLIENT}, true), + CTC_ZONE_SAVE_TRIP_NUMBER(new Label[]{ + Label.CLIENT + }, true), /** * 保存运行计划计划时间 */ - CTC_ZONE_SAVE_PLAN_TIME(new Label[]{Label.CLIENT}, true), + CTC_ZONE_SAVE_PLAN_TIME(new Label[]{ + Label.CLIENT + }, true), /** * 分钟数 */ - CTC_ZONE_SAVE_PLAN_TIME_MINUTE(new Label[]{Label.OTHER}, true), + CTC_ZONE_SAVE_PLAN_TIME_MINUTE(new Label[]{ + Label.OTHER + }, true), /** * 保存方向 */ - CTC_ZONE_SAVE_DIRECTION(new Label[]{Label.OTHER}, true), + CTC_ZONE_SAVE_DIRECTION(new Label[]{ + Label.OTHER + }, true), /** * 保存车站 */ - CTC_ZONE_SAVE_STATION(new Label[]{Label.OTHER}, true), + CTC_ZONE_SAVE_STATION(new Label[]{ + Label.OTHER + }, true), /** * 删除运行计划 */ - CTC_ZONE_DELETE_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_ZONE_DELETE_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 发布运行区段运行计划 */ - CTC_ZONE_RELEASE_ZONE_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_ZONE_RELEASE_ZONE_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 发布单车站的运行计划 */ - CTC_ZONE_RELEASE_STATION_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_ZONE_RELEASE_STATION_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 调度中心确认申请 */ - CTC_ZONE_CONFIRM_APPLY_RUN_PLAY(new Label[]{Label.CLIENT}, true), + CTC_ZONE_CONFIRM_APPLY_RUN_PLAY(new Label[]{ + Label.CLIENT + }, true), /** * 全量发布计划 */ - CTC_ZONE_RELEASE_ALL_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_ZONE_RELEASE_ALL_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /**************调度台******************/ /** * 签收计划 */ - CTC_STATION_SIGN_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_STATION_SIGN_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 车站发送计划 */ - CTC_STATION_SEND_OUT_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_STATION_SEND_OUT_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 车站向中心发送申请 */ - CTC_STATION_APPLY_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_STATION_APPLY_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 批量修改运行计划 */ - CTC_BATCH_MODIFY_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_BATCH_MODIFY_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 修改股道 */ - CTC_MODIFY_SECTION(new Label[]{Label.CLIENT}, true), + CTC_MODIFY_SECTION(new Label[]{ + Label.CLIENT + }, true), /** * 修改方向 */ - CTC_MODIFY_DIRECTION(new Label[]{Label.CLIENT}, true), + CTC_MODIFY_DIRECTION(new Label[]{ + Label.CLIENT + }, true), /** * 修改实际到达时间 */ - CTC_MODIFY_ACTUAL_TIME(new Label[]{Label.OTHER}, true), + CTC_MODIFY_ACTUAL_TIME(new Label[]{ + Label.OTHER + }, true), /** * 修改车次 */ - CTC_MODIFY_TRIP_NUMBER(new Label[]{Label.CLIENT}, true), + CTC_MODIFY_TRIP_NUMBER(new Label[]{ + Label.CLIENT + }, true), /** * 修改邻站 */ - CTC_MODIFY_ADJACENT_STATION(new Label[]{Label.OTHER}, true), + CTC_MODIFY_ADJACENT_STATION(new Label[]{ + Label.OTHER + }, true), /** * 移除运行计划 */ - CTC_REMOVE_RUN_PLAN(new Label[]{Label.CLIENT}, true), + CTC_REMOVE_RUN_PLAN(new Label[]{ + Label.CLIENT + }, true), /** * 添加运行计划到编辑区 */ - CTC_ADD_RUN_PLAN_LIST_TO_EDIT_AREA(new Label[]{Label.CLIENT}, true), + CTC_ADD_RUN_PLAN_LIST_TO_EDIT_AREA(new Label[]{ + Label.CLIENT + }, true), /** * 删除编辑区中的运行计划 */ - CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA(new Label[]{Label.CLIENT}, true), + CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA(new Label[]{ + Label.CLIENT + }, true), /** * 清空编辑区中的运行计划 */ - CTC_CLEAR_RUN_PLAN_FROM_EDIT_AREA(new Label[]{Label.CLIENT}, true), + CTC_CLEAR_RUN_PLAN_FROM_EDIT_AREA(new Label[]{ + Label.CLIENT + }, true), /** * 导入覆盖运行计划到编辑区 */ - CTC_COVER_RUN_PLAN_LIST_TO_EDIT_AREA(new Label[]{Label.CLIENT}, true), + CTC_COVER_RUN_PLAN_LIST_TO_EDIT_AREA(new Label[]{ + Label.CLIENT + }, true), + /** * 将编辑区行车日志发布至仿真计划中 */ - CTC_RELEASE_RUN_PLAN_TO_SIMULATION(new Label[]{Label.OTHER}, true), + CTC_RELEASE_RUN_PLAN_TO_SIMULATION(new Label[]{ + Label.OTHER + }, true), /** * 将CTC生效区发布至车站 */ - CTC_RELEASE_EFFECT_AREA_TO_STATION(new Label[]{Label.CLIENT}, true), + CTC_RELEASE_EFFECT_AREA_TO_STATION(new Label[]{ + Label.CLIENT + }, true), //---------------------------- 改方、辅助操作 ------------------------- + /** * 改方按钮操作 */ - ASSIST_PRESS_DOWN_TURN_DIRECTION(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_DOWN_TURN_DIRECTION(new Label[]{ + Label.CLIENT + }, true), /** * 改方抬起操作 */ - ASSIST_PRESS_UP_TURN_DIRECTION(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_UP_TURN_DIRECTION(new Label[]{ + Label.CLIENT + }, true), /** * 总辅助按钮操作 */ - ASSIST_PRESS_MAIN_ASSIST(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_MAIN_ASSIST(new Label[]{ + Label.CLIENT + }, true), /** * 接辅助按钮操作 */ - ASSIST_PRESS_RECEIVE_ASSIST(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_RECEIVE_ASSIST(new Label[]{ + Label.CLIENT + }, true), /** * 发辅助按钮操作 */ - ASSIST_PRESS_DELIVER_ASSIST(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_DELIVER_ASSIST(new Label[]{ + Label.CLIENT + }, true), + /** * 按下闭塞按钮 */ - ASSIST_PRESS_BLOCK(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_BLOCK(new Label[]{ + Label.CLIENT + }, true), + /** * 按下复原按钮 */ - ASSIST_PRESS_RESTORE(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_RESTORE(new Label[]{ + Label.CLIENT + }, true), + /** * 事故按钮 */ - ASSIST_PRESS_ACCIDENT(new Label[]{Label.CLIENT}, true), + ASSIST_PRESS_ACCIDENT(new Label[]{ + Label.CLIENT + }, true), //---------------------------- 调度命令 v1 ------------------------- + /** * 发送调度命令 */ - CTC_SEND_DISPATCH_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SEND_DISPATCH_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 阅读调度命令 */ - CTC_READ_DISPATCH_COMMAND(new Label[]{Label.OTHER}, true), + CTC_READ_DISPATCH_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 签收调度命令 */ - CTC_SIGN_DISPATCH_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SIGN_DISPATCH_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 查询调度命令 */ - CTC_QUERY_DISPATCH_COMMAND(new Label[]{Label.OTHER}, true), + CTC_QUERY_DISPATCH_COMMAND(new Label[]{ + Label.OTHER + }, true), //--------------------------- 调度命令 v2 ------------------------- + /** * 发送调度命令 */ - CTC_SEND_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SEND_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 阅读调度命令 */ - CTC_READ_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_READ_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 正常签收调度命令 */ - CTC_SIGN_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SIGN_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 发令单位代签调度命令 */ - CTC_SIGN_PROXY_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SIGN_PROXY_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 拒签调度命令 */ - CTC_SIGN_REJECT_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SIGN_REJECT_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 查询调度命令 */ - CTC_QUERY_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_QUERY_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 新建调度命令 */ - CTC_NEW_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_NEW_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 新建调度命令的发令或受令单位 */ - CTC_NEW_COMPANY_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_NEW_COMPANY_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 查询调度命令回执 */ - CTC_QUERY_RECEIPT_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_QUERY_RECEIPT_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 保存调度命令 */ - CTC_SAVE_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_SAVE_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 删除缓存箱某条调度命令 */ - CTC_DELETE_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_DELETE_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 清空缓存箱调度命令 */ - CTC_CLEAR_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_CLEAR_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 调度命令转发 */ - CTC_FORWARD_PREPARE_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_FORWARD_PREPARE_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), + /** * 调度命令增补受令者 */ - CTC_ADD_RCV_COMPANIES_DIS_COMMAND(new Label[]{Label.OTHER}, true), + CTC_ADD_RCV_COMPANIES_DIS_COMMAND(new Label[]{ + Label.OTHER + }, true), //---------------------------- 行车簿册 ------------------------- + /** * 填写行车簿册 */ - RAIL_FILL_IN_REGISTER(new Label[]{Label.OTHER}, true), + RAIL_FILL_IN_REGISTER(new Label[]{ + Label.OTHER + }, true), + /** * 查询行车簿册 */ - RAIL_QUERY_REGISTER(new Label[]{Label.OTHER}, true), + RAIL_QUERY_REGISTER(new Label[]{ + Label.OTHER + }, true), + /** * 填写票据 */ - RAIL_FILL_IN_TICKET(new Label[]{Label.OTHER}, true), + RAIL_FILL_IN_TICKET(new Label[]{ + Label.OTHER + }, true), + /** * 查询票据 */ - RAIL_QUERY_TICKET(new Label[]{Label.OTHER}, true), + RAIL_QUERY_TICKET(new Label[]{ + Label.OTHER + }, true), + /** * 给出票据 */ - RAIL_GIVE_TICKET_TO(new Label[]{Label.OTHER}, true), + RAIL_GIVE_TICKET_TO(new Label[]{ + Label.OTHER + }, true), + /** * 股道列表 */ - STATION_DETAIL_LIST(new Label[]{Label.CLIENT}, true), + STATION_DETAIL_LIST(new Label[]{ + Label.CLIENT + }, true), + /** * 股道编辑 */ - STATION_DETAIL_EDIT(new Label[]{Label.CLIENT}, true), + STATION_DETAIL_EDIT(new Label[]{ + Label.CLIENT + }, true), + /** * 编辑区发布生效 */ - STATION_DETAIL_PUBLISH(new Label[]{Label.CLIENT}, true), + STATION_DETAIL_PUBLISH(new Label[]{ + Label.CLIENT + }, true), /** * 车站出入口列表 */ - STATION_IO_GATE_LIST(new Label[]{Label.CLIENT}, true), + STATION_IO_GATE_LIST(new Label[]{ + Label.CLIENT + }, true), + /** * 车站出入口编辑 */ - STATION_IO_GATE_EDIT(new Label[]{Label.CLIENT}, true), + STATION_IO_GATE_EDIT(new Label[]{ + Label.CLIENT + }, true), + /** * 编辑区发布生效 */ - STATION_IO_GATE_PUBLISH(new Label[]{Label.CLIENT}, true), + STATION_IO_GATE_PUBLISH(new Label[]{ + Label.CLIENT + }, true), /** * 车辆固定经路列表 */ - REGULAR_TRAIN_LINE_LIST(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_LIST(new Label[]{ + Label.CLIENT + }, true), + /** * 车辆固定经路修改 */ - REGULAR_TRAIN_LINE_EDIT(new Label[]{Label.CLIENT}, true), - REGULAR_TRAIN_LINE_SAVE(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_EDIT(new Label[]{ + Label.CLIENT + }, true), + + REGULAR_TRAIN_LINE_SAVE(new Label[]{ + Label.CLIENT + }, true), + /** * 车辆固定经路删除 */ - REGULAR_TRAIN_LINE_DELETE(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_DELETE(new Label[]{ + Label.CLIENT + }, true), + /** * 车辆固定经路清除 */ - REGULAR_TRAIN_LINE_CLEAR(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_CLEAR(new Label[]{ + Label.CLIENT + }, true), + /** * 车辆固定经路批量添加 */ - REGULAR_TRAIN_LINE_BATCH(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_BATCH(new Label[]{ + Label.CLIENT + }, true), + /** * 编辑区发布生效 */ - REGULAR_TRAIN_LINE_PUBLISH(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_PUBLISH(new Label[]{ + Label.CLIENT + }, true), /** * */ - REGULAR_TRAIN_LINE_STATION_UPDATE(new Label[]{Label.CLIENT}, true), - REGULAR_TRAIN_LINE_STATION_UPDATE_LIST(new Label[]{Label.CLIENT}, true), - REGULAR_TRAIN_LINE_STATION_UPDATE_LOAD(new Label[]{Label.CLIENT}, true), + REGULAR_TRAIN_LINE_STATION_UPDATE(new Label[]{ + Label.CLIENT + }, true), + + REGULAR_TRAIN_LINE_STATION_UPDATE_LIST(new Label[]{ + Label.CLIENT + }, true), + + REGULAR_TRAIN_LINE_STATION_UPDATE_LOAD(new Label[]{ + Label.CLIENT + }, true), /** * 非正常情况接发列车关键环节控制表信息保存 */ - KEY_LINK_CONTROL_INFO_SAVE(new Label[]{Label.CLIENT}, true), + KEY_LINK_CONTROL_INFO_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 非正常情况接发列车关键环节控制表信息更新 */ - KEY_LINK_CONTROL_INFO_UPDATE(new Label[]{Label.CLIENT}, true), + KEY_LINK_CONTROL_INFO_UPDATE(new Label[]{ + Label.CLIENT + }, true), /** * 非正常情况接发列车关键环节控制表信息查询 */ - KEY_LINK_CONTROL_INFO_QUERY(new Label[]{Label.CLIENT}, true), + KEY_LINK_CONTROL_INFO_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存行车设备施工登记信息 */ - EQUIPMENT_CONSTRUCTION_INFO_SAVE(new Label[]{Label.CLIENT}, true), + EQUIPMENT_CONSTRUCTION_INFO_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 查询行车设备施工登记信息 */ - EQUIPMENT_CONSTRUCTION_INFO_QUERY(new Label[]{Label.CLIENT}, true), + EQUIPMENT_CONSTRUCTION_INFO_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存区段站交接班记录 */ - HAND_OVER_SECTION_STATION_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_SECTION_STATION_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取区间站交接班记录 */ - HAND_OVER_SECTION_STATION_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_SECTION_STATION_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存中间站交接班记录 */ - HAND_OVER_MIDDLE_STATION_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_MIDDLE_STATION_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取中间站交接班记录 */ - HAND_OVER_MIDDLE_STATION_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_MIDDLE_STATION_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存外勤助理值班员交接班记录 */ - HAND_OVER_FIELD_PERSONNEL_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_FIELD_PERSONNEL_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取外勤助理值班员交接班记录 */ - HAND_OVER_FIELD_PERSONNEL_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_FIELD_PERSONNEL_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存调车区长交接班记录 */ - HAND_OVER_SHUT_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_SHUT_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取调车区长交接班记录 */ - HAND_OVER_SHUT_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_SHUT_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存车站调度员交接班记录 */ - HAND_OVER_DISPATCHER_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_DISPATCHER_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取车站调度员交接班记录 */ - HAND_OVER_DISPATCHER_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_DISPATCHER_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存车号长交接班记录 */ - HAND_OVER_STATION_MASTER_SAVE(new Label[]{Label.CLIENT}, true), + HAND_OVER_STATION_MASTER_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 获取车号长交接班记录 */ - HAND_OVER_STATION_MASTER_QUERY(new Label[]{Label.CLIENT}, true), + HAND_OVER_STATION_MASTER_QUERY(new Label[]{ + Label.CLIENT + }, true), /** * 保存防洪安全上岗签到表 */ - CONTROL_FLOOD_SIGN_SAVE(new Label[]{Label.CLIENT}, true), + CONTROL_FLOOD_SIGN_SAVE(new Label[]{ + Label.CLIENT + }, true), /** * 更新防洪安全上岗签到表 */ - CONTROL_FLOOD_SIGN_UPDATE(new Label[]{Label.CLIENT}, true), + CONTROL_FLOOD_SIGN_UPDATE(new Label[]{ + Label.CLIENT + }, true), /** * 查询防洪安全上岗签到表 */ - CONTROL_FLOOD_SIGN_QUERY(new Label[]{Label.CLIENT}, true), + CONTROL_FLOOD_SIGN_QUERY(new Label[]{ + Label.CLIENT + }, true), //----------------------------会话信息------------------------------ + /** * 电话:创建电话消息 */ - Conversation_Phone_Start(new Label[]{Label.CLIENT}, true), + Conversation_Phone_Start(new Label[]{ + Label.CLIENT + }, true), + /** * 电话:接听电话 */ - Conversation_Phone_Connect(new Label[]{Label.CLIENT}, true), + Conversation_Phone_Connect(new Label[]{ + Label.CLIENT + }, true), + /** * 电话:语音消息 */ - Conversation_Phone_Audio(new Label[]{Label.CLIENT}, true), + Conversation_Phone_Audio(new Label[]{ + Label.CLIENT + }, true), + /** * 电话:文字消息 */ - Conversation_Phone_Text(new Label[]{Label.CLIENT}, true), + Conversation_Phone_Text(new Label[]{ + Label.CLIENT + }, true), + /** * 电话:挂电话 */ - Conversation_Phone_Exit(new Label[]{Label.CLIENT}, true), + Conversation_Phone_Exit(new Label[]{ + Label.CLIENT + }, true), + /** * 发送会话消息(语音输入) */ - Conversation_Chat_Audio(new Label[]{Label.CLIENT}, true), + Conversation_Chat_Audio(new Label[]{ + Label.CLIENT + }, true), + /** * 发送会话消息(文字输入) */ - Conversation_Chat_Text(new Label[]{Label.CLIENT}, true), + Conversation_Chat_Text(new Label[]{ + Label.CLIENT + }, true), + /** * 发送会话消息(语音输入)Base64格式 */ - Conversation_Chat_Audio_Base64(new Label[]{Label.CLIENT}, true), + Conversation_Chat_Audio_Base64(new Label[]{ + Label.CLIENT + }, true), /** * 紧急应急语音命令 */ - YJDDZH_VOICE_COMMAND(new Label[]{Label.CLIENT}, true), + YJDDZH_VOICE_COMMAND(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组创建 */ - Conversation_Group_Create(new Label[]{Label.CLIENT}, true), + Conversation_Group_Create(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组修改组名 */ - Conversation_Group_Update_Name(new Label[]{Label.CLIENT}, true), + Conversation_Group_Update_Name(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组修改群主 */ - Conversation_Group_Update_Leader(new Label[]{Label.CLIENT}, true), + Conversation_Group_Update_Leader(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组邀请成员 */ - Conversation_Group_Invite_Member(new Label[]{Label.CLIENT}, true), + Conversation_Group_Invite_Member(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组移除成员 */ - Conversation_Group_Remove_Member(new Label[]{Label.CLIENT}, true), + Conversation_Group_Remove_Member(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组退出 */ - Conversation_Group_Exit(new Label[]{Label.CLIENT}, true), + Conversation_Group_Exit(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组解散 */ - Conversation_Group_Dissolve(new Label[]{Label.CLIENT}, true), + Conversation_Group_Dissolve(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组语音文件聊天 */ - Conversation_Group_Audio_Chat(new Label[]{Label.CLIENT}, true), + Conversation_Group_Audio_Chat(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组文字聊天 */ - Conversation_Group_Text_Chat(new Label[]{Label.CLIENT}, true), + Conversation_Group_Text_Chat(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组语音文件聊天 */ - Conversation_Group_Audio_Base64(new Label[]{Label.CLIENT}, true), + Conversation_Group_Audio_Base64(new Label[]{ + Label.CLIENT + }, true), /** * 会话群组获取未读消息 */ - Conversation_Group_Read_Message(new Label[]{Label.CLIENT}, true), + Conversation_Group_Read_Message(new Label[]{ + Label.CLIENT + }, true), /** * 跟指定用户文字私聊 */ - Conversation_Group_Private_Text_Chat(new Label[]{Label.CLIENT}, true), + Conversation_Group_Private_Text_Chat(new Label[]{ + Label.CLIENT + }, true), /** * 跟指定用户发语音信息 */ - Conversation_Group_Private_Audio_Base64(new Label[]{Label.CLIENT}, true), + Conversation_Group_Private_Audio_Base64(new Label[]{ + Label.CLIENT + }, true), + /** * 向指定用户发送(已上传的)语音消息 */ - Conversation_Group_Private_Audio_Chat(new Label[]{Label.CLIENT}, true), + Conversation_Group_Private_Audio_Chat(new Label[]{ + Label.CLIENT + }, true), //---------------------------- PSL ------------------------------ + /** * PSL盘按下按钮 */ - PSL_PRESS_BUTTON(new Label[]{Label.OTHER}, true), + PSL_PRESS_BUTTON(new Label[]{ + Label.OTHER + }, true), //---------------------------- IBP ------------------------------ + /** * IBP盘按下按钮 */ - IBP_PRESS_BUTTON(new Label[]{Label.OTHER}, true), + IBP_PRESS_BUTTON(new Label[]{ + Label.OTHER + }, true), /** * IBP盘松开按钮 */ - IBP_RELEASE_BUTTON(new Label[]{Label.OTHER}, true), + IBP_RELEASE_BUTTON(new Label[]{ + Label.OTHER + }, true), ; /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java index 8c1ffe620..399698c2e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java @@ -16,332 +16,360 @@ import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; - import java.util.List; import java.util.Objects; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; @Slf4j @OperateHandler public class StationOperateHandler { - @Autowired - private AtsStationService atsStationService; - @Autowired - private CiApiService ciApiService; + @Autowired + private AtsStationService atsStationService; + @Autowired + private CiApiService ciApiService; - /** - * 设置折返站折返策略 - * - * @param simulation - * @param stationCode 折返车站code - * @param id 折返策略id - */ - @OperateHandlerMapping(type = Operation.Type.Station_Set_Turn_Back_Strategy) - public void setTurnBackStrategy(Simulation simulation, String stationCode, Integer id) { - this.atsStationService.setTurnBackStrategy(simulation, stationCode, id); - } + /** + * 设置折返站折返策略 + * + * @param simulation + * @param stationCode 折返车站code + * @param id 折返策略id + */ + @OperateHandlerMapping(type = Operation.Type.Station_Set_Turn_Back_Strategy) + public void setTurnBackStrategy(Simulation simulation, String stationCode, Integer id) { + this.atsStationService.setTurnBackStrategy(simulation, stationCode, id); + } - /** - * 全站设置联锁自动触发 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Set_CI_Auto_Trigger) - public void setCIAutoTrigger(Simulation simulation, String stationCode) { - this.atsStationService.setCiAutoTrigger(simulation, stationCode); - } + /** + * 全站设置联锁自动触发 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Set_CI_Auto_Trigger) + public void setCIAutoTrigger(Simulation simulation, String stationCode) { + this.atsStationService.setCiAutoTrigger(simulation, stationCode); + } - /** - * 全站取消联锁自动触发 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Cancel_CI_Auto_Trigger) - public void cancelCIAutoTrigger(Simulation simulation, String stationCode) { - this.atsStationService.cancelCiAutoTrigger(simulation, stationCode); - } + /** + * 全站取消联锁自动触发 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Cancel_CI_Auto_Trigger) + public void cancelCIAutoTrigger(Simulation simulation, String stationCode) { + this.atsStationService.cancelCiAutoTrigger(simulation, stationCode); + } - /** - * 所有进路自排开 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Open_Auto_Setting) - public void openAutoSetting(Simulation simulation, String stationCode) { - this.atsStationService.openAutoSetting(simulation, stationCode); - } + /** + * 所有进路自排开 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Open_Auto_Setting) + public void openAutoSetting(Simulation simulation, String stationCode) { + this.atsStationService.openAutoSetting(simulation, stationCode); + } - /** - * 所有进路自排关 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Close_Auto_Setting) - public void closeAutoSetting(Simulation simulation, String stationCode) { - this.atsStationService.closeAutoSetting(simulation, stationCode); - } + /** + * 所有进路自排关 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Close_Auto_Setting) + public void closeAutoSetting(Simulation simulation, String stationCode) { + this.atsStationService.closeAutoSetting(simulation, stationCode); + } - /** - * 执行关键操作测试 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Key_Operation_Test) - public void keyOperationTest() { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); - } + /** + * 执行关键操作测试 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Key_Operation_Test) + public void keyOperationTest() { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); + } - /** - * 上电解锁 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock) - public void powerOnUnlock(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - ciApiService.powerOnUnlock(simulation, repository.getByCode(stationCode, Station.class)); - } + /** + * 上电解锁 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock) + public void powerOnUnlock(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + ciApiService.powerOnUnlock(simulation, repository.getByCode(stationCode, Station.class)); + } - /** - * 显示车站信息 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Info) - public StationStatus info(Simulation simulation, String stationCode) { - return atsStationService.info(simulation, stationCode); - } + /** + * 显示车站信息 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Info) + public StationStatus info(Simulation simulation, String stationCode) { + return atsStationService.info(simulation, stationCode); + } - /** - * 设置引导总锁 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Set_Master_Guide_Lock) - public void setMasterGuideLock(Simulation simulation, String stationCode) { - atsStationService.setMasterGuideLock(simulation, stationCode); - } + /** + * 设置引导总锁 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Set_Master_Guide_Lock) + public void setMasterGuideLock(Simulation simulation, String stationCode) { + atsStationService.setMasterGuideLock(simulation, stationCode); + } - /** - * 取消引导总锁 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Cancel_Master_Guide_Lock) - public void cancelMasterGuideLock(Simulation simulation, String stationCode) { - atsStationService.cancelMasterGuideLock(simulation, stationCode); - } + /** + * 取消引导总锁 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Cancel_Master_Guide_Lock) + public void cancelMasterGuideLock(Simulation simulation, String stationCode) { + atsStationService.cancelMasterGuideLock(simulation, stationCode); + } - /** - * 请求站控lc - */ - @OperateHandlerMapping(type = Operation.Type.CM_Apply_For_Station_Control) - public void applyForStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - atsStationService.applyForStationControl(simulation, fromMember, stationCodes); - } + /** + * 请求站控lc + */ + @OperateHandlerMapping(type = Operation.Type.CM_Apply_For_Station_Control) + public void applyForStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + atsStationService.applyForStationControl(simulation, fromMember, stationCodes); + } - /** - * 请求中控lc - */ - @OperateHandlerMapping(type = Operation.Type.CM_Apply_For_Center_Control) - public void applyForCenterControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - atsStationService.applyForCenterControl(simulation, fromMember, stationCodes); - } + /** + * 请求中控lc + */ + @OperateHandlerMapping(type = Operation.Type.CM_Apply_For_Center_Control) + public void applyForCenterControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + atsStationService.applyForCenterControl(simulation, fromMember, stationCodes); + } - /** - * 连锁控 - */ - @OperateHandlerMapping(type = Operation.Type.CM_Interlock_Control) - public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - atsStationService.applyForInterlockControl(simulation, fromMember, stationCodes); - } + @OperateHandlerMapping(type = Operation.Type.CM_Direct_Turn_Center_Control) + public void directTurnCenterControl(Simulation simulation, String stationCode) { + atsStationService.directTurnCenterControl(simulation, stationCode); + } - /** - * 强制站控-l - */ - @OperateHandlerMapping(type = Operation.Type.CM_Force_Station_Control) - public void forceForStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - atsStationService.forceForStationControl(simulation, fromMember, stationCodes); - } + /** + * 连锁控 + */ + @OperateHandlerMapping(type = Operation.Type.CM_Interlock_Control) + public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + atsStationService.applyForInterlockControl(simulation, fromMember, stationCodes); + } - /** - * 紧急站控-l - */ - @OperateHandlerMapping(type = Operation.Type.CM_Emergency_Station_Control) - public void emergencyStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - atsStationService.emergencyStationControl(simulation, fromMember, stationCodes); - } + /** + * 强制站控-l + */ + @OperateHandlerMapping(type = Operation.Type.CM_Force_Station_Control) + public void forceForStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + atsStationService.forceForStationControl(simulation, fromMember, stationCodes); + } + + /** + * 紧急站控-l + */ + @OperateHandlerMapping(type = Operation.Type.CM_Emergency_Station_Control) + public void emergencyStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + atsStationService.emergencyStationControl(simulation, fromMember, stationCodes); + } - /** - * 回复站控请求c - */ - @OperateHandlerMapping(type = Operation.Type.CM_Reply_Station_Control) - public void replyForStationControl(Simulation simulation, List replyVOList) { - atsStationService.replyForStationControl(simulation, replyVOList); - } + /** + * 回复站控请求c + */ + @OperateHandlerMapping(type = Operation.Type.CM_Reply_Station_Control) + public void replyForStationControl(Simulation simulation, + List replyVOList) { + atsStationService.replyForStationControl(simulation, replyVOList); + } - /** - * 回复中控请求c - */ - @OperateHandlerMapping(type = Operation.Type.CM_Reply_Center_Control) - public void replyForCenterControl(Simulation simulation, List replyVOList) { - atsStationService.replyForCenterControl(simulation, replyVOList); - } + /** + * 回复中控请求c + */ + @OperateHandlerMapping(type = Operation.Type.CM_Reply_Center_Control) + public void replyForCenterControl(Simulation simulation, + List replyVOList) { + atsStationService.replyForCenterControl(simulation, replyVOList); + } - /** - * 关站信号 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Close_AllSignal) - public void closeAllSignal(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - repository.getSignalList().stream() - .filter(s -> s.getStation() != null && Objects.equals(stationCode, s.getStation().getCode())) - .forEach(signal -> { - ciApiService.blockadeSignal(simulation, signal.getCode()); - if (signal.getLockedRoute() != null) { - ciApiService.closeSignal(simulation, signal.getCode()); - } - }); - } + /** + * 关站信号 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Close_AllSignal) + public void closeAllSignal(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + repository.getSignalList().stream() + .filter( + s -> s.getStation() != null && Objects.equals(stationCode, s.getStation().getCode())) + .forEach(signal -> { + ciApiService.blockadeSignal(simulation, signal.getCode()); + if (signal.getLockedRoute() != null) { + ciApiService.closeSignal(simulation, signal.getCode()); + } + }); + } - /** - * 关区信号 - */ - @OperateHandlerMapping(type = Operation.Type.Station_CIArea_Close_AllSignal) - public void closeCIAreaAllSignal(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - repository.getSignalList().stream() - .filter(s -> Objects.equals(stationCode, s.getInterlockStation().getCode())) - .forEach(signal -> { - ciApiService.blockadeSignal(simulation, signal.getCode()); - ciApiService.closeSignal(simulation, signal.getCode()); - }); - } + /** + * 关区信号 + */ + @OperateHandlerMapping(type = Operation.Type.Station_CIArea_Close_AllSignal) + public void closeCIAreaAllSignal(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + repository.getSignalList().stream() + .filter(s -> Objects.equals(stationCode, s.getInterlockStation().getCode())) + .forEach(signal -> { + ciApiService.blockadeSignal(simulation, signal.getCode()); + ciApiService.closeSignal(simulation, signal.getCode()); + }); + } - /** - * 交出控制权/下放站控 - */ - @OperateHandlerMapping(type = Operation.Type.CM_Surrender_Control) - public void surrenderControl(Simulation simulation, SimulationMember member, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.surrenderControl(simulation, member, repository.getByCode(stationCode, Station.class)); - } + /** + * 交出控制权/下放站控 + */ + @OperateHandlerMapping(type = Operation.Type.CM_Surrender_Control) + public void surrenderControl(Simulation simulation, SimulationMember member, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.surrenderControl(simulation, member, + repository.getByCode(stationCode, Station.class)); + } - /** - * 接收控制权 - */ - @OperateHandlerMapping(type = Operation.Type.CM_Receive_Control) - public void receiveControl(Simulation simulation, SimulationMember member, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.receiveControl(simulation, member, repository.getByCode(stationCode, Station.class)); - } + /** + * 接收控制权 + */ + @OperateHandlerMapping(type = Operation.Type.CM_Receive_Control) + public void receiveControl(Simulation simulation, SimulationMember member, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.receiveControl(simulation, member, + repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Restart) - public void restart(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.ciApiService.restart(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Restart) + public void restart(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.ciApiService.restart(simulation, repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Release) - public void release(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.ciApiService.release(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Release) + public void release(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.ciApiService.release(simulation, repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Set_CI_Auto) - public void setCIAuto(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.setCIAuto(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Set_CI_Auto) + public void setCIAuto(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.setCIAuto(simulation, repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Cancel_CI_Auto) - public void cancelCIAuto(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.cancelCIAuto(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Cancel_CI_Auto) + public void cancelCIAuto(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.cancelCIAuto(simulation, + repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Set_Or_Cancel_Force_Physical_Signal) - public void setOrCancelForcePhysicalSignal(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.setOrCancelForcePhysicalSignal(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Set_Or_Cancel_Force_Physical_Signal) + public void setOrCancelForcePhysicalSignal(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.setOrCancelForcePhysicalSignal(simulation, + repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Control_Apply) - public void applyControl(Simulation simulation, List stationCodes, SimulationMember simulationMember) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, "未选择车站"); - this.atsStationService.applyControl(simulation, stationCodes, simulationMember); - } + @OperateHandlerMapping(type = Operation.Type.Station_Control_Apply) + public void applyControl(Simulation simulation, List stationCodes, + SimulationMember simulationMember) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, + "未选择车站"); + this.atsStationService.applyControl(simulation, stationCodes, simulationMember); + } - @OperateHandlerMapping(type = Operation.Type.Station_Control_Transfer) - public void transferControl(Simulation simulation, List stationCodes, boolean agree, SimulationMember simulationMember) { - this.atsStationService.transferControl(simulation, stationCodes, agree, simulationMember); - } + @OperateHandlerMapping(type = Operation.Type.Station_Control_Transfer) + public void transferControl(Simulation simulation, List stationCodes, boolean agree, + SimulationMember simulationMember) { + this.atsStationService.transferControl(simulation, stationCodes, agree, simulationMember); + } - @OperateHandlerMapping(type = Operation.Type.Station_Control_Devolve) - public void devolveControl(Simulation simulation, List stationCodes, SimulationMember simulationMember) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, "未选择车站"); - this.atsStationService.devolveControl(simulation, stationCodes, simulationMember); - } + @OperateHandlerMapping(type = Operation.Type.Station_Control_Devolve) + public void devolveControl(Simulation simulation, List stationCodes, + SimulationMember simulationMember) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, + "未选择车站"); + this.atsStationService.devolveControl(simulation, stationCodes, simulationMember); + } - @OperateHandlerMapping(type = Operation.Type.Station_Control_Revoke) - public void revokeControl(Simulation simulation, List stationCodes, SimulationMember simulationMember) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, "未选择车站"); - this.atsStationService.revokeControl(simulation, stationCodes, simulationMember); - } + @OperateHandlerMapping(type = Operation.Type.Station_Control_Revoke) + public void revokeControl(Simulation simulation, List stationCodes, + SimulationMember simulationMember) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, + "未选择车站"); + this.atsStationService.revokeControl(simulation, stationCodes, simulationMember); + } - @OperateHandlerMapping(type = Operation.Type.Station_Pre_Reset) - public void preReset(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.preReset(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Pre_Reset) + public void preReset(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.preReset(simulation, repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Cancel_Pre_Reset) - public void cancelPreReset(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.cancelPreReset(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Cancel_Pre_Reset) + public void cancelPreReset(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.cancelPreReset(simulation, + repository.getByCode(stationCode, Station.class)); + } - @OperateHandlerMapping(type = Operation.Type.Station_Restart_Interlock_Machine) - public void restartInterlock(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - this.atsStationService.restartInterlock(simulation, repository.getByCode(stationCode, Station.class)); - } + @OperateHandlerMapping(type = Operation.Type.Station_Restart_Interlock_Machine) + public void restartInterlock(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + this.atsStationService.restartInterlock(simulation, + repository.getByCode(stationCode, Station.class)); + } - /** - * 引导总锁(大铁) - * - * @param stationCode 车站 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Master_Lock) - public void masterLock(Simulation simulation, String stationCode, Station.Throat throat) { - ciApiService.switchMasterLock(simulation, stationCode, throat); - } + /** + * 引导总锁(大铁) + * + * @param stationCode 车站 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Master_Lock) + public void masterLock(Simulation simulation, String stationCode, Station.Throat throat) { + ciApiService.switchMasterLock(simulation, stationCode, throat); + } - /** - * 解除引导总锁(大铁) - */ - @OperateHandlerMapping(type = Operation.Type.Station_Master_Unlock) - public void masterUnlock(Simulation simulation, String stationCode, Station.Throat throat) { - ciApiService.switchMasterUnlock(simulation, stationCode, throat); - } + /** + * 解除引导总锁(大铁) + */ + @OperateHandlerMapping(type = Operation.Type.Station_Master_Unlock) + public void masterUnlock(Simulation simulation, String stationCode, Station.Throat throat) { + ciApiService.switchMasterUnlock(simulation, stationCode, throat); + } - /** - * 大铁非常站控(大铁) - * - * @param stationCode 车站编号 - * @param pressDown 弹起:0;按下:1 - */ - @OperateHandlerMapping(type = Operation.Type.CM_Special_Station_Control) - public void specialStationControl(Simulation simulation, SimulationMember fromMember, String stationCode, Integer pressDown) { - atsStationService.specialStationControl(simulation, fromMember, stationCode, pressDown); - } + /** + * 大铁非常站控(大铁) + * + * @param stationCode 车站编号 + * @param pressDown 弹起:0;按下:1 + */ + @OperateHandlerMapping(type = Operation.Type.CM_Special_Station_Control) + public void specialStationControl(Simulation simulation, SimulationMember fromMember, + String stationCode, Integer pressDown) { + atsStationService.specialStationControl(simulation, fromMember, stationCode, pressDown); + } - /** - * 车站状态选择切换 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Switch_Route_Set_Model) - public void switchRouteSetModel(Simulation simulation, List routeSetModeParams) { - atsStationService.switchRouteSetModel(simulation, routeSetModeParams); - } + /** + * 车站状态选择切换 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Switch_Route_Set_Model) + public void switchRouteSetModel(Simulation simulation, List routeSetModeParams) { + atsStationService.switchRouteSetModel(simulation, routeSetModeParams); + } - /** - * 车站在分散自律时,操作模式转换 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Switch_Control_Operation_Mode) - public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, List params) { - atsStationService.controlOperationModeSwitch(simulation, fromMember, params); - } + /** + * 车站在分散自律时,操作模式转换 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Switch_Control_Operation_Mode) + public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, + List params) { + atsStationService.controlOperationModeSwitch(simulation, fromMember, params); + } - /** - * 分散自律同意、不同意转换模式操作 - */ - @OperateHandlerMapping(type = Operation.Type.Station_Handle_Operation_Mode_Apply) - public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, List noAgreeStationCodes) { - atsStationService.handleOperationModelApply(simulation, agreeStationCodes, noAgreeStationCodes); - } + /** + * 分散自律同意、不同意转换模式操作 + */ + @OperateHandlerMapping(type = Operation.Type.Station_Handle_Operation_Mode_Apply) + public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, + List noAgreeStationCodes) { + atsStationService.handleOperationModelApply(simulation, agreeStationCodes, noAgreeStationCodes); + } } 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 b71c4e33f..bf0c289df 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 @@ -9,7 +9,12 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.command.OperationMessage; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.*; +import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.Route; +import club.joylink.rtss.simulation.cbtc.data.map.Section; +import club.joylink.rtss.simulation.cbtc.data.map.Signal; +import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.status.StationStatus; import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption; import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO; @@ -21,6 +26,17 @@ import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.websocket.StompMessageService; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -28,731 +44,806 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.time.LocalTime; -import java.util.*; -import java.util.stream.Collectors; - @Component @Slf4j public class AtsStationService { - @Autowired - private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher; + @Autowired + private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher; - @Autowired - private AtsRouteService atsRouteService; + @Autowired + private AtsRouteService atsRouteService; - @Autowired - private StompMessageService stompMessageService; + @Autowired + private StompMessageService stompMessageService; - public StationStatus info(Simulation simulation, String stationCode) { - Station station = getStation(simulation, stationCode); - return new StationStatus(station); + public StationStatus info(Simulation simulation, String stationCode) { + Station station = getStation(simulation, stationCode); + return new StationStatus(station); + } + + public Station getStation(Simulation simulation, String stationCode) { + Station station = simulation.getRepository().getByCode(stationCode, Station.class); + if (station == null) { + throw new SimulationException(SimulationExceptionType.Data_Not_Exist, + String.format("code为【%s】的车站不存在", stationCode)); + } + return station; + } + + /** + * 设置引导总锁 + */ + public void setMasterGuideLock(Simulation simulation, String stationCode) { + Station station = getStation(simulation, stationCode); + if (!station.isCentralized()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.format("车站[%s(%s)]不是设备集中站", station.getName(), station.getCode())); + } + station.setTotalGuideLock(true); + List switches = simulation.getRepository() + .getSwitchListByDeviceStationCode(station.getCode()); + if (!CollectionUtils.isEmpty(switches)) { + switches.forEach(s -> s.setSingleLock(true)); + } + } + + /** + * 取消引导总锁 + */ + public void cancelMasterGuideLock(Simulation simulation, String stationCode) { + Station station = getStation(simulation, stationCode); + if (!station.isCentralized()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.format("车站[%s(%s)]不是设备集中站", station.getName(), station.getCode())); + } + station.setTotalGuideLock(false); + List switches = simulation.getRepository() + .getSwitchListByDeviceStationCode(station.getCode()); + if (!CollectionUtils.isEmpty(switches)) { + switches.forEach(s -> s.setSingleLock(false)); + } + } + + /** + * 请求站控处理 + */ + public void applyForStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + this.controlTransfer(simulation, fromMember, stationCodes, Station.ControlMode.Local); + } + + /** + * 请求中控处理 + */ + public void applyForCenterControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + this.controlTransfer(simulation, fromMember, stationCodes, Station.ControlMode.Center); + } + + /** + * 控制权转换 + */ + private void controlTransfer(Simulation simulation, SimulationMember fromMember, + List stationCodes, Station.ControlMode controlMode) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "请求控制权转换的车站列表不能为空"); + } + for (String stationCode : stationCodes) { + Station station = simulation.getRepository().getByCode(stationCode, Station.class); + station.apply4ControlTransfer(fromMember, controlMode); + } + } + + /** + * 强制站控处理 + */ + public void forceForStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "强制站控的车站不能为空"); + } + List results = new ArrayList<>(); + stationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + station.setControlMode(Station.ControlMode.Local); + results.add( + new ControlModelApplyResult(stationCode, ControlModelApplyResult.Application.FORCE_LOCAL, + true)); + }); + sendControlModelApplyResult(simulation, fromMember, results); + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(fromMember.getId(), + new HashSet<>(Collections.singleton(fromMember)), + Operation.Type.CM_Reply_Station_Control, null, true, stationCodes)); + + } + + /** + * 紧急站控处理 + */ + public void emergencyStationControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "紧急站控的车站不能为空"); } - public Station getStation(Simulation simulation, String stationCode) { - Station station = simulation.getRepository().getByCode(stationCode, Station.class); - if (station == null) { - throw new SimulationException(SimulationExceptionType.Data_Not_Exist, - String.format("code为【%s】的车站不存在", stationCode)); - } - return station; + List results = new ArrayList<>(); + stationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + station.setControlMode(Station.ControlMode.Emergency); + results.add(new ControlModelApplyResult(stationCode, + ControlModelApplyResult.Application.EMERGENCY_LOCAL, true)); + }); + sendControlModelApplyResult(simulation, fromMember, results); + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(fromMember.getId(), + new HashSet<>(Collections.singleton(fromMember)), + Operation.Type.CM_Reply_Station_Control, null, true, stationCodes)); + } + + /** + * 请求连锁控处理 + */ + public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, + List stationCodes) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "连锁控的车站不能为空"); } + List results = new ArrayList<>(); + stationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + station.setControlMode(Station.ControlMode.Interlock); + results.add( + new ControlModelApplyResult(stationCode, ControlModelApplyResult.Application.INTERLOCK, + true)); + }); + sendControlModelApplyResult(simulation, fromMember, results); + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(fromMember.getId(), + new HashSet<>(Collections.singleton(fromMember)), + Operation.Type.CM_Reply_Interlock_Control, null, true, stationCodes)); + } - /** - * 设置引导总锁 - */ - public void setMasterGuideLock(Simulation simulation, String stationCode) { - Station station = getStation(simulation, stationCode); - if (!station.isCentralized()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - String.format("车站[%s(%s)]不是设备集中站", station.getName(), station.getCode())); - } - station.setTotalGuideLock(true); - List switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); - if (!CollectionUtils.isEmpty(switches)) { - switches.forEach(s -> s.setSingleLock(true)); - } + /** + * 回复站控请求c + */ + public void replyForStationControl(Simulation simulation, + List replyVOList) { + this.reply4ControlTransferApplication(simulation, replyVOList, Station.ControlMode.Local); + } + + /** + * 回复中控请求c + */ + public void replyForCenterControl(Simulation simulation, + List replyVOList) { + this.reply4ControlTransferApplication(simulation, replyVOList, Station.ControlMode.Center); + } + + /** + * 回复控制权转换 + */ + private void reply4ControlTransferApplication(Simulation simulation, + List replyVOList, Station.ControlMode controlMode) { + if (CollectionUtils.isEmpty(replyVOList)) { + throw new SimulationException(SimulationExceptionType.Invalid_Operation, + "回复结果列表不能为空"); } - - /** - * 取消引导总锁 - */ - public void cancelMasterGuideLock(Simulation simulation, String stationCode) { - Station station = getStation(simulation, stationCode); - if (!station.isCentralized()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - String.format("车站[%s(%s)]不是设备集中站", station.getName(), station.getCode())); - } - station.setTotalGuideLock(false); - List switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); - if (!CollectionUtils.isEmpty(switches)) { - switches.forEach(s -> s.setSingleLock(false)); - } - } - - /** - * 请求站控处理 - */ - public void applyForStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - this.controlTransfer(simulation, fromMember, stationCodes, Station.ControlMode.Local); - } - - /** - * 请求中控处理 - */ - public void applyForCenterControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - this.controlTransfer(simulation, fromMember, stationCodes, Station.ControlMode.Center); - } - - /** - * 控制权转换 - */ - private void controlTransfer(Simulation simulation, SimulationMember fromMember, List stationCodes, Station.ControlMode controlMode) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "请求控制权转换的车站列表不能为空"); - } - for (String stationCode : stationCodes) { - Station station = simulation.getRepository().getByCode(stationCode, Station.class); - station.apply4ControlTransfer(fromMember, controlMode); - } - } - - /** - * 强制站控处理 - */ - public void forceForStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "强制站控的车站不能为空"); - } - List results = new ArrayList<>(); - stationCodes.forEach(stationCode -> { - Station station = getStation(simulation, stationCode); - station.setControlMode(Station.ControlMode.Local); - results.add(new ControlModelApplyResult(stationCode, ControlModelApplyResult.Application.FORCE_LOCAL, true)); - }); - sendControlModelApplyResult(simulation, fromMember, results); - atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), - new HashSet<>(Collections.singleton(fromMember)), Operation.Type.CM_Reply_Station_Control, null, true, stationCodes)); - - } - - /** - * 紧急站控处理 - */ - public void emergencyStationControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "紧急站控的车站不能为空"); - } - - List results = new ArrayList<>(); - stationCodes.forEach(stationCode -> { - Station station = getStation(simulation, stationCode); - station.setControlMode(Station.ControlMode.Emergency); - results.add(new ControlModelApplyResult(stationCode, ControlModelApplyResult.Application.EMERGENCY_LOCAL, true)); - }); - sendControlModelApplyResult(simulation, fromMember, results); - atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), - new HashSet<>(Collections.singleton(fromMember)), Operation.Type.CM_Reply_Station_Control, null, true, stationCodes)); - } - - /** - * 请求连锁控处理 - */ - public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List stationCodes) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "连锁控的车站不能为空"); - } - List results = new ArrayList<>(); - stationCodes.forEach(stationCode -> { - Station station = getStation(simulation, stationCode); - station.setControlMode(Station.ControlMode.Interlock); - results.add(new ControlModelApplyResult(stationCode, ControlModelApplyResult.Application.INTERLOCK, true)); - }); - sendControlModelApplyResult(simulation, fromMember, results); - atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), - new HashSet<>(Collections.singleton(fromMember)), Operation.Type.CM_Reply_Interlock_Control, null, true, stationCodes)); - } - - /** - * 回复站控请求c - */ - public void replyForStationControl(Simulation simulation, List replyVOList) { - this.reply4ControlTransferApplication(simulation, replyVOList, Station.ControlMode.Local); - } - - /** - * 回复中控请求c - */ - public void replyForCenterControl(Simulation simulation, List replyVOList) { - this.reply4ControlTransferApplication(simulation, replyVOList, Station.ControlMode.Center); - } - - /** - * 回复控制权转换 - */ - private void reply4ControlTransferApplication(Simulation simulation, List replyVOList, Station.ControlMode controlMode) { - if (CollectionUtils.isEmpty(replyVOList)) { - throw new SimulationException(SimulationExceptionType.Invalid_Operation, "回复结果列表不能为空"); - } - List stationCodes = new ArrayList<>(replyVOList.size()); - SimulationMember applicant = null; - boolean replyResult = false; - List results = new ArrayList<>(); - for (ControlTransferReplyVO reply : replyVOList) { - Station station = simulation.getRepository().getByCode(reply.getStationCode(), Station.class); - if (station.isControlTransferApplying()) { - if (Station.ControlMode.Center.equals(controlMode)) { - results.add(new ControlModelApplyResult(station.getCode(), ControlModelApplyResult.Application.CENTER, reply.isAgree())); - } else { - results.add(new ControlModelApplyResult(station.getCode(), ControlModelApplyResult.Application.LOCAL, reply.isAgree())); - } - if (reply.isAgree()) { - station.setControlMode(controlMode); - } - if (!Station.ControlMode.Center.equals(controlMode)) { - applicant = station.getApplicant(); - replyResult = reply.isAgree(); - stationCodes.add(station.getCode()); - } - station.cancelControlTransferApplication(); - } - } - if (applicant != null) { - sendControlModelApplyResult(simulation, applicant, results); - } - if (!CollectionUtils.isEmpty(stationCodes)) { - atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, - new OperationMessage(applicant.getId(), new HashSet<>(Collections.singleton(applicant)), - Operation.Type.CM_Reply_Station_Control, null, replyResult, stationCodes)); - } - } - - /** - * 设置折返策略 - * - * @param simulation - * @param stationCode - * @param id 折返策略id - */ - public void setTurnBackStrategy(Simulation simulation, String stationCode, Integer id) { - SimulationDataRepository repository = simulation.getRepository(); - Station station = repository.getByCode(stationCode, Station.class); - if (!station.isTurnBack()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - String.format("车站[%s(%s)]不是折返站", - station.getName(), station.getCode())); - } - StationTurnBackStrategyOption strategyOption = station.getTurnBackStrategyById(id); - log.debug(String.format("车站[%s(%s)]应用了折返策略[%s]", - station.getName(), station.getCode(), - strategyOption.toString())); - station.setTbStrategyId(id); - } - - /** - * 交出控制权 - * - * @param simulation - * @param member - * @param station - */ - public void surrenderControl(Simulation simulation, SimulationMember member, Station station) { - Station deviceStation; - if (station.isCentralized()) { - deviceStation = station; + List stationCodes = new ArrayList<>(replyVOList.size()); + SimulationMember applicant = null; + boolean replyResult = false; + List results = new ArrayList<>(); + for (ControlTransferReplyVO reply : replyVOList) { + Station station = simulation.getRepository().getByCode(reply.getStationCode(), Station.class); + if (station.isControlTransferApplying()) { + if (Station.ControlMode.Center.equals(controlMode)) { + results.add(new ControlModelApplyResult(station.getCode(), + ControlModelApplyResult.Application.CENTER, reply.isAgree())); } else { - deviceStation = station.getDeviceStation(); + results.add(new ControlModelApplyResult(station.getCode(), + ControlModelApplyResult.Application.LOCAL, reply.isAgree())); } - SimulationDataRepository repository = simulation.getRepository(); - Set stations = repository.getStationsByDeviceStations(deviceStation); - boolean canSurrender = false; - if (member.isDispatcher() && deviceStation.isCenterControl()) { - canSurrender = true; - } else if (member.isStationSupervisor() && deviceStation.isLocalControl()) { - if (stations.stream().anyMatch(sta -> Objects.equals(sta, member.getDevice()))) { - canSurrender = true; - } + if (reply.isAgree()) { + station.setControlMode(controlMode); } - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(canSurrender, - String.format("成员[%s]无权交出设备集中站[%s]的控制权", member.getId(), deviceStation.debugStr())); - stations.forEach(Station::surrenderControl); + if (!Station.ControlMode.Center.equals(controlMode)) { + applicant = station.getApplicant(); + replyResult = reply.isAgree(); + stationCodes.add(station.getCode()); + } + station.cancelControlTransferApplication(); + } } + if (applicant != null) { + sendControlModelApplyResult(simulation, applicant, results); + } + if (!CollectionUtils.isEmpty(stationCodes)) { + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(applicant.getId(), new HashSet<>(Collections.singleton(applicant)), + Operation.Type.CM_Reply_Station_Control, null, replyResult, stationCodes)); + } + } - /** - * 接收控制权 - * - * @param simulation - * @param member - * @param station - */ - public void receiveControl(Simulation simulation, SimulationMember member, Station station) { - Station deviceStation; - if (station.isCentralized()) { - deviceStation = station; + /** + * 设置折返策略 + * + * @param simulation + * @param stationCode + * @param id 折返策略id + */ + public void setTurnBackStrategy(Simulation simulation, String stationCode, Integer id) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + if (!station.isTurnBack()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.format("车站[%s(%s)]不是折返站", + station.getName(), station.getCode())); + } + StationTurnBackStrategyOption strategyOption = station.getTurnBackStrategyById(id); + log.debug(String.format("车站[%s(%s)]应用了折返策略[%s]", + station.getName(), station.getCode(), + strategyOption.toString())); + station.setTbStrategyId(id); + } + + /** + * 交出控制权 + * + * @param simulation + * @param member + * @param station + */ + public void surrenderControl(Simulation simulation, SimulationMember member, Station station) { + Station deviceStation; + if (station.isCentralized()) { + deviceStation = station; + } else { + deviceStation = station.getDeviceStation(); + } + SimulationDataRepository repository = simulation.getRepository(); + Set stations = repository.getStationsByDeviceStations(deviceStation); + boolean canSurrender = false; + if (member.isDispatcher() && deviceStation.isCenterControl()) { + canSurrender = true; + } else if (member.isStationSupervisor() && deviceStation.isLocalControl()) { + if (stations.stream().anyMatch(sta -> Objects.equals(sta, member.getDevice()))) { + canSurrender = true; + } + } + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(canSurrender, + String.format("成员[%s]无权交出设备集中站[%s]的控制权", member.getId(), + deviceStation.debugStr())); + stations.forEach(Station::surrenderControl); + } + + /** + * 接收控制权 + * + * @param simulation + * @param member + * @param station + */ + public void receiveControl(Simulation simulation, SimulationMember member, Station station) { + Station deviceStation; + if (station.isCentralized()) { + deviceStation = station; + } else { + deviceStation = station.getDeviceStation(); + } + if ((member.isDispatcher() && deviceStation.isCenterControl()) + || (member.isStationSupervisor() && deviceStation.isLocalControl())) { //已是期望的控制模式 + return; + } + SimulationDataRepository repository = simulation.getRepository(); + Set stations = repository.getStationsByDeviceStations(deviceStation); + + if (member.isDispatcher()) { + if (!deviceStation.isSurrenderControl()) { + List stationMember = simulation.getSimulationMembersByDevice( + deviceStation); + if (!CollectionUtils.isEmpty(stationMember)) { + boolean allDispatchersAreRobots = stationMember.stream() + .allMatch(SimulationMember::isRobot); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED + .assertTrue(allDispatchersAreRobots, + String.format("车站[%s]控制权未交出", deviceStation.debugStr())); + } + } + stations.forEach(Station::occControl); + } else if (member.isStationSupervisor()) { + if (!deviceStation.isSurrenderControl()) { + List dispatchers = simulation.querySimulationMembersOfRole( + SimulationMember.Type.DISPATCHER); + if (!CollectionUtils.isEmpty(dispatchers)) { + boolean allDispatchersAreRobots = dispatchers.stream() + .allMatch(SimulationMember::isRobot); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED + .assertTrue(allDispatchersAreRobots, + String.format("车站[%s]控制权未交出", deviceStation.debugStr())); + } + } + stations.forEach(Station::localControl); + } + } + + public void setCiAutoTrigger(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + if (!station.isInterlock()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "车站不是联锁站"); + } + List routeList = repository.getRouteList(); + List routeCodes = routeList.stream() + .filter(route -> Objects.equals(route.getInterlockStation(), station)) + .map(MapElement::getCode) + .collect(Collectors.toList()); + atsRouteService.setCiAutoTrigger(simulation, null, routeCodes); + } + + public void cancelCiAutoTrigger(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + if (!station.isInterlock()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "车站不是联锁站"); + } + List routeList = repository.getRouteList(); + List routeCodes = routeList.stream() + .filter(route -> Objects.equals(route.getInterlockStation(), station)) + .map(MapElement::getCode) + .collect(Collectors.toList()); + atsRouteService.cancelCiAutoTrigger(simulation, null, routeCodes); + } + + /** + * 更新车站控制权转换倒计时及有效性 + */ + public void updateControlTransferApplicationStatus(Station station) { + if (station.isControlTransferApplying()) { + Integer validDuration = station.getValidDuration(); + validDuration -= SimulationConstants.ATS_LOOP_RATE; + if (validDuration <= 0) { + station.cancelControlTransferApplication(); + } else { + station.setValidDuration(validDuration); + } + } + } + + /** + * 全站设置自动通过进路 + */ + public void setCIAuto(Simulation simulation, @NonNull Station station) { + List routes = simulation.getRepository().getRouteList(); + routes.stream() + .filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() + && !route.isFleetMode()) + .map(Route::getStart) + .distinct() + .forEach(signal -> atsRouteService.setCiAuto(simulation, signal.getCode())); + } + + /** + * 全站取消自动通过进路 + */ + public void cancelCIAuto(Simulation simulation, @NonNull Station station) { + List routes = simulation.getRepository().getRouteList(); + routes.stream().filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() + && route.isFleetMode()) + .filter(route -> station.equals(route.getInterlockStation()) && route.isFleetMode()) + .map(Route::getStart) + .forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode())); + } + + /** + * 设置/取消强制点灯 + */ + public void setOrCancelForcePhysicalSignal(Simulation simulation, @NonNull Station station) { + List signalList = simulation.getRepository().getSignalList().stream() + .filter(signal -> station.equals(signal.getInterlockStation())) + .collect(Collectors.toList()); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(signalList, + station.debugStr() + "下无信号机"); + if (signalList.get(0).isForcePhysical()) { + signalList.forEach(signal -> signal.setForcePhysical(false)); + } else { + signalList.forEach(signal -> signal.setForcePhysical(true)); + } + } + + /** + * 计轴预复位 + */ + public void preReset(Simulation simulation, Station station) { + if (station.isCentralized()) { + station.getPreResetValidDuration().set(60 * 1000); + } else { + station.getDeviceStation().getPreResetValidDuration().set(60 * 1000); + } + } + + /** + * 更新车站随时间变化的属性 + */ + public void updateFieldThatChangeOverTime(Simulation simulation) { + List stations = simulation.getRepository().getStationList(); + for (Station station : stations) { + //更新车站控制权转换倒计时及有效性 + this.updateControlTransferApplicationStatus(station); + // 更新车站预复位的剩余时间 + this.updatePreResetRemainderTime(station); + } + } + + private void updatePreResetRemainderTime(Station station) { + int validDuration = station.getPreResetValidDuration().get(); + if (validDuration > 0) { + station.getPreResetValidDuration().compareAndExchange(validDuration, + Math.max(0, validDuration - SimulationConstants.ATS_LOOP_RATE)); + } + } + + public void applyControl(Simulation simulation, List stationCodes, + SimulationMember member) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "申请控制的车站列表不能为空"); + } + //TODO 角色和设备检查 + synchronized (simulation) { + SimulationDataRepository repository = simulation.getRepository(); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(stationCodes.stream().anyMatch( + s -> Objects.nonNull(repository.getByCode(s, Station.class).getControlApplicant())), + "申请列车存在已被申请的车站"); + stationCodes.forEach(s -> { + Station station = repository.getByCode(s, Station.class); + if (station.getController() == null) { + station.setController(member); } else { - deviceStation = station.getDeviceStation(); + station.setControlApplicant(member); } - if ((member.isDispatcher() && deviceStation.isCenterControl()) - || (member.isStationSupervisor() && deviceStation.isLocalControl())) { //已是期望的控制模式 - return; + }); + } + } + + public void transferControl(Simulation simulation, List stationCodes, boolean agree, + SimulationMember member) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "控制权转移的车站列表不能为空"); + } + //TODO 角色和设备检查 + synchronized (simulation) { + SimulationDataRepository repository = simulation.getRepository(); + stationCodes.forEach(s -> { + Station station = repository.getByCode(s, Station.class); + if (agree) { + if (station.getController() == null || Objects.equals(station.getController(), member)) { + station.setController(station.getControlApplicant()); + station.setControlApplicant(null); + } + return; } - SimulationDataRepository repository = simulation.getRepository(); - Set stations = repository.getStationsByDeviceStations(deviceStation); + station.setControlApplicant(null); + }); + } + } - if (member.isDispatcher()) { - if (!deviceStation.isSurrenderControl()) { - List stationMember = simulation.getSimulationMembersByDevice(deviceStation); - if (!CollectionUtils.isEmpty(stationMember)) { - boolean allDispatchersAreRobots = stationMember.stream().allMatch(SimulationMember::isRobot); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED - .assertTrue(allDispatchersAreRobots, - String.format("车站[%s]控制权未交出", deviceStation.debugStr())); - } - } - stations.forEach(Station::occControl); - } else if (member.isStationSupervisor()) { - if (!deviceStation.isSurrenderControl()) { - List dispatchers = simulation.querySimulationMembersOfRole(SimulationMember.Type.DISPATCHER); - if (!CollectionUtils.isEmpty(dispatchers)) { - boolean allDispatchersAreRobots = dispatchers.stream().allMatch(SimulationMember::isRobot); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED - .assertTrue(allDispatchersAreRobots, - String.format("车站[%s]控制权未交出", deviceStation.debugStr())); - } - } - stations.forEach(Station::localControl); + public void devolveControl(Simulation simulation, List stationCodes, + SimulationMember member) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "控制权下放的车站列表不能为空"); + } + //TODO 角色和设备检查 + synchronized (simulation) { + SimulationDataRepository repository = simulation.getRepository(); + stationCodes.forEach(s -> { + Station station = repository.getByCode(s, Station.class); + if (Objects.nonNull(station.getController()) && Objects.equals(station.getController(), + member)) { + station.setController(null); + station.setEmergencyController(false); + station.setControlApplicant(null); } + }); } + } - public void setCiAutoTrigger(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - Station station = repository.getByCode(stationCode, Station.class); - if (!station.isInterlock()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - "车站不是联锁站"); + + public void revokeControl(Simulation simulation, List stationCodes, + SimulationMember member) { + if (CollectionUtils.isEmpty(stationCodes)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "回收控制权的车站列表不能为空"); + } + //TODO 角色和设备检查 + synchronized (simulation) { + SimulationDataRepository repository = simulation.getRepository(); + stationCodes.forEach(s -> { + Station station = repository.getByCode(s, Station.class); + station.setController(member); + station.setEmergencyController(true); + station.setControlApplicant(null); + }); + } + } + + public void cancelPreReset(Simulation simulation, Station station) { + station.getPreResetValidDuration().set(0); + } + + public void restartInterlock(Simulation simulation, Station station) { + if (station.getDeviceStation() != null) { + station = station.getDeviceStation(); + } + station.setInterlockMachineStarting(true); + station.setRestartTime(LocalTime.now()); + station.setPowerUnlockButtonShow(true); + Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障 + SimulationDataRepository repository = simulation.getRepository(); + //该站范围内区段故障锁闭 + station.getDeviceMap().values().stream() + .filter(v -> v instanceof Section) + .map(v -> (Section) v) + .forEach(section -> section.recursivelySetFaultLock(true)); + //车站交出控制权 + station.setControlMode(Station.ControlMode.None); + for (Station station1 : repository.getStationList()) { + if (Objects.equals(station, station1.getDeviceStation())) { + station1.setControlMode(Station.ControlMode.None); + } + } + } + + public void openAutoSetting(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + List routeList = repository.getRouteList(); + List routeCodes = routeList.stream() + .filter(route -> Objects.equals(route.getInterlockStation(), station)) + .map(MapElement::getCode) + .collect(Collectors.toList()); + atsRouteService.setRouteAtsControl(simulation, null, routeCodes, null); + } + + public void closeAutoSetting(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + List routeList = repository.getRouteList(); + List routeCodes = routeList.stream() + .filter(route -> Objects.equals(route.getInterlockStation(), station)) + .map(MapElement::getCode) + .collect(Collectors.toList()); + atsRouteService.setRouteHumanControl(simulation, null, routeCodes); + } + + /** + * 大铁非常站控(大铁) + * + * @param simulation 仿真实体 + * @param fromMember + * @param stationCode 车站编码 + * @param pressDown 按下抬起 + */ + public void specialStationControl(Simulation simulation, SimulationMember fromMember, + String stationCode, Integer pressDown) { + if (StringUtils.isEmpty(stationCode)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "非常站控的车站不能为空"); + } + Station station = getStation(simulation, stationCode); + if (pressDown == 0 && !station.refreshAllowAutonomyStatus()) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + "车站场界有按钮处于按下状态"); + } + // 按下时非常站控,抬起时自律控制 + Operation.Type operationType = (pressDown == 1) ? Operation.Type.CM_Reply_Interlock_Control + : Operation.Type.CM_Reply_Station_Control; + Station.ControlMode controlMode = + (pressDown == 1) ? Station.ControlMode.Interlock : Station.ControlMode.Local; + // 变更控制模式 + station.setControlMode(controlMode); + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)), + operationType, null, true, Arrays.asList(stationCode))); + } + + /** + * 车站状态选择切换 + * + * @param simulation 仿真实体 + * @param routeSetModeParams 转换参数 + */ + public void switchRouteSetModel(Simulation simulation, List routeSetModeParams) { + List logList = new ArrayList<>(routeSetModeParams.size()); + for (RouteModelParam params : routeSetModeParams) { + if (StringUtils.isEmpty(params.getStationCode())) { + logList.add("车站不能为空"); + continue; + } + Station station = getStation(simulation, params.getStationCode()); + if (station.isLocalControl() && Objects.equals(Station.OperationMode.Station, + station.getOperationMode())) { + if (params.getPlanControl() != null) { + station.setPlanControl(params.getPlanControl()); // 计划控制 } - List routeList = repository.getRouteList(); - List routeCodes = routeList.stream() - .filter(route -> Objects.equals(route.getInterlockStation(), station)) - .map(MapElement::getCode) - .collect(Collectors.toList()); - atsRouteService.setCiAutoTrigger(simulation, null, routeCodes); + station.setRouteSetMode(params.getRouteSetMode()); // 进路排列方式 + } else { + logList.add(String.format("车站【%s(%s)】不可操作", station.getName(), station.getCode())); + } } - - public void cancelCiAutoTrigger(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - Station station = repository.getByCode(stationCode, Station.class); - if (!station.isInterlock()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - "车站不是联锁站"); - } - List routeList = repository.getRouteList(); - List routeCodes = routeList.stream() - .filter(route -> Objects.equals(route.getInterlockStation(), station)) - .map(MapElement::getCode) - .collect(Collectors.toList()); - atsRouteService.cancelCiAutoTrigger(simulation, null, routeCodes); + if (!CollectionUtils.isEmpty(logList)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.join(";", logList)); } + } - /** - * 更新车站控制权转换倒计时及有效性 - */ - public void updateControlTransferApplicationStatus(Station station) { - if (station.isControlTransferApplying()) { - Integer validDuration = station.getValidDuration(); - validDuration -= SimulationConstants.ATS_LOOP_RATE; - if (validDuration <= 0) { - station.cancelControlTransferApplication(); - } else { - station.setValidDuration(validDuration); - } - } - } - - /** - * 全站设置自动通过进路 - */ - public void setCIAuto(Simulation simulation, @NonNull Station station) { - List routes = simulation.getRepository().getRouteList(); - routes.stream() - .filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() && !route.isFleetMode()) - .map(Route::getStart) - .distinct() - .forEach(signal -> atsRouteService.setCiAuto(simulation, signal.getCode())); - } - - /** - * 全站取消自动通过进路 - */ - public void cancelCIAuto(Simulation simulation, @NonNull Station station) { - List routes = simulation.getRepository().getRouteList(); - routes.stream().filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() && route.isFleetMode()) - .filter(route -> station.equals(route.getInterlockStation()) && route.isFleetMode()) - .map(Route::getStart) - .forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode())); - } - - /** - * 设置/取消强制点灯 - */ - public void setOrCancelForcePhysicalSignal(Simulation simulation, @NonNull Station station) { - List signalList = simulation.getRepository().getSignalList().stream() - .filter(signal -> station.equals(signal.getInterlockStation())).collect(Collectors.toList()); - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(signalList, station.debugStr() + "下无信号机"); - if (signalList.get(0).isForcePhysical()) { - signalList.forEach(signal -> signal.setForcePhysical(false)); + /** + * 车站在分散自律时,操作模式转换 + * + * @param simulation 仿真 + * @param fromMember 操作角色 + * @param params 转换参数 + */ + public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, + List params) { + List logList = new ArrayList<>(params.size()); + for (OperationModeParam param : params) { + Station station = getStation(simulation, param.getStationCode()); + if (Station.ControlMode.Local.equals(station.getControlMode())) { + Station.OperationModeApplication applyOperation = new Station.OperationModeApplication( + fromMember, station.getOperationMode(), param.getTarget()); + if (applyOperation.isNoHandle()) { + log.info(String.format("车站【%s(%s)】 操作方式与目的方式相同不做操作", station.getName(), + station.getCode())); + } else if (applyOperation.isDirectConversion()) { // 如果可以直接转换 + station.setOperationMode(param.getTarget()); + log.info(String.format("车站【%s(%s)】 直接转换", station.getName(), station.getCode())); + } else if (applyOperation.isProhibitConversion()) { // 禁止转换 + logList.add(String.format("车站【%s(%s)】 禁止转换", station.getName(), station.getCode())); } else { - signalList.forEach(signal -> signal.setForcePhysical(true)); + applyOperation.setApplyDateTime(simulation.getCorrectSystemTime()); + if (applyOperation.isCenterApplication()) { // 如果中心请求,需要车站同意 + SimulationMember member = simulation.getSimulationMember( + SimulationMember.Type.STATION_SUPERVISOR, station.getCode()); + applyOperation.setApprovalMember(Arrays.asList(member)); + } else { // 车站同意需要中心同意 + applyOperation.setApprovalMember( + simulation.getSimulationMembers().stream() + .filter(s -> Objects.equals(s.getType(), SimulationMember.Type.DISPATCHER)) + .collect(Collectors.toList()) + ); + } + station.setOperationModeApplication(applyOperation); } + } else { // 非分散自律抛出异常 + logList.add(String.format("车站【%s(%s)】 非分散自律,不可操作", station.getName(), + station.getCode())); + } } + if (!CollectionUtils.isEmpty(logList)) { + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.join(";", logList)); + } + } - /** - * 计轴预复位 - */ - public void preReset(Simulation simulation, Station station) { - if (station.isCentralized()) { - station.getPreResetValidDuration().set(60 * 1000); - } else { - station.getDeviceStation().getPreResetValidDuration().set(60 * 1000); - } - } + /** + * 分散自律同意、不同意转换模式操作 + * + * @param simulation 仿真 + * @param agreeStationCodes 同意车站编码 + * @param noAgreeStationCodes 不同意车站编码 + */ + public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, + List noAgreeStationCodes) { + agreeStationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + if (station.getOperationModeApplication() != null) { + doOperationModeSwitch(station); + } + }); + // 不同意分散自律操作模式转换 + noAgreeStationCodes.forEach(stationCode -> { + Station station = getStation(simulation, stationCode); + station.setOperationModeApplication(null); + }); + } - /** - * 更新车站随时间变化的属性 - */ - public void updateFieldThatChangeOverTime(Simulation simulation) { - List stations = simulation.getRepository().getStationList(); - for (Station station : stations) { - //更新车站控制权转换倒计时及有效性 - this.updateControlTransferApplicationStatus(station); - // 更新车站预复位的剩余时间 - this.updatePreResetRemainderTime(station); + /** + * 发送申请转换操作模式申请 + * + * @param simulation + */ + public void replyOperationMode(Simulation simulation) { + List stationList = simulation.getRepository().getStationList(); + // 需要给用户发送的申请列表 + Map>> userMessageMap = new HashMap<>(stationList.size()); + stationList.stream().filter(station -> { + Station.OperationModeApplication modeApplication = station.getOperationModeApplication(); + if (modeApplication == null) { + return false; + } + if (CollectionUtils.isEmpty(modeApplication.getApprovalMember())) { + return false; + } + // 申请超过两分钟 + if (simulation.getCorrectSystemTime() + .isAfter(modeApplication.getApplyDateTime().plusMinutes(2))) { + station.setOperationModeApplication(null); + return false; + } + return true; + }).forEach(station -> { + Station.OperationModeApplication modeApplication = station.getOperationModeApplication(); + Set userSet = modeApplication.getApprovalMember().stream().filter(m -> !m.isRobot()) + .map(club.joylink.rtss.simulation.SimulationMember::getUserId) + .collect(Collectors.toSet()); + if (!CollectionUtils.isEmpty(userSet)) { + Map messageMap = new HashMap<>(); + messageMap.put("code", station.getCode()); + messageMap.put("source", modeApplication.getSource()); + messageMap.put("target", modeApplication.getTarget()); + messageMap.put("applyMember", modeApplication.getApplicationMember().getId()); + messageMap.put("applyDateTime", modeApplication.getApplyDateTime()); + for (String userId : userSet) { + if (!userMessageMap.containsKey(userId)) { + userMessageMap.put(userId, new ArrayList<>()); + } + userMessageMap.get(userId).add(messageMap); } + } + }); + if (!CollectionUtils.isEmpty(userMessageMap)) { + userMessageMap.forEach((k, v) -> + stompMessageService.sendToUser(k, + SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, + simulation.getId(), v))); } + } - private void updatePreResetRemainderTime(Station station) { - int validDuration = station.getPreResetValidDuration().get(); - if (validDuration > 0) { - station.getPreResetValidDuration().compareAndExchange(validDuration, Math.max(0, validDuration - SimulationConstants.ATS_LOOP_RATE)); - } + /** + * 操作模式直接转换 + */ + public void doOperationModeSwitch(Station station) { + Station.OperationModeApplication applyOperation = station.getOperationModeApplication(); + if (applyOperation != null) { + station.setOperationMode(applyOperation.getTarget()); + station.setOperationModeApplication(null); } + } - public void applyControl(Simulation simulation, List stationCodes, SimulationMember member) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "申请控制的车站列表不能为空"); - } - //TODO 角色和设备检查 - synchronized (simulation) { - SimulationDataRepository repository = simulation.getRepository(); - BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(stationCodes.stream().anyMatch(s -> Objects.nonNull(repository.getByCode(s, Station.class).getControlApplicant())), "申请列车存在已被申请的车站"); - stationCodes.forEach(s -> { - Station station = repository.getByCode(s, Station.class); - if (station.getController() == null) { - station.setController(member); - } else { - station.setControlApplicant(member); - } - }); - } + public void directTurnCenterControl(Simulation simulation, String stationCode) { + SimulationDataRepository repository = simulation.getRepository(); + Station station = repository.getByCode(stationCode, Station.class); + if (!station.isCenterControl()) { + station.setControlMode(Station.ControlMode.Center); } + } - public void transferControl(Simulation simulation, List stationCodes, boolean agree, SimulationMember member) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "控制权转移的车站列表不能为空"); - } - //TODO 角色和设备检查 - synchronized (simulation) { - SimulationDataRepository repository = simulation.getRepository(); - stationCodes.forEach(s -> { - Station station = repository.getByCode(s, Station.class); - if (agree) { - if (station.getController() == null || Objects.equals(station.getController(), member)) { - station.setController(station.getControlApplicant()); - station.setControlApplicant(null); - } - return; - } - station.setControlApplicant(null); - }); - } + /** + * 发送控制模式申请结果 + */ + private void sendControlModelApplyResult(Simulation sim, SimulationMember applier, + List results) { + SocketMessageVO> message = SocketMessageFactory.buildControlModelApplyResultMessage( + sim.getId(), results); + if (!applier.isRobot()) { + stompMessageService.sendToUser(applier.getUserId(), message); + return; } - - public void devolveControl(Simulation simulation, List stationCodes, SimulationMember member) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "控制权下放的车站列表不能为空"); - } - //TODO 角色和设备检查 - synchronized (simulation) { - SimulationDataRepository repository = simulation.getRepository(); - stationCodes.forEach(s -> { - Station station = repository.getByCode(s, Station.class); - if (Objects.nonNull(station.getController()) && Objects.equals(station.getController(), member)) { - station.setController(null); - station.setEmergencyController(false); - station.setControlApplicant(null); - } - }); - } + if (sim.isInSceneTraining() && applier.isRobot()) { + applier.getUnreceivedMessages().offer(message); } + } - public void revokeControl(Simulation simulation, List stationCodes, SimulationMember member) { - if (CollectionUtils.isEmpty(stationCodes)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "回收控制权的车站列表不能为空"); - } - //TODO 角色和设备检查 - synchronized (simulation) { - SimulationDataRepository repository = simulation.getRepository(); - stationCodes.forEach(s -> { - Station station = repository.getByCode(s, Station.class); - station.setController(member); - station.setEmergencyController(true); - station.setControlApplicant(null); - }); - } - } - - public void cancelPreReset(Simulation simulation, Station station) { - station.getPreResetValidDuration().set(0); - } - - public void restartInterlock(Simulation simulation, Station station) { - if (station.getDeviceStation() != null) { - station = station.getDeviceStation(); - } - station.setInterlockMachineStarting(true); - station.setRestartTime(LocalTime.now()); - station.setPowerUnlockButtonShow(true); - Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障 - SimulationDataRepository repository = simulation.getRepository(); - //该站范围内区段故障锁闭 - station.getDeviceMap().values().stream() - .filter(v -> v instanceof Section) - .map(v -> (Section) v) - .forEach(section -> section.recursivelySetFaultLock(true)); - //车站交出控制权 - station.setControlMode(Station.ControlMode.None); - for (Station station1 : repository.getStationList()) { - if (Objects.equals(station, station1.getDeviceStation())) { - station1.setControlMode(Station.ControlMode.None); - } - } - } - - public void openAutoSetting(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - Station station = repository.getByCode(stationCode, Station.class); - List routeList = repository.getRouteList(); - List routeCodes = routeList.stream() - .filter(route -> Objects.equals(route.getInterlockStation(), station)) - .map(MapElement::getCode) - .collect(Collectors.toList()); - atsRouteService.setRouteAtsControl(simulation, null, routeCodes, null); - } - - public void closeAutoSetting(Simulation simulation, String stationCode) { - SimulationDataRepository repository = simulation.getRepository(); - Station station = repository.getByCode(stationCode, Station.class); - List routeList = repository.getRouteList(); - List routeCodes = routeList.stream() - .filter(route -> Objects.equals(route.getInterlockStation(), station)) - .map(MapElement::getCode) - .collect(Collectors.toList()); - atsRouteService.setRouteHumanControl(simulation, null, routeCodes); - } - - /** - * 大铁非常站控(大铁) - * - * @param simulation 仿真实体 - * @param fromMember - * @param stationCode 车站编码 - * @param pressDown 按下抬起 - */ - public void specialStationControl(Simulation simulation, SimulationMember fromMember, String stationCode, Integer pressDown) { - if (StringUtils.isEmpty(stationCode)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "非常站控的车站不能为空"); - } - Station station = getStation(simulation, stationCode); - if (pressDown == 0 && !station.refreshAllowAutonomyStatus()) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "车站场界有按钮处于按下状态"); - } - // 按下时非常站控,抬起时自律控制 - Operation.Type operationType = (pressDown == 1) ? Operation.Type.CM_Reply_Interlock_Control : Operation.Type.CM_Reply_Station_Control; - Station.ControlMode controlMode = (pressDown == 1) ? Station.ControlMode.Interlock : Station.ControlMode.Local; - // 变更控制模式 - station.setControlMode(controlMode); - atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, - new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)), - operationType, null, true, Arrays.asList(stationCode))); - } - - /** - * 车站状态选择切换 - * - * @param simulation 仿真实体 - * @param routeSetModeParams 转换参数 - */ - public void switchRouteSetModel(Simulation simulation, List routeSetModeParams) { - List logList = new ArrayList<>(routeSetModeParams.size()); - for (RouteModelParam params : routeSetModeParams) { - if (StringUtils.isEmpty(params.getStationCode())) { - logList.add("车站不能为空"); - continue; - } - Station station = getStation(simulation, params.getStationCode()); - if (station.isLocalControl() && Objects.equals(Station.OperationMode.Station, station.getOperationMode())) { - if (params.getPlanControl() != null) { - station.setPlanControl(params.getPlanControl()); // 计划控制 - } - station.setRouteSetMode(params.getRouteSetMode()); // 进路排列方式 - } else { - logList.add(String.format("车站【%s(%s)】不可操作", station.getName(), station.getCode())); - } - } - if (!CollectionUtils.isEmpty(logList)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, String.join(";", logList)); - } - } - - /** - * 车站在分散自律时,操作模式转换 - * - * @param simulation 仿真 - * @param fromMember 操作角色 - * @param params 转换参数 - */ - public void controlOperationModeSwitch(Simulation simulation, SimulationMember fromMember, List params) { - List logList = new ArrayList<>(params.size()); - for (OperationModeParam param : params) { - Station station = getStation(simulation, param.getStationCode()); - if (Station.ControlMode.Local.equals(station.getControlMode())) { - Station.OperationModeApplication applyOperation = new Station.OperationModeApplication(fromMember, station.getOperationMode(), param.getTarget()); - if (applyOperation.isNoHandle()) { - log.info(String.format("车站【%s(%s)】 操作方式与目的方式相同不做操作", station.getName(), station.getCode())); - } else if (applyOperation.isDirectConversion()) { // 如果可以直接转换 - station.setOperationMode(param.getTarget()); - log.info(String.format("车站【%s(%s)】 直接转换", station.getName(), station.getCode())); - } else if (applyOperation.isProhibitConversion()) { // 禁止转换 - logList.add(String.format("车站【%s(%s)】 禁止转换", station.getName(), station.getCode())); - } else { - applyOperation.setApplyDateTime(simulation.getCorrectSystemTime()); - if (applyOperation.isCenterApplication()) { // 如果中心请求,需要车站同意 - SimulationMember member = simulation.getSimulationMember(SimulationMember.Type.STATION_SUPERVISOR, station.getCode()); - applyOperation.setApprovalMember(Arrays.asList(member)); - } else { // 车站同意需要中心同意 - applyOperation.setApprovalMember( - simulation.getSimulationMembers().stream() - .filter(s -> Objects.equals(s.getType(), SimulationMember.Type.DISPATCHER)) - .collect(Collectors.toList()) - ); - } - station.setOperationModeApplication(applyOperation); - } - } else { // 非分散自律抛出异常 - logList.add(String.format("车站【%s(%s)】 非分散自律,不可操作", station.getName(), station.getCode())); - } - } - if (!CollectionUtils.isEmpty(logList)) { - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, String.join(";", logList)); - } - } - - /** - * 分散自律同意、不同意转换模式操作 - * - * @param simulation 仿真 - * @param agreeStationCodes 同意车站编码 - * @param noAgreeStationCodes 不同意车站编码 - */ - public void handleOperationModelApply(Simulation simulation, List agreeStationCodes, List noAgreeStationCodes) { - agreeStationCodes.forEach(stationCode -> { - Station station = getStation(simulation, stationCode); - if (station.getOperationModeApplication() != null) { - doOperationModeSwitch(station); - } - }); - // 不同意分散自律操作模式转换 - noAgreeStationCodes.forEach(stationCode -> { - Station station = getStation(simulation, stationCode); - station.setOperationModeApplication(null); - }); - } - - /** - * 发送申请转换操作模式申请 - * - * @param simulation - */ - public void replyOperationMode(Simulation simulation) { - List stationList = simulation.getRepository().getStationList(); - // 需要给用户发送的申请列表 - Map>> userMessageMap = new HashMap<>(stationList.size()); - stationList.stream().filter(station -> { - Station.OperationModeApplication modeApplication = station.getOperationModeApplication(); - if (modeApplication == null) { - return false; - } - if (CollectionUtils.isEmpty(modeApplication.getApprovalMember())) { - return false; - } - // 申请超过两分钟 - if (simulation.getCorrectSystemTime().isAfter(modeApplication.getApplyDateTime().plusMinutes(2))) { - station.setOperationModeApplication(null); - return false; - } - return true; - }).forEach(station -> { - Station.OperationModeApplication modeApplication = station.getOperationModeApplication(); - Set userSet = modeApplication.getApprovalMember().stream().filter(m -> !m.isRobot()) - .map(club.joylink.rtss.simulation.SimulationMember::getUserId).collect(Collectors.toSet()); - if (!CollectionUtils.isEmpty(userSet)) { - Map messageMap = new HashMap<>(); - messageMap.put("code", station.getCode()); - messageMap.put("source", modeApplication.getSource()); - messageMap.put("target", modeApplication.getTarget()); - messageMap.put("applyMember", modeApplication.getApplicationMember().getId()); - messageMap.put("applyDateTime", modeApplication.getApplyDateTime()); - for (String userId : userSet) { - if (!userMessageMap.containsKey(userId)) { - userMessageMap.put(userId, new ArrayList<>()); - } - userMessageMap.get(userId).add(messageMap); - } - } - }); - if (!CollectionUtils.isEmpty(userMessageMap)) { - userMessageMap.forEach((k, v) -> - stompMessageService.sendToUser(k, - SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, simulation.getId(), v))); - } - } - - /** - * 操作模式直接转换 - */ - public void doOperationModeSwitch(Station station) { - Station.OperationModeApplication applyOperation = station.getOperationModeApplication(); - if (applyOperation != null) { - station.setOperationMode(applyOperation.getTarget()); - station.setOperationModeApplication(null); - } - } - - /** - * 发送控制模式申请结果 - */ - private void sendControlModelApplyResult(Simulation sim, SimulationMember applier, List results) { - SocketMessageVO> message = SocketMessageFactory.buildControlModelApplyResultMessage(sim.getId(), results); - if (!applier.isRobot()) { - stompMessageService.sendToUser(applier.getUserId(), message); - return; - } - if (sim.isInSceneTraining() && applier.isRobot()) { - applier.getUnreceivedMessages().offer(message); - } - } }