【增加实训开始结束状态消息】
This commit is contained in:
parent
cda1272d08
commit
488ec0a7a4
@ -143,6 +143,7 @@ public class Training2Service {
|
|||||||
if (training2 == null || !training2.isStarted() || training2.isFinish()) {
|
if (training2 == null || !training2.isStarted() || training2.isFinish()) {
|
||||||
// 结束并移除运行任务
|
// 结束并移除运行任务
|
||||||
removeTrainingJob(simulation);
|
removeTrainingJob(simulation);
|
||||||
|
trainingStatusMessage(simulation, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获取运行步骤
|
// 获取运行步骤
|
||||||
@ -275,7 +276,6 @@ public class Training2Service {
|
|||||||
// 创建者退出,则清理实训
|
// 创建者退出,则清理实训
|
||||||
if (simulation.getCreator().getId().equals(user.getId())) {
|
if (simulation.getCreator().getId().equals(user.getId())) {
|
||||||
training2.finish();
|
training2.finish();
|
||||||
removeTrainingJob(simulation);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return List.of();
|
return List.of();
|
||||||
@ -554,7 +554,6 @@ public class Training2Service {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("loadTrainingToStep is error", e);
|
log.error("loadTrainingToStep is error", e);
|
||||||
training2.finish();
|
training2.finish();
|
||||||
removeTrainingJob(simulation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,6 +929,8 @@ public class Training2Service {
|
|||||||
addTrainingJob(simulation, training2);
|
addTrainingJob(simulation, training2);
|
||||||
// 启动仿真
|
// 启动仿真
|
||||||
simulationLifeCycleService.resume(simulation);
|
simulationLifeCycleService.resume(simulation);
|
||||||
|
// 发送开始消息
|
||||||
|
trainingStatusMessage(simulation, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -940,4 +941,14 @@ public class Training2Service {
|
|||||||
simulation.getTraining2().setJumpToStep(null);
|
simulation.getTraining2().setJumpToStep(null);
|
||||||
simulation.getTraining2().finish();
|
simulation.getTraining2().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实训状态消息
|
||||||
|
* @param simulation 仿真
|
||||||
|
* @param status 状态
|
||||||
|
*/
|
||||||
|
private void trainingStatusMessage(Simulation simulation, int status) {
|
||||||
|
SocketMessageVO<Integer> message = SocketMessageFactory.build(WebSocketMessageType.Simulation_Training_Status, simulation.getId(), status);
|
||||||
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,6 +381,10 @@ public enum WebSocketMessageType {
|
|||||||
* 实训准备开始,其他成员加载实训内容消息
|
* 实训准备开始,其他成员加载实训内容消息
|
||||||
*/
|
*/
|
||||||
Simulation_Training_Prepare_Start,
|
Simulation_Training_Prepare_Start,
|
||||||
|
/**
|
||||||
|
* 实训开始、结束状态
|
||||||
|
*/
|
||||||
|
Simulation_Training_Status,
|
||||||
/**
|
/**
|
||||||
* 步骤开始时提示信息
|
* 步骤开始时提示信息
|
||||||
*/
|
*/
|
||||||
@ -399,7 +403,7 @@ public enum WebSocketMessageType {
|
|||||||
/**
|
/**
|
||||||
* 实训完成
|
* 实训完成
|
||||||
*/
|
*/
|
||||||
Simulation_Training_Finish
|
Simulation_Training_Finish,
|
||||||
/** ------------ 新实训消息 ----------- */
|
/** ------------ 新实训消息 ----------- */
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,8 @@ public class SocketMessageFactory {
|
|||||||
case Simulation_Training_Audio_MATCH_RESULT:
|
case Simulation_Training_Audio_MATCH_RESULT:
|
||||||
// case Simulation_Training_Operate_Error:
|
// case Simulation_Training_Operate_Error:
|
||||||
// case Simulation_Training_Operate_Finish:
|
// case Simulation_Training_Operate_Finish:
|
||||||
case Simulation_Training_Finish: {
|
case Simulation_Training_Finish:
|
||||||
|
case Simulation_Training_Status: {
|
||||||
topicList.add(String.format(WebSocketSubscribeTopic.AssistantSimulation, group));
|
topicList.add(String.format(WebSocketSubscribeTopic.AssistantSimulation, group));
|
||||||
topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group));
|
topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group));
|
||||||
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
||||||
|
Loading…
Reference in New Issue
Block a user