增加仿真销毁日志

This commit is contained in:
joylink_zhangsai 2022-05-30 17:39:46 +08:00
parent e39dd0a539
commit fd6eb2d874
4 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.vo.SimulationInfoVO;
import club.joylink.rtss.simulation.vo.SimulationMemberVO; import club.joylink.rtss.simulation.vo.SimulationMemberVO;
import club.joylink.rtss.simulation.vo.SimulationUserVO; import club.joylink.rtss.simulation.vo.SimulationUserVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO; import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -18,6 +19,7 @@ import java.util.stream.Stream;
/** /**
* 仿真通用接口 * 仿真通用接口
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/common/simulation") @RequestMapping("/common/simulation")
public class SimulationCommonController { public class SimulationCommonController {
@ -116,5 +118,6 @@ public class SimulationCommonController {
@DeleteMapping("/{id}/destroy") @DeleteMapping("/{id}/destroy")
public void destroy(@PathVariable String id) { public void destroy(@PathVariable String id) {
this.simulationManager.destroy(id); this.simulationManager.destroy(id);
log.info(String.format("仿真通用接口销毁仿真[%s]", id));
} }
} }

View File

@ -60,6 +60,7 @@ public class SimulationManager {
simulation.setNoUserStartTime(now); simulation.setNoUserStartTime(now);
} else if (noUserStartTime.plusSeconds(Destroy_Time).isBefore(now)) { } else if (noUserStartTime.plusSeconds(Destroy_Time).isBefore(now)) {
this.destroy(simulation.getId()); this.destroy(simulation.getId());
log.info(String.format("仿真[%s]无用户在线超时销毁", simulation.getId()));
} }
} }
}); });

View File

@ -501,6 +501,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
// this.simulationLifeCycleService.destroy(simulation); // this.simulationLifeCycleService.destroy(simulation);
// simulationManager.destroy(simulation.getId()); // simulationManager.destroy(simulation.getId());
clearSimulation(group); clearSimulation(group);
log.info(String.format("仿真[%s]清除", group));
} else { } else {
log.warn(String.format("不是仿真创建者或管理员,无权销毁仿真")); log.warn(String.format("不是仿真创建者或管理员,无权销毁仿真"));
throw new SimulationException(SimulationExceptionType.Simulation_Clear_Failed, throw new SimulationException(SimulationExceptionType.Simulation_Clear_Failed,

View File

@ -158,6 +158,7 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic
club.joylink.rtss.simulation.Simulation needDestroySimulation = simulationManager.save(simulation); club.joylink.rtss.simulation.Simulation needDestroySimulation = simulationManager.save(simulation);
if (needDestroySimulation != null) { if (needDestroySimulation != null) {
groupSimulationService.clearSimulation(needDestroySimulation.getId()); groupSimulationService.clearSimulation(needDestroySimulation.getId());
log.info(String.format("仿真[%s]因用户创建新仿真而销毁", needDestroySimulation.getId()));
} }
// TODO: 2021/9/10 暂时放在这里 // TODO: 2021/9/10 暂时放在这里
simulation.addMessagePublisher(new IscsStatusPublisher(simulation)); simulation.addMessagePublisher(new IscsStatusPublisher(simulation));