【前端调用完成步骤中的操作】
This commit is contained in:
parent
8c3293ae68
commit
5b9423cf8e
@ -303,7 +303,32 @@ public class Training2Service {
|
||||
*/
|
||||
public Integer completionClientStepOperation(String group, Integer stepId
|
||||
, Integer id, AccountVO user) {
|
||||
return null;
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
if (simulation == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
|
||||
}
|
||||
Training2 training2 = simulation.getTraining2();
|
||||
if (training2 == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "实训数据不存在");
|
||||
}
|
||||
Step2 step = training2.getSteps().stream().filter(s -> Objects.equals(s.getId(), stepId))
|
||||
.findFirst().orElse(null);
|
||||
if (step == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "不存在步骤");
|
||||
}
|
||||
if (Objects.equals(user.getId(), step.getSimulationMember().getId())) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "无权限操作");
|
||||
}
|
||||
Operation2 operation = step.getOperations().stream().filter(o -> Objects.equals(o.getId(), id))
|
||||
.findFirst().orElse(null);
|
||||
if (operation == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "不存在操作");
|
||||
}
|
||||
operation.doOperated();
|
||||
operation.checkCompletion();
|
||||
// 恢复前端运行
|
||||
pauseOrStartSimulation(simulation, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Async("trainingV2Executor")
|
||||
@ -411,8 +436,14 @@ public class Training2Service {
|
||||
simulationLifeCycleService.pause(simulation);
|
||||
// 重置仿真状态
|
||||
groupSimulationService.planOver(group);
|
||||
if (!StringUtils.isEmpty(draftTraining2.getBgSceneJson())) {
|
||||
groupSimulationService.loadScenes(simulation.getId(), draftTraining2.getBgSceneJson());
|
||||
// 场景的时候加载最后背景
|
||||
String bgSceneJson = draftTraining2.getBgSceneJson();
|
||||
if (Training2.Type.SCENE.name().equals(draftTraining2.getType())) {
|
||||
bgSceneJson = StringUtils.isEmpty(draftTraining2.getFinalScenesJson()) ? bgSceneJson
|
||||
: draftTraining2.getFinalScenesJson();
|
||||
}
|
||||
if (!StringUtils.isEmpty(bgSceneJson)) {
|
||||
groupSimulationService.loadScenes(simulation.getId(), bgSceneJson);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user