【发布实训导出去除地图ID】【实训加载增加模式参数】

This commit is contained in:
weizhihong 2023-05-29 17:52:53 +08:00
parent 07f8bcbd16
commit cda1272d08
3 changed files with 9 additions and 5 deletions

View File

@ -116,7 +116,7 @@ public class SimulationTrainingV2Controller {
* @param user 操作人
*/
@PostMapping("/{group}/prepare/start")
public void prepareStart(@PathVariable String group, @RequestAttribute AccountVO user) {
training2Service.prepareStart(group, user);
public void prepareStart(@PathVariable String group, @RequestAttribute AccountVO user, ScriptBO.Mode mode) {
training2Service.prepareStart(group, user, mode);
}
}

View File

@ -472,6 +472,7 @@ public class Training2PublishService {
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
t.setId(null);
t.setMapId(null);
t.setUpdateTime(null);
t.setCreateTime(null);
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));

View File

@ -563,11 +563,14 @@ public class Training2Service {
* @param group 仿真号
* @param user 操作人
*/
public void prepareStart(String group, AccountVO user) {
public void prepareStart(String group, AccountVO user, ScriptBO.Mode mode) {
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());
Map<String, Object> messageMap = new HashMap<>();
messageMap.put("id", simulation.getTraining2().getId());
messageMap.put("mode", mode);
SocketMessageVO<Map<String, Object>> message = SocketMessageFactory.build(
WebSocketMessageType.Simulation_Training_Prepare_Start, simulation.getId(), messageMap);
Set<String> userIdSet = simulation.getSimulationUserIds().stream()
.filter(id -> !Objects.equals(id, user.getId().toString())).collect(Collectors.toSet());
stompMessageService.sendToUser(userIdSet, message);