【增加点击初始化清除人员操作,编制时找不到列车问题】
This commit is contained in:
parent
28c74a75cd
commit
700d95e4a7
@ -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.data.status.IbpStatus;
|
||||
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.script.ScriptBO;
|
||||
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.runplan.PlanTripNumberVO;
|
||||
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.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.format.annotation.DateTimeFormat;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 新仿真接口
|
||||
@ -69,6 +85,8 @@ public class SimulationV1Controller {
|
||||
private SimulationService simulationService;
|
||||
@Autowired
|
||||
private SimulationManager simulationManager;
|
||||
@Autowired
|
||||
private MemberManager memberManager;
|
||||
|
||||
/**
|
||||
* 根据产品类型创建仿真
|
||||
@ -163,7 +181,8 @@ public class SimulationV1Controller {
|
||||
* 加载草稿运行图
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -203,8 +222,10 @@ public class SimulationV1Controller {
|
||||
* 根据服务号和车次号获取计划车次信息
|
||||
*/
|
||||
@GetMapping("/{group}/planTripInfoBySt")
|
||||
public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber, String tripNumber) {
|
||||
return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber, tripNumber);
|
||||
public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber,
|
||||
String tripNumber) {
|
||||
return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber,
|
||||
tripNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,7 +244,8 @@ public class SimulationV1Controller {
|
||||
* 仿真指令
|
||||
*/
|
||||
@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);
|
||||
SimulationMember member = simulation.getSimulationMemberByUserId(user.getId());
|
||||
this.groupSimulationService.command(simulation, initiateVO, member);
|
||||
@ -272,8 +294,7 @@ public class SimulationV1Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁仿真。
|
||||
* 由系统管理员或老师在仿真监管功能中使用
|
||||
* 销毁仿真。 由系统管理员或老师在仿真监管功能中使用
|
||||
*/
|
||||
@DeleteMapping("/{simulationId}/destroy")
|
||||
public void destroySimulation(@PathVariable String simulationId) {
|
||||
@ -321,7 +342,8 @@ public class SimulationV1Controller {
|
||||
* 取消自动故障
|
||||
*/
|
||||
@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)) {
|
||||
this.groupSimulationService.clearAllAutoFault(group);
|
||||
return;
|
||||
@ -333,7 +355,8 @@ public class SimulationV1Controller {
|
||||
* 设置自动故障
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -391,7 +414,8 @@ public class SimulationV1Controller {
|
||||
* 仿真报警确认
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -407,7 +431,8 @@ public class SimulationV1Controller {
|
||||
* 获取仿真日志
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -415,7 +440,8 @@ public class SimulationV1Controller {
|
||||
* 获取机器人驾驶参数
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -425,7 +451,8 @@ public class SimulationV1Controller {
|
||||
* 查询进路路径
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -433,15 +460,18 @@ public class SimulationV1Controller {
|
||||
* 查询列车或运行线经过的站台
|
||||
*/
|
||||
@GetMapping("/{group}/queryStands/trainOrDestination")
|
||||
public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group, String groupNumber, String destinationCode) {
|
||||
return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber, destinationCode);
|
||||
public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group,
|
||||
String groupNumber, String destinationCode) {
|
||||
return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber,
|
||||
destinationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询为该列车已建立的进路
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -469,7 +499,8 @@ public class SimulationV1Controller {
|
||||
* 条件查询仿真中的ISCS系统资源
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -498,7 +529,8 @@ public class SimulationV1Controller {
|
||||
* 根据地图功能id创建仿真
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -506,7 +538,8 @@ public class SimulationV1Controller {
|
||||
* 按计划行车(新)
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -516,6 +549,9 @@ public class SimulationV1Controller {
|
||||
@PutMapping("/new/{simulationId}/reset")
|
||||
public void reset(@PathVariable String 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")
|
||||
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) {
|
||||
return simulationService.listSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
|
||||
}
|
||||
@ -542,7 +579,8 @@ public class SimulationV1Controller {
|
||||
* 分页,按组织查询存在的仿真(监管仿真)
|
||||
*/
|
||||
@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) {
|
||||
return simulationService.pagedSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
|
||||
}
|
||||
@ -558,7 +596,8 @@ public class SimulationV1Controller {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
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());
|
||||
}
|
||||
@ -591,7 +630,8 @@ public class SimulationV1Controller {
|
||||
* 获取仿真中所有仿真用户
|
||||
*/
|
||||
@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()
|
||||
.map(club.joylink.rtss.simulation.SimulationUser::convertToVO)
|
||||
.collect(Collectors.toList());
|
||||
@ -614,7 +654,8 @@ public class SimulationV1Controller {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -310,6 +310,9 @@ public class SimulationDataRepository {
|
||||
|
||||
public MapElement getByCode(String code) {
|
||||
MapElement mapElement = this.deviceMap.get(code);
|
||||
if (Objects.isNull(mapElement)) {
|
||||
mapElement = this.vrDeviceMap.get(code);
|
||||
}
|
||||
if (Objects.isNull(mapElement)) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault,
|
||||
String.format("地图数据异常:不存在code为[%s]的数据", code));
|
||||
|
@ -314,15 +314,18 @@ public class MemberManager {
|
||||
}
|
||||
// 删除在原始数据中不存在的成员
|
||||
List<SimulationMember> members = simulation.getSimulationMembers();
|
||||
Map<String, SimulationMember> simMemberMap = new HashMap<>(members.size());
|
||||
for (SimulationMember m : members) {
|
||||
if (!originMemberMap.containsKey(m.getId())) {
|
||||
simulation.removeSimulationMember(m.getId());
|
||||
simMemberMap.put(m.getId(), m);
|
||||
if (originMemberMap.containsKey(m.getId())) {
|
||||
continue;
|
||||
}
|
||||
simulation.removeSimulationMember(m.getId());
|
||||
}
|
||||
// 加入额外的成员
|
||||
if (!CollectionUtils.isEmpty(memberPOS)) {
|
||||
for (SimulationMemberPO p : memberPOS) {
|
||||
if (originMemberMap.containsKey(p.getId())) {
|
||||
if (simMemberMap.containsKey(p.getId())) {
|
||||
continue;
|
||||
}
|
||||
MapElement mapElement = null;
|
||||
|
Loading…
Reference in New Issue
Block a user