Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-08-30 14:22:42 +08:00
commit 9a3cc981de
2 changed files with 10 additions and 5 deletions

View File

@ -240,12 +240,12 @@ public class Training2Service {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "无权限操作实训"); throw new SimulationException(SimulationExceptionType.Invalid_Operation, "无权限操作实训");
} }
Training2 training2 = simulation.getTraining2(); Training2 training2 = simulation.getTraining2();
if (training2 == null) { if (training2 != null) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "实训数据不存在"); training2.finish();
training2.mark();
} }
simulation.removeJob(SCORING_JOB_NAME); //移除打分监视任务 simulation.removeJob(SCORING_JOB_NAME); //移除打分监视任务
training2.finish(); simulation.removeJob(EXECUTE_JOB_NAME); //移除实训执行任务
training2.mark();
// 暂停仿真 // 暂停仿真
simulationLifeCycleService.pause(simulation); simulationLifeCycleService.pause(simulation);
} }
@ -455,7 +455,10 @@ public class Training2Service {
*/ */
private void loadTraining(Simulation simulation, DraftTraining2WithBLOBs draftTraining2, LoginUserInfoVO loginUserInfoVO) { private void loadTraining(Simulation simulation, DraftTraining2WithBLOBs draftTraining2, LoginUserInfoVO loginUserInfoVO) {
Training2 training2 = new Training2(draftTraining2, simulation); Training2 training2 = new Training2(draftTraining2, simulation);
groupSimulationService.loadScenes(simulation.getId(), training2.getBgSceneJson()); // 没有背景不做加载
if (!StringUtils.isEmpty(training2.getBgSceneJson())) {
groupSimulationService.loadScenes(simulation.getId(), training2.getBgSceneJson());
}
simulation.setTraining2(training2); simulation.setTraining2(training2);
// 如果是单操设置为步骤指定角色 // 如果是单操设置为步骤指定角色
if (Training2.Type.SINGLE.equals(training2.getType())) { if (Training2.Type.SINGLE.equals(training2.getType())) {

View File

@ -121,6 +121,7 @@ public class Training2 {
this.needReloadScenes = true; this.needReloadScenes = true;
this.started = true; this.started = true;
this.mode = mode; this.mode = mode;
this.finish = false;
if (this.steps != null) { if (this.steps != null) {
this.steps.forEach(Step2::reset); this.steps.forEach(Step2::reset);
} }
@ -128,6 +129,7 @@ public class Training2 {
public boolean finish() { public boolean finish() {
this.finish = true; this.finish = true;
this.needReloadScenes = true;
return true; return true;
} }