【多人实训开始前发送实训ID消息】

This commit is contained in:
weizhihong 2023-05-29 14:13:09 +08:00
parent 2596ad3085
commit b505dcdbfe
4 changed files with 31 additions and 0 deletions

View File

@ -109,4 +109,14 @@ public class SimulationTrainingV2Controller {
public void jumpToStep(@PathVariable String group, @PathVariable Long stepId){
training2Service.jumpToStep(group, stepId);
}
/**
* 实训开始准备给实训参与人员发送准备开始执行
* @param group 仿真ID
* @param user 操作人
*/
@PostMapping("/{group}/prepare/start")
public void prepareStart(@PathVariable String group, @RequestAttribute AccountVO user) {
training2Service.prepareStart(group, user);
}
}

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training2.index.IndexAlgorithmService;
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
@ -557,6 +558,21 @@ public class Training2Service {
}
}
/**
* 实训准备开始
* @param group 仿真号
* @param user 操作人
*/
public void prepareStart(String group, AccountVO user) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(simulation.getTraining2() != null, "未加载实训");
SocketMessageVO<Long> message = SocketMessageFactory.build(
WebSocketMessageType.Simulation_Training_Prepare_Start, simulation.getId(), simulation.getTraining2().getId());
Set<String> userIdSet = simulation.getSimulationUserIds().stream()
.filter(id -> !Objects.equals(id, user.getId().toString())).collect(Collectors.toSet());
stompMessageService.sendToUser(userIdSet, message);
}
/**
* 实训时创建仿真对象
*/

View File

@ -377,6 +377,10 @@ public enum WebSocketMessageType {
/**
* ------------ 新实训消息 -----------
*/
/**
* 实训准备开始其他成员加载实训内容消息
*/
Simulation_Training_Prepare_Start,
/**
* 步骤开始时提示信息
*/

View File

@ -155,6 +155,7 @@ public class SocketMessageFactory {
break;
}
// 20220819
case Simulation_Training_Prepare_Start:
case Simulation_Training_Step_Tip:
case Simulation_Training_Step_Finish:
case Simulation_Training_Audio_MATCH_RESULT: