【实训场景编制时,控制权不做自动转换】

This commit is contained in:
weizhihong 2022-12-30 16:22:37 +08:00
parent daadb7ccee
commit 4faff6bb77
3 changed files with 17 additions and 2 deletions

View File

@ -469,6 +469,8 @@ public class Training2Service {
if (!StringUtils.isEmpty(bgSceneJson)) {
groupSimulationService.loadScenes(simulation.getId(), bgSceneJson);
}
Training2 training2 = new Training2(draftTraining2, simulation);
simulation.setTraining2(training2);
// 如果存在会话信息需要给前端发送
sendSimulationConversation(simulation);
}

View File

@ -504,7 +504,10 @@ public class SimulationRobotService {
if (simulation.getScript() != null && simulation.getScript().isBgSet()) {
return;
}
// 实训场景模式处于编制状态的实训不做自动转换处理
if (simulation.getTraining2() != null && simulation.getTraining2().isScene() && !simulation.getTraining2().isRunning()) {
return;
}
Map<SimulationMember, List<Station>> collect = simulation.getRepository().getStationList().stream()
.filter(station -> station.getApplicant() != null).collect(Collectors.groupingBy(Station::getApplicant));

View File

@ -104,6 +104,7 @@ public class Training2 {
*/
private Map<String, IndexAlgorithmService> indexAlgorithmMap;
public Training2(DraftTraining2WithBLOBs draftTraining2, Simulation simulation) {
this.id = draftTraining2.getId();
this.mapId = draftTraining2.getMapId();
@ -117,7 +118,9 @@ public class Training2 {
if (!StringUtils.isEmpty(draftTraining2.getPlayerIdJson())) {
this.playerIds = JsonUtils.readCollection(draftTraining2.getPlayerIdJson(), List.class, String.class);
}
labels = JsonUtils.readCollection(draftTraining2.getLabelJson(), List.class, String.class);
if (!StringUtils.isEmpty(draftTraining2.getLabelJson())) {
labels = JsonUtils.readCollection(draftTraining2.getLabelJson(), List.class, String.class);
}
if (!StringUtils.isEmpty(draftTraining2.getOperaJson())) {
List<Operation2VO> operation2VOS = JsonUtils.readCollection(draftTraining2.getOperaJson(), List.class, Operation2VO.class);
operations = operation2VOS.stream().map(vo -> vo.convert2BO(simulation)).collect(Collectors.toList());
@ -222,6 +225,13 @@ public class Training2 {
return !this.started || this.finish;
}
/**
* 是否场景
*/
public boolean isScene() {
return Type.SCENE.equals(this.type);
}
private void resetStepAndIndex() {
if (this.steps != null) {
this.steps.forEach(Step2::reset);