This commit is contained in:
xiazengbin 2022-07-29 18:04:24 +08:00
commit ce2b3a8d7c
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.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -83,6 +80,23 @@ public class ScriptSimulationService implements IScriptSimulationService {
@Autowired @Autowired
private CompetitionAndScriptManager competitionAndScriptManager; 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 @Override
public String scriptWriteSimulation(Long scriptId, LoginUserInfoVO loginUserInfoVO) { public String scriptWriteSimulation(Long scriptId, LoginUserInfoVO loginUserInfoVO) {
// 先拿到剧本 // 先拿到剧本
@ -241,7 +255,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
throw new SimulationException(SimulationExceptionType.System_Fault, "仿真中没有剧本"); throw new SimulationException(SimulationExceptionType.System_Fault, "仿真中没有剧本");
} }
SocketMessageVO<ScriptActionVO> message = SocketMessageFactory.buildScriptActionMessage(simulation.getId(), new ScriptActionVO(action)); 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); script.addAction(action);
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message); stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
} }
@ -529,7 +543,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
if (!Objects.equals(true, event.getSuccessful())) { //如果操作没有执行成功 if (!Objects.equals(true, event.getSuccessful())) { //如果操作没有执行成功
return; return;
} }
if (Operation.Type.Driver_Force_Change.name().equals(event.getOperate())) { //推列车控制杆动作特别记录 if (IGNORE_OPERATION.contains(event.getOperate())) {
return; return;
} }
ScriptActionBO action = new ScriptActionBO(); ScriptActionBO action = new ScriptActionBO();

View File

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