剧本不记录除驾驶、停车、换端外的所有列车驾驶相关操作

This commit is contained in:
joylink_zhangsai 2022-07-29 16:51:41 +08:00
parent c862318813
commit 76652f4a4f
3 changed files with 64 additions and 93 deletions

View File

@ -41,10 +41,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -83,6 +80,23 @@ public class ScriptSimulationService implements IScriptSimulationService {
@Autowired
private CompetitionAndScriptManager competitionAndScriptManager;
private static final Set<String> IGNORE_OPERATION = new HashSet<>();
static {
IGNORE_OPERATION.add(Operation.Type.Driver_Force_Change.name());
IGNORE_OPERATION.add(Operation.Type.Driver_EB.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Gear_Change.name());
IGNORE_OPERATION.add(Operation.Type.Driver_ATO_Open.name());
IGNORE_OPERATION.add(Operation.Type.Driver_ATP_Change.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Drive_Mode_Change.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Door_On_Off.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Door_Mode.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Door_Selection.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Preselection_Mode_Up.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Preselection_Mode_Down.name());
IGNORE_OPERATION.add(Operation.Type.Driver_Confirm.name());
}
@Override
public String scriptWriteSimulation(Long scriptId, LoginUserInfoVO loginUserInfoVO) {
// 先拿到剧本
@ -241,7 +255,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
throw new SimulationException(SimulationExceptionType.System_Fault, "仿真中没有剧本");
}
SocketMessageVO<ScriptActionVO> message = SocketMessageFactory.buildScriptActionMessage(simulation.getId(), new ScriptActionVO(action));
if(!Operation.Type.Driver_Gear_Change.equals(message.getBody().getOperationType())){
if (!Operation.Type.Driver_Gear_Change.equals(message.getBody().getOperationType())) {
script.addAction(action);
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
}
@ -529,7 +543,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
if (!Objects.equals(true, event.getSuccessful())) { //如果操作没有执行成功
return;
}
if (Operation.Type.Driver_Force_Change.name().equals(event.getOperate())) { //推列车控制杆动作特别记录
if (IGNORE_OPERATION.contains(event.getOperate())) {
return;
}
ScriptActionBO action = new ScriptActionBO();

View File

@ -628,38 +628,38 @@ public class Operation {
* 设乘务组号
*/
Train_Set_Crew_Number(),
/**
* 标记ATP切除
*/
Train_Tag_Atp_Cut(),
/**
* 标记ATP恢复
*/
Train_Tag_Atp_Recover(),
/**
* 放行冲突列车
*/
Train_Allow_Pass(),
/**
* 列车信息
*/
Train_Info(),
/**
* 人工限速行驶
*/
Train_Manual_Limit_Drive(),
/**
* 按进路闭塞法行车
*/
Train_Manual_Route_Blocking_Drive(),
/**
* 越信号机红灯
*/
Train_Pass_Red_Signal(),
/**
* 引导信号行车
*/
Train_Drive_By_Guide_Signal(),
// /**
// * 标记ATP切除
// */
// Train_Tag_Atp_Cut(),
// /**
// * 标记ATP恢复
// */
// Train_Tag_Atp_Recover(),
// /**
// * 放行冲突列车
// */
// Train_Allow_Pass(),
// /**
// * 列车信息
// */
// Train_Info(),
// /**
// * 人工限速行驶
// */
// Train_Manual_Limit_Drive(),
// /**
// * 按进路闭塞法行车
// */
// Train_Manual_Route_Blocking_Drive(),
// /**
// * 越信号机红灯
// */
// Train_Pass_Red_Signal(),
// /**
// * 引导信号行车
// */
// Train_Drive_By_Guide_Signal(),
// /** 添加列车识别号 */
// Train_Identify_Add(),
// /** 删除列车识别号 */
@ -672,10 +672,10 @@ public class Operation {
// Train_Identify_Move(),
// /** 交换列车识别号 */
// Train_Identify_Exchange(),
/**
* 列车惰行
*/
Train_Idle,
// /**
// * 列车惰行
// */
// Train_Idle,
/**
* 扣车
*/
@ -684,14 +684,14 @@ public class Operation {
* 取消扣车
*/
Train_Cancel_Hold,
/**
* 删除车次号
*/
Train_Delete_Service_Number,
/**
* 更改目的地码
*/
Train_Change_Destination_Code,
// /**
// * 删除车次号
// */
// Train_Delete_Service_Number,
// /**
// * 更改目的地码
// */
// Train_Change_Destination_Code,
/**
* 更改车次号
*/

View File

@ -217,49 +217,6 @@ public class TrainOperateHandler {
}
/**
* 标记ATP切除
*
* @param simulation
* @param groupNumber 车组号
*/
@OperateHandlerMapping(type = Operation.Type.Train_Tag_Atp_Cut)
public void tagAtpCutOff(Simulation simulation, String groupNumber) {
}
/**
* 标记ATP恢复
*
* @param simulation
* @param groupNumber 车组号
*/
@OperateHandlerMapping(type = Operation.Type.Train_Tag_Atp_Recover)
public void tagAtpRecover(Simulation simulation, String groupNumber) {
}
/**
* 放行冲突列车
*
* @param simulation
* @param groupNumber 车组号
*/
@OperateHandlerMapping(type = Operation.Type.Train_Allow_Pass)
public void allowPass(Simulation simulation, String groupNumber) {
}
/**
* 获取列车信息
*
* @param simulation
* @param groupNumber
*/
@OperateHandlerMapping(type = Operation.Type.Train_Info)
public void getInfo(Simulation simulation, String groupNumber) {
}
/**
* 扣车