处理福州线列车在二十一站左侧折返轨停车会导致提前更换车次问题;机器人驾驶增加识别信号机功能;处理车辆段的列车以备用车方式加载到正线上时因ctc移动授权丢失引起的问题;
This commit is contained in:
parent
306e91296a
commit
46acce3f6b
@ -1,6 +1,8 @@
|
|||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.Project;
|
import club.joylink.rtss.constants.Project;
|
||||||
|
import club.joylink.rtss.exception.BaseException;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.auth.IAuthenticateService;
|
import club.joylink.rtss.services.auth.IAuthenticateService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
@ -27,16 +29,23 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*获取微信小程序登陆二维码
|
* 获取微信小程序登陆二维码
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "/wmurl")
|
@GetMapping(path = "/wmurl")
|
||||||
public LoginStatusVO getWmLoginUrl(@NotBlank String clientId, @NotBlank String secret,
|
public LoginStatusVO getWmLoginUrl(@NotBlank String clientId, @NotBlank String secret,
|
||||||
Project project, @RequestParam(required = false) String deviceCode) {
|
String project, @RequestParam(required = false) String deviceCode) {
|
||||||
return this.iAuthenticateService.getWmLoginUrl(clientId, secret, project, deviceCode);
|
try {
|
||||||
|
Project pro = Project.valueOf(project);
|
||||||
|
return this.iAuthenticateService.getWmLoginUrl(clientId, secret, pro, deviceCode);
|
||||||
|
} catch (BaseException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("获取登录二维码失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*用户微信小程序扫登陆二维码
|
* 用户微信小程序扫登陆二维码
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "/scan/wmLoginUrl")
|
@GetMapping(path = "/scan/wmLoginUrl")
|
||||||
public AccountVO scanWmLoginQrCode(String code, String state) {
|
public AccountVO scanWmLoginQrCode(String code, String state) {
|
||||||
@ -44,7 +53,7 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*微信小程序确认登陆接口
|
* 微信小程序确认登陆接口
|
||||||
*/
|
*/
|
||||||
@PostMapping(path = "/wm")
|
@PostMapping(path = "/wm")
|
||||||
public void wmConfirmLogin(String code, String state) {
|
public void wmConfirmLogin(String code, String state) {
|
||||||
@ -61,18 +70,19 @@ public class LoginController {
|
|||||||
this.iAuthenticateService.preLogout(token);
|
this.iAuthenticateService.preLogout(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path="/logout")
|
@GetMapping(path = "/logout")
|
||||||
public void logout(String token) {
|
public void logout(String token) {
|
||||||
this.iAuthenticateService.logout(token);
|
this.iAuthenticateService.logout(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path="/checkStatus")
|
@GetMapping(path = "/checkStatus")
|
||||||
public LoginStatusVO checkStatus(@NotBlank String sessionId) {
|
public LoginStatusVO checkStatus(@NotBlank String sessionId) {
|
||||||
return iAuthenticateService.checkStatus(sessionId);
|
return iAuthenticateService.checkStatus(sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息 - 通过token
|
* 获取用户信息 - 通过token
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -84,6 +94,7 @@ public class LoginController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户登录信息(包含登录的项目/客户端等)
|
* 获取用户登录信息(包含登录的项目/客户端等)
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -93,7 +104,7 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*<玖琏科技>微信小程序code换取token
|
* <玖琏科技>微信小程序code换取token
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "/wm/token")
|
@GetMapping(path = "/wm/token")
|
||||||
public String getTokenByWmCode(String code) {
|
public String getTokenByWmCode(String code) {
|
||||||
@ -102,6 +113,7 @@ public class LoginController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 到那儿了小程序code换token
|
* 到那儿了小程序code换token
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -112,6 +124,7 @@ public class LoginController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 郑州共赢小程序code换token
|
* 郑州共赢小程序code换token
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -121,7 +134,7 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*token是否过期
|
* token是否过期
|
||||||
*/
|
*/
|
||||||
@GetMapping(path = "/{token}/isExpired")
|
@GetMapping(path = "/{token}/isExpired")
|
||||||
public boolean isTokenExpired(@PathVariable String token) {
|
public boolean isTokenExpired(@PathVariable String token) {
|
||||||
|
@ -4,6 +4,8 @@ import club.joylink.rtss.constants.Project;
|
|||||||
import club.joylink.rtss.constants.RoleEnum;
|
import club.joylink.rtss.constants.RoleEnum;
|
||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.controller.advice.Role;
|
import club.joylink.rtss.controller.advice.Role;
|
||||||
|
import club.joylink.rtss.exception.BaseException;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.project.ServerService;
|
import club.joylink.rtss.services.project.ServerService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -25,8 +27,14 @@ public class ProjectServerController {
|
|||||||
private ServerService serverService;
|
private ServerService serverService;
|
||||||
|
|
||||||
@GetMapping("/project/{project}")
|
@GetMapping("/project/{project}")
|
||||||
public ProjectServerVO getByProject(@PathVariable Project project) {
|
public ProjectServerVO getByProject(@PathVariable String project) {
|
||||||
return this.serverService.getByProject(project);
|
try {
|
||||||
|
return this.serverService.getByProject(Project.valueOf(project));
|
||||||
|
} catch (BaseException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Role(RoleEnum.SuperAdmin)
|
@Role(RoleEnum.SuperAdmin)
|
||||||
|
@ -234,8 +234,8 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
|||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
LocalDateTime systemTime = simulation.getSystemTime();
|
LocalDateTime systemTime = simulation.getSystemTime();
|
||||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||||
if (tripPlan.getEndSection().equals(parkSection) ||
|
if (tripPlan.getEndSection().equals(parkSection)
|
||||||
tripPlan.getEndSection().getStation().equals(parkSection.getStation())) {
|
/*|| tripPlan.getEndSection().getStation().equals(parkSection.getStation())*/) {
|
||||||
// 计划终端折返轨或和计划终端折返轨同站的折返轨,根据车次类型处理
|
// 计划终端折返轨或和计划终端折返轨同站的折返轨,根据车次类型处理
|
||||||
TripPlan nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
TripPlan nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||||
if (nextTripPlan == null) {
|
if (nextTripPlan == null) {
|
||||||
|
@ -627,6 +627,13 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
replaceSignals.add(signal);
|
replaceSignals.add(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取信号机在区段上的位置
|
||||||
|
*/
|
||||||
|
public SectionPosition getPosition() {
|
||||||
|
return new SectionPosition(section, offset);
|
||||||
|
}
|
||||||
|
|
||||||
public enum LightColor {
|
public enum LightColor {
|
||||||
RED,
|
RED,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
|
@ -668,6 +668,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
this.nextParking = true;
|
this.nextParking = true;
|
||||||
this.gear = Handwheel.ATO;
|
this.gear = Handwheel.ATO;
|
||||||
this.confirmationMessages.clear();
|
this.confirmationMessages.clear();
|
||||||
|
this.cbtcMaMissDuration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(Section target) {
|
public void setTarget(Section target) {
|
||||||
|
@ -5,21 +5,15 @@ import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService;
|
|||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.DriverOperateHandler;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.DriverOperateHandler;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStationService;
|
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStationService;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.command.CommandBO;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.PSD;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
import club.joylink.rtss.simulation.cbtc.data.vr.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
|
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
|
||||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||||
@ -152,18 +146,65 @@ public class RobotLogicLoop {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
robotOpenATO(simulation, train);
|
robotOpenATO(simulation, train);
|
||||||
robotDrive(simulation, train);
|
robotDrive(simulation, driver, train);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人驾驶
|
* 机器人驾驶
|
||||||
*/
|
*/
|
||||||
private void robotDrive(Simulation simulation, VirtualRealityTrain train) {
|
private void robotDrive(Simulation simulation, SimulationMember driver, VirtualRealityTrain train) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
|
||||||
SectionPosition targetPosition = train.getRobotTargetPosition();
|
SectionPosition targetPosition = train.getRobotTargetPosition();
|
||||||
if (targetPosition == null)
|
if (targetPosition == null)
|
||||||
return;
|
return;
|
||||||
|
SectionPosition headPosition = train.getHeadPosition();
|
||||||
|
boolean right = train.isRight();
|
||||||
|
//检查是否已到达/越过目的地
|
||||||
|
Float distance = CalculateService.calculateDistanceDoubleDirection(headPosition, targetPosition, right);
|
||||||
|
if (distance != null && distance < SimulationConstants.PARK_POINT_MAX_OFFSET) {
|
||||||
|
atoService.doBreakMax(train);
|
||||||
|
train.setRobotTargetPosition(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandBO command = driver.getCommand();
|
||||||
|
CommandBO.CommandType commandType = null;
|
||||||
|
if (command != null) {
|
||||||
|
commandType = command.getCommandType();
|
||||||
|
}
|
||||||
|
if (!CommandBO.CommandType.Drive_Through_The_Guide_Signal.equals(commandType)
|
||||||
|
&& !CommandBO.CommandType.Drive_Through_The_Red_Light.equals(commandType)) { //非越红灯、越引导指令时,考虑信号机状态
|
||||||
|
//判断前方信号机正常开放以控制目标位置
|
||||||
|
Section nextSection = headPosition.getSection();
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (nextSection.equals(targetPosition.getSection())) //当前区段就是目标区段,则不需要考虑区段末端的信号机了
|
||||||
|
break;
|
||||||
|
Signal signal = nextSection.getSignalOf(right);
|
||||||
|
if (signal != null && !Signal.SignalType.SHUNTING.equals(signal.getType())) {
|
||||||
|
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||||
|
if (vrSignal != null && (signal.isGuideAspect() || signal.isDefaultAspect())) { //真实信号机不为null且信号机显示是引导或默认
|
||||||
|
//目标位置修改为信号机前5米
|
||||||
|
SectionPosition signalPosition = signal.getPosition();
|
||||||
|
targetPosition = CalculateService.calculateNextPositionByStartAndLen(signalPosition, !right, 5, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextSection = nextSection.getNextRunningSectionBaseRealSwitch(right);
|
||||||
|
if (nextSection == null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
robotDrive(simulation, train, targetPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人驾驶
|
||||||
|
* @param simulation
|
||||||
|
* @param train
|
||||||
|
* @param targetPosition
|
||||||
|
*/
|
||||||
|
private void robotDrive(Simulation simulation, VirtualRealityTrain train, SectionPosition targetPosition) {
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关
|
if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -171,37 +212,23 @@ public class RobotLogicLoop {
|
|||||||
boolean right = train.isRight();
|
boolean right = train.isRight();
|
||||||
float speed = train.getSpeed();
|
float speed = train.getSpeed();
|
||||||
|
|
||||||
// if (train.isAtoOn()) { //为国赛剧本,暂时注掉
|
|
||||||
// train.setRobotTargetPosition(null);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
Float distance = CalculateService.calculateDistance(headPosition, targetPosition, right);
|
Float distance = CalculateService.calculateDistance(headPosition, targetPosition, right);
|
||||||
if (distance == null || distance <= SimulationConstants.PARK_POINT_MAX_OFFSET) { //如果列车已经抵达或越过目标位置
|
if (distance == null || distance <= SimulationConstants.PARK_POINT_MAX_OFFSET) { //如果列车已经抵达或越过目标位置
|
||||||
// this.doBreakMax(simulation, train);
|
|
||||||
atoService.doBreakMax(train);
|
atoService.doBreakMax(train);
|
||||||
train.setRobotTargetPosition(null);
|
|
||||||
// TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
|
||||||
// if (trainInfo.isManual()) {
|
|
||||||
// train.setTarget(null);
|
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (train.isEB()) {
|
|
||||||
// Map<String, Object> operationParams = new HashMap<>();
|
|
||||||
// operationParams.put("groupNumber", train.getGroupNumber());
|
|
||||||
// operationParams.put("percent", 0);
|
|
||||||
// atsOperationDispatcher.execute(simulation, driver, Operation.Type.Driver_Force_Change.name(), operationParams);
|
|
||||||
// }
|
|
||||||
SectionPosition tailPosition = CalculateService.calculateNextPositionByStartAndLen(headPosition, !right, train.getLen(), true);
|
SectionPosition tailPosition = CalculateService.calculateNextPositionByStartAndLen(headPosition, !right, train.getLen(), true);
|
||||||
SpeedCurve speedCurve = null;
|
SpeedCurve speedCurve = null;
|
||||||
switch (train.getDriveMode()) {
|
switch (train.getDriveMode()) {
|
||||||
case AM: //AM模式下不需要司机驾驶
|
case AM: //AM模式下不需要司机驾驶
|
||||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
return;
|
||||||
if (trainInfo.isManualTrain()) {
|
// TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
||||||
train.setTarget(train.getRobotTargetPosition().getSection());
|
// if (trainInfo.isManualTrain()) {
|
||||||
train.setRobotTargetPosition(null);
|
// train.setTarget(train.getRobotTargetPosition().getSection());
|
||||||
}
|
// train.setRobotTargetPosition(null);
|
||||||
break;
|
// }
|
||||||
|
// break;
|
||||||
case CM:
|
case CM:
|
||||||
MaService.Ma ma = train.getMa2();
|
MaService.Ma ma = train.getMa2();
|
||||||
if (ma != null) {
|
if (ma != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user