【增加点击初始化清除人员操作,编制时找不到列车问题】

This commit is contained in:
weizhihong 2023-11-27 17:56:27 +08:00
parent 28c74a75cd
commit 700d95e4a7
3 changed files with 539 additions and 492 deletions

View File

@ -15,6 +15,7 @@ import club.joylink.rtss.simulation.cbtc.command.CommandInitiateVO;
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo; import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO; import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO; import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.simulation.vo.SimulationInfoVO; import club.joylink.rtss.simulation.vo.SimulationInfoVO;
@ -30,22 +31,37 @@ import club.joylink.rtss.vo.client.operation.DriveParamVO;
import club.joylink.rtss.vo.client.psl.PslStatus; import club.joylink.rtss.vo.client.psl.PslStatus;
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO; import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO; import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
import club.joylink.rtss.vo.client.simulationv1.*; import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationLogPagedQueryVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationUserVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO; import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import javax.validation.constraints.NotBlank; import org.springframework.web.bind.annotation.PathVariable;
import javax.validation.constraints.NotNull; import org.springframework.web.bind.annotation.PostMapping;
import java.time.LocalDateTime; import org.springframework.web.bind.annotation.PutMapping;
import java.time.LocalTime; import org.springframework.web.bind.annotation.RequestAttribute;
import java.util.*; import org.springframework.web.bind.annotation.RequestBody;
import java.util.stream.Collectors; import org.springframework.web.bind.annotation.RequestMapping;
import java.util.stream.Stream; import org.springframework.web.bind.annotation.RestController;
/** /**
* 新仿真接口 * 新仿真接口
@ -69,6 +85,8 @@ public class SimulationV1Controller {
private SimulationService simulationService; private SimulationService simulationService;
@Autowired @Autowired
private SimulationManager simulationManager; private SimulationManager simulationManager;
@Autowired
private MemberManager memberManager;
/** /**
* 根据产品类型创建仿真 * 根据产品类型创建仿真
@ -163,7 +181,8 @@ public class SimulationV1Controller {
* 加载草稿运行图 * 加载草稿运行图
*/ */
@PutMapping("/{simulationId}/load/draftRunPlan/{draftRunPlanId}") @PutMapping("/{simulationId}/load/draftRunPlan/{draftRunPlanId}")
public void loadDraftRunPlan(@PathVariable String simulationId, @PathVariable long draftRunPlanId) { public void loadDraftRunPlan(@PathVariable String simulationId,
@PathVariable long draftRunPlanId) {
this.simulationService.loadDraftRunPlan(simulationId, draftRunPlanId); this.simulationService.loadDraftRunPlan(simulationId, draftRunPlanId);
} }
@ -203,8 +222,10 @@ public class SimulationV1Controller {
* 根据服务号和车次号获取计划车次信息 * 根据服务号和车次号获取计划车次信息
*/ */
@GetMapping("/{group}/planTripInfoBySt") @GetMapping("/{group}/planTripInfoBySt")
public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber, String tripNumber) { public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber,
return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber, tripNumber); String tripNumber) {
return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber,
tripNumber);
} }
/** /**
@ -223,7 +244,8 @@ public class SimulationV1Controller {
* 仿真指令 * 仿真指令
*/ */
@PostMapping("/{group}/command") @PostMapping("/{group}/command")
public void command(@PathVariable String group, @RequestBody @Validated CommandInitiateVO initiateVO, @RequestAttribute AccountVO user) { public void command(@PathVariable String group,
@RequestBody @Validated CommandInitiateVO initiateVO, @RequestAttribute AccountVO user) {
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group); Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
SimulationMember member = simulation.getSimulationMemberByUserId(user.getId()); SimulationMember member = simulation.getSimulationMemberByUserId(user.getId());
this.groupSimulationService.command(simulation, initiateVO, member); this.groupSimulationService.command(simulation, initiateVO, member);
@ -272,8 +294,7 @@ public class SimulationV1Controller {
} }
/** /**
* 销毁仿真 * 销毁仿真 由系统管理员或老师在仿真监管功能中使用
* 由系统管理员或老师在仿真监管功能中使用
*/ */
@DeleteMapping("/{simulationId}/destroy") @DeleteMapping("/{simulationId}/destroy")
public void destroySimulation(@PathVariable String simulationId) { public void destroySimulation(@PathVariable String simulationId) {
@ -321,7 +342,8 @@ public class SimulationV1Controller {
* 取消自动故障 * 取消自动故障
*/ */
@PutMapping(path = "/{group}/faultMode/{id}") @PutMapping(path = "/{group}/faultMode/{id}")
public void setFaultMode(@PathVariable @NotBlank String group, @PathVariable(required = false) Integer id) { public void setFaultMode(@PathVariable @NotBlank String group,
@PathVariable(required = false) Integer id) {
if (Objects.isNull(id)) { if (Objects.isNull(id)) {
this.groupSimulationService.clearAllAutoFault(group); this.groupSimulationService.clearAllAutoFault(group);
return; return;
@ -333,7 +355,8 @@ public class SimulationV1Controller {
* 设置自动故障 * 设置自动故障
*/ */
@PostMapping(path = "/{group}/faultMode") @PostMapping(path = "/{group}/faultMode")
public Integer setFaultMode(@PathVariable @NotBlank String group, @RequestBody FaultRuleVO ruleVO) { public Integer setFaultMode(@PathVariable @NotBlank String group,
@RequestBody FaultRuleVO ruleVO) {
return this.groupSimulationService.setFaultMode(group, ruleVO); return this.groupSimulationService.setFaultMode(group, ruleVO);
} }
@ -391,7 +414,8 @@ public class SimulationV1Controller {
* 仿真报警确认 * 仿真报警确认
*/ */
@PutMapping(path = "/{group}/alarm/confirm") @PutMapping(path = "/{group}/alarm/confirm")
public void AlarmConfirm(@PathVariable String group, @RequestBody List<String> codes, @RequestAttribute AccountVO user) { public void AlarmConfirm(@PathVariable String group, @RequestBody List<String> codes,
@RequestAttribute AccountVO user) {
groupSimulationService.alarmConfirm(group, codes, user); groupSimulationService.alarmConfirm(group, codes, user);
} }
@ -407,7 +431,8 @@ public class SimulationV1Controller {
* 获取仿真日志 * 获取仿真日志
*/ */
@GetMapping("/{group}/log") @GetMapping("/{group}/log")
public PageVO<SimulationLog> getLog(@PathVariable String group, SimulationLogPagedQueryVO queryVO) { public PageVO<SimulationLog> getLog(@PathVariable String group,
SimulationLogPagedQueryVO queryVO) {
return groupSimulationService.getLog(group, queryVO); return groupSimulationService.getLog(group, queryVO);
} }
@ -415,7 +440,8 @@ public class SimulationV1Controller {
* 获取机器人驾驶参数 * 获取机器人驾驶参数
*/ */
@GetMapping("/{simulationId}/driveParam/{groupNumber}") @GetMapping("/{simulationId}/driveParam/{groupNumber}")
public DriveParamVO getDriveParam(@PathVariable String simulationId, @PathVariable String groupNumber) { public DriveParamVO getDriveParam(@PathVariable String simulationId,
@PathVariable String groupNumber) {
return groupSimulationService.getDriveParam(simulationId, groupNumber); return groupSimulationService.getDriveParam(simulationId, groupNumber);
} }
@ -425,7 +451,8 @@ public class SimulationV1Controller {
* 查询进路路径 * 查询进路路径
*/ */
@GetMapping("/{group}/querySectionPaths") @GetMapping("/{group}/querySectionPaths")
public List<List<String>> querySectionPaths(@PathVariable String group, String groupNumber, String standCode, String signalCode) { public List<List<String>> querySectionPaths(@PathVariable String group, String groupNumber,
String standCode, String signalCode) {
return simulationSupportService.queryRoutePaths(group, groupNumber, standCode, signalCode); return simulationSupportService.queryRoutePaths(group, groupNumber, standCode, signalCode);
} }
@ -433,15 +460,18 @@ public class SimulationV1Controller {
* 查询列车或运行线经过的站台 * 查询列车或运行线经过的站台
*/ */
@GetMapping("/{group}/queryStands/trainOrDestination") @GetMapping("/{group}/queryStands/trainOrDestination")
public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group, String groupNumber, String destinationCode) { public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group,
return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber, destinationCode); String groupNumber, String destinationCode) {
return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber,
destinationCode);
} }
/** /**
* 查询为该列车已建立的进路 * 查询为该列车已建立的进路
*/ */
@GetMapping("/{group}/queryEstablishedRoutes/{groupNumber}") @GetMapping("/{group}/queryEstablishedRoutes/{groupNumber}")
public List<String> queryEstablishedRoutes(@PathVariable String group, @PathVariable String groupNumber) { public List<String> queryEstablishedRoutes(@PathVariable String group,
@PathVariable String groupNumber) {
return simulationSupportService.queryEstablishedRoutes(group, groupNumber); return simulationSupportService.queryEstablishedRoutes(group, groupNumber);
} }
@ -469,7 +499,8 @@ public class SimulationV1Controller {
* 条件查询仿真中的ISCS系统资源 * 条件查询仿真中的ISCS系统资源
*/ */
@GetMapping("/{group}/iscs/systemResources") @GetMapping("/{group}/iscs/systemResources")
public List<IscsSystemResourcesVO> getAllIscsSystemResources(@PathVariable String group, IscsSystemResourcesQueryVO queryVO) { public List<IscsSystemResourcesVO> getAllIscsSystemResources(@PathVariable String group,
IscsSystemResourcesQueryVO queryVO) {
return groupSimulationService.getAllIscsSystemResources(group, queryVO); return groupSimulationService.getAllIscsSystemResources(group, queryVO);
} }
@ -498,7 +529,8 @@ public class SimulationV1Controller {
* 根据地图功能id创建仿真 * 根据地图功能id创建仿真
*/ */
@PostMapping("/new/mapFunction/{mapFunctionId}") @PostMapping("/new/mapFunction/{mapFunctionId}")
public String createSimulationByMapFunction(@PathVariable long mapFunctionId, @RequestAttribute LoginUserInfoVO loginInfo) { public String createSimulationByMapFunction(@PathVariable long mapFunctionId,
@RequestAttribute LoginUserInfoVO loginInfo) {
return simulationService.createSimulation(mapFunctionId, loginInfo); return simulationService.createSimulation(mapFunctionId, loginInfo);
} }
@ -506,7 +538,8 @@ public class SimulationV1Controller {
* 按计划行车 * 按计划行车
*/ */
@PostMapping("/new/{simulationId}/runAsPlan") @PostMapping("/new/{simulationId}/runAsPlan")
public void runAsPlanNew(@PathVariable String simulationId, @RequestBody @Validated RunAsPlanParam param) { public void runAsPlanNew(@PathVariable String simulationId,
@RequestBody @Validated RunAsPlanParam param) {
simulationService.runAsPlan(simulationId, param); simulationService.runAsPlan(simulationId, param);
} }
@ -516,6 +549,9 @@ public class SimulationV1Controller {
@PutMapping("/new/{simulationId}/reset") @PutMapping("/new/{simulationId}/reset")
public void reset(@PathVariable String simulationId) { public void reset(@PathVariable String simulationId) {
simulationService.reset(simulationId); simulationService.reset(simulationId);
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
// 写在这里为了不与加载实训时冲突如果写入reset方法实训加载会多次处理会有问题
memberManager.loadExtraMembers(simulation, null);
} }
/** /**
@ -533,7 +569,8 @@ public class SimulationV1Controller {
* 按组织查询存在的仿真(监管仿真) * 按组织查询存在的仿真(监管仿真)
*/ */
@GetMapping("/supervise") @GetMapping("/supervise")
public List<SimulationInfoVO> listSimulationByOrg(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, public List<SimulationInfoVO> listSimulationByOrg(
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
SimulationInfoQueryVO queryVO) { SimulationInfoQueryVO queryVO) {
return simulationService.listSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO); return simulationService.listSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
} }
@ -542,7 +579,8 @@ public class SimulationV1Controller {
* 分页按组织查询存在的仿真(监管仿真) * 分页按组织查询存在的仿真(监管仿真)
*/ */
@GetMapping("/paged/supervise") @GetMapping("/paged/supervise")
public PageVO<SimulationInfoVO> pagedSuperviseSimulation(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, public PageVO<SimulationInfoVO> pagedSuperviseSimulation(
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
SimulationInfoQueryVO queryVO) { SimulationInfoQueryVO queryVO) {
return simulationService.pagedSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO); return simulationService.pagedSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
} }
@ -558,7 +596,8 @@ public class SimulationV1Controller {
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup())); stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
} }
if (StringUtils.hasText(queryVO.getUserName())) { if (StringUtils.hasText(queryVO.getUserName())) {
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> user.getName().contains(queryVO.getUserName()))); stream = stream.filter(simulation -> simulation.getSimulationUsers().stream()
.anyMatch(user -> user.getName().contains(queryVO.getUserName())));
} }
return stream.map(Simulation::convertToVO).collect(Collectors.toList()); return stream.map(Simulation::convertToVO).collect(Collectors.toList());
} }
@ -591,7 +630,8 @@ public class SimulationV1Controller {
* 获取仿真中所有仿真用户 * 获取仿真中所有仿真用户
*/ */
@GetMapping("/{id}/users") @GetMapping("/{id}/users")
public List<club.joylink.rtss.simulation.vo.SimulationUserVO> getSimulationUsers(@PathVariable String id) { public List<club.joylink.rtss.simulation.vo.SimulationUserVO> getSimulationUsers(
@PathVariable String id) {
return this.simulationManager.getSimulationUsers(id).stream() return this.simulationManager.getSimulationUsers(id).stream()
.map(club.joylink.rtss.simulation.SimulationUser::convertToVO) .map(club.joylink.rtss.simulation.SimulationUser::convertToVO)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -614,7 +654,8 @@ public class SimulationV1Controller {
} }
@GetMapping("/{simulationId}/{memberId}/unreceivedMessages") @GetMapping("/{simulationId}/{memberId}/unreceivedMessages")
public void sendUnreceivedMessages(@PathVariable String simulationId, @PathVariable String memberId) { public void sendUnreceivedMessages(@PathVariable String simulationId,
@PathVariable String memberId) {
simulationService.sendUnreceivedMessages(simulationId, memberId); simulationService.sendUnreceivedMessages(simulationId, memberId);
} }
} }

View File

@ -310,6 +310,9 @@ public class SimulationDataRepository {
public MapElement getByCode(String code) { public MapElement getByCode(String code) {
MapElement mapElement = this.deviceMap.get(code); MapElement mapElement = this.deviceMap.get(code);
if (Objects.isNull(mapElement)) {
mapElement = this.vrDeviceMap.get(code);
}
if (Objects.isNull(mapElement)) { if (Objects.isNull(mapElement)) {
throw new SimulationException(SimulationExceptionType.System_Fault, throw new SimulationException(SimulationExceptionType.System_Fault,
String.format("地图数据异常不存在code为[%s]的数据", code)); String.format("地图数据异常不存在code为[%s]的数据", code));

View File

@ -314,15 +314,18 @@ public class MemberManager {
} }
// 删除在原始数据中不存在的成员 // 删除在原始数据中不存在的成员
List<SimulationMember> members = simulation.getSimulationMembers(); List<SimulationMember> members = simulation.getSimulationMembers();
Map<String, SimulationMember> simMemberMap = new HashMap<>(members.size());
for (SimulationMember m : members) { for (SimulationMember m : members) {
if (!originMemberMap.containsKey(m.getId())) { simMemberMap.put(m.getId(), m);
simulation.removeSimulationMember(m.getId()); if (originMemberMap.containsKey(m.getId())) {
continue;
} }
simulation.removeSimulationMember(m.getId());
} }
// 加入额外的成员 // 加入额外的成员
if (!CollectionUtils.isEmpty(memberPOS)) { if (!CollectionUtils.isEmpty(memberPOS)) {
for (SimulationMemberPO p : memberPOS) { for (SimulationMemberPO p : memberPOS) {
if (originMemberMap.containsKey(p.getId())) { if (simMemberMap.containsKey(p.getId())) {
continue; continue;
} }
MapElement mapElement = null; MapElement mapElement = null;