From fd6eb2d874956bb972acc1322e327c3665ec3716 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 30 May 2022 17:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=BF=E7=9C=9F=E9=94=80?= =?UTF-8?q?=E6=AF=81=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/simulation/SimulationCommonController.java | 3 +++ .../java/club/joylink/rtss/simulation/SimulationManager.java | 1 + .../rtss/simulation/cbtc/GroupSimulationServiceImpl.java | 1 + .../rtss/simulation/cbtc/SimulationLifeCycleServiceImpl.java | 1 + 4 files changed, 6 insertions(+) diff --git a/src/main/java/club/joylink/rtss/simulation/SimulationCommonController.java b/src/main/java/club/joylink/rtss/simulation/SimulationCommonController.java index 5cdac6cc4..d5978ee7c 100644 --- a/src/main/java/club/joylink/rtss/simulation/SimulationCommonController.java +++ b/src/main/java/club/joylink/rtss/simulation/SimulationCommonController.java @@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.vo.SimulationInfoVO; import club.joylink.rtss.simulation.vo.SimulationMemberVO; import club.joylink.rtss.simulation.vo.SimulationUserVO; import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -18,6 +19,7 @@ import java.util.stream.Stream; /** * 仿真通用接口 */ +@Slf4j @RestController @RequestMapping("/common/simulation") public class SimulationCommonController { @@ -116,5 +118,6 @@ public class SimulationCommonController { @DeleteMapping("/{id}/destroy") public void destroy(@PathVariable String id) { this.simulationManager.destroy(id); + log.info(String.format("仿真通用接口销毁仿真[%s]", id)); } } diff --git a/src/main/java/club/joylink/rtss/simulation/SimulationManager.java b/src/main/java/club/joylink/rtss/simulation/SimulationManager.java index 53b63b60f..8cdd41b4d 100644 --- a/src/main/java/club/joylink/rtss/simulation/SimulationManager.java +++ b/src/main/java/club/joylink/rtss/simulation/SimulationManager.java @@ -60,6 +60,7 @@ public class SimulationManager { simulation.setNoUserStartTime(now); } else if (noUserStartTime.plusSeconds(Destroy_Time).isBefore(now)) { this.destroy(simulation.getId()); + log.info(String.format("仿真[%s]无用户在线超时销毁", simulation.getId())); } } }); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java index 6c0f86c89..ec2334e35 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java @@ -501,6 +501,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { // this.simulationLifeCycleService.destroy(simulation); // simulationManager.destroy(simulation.getId()); clearSimulation(group); + log.info(String.format("仿真[%s]清除", group)); } else { log.warn(String.format("不是仿真创建者或管理员,无权销毁仿真")); throw new SimulationException(SimulationExceptionType.Simulation_Clear_Failed, diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationLifeCycleServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationLifeCycleServiceImpl.java index 19f8c527f..e7bae33b4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationLifeCycleServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationLifeCycleServiceImpl.java @@ -158,6 +158,7 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic club.joylink.rtss.simulation.Simulation needDestroySimulation = simulationManager.save(simulation); if (needDestroySimulation != null) { groupSimulationService.clearSimulation(needDestroySimulation.getId()); + log.info(String.format("仿真[%s]因用户创建新仿真而销毁", needDestroySimulation.getId())); } // TODO: 2021/9/10 暂时放在这里 simulation.addMessagePublisher(new IscsStatusPublisher(simulation));