This commit is contained in:
DU 2021-02-20 13:40:52 +08:00
commit ede2afc019
21 changed files with 381 additions and 74 deletions

View File

@ -1,8 +1,10 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.configuration.configProp.OtherConfig;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.SaleOrderPayStatusEnum; import club.joylink.rtss.constants.SaleOrderPayStatusEnum;
import club.joylink.rtss.constants.SaleOrderTypeEnum; import club.joylink.rtss.constants.SaleOrderTypeEnum;
import club.joylink.rtss.constants.SystemEnv;
import club.joylink.rtss.dao.SaleOrderDAO; import club.joylink.rtss.dao.SaleOrderDAO;
import club.joylink.rtss.dao.SaleOrderDetailDAO; import club.joylink.rtss.dao.SaleOrderDetailDAO;
import club.joylink.rtss.entity.SaleOrder; import club.joylink.rtss.entity.SaleOrder;
@ -57,6 +59,9 @@ public class OrderService implements IOrderService {
@Autowired @Autowired
private WechatPayService wechatPayService; private WechatPayService wechatPayService;
@Autowired
private OtherConfig otherConfig;
@Override @Override
public PageVO<OrderVO> queryPagedOrders(OrderQueryVO queryVO) { public PageVO<OrderVO> queryPagedOrders(OrderQueryVO queryVO) {
return queryPagedOrders(queryVO, null); return queryPagedOrders(queryVO, null);
@ -155,6 +160,9 @@ public class OrderService implements IOrderService {
@Override @Override
public WxPayUnifiedOrderResultVO pay(long id, String payType, String description) { public WxPayUnifiedOrderResultVO pay(long id, String payType, String description) {
SaleOrder order = getEntity(id); SaleOrder order = getEntity(id);
if (!SystemEnv.isPrdEnv(otherConfig.getEnv())) {
order.setCode(order.getCode() + "-" + otherConfig.getEnv());
}
if (!StringUtils.hasText(description)) { if (!StringUtils.hasText(description)) {
description = "城轨平台权限"; description = "城轨平台权限";
} }
@ -281,7 +289,8 @@ public class OrderService implements IOrderService {
SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType()); SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType());
switch (type) { switch (type) {
case Individual: case Individual:
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPrice(), "个人订单价格不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(createVO.getPrice() != null || createVO.getPriceInCents() != null,
"个人订单价格不能为空");
case Business_Contract: case Business_Contract:
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空"); // BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空");
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getContractNo(), "订单合同号不能为空"); // BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getContractNo(), "订单合同号不能为空");
@ -298,7 +307,7 @@ public class OrderService implements IOrderService {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getStartTime(), "非永久订单开始时间不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getStartTime(), "非永久订单开始时间不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getMonthAmount(), "非永久订单购买时长不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getMonthAmount(), "非永久订单购买时长不能为空");
} }
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPrice(), "订单总价不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(createVO.getPrice() != null || createVO.getPriceInCents() != null, "订单总价不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayWays(), "订单支付方式不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayWays(), "订单支付方式不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayStatus(), "订单支付状态不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayStatus(), "订单支付状态不能为空");
break; break;

View File

@ -437,7 +437,7 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
SaleGoods goods = iGoodsService.getByPermissionId(permission.getId()); SaleGoods goods = iGoodsService.getByPermissionId(permission.getId());
//创建订单 //创建订单
OrderCreateVO orderCreate = new OrderCreateVO(); OrderCreateVO orderCreate = new OrderCreateVO();
orderCreate.setPrice(200f * monthAmount); orderCreate.setPriceInCents(20000 * monthAmount);
orderCreate.setPayWays(SaleOrderPayWaysEnum.Wechat.getCode()); orderCreate.setPayWays(SaleOrderPayWaysEnum.Wechat.getCode());
orderCreate.setPayStatus(SaleOrderPayStatusEnum.Unpaid.getCode()); orderCreate.setPayStatus(SaleOrderPayStatusEnum.Unpaid.getCode());
orderCreate.setOrderType(SaleOrderTypeEnum.Individual.getCode()); orderCreate.setOrderType(SaleOrderTypeEnum.Individual.getCode());

View File

@ -79,6 +79,8 @@ public class Operation {
Switch_Force_Unlock, Switch_Force_Unlock,
/** 挤岔恢复 */ /** 挤岔恢复 */
Switch_Squeeze_Recovery, Switch_Squeeze_Recovery,
/** 命令 */
Switch_Command,
//--------------------------- 区段 --------------------------- //--------------------------- 区段 ---------------------------
/** 封锁 */ /** 封锁 */
@ -249,6 +251,8 @@ public class Operation {
Station_Cancel_CI_Auto, Station_Cancel_CI_Auto,
/** 设置/取消强制点灯 */ /** 设置/取消强制点灯 */
Station_Set_Or_Cancel_Force_Physical_Signal, Station_Set_Or_Cancel_Force_Physical_Signal,
/** 区域选择(请求区域控制权【泰雷兹】) */
Station_Apply_Control,
//车站控制授权 //车站控制授权
/** 请求区域控制权 */ /** 请求区域控制权 */
@ -329,6 +333,8 @@ public class Operation {
Train_Link, Train_Link,
/** 排列进路到 */ /** 排列进路到 */
Train_Set_Route, Train_Set_Route,
/** 设置运行类型 */
Train_Set_Run_Type,
//--------------------------- 司机 --------------------------- //--------------------------- 司机 ---------------------------
/** 改变列车的牵引/制动力 */ /** 改变列车的牵引/制动力 */

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler; package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@OperateHandler @OperateHandler
@ -225,4 +227,12 @@ public class StationOperateHandler {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
this.atsStationService.setOrCancelForcePhysicalSignal(simulation, repository.getByCode(stationCode, Station.class)); this.atsStationService.setOrCancelForcePhysicalSignal(simulation, repository.getByCode(stationCode, Station.class));
} }
@OperateHandlerMapping(type = Operation.Type.Station_Apply_Control)
public void applyControl(Simulation simulation, List<String> stationCodes, SimulationMember simulationMember) {
SimulationDataRepository repository = simulation.getRepository();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, "未选择车站");
List<Station> stations = stationCodes.stream().map(stationCode -> repository.getByCode(stationCode, Station.class)).collect(Collectors.toList());
this.atsStationService.applyControl(simulation, stations, simulationMember);
}
} }

View File

@ -266,4 +266,10 @@ public class SwitchOperateHandler {
public void switchSqueezeRecovery(Simulation simulation, String switchCode) { public void switchSqueezeRecovery(Simulation simulation, String switchCode) {
ciApiService.switchSqueezeRecovery(simulation, switchCode); ciApiService.switchSqueezeRecovery(simulation, switchCode);
} }
/** 命令【泰雷兹】 */
@OperateHandlerMapping(type = Operation.Type.Switch_Command)
public void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal) {
ciApiService.switchCommand(simulation, switchCode, auto, reserve, normal);
}
} }

View File

@ -321,8 +321,16 @@ public class TrainOperateHandler {
/** /**
* 排列进路到站台/信号机泰雷兹 * 排列进路到站台/信号机泰雷兹
*/ */
@OperateHandlerMapping(type = Operation.Type.Train_Link) @OperateHandlerMapping(type = Operation.Type.Train_Set_Route)
public void setRouteTo(Simulation simulation, RoutePathVO routePath) { public void setRouteTo(Simulation simulation, RoutePathVO routePath) {
atsTrainService.setRouteTo(simulation, routePath); atsTrainService.setRouteTo(simulation, routePath);
} }
/**
* 设置列车运行类型泰雷兹
*/
@OperateHandlerMapping(type = Operation.Type.Train_Set_Run_Type)
public void setRunType(Simulation simulation, String groupNumber, VirtualRealityTrain.RunType runType) {
atsTrainService.setRunType(simulation, groupNumber, runType);
}
} }

View File

@ -398,7 +398,7 @@ public class AtsStationService {
public void cancelCIAuto(Simulation simulation, @NonNull Station station) { public void cancelCIAuto(Simulation simulation, @NonNull Station station) {
List<Route> routes = simulation.getRepository().getRouteList(); List<Route> routes = simulation.getRepository().getRouteList();
routes.stream().filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() && !route.isFleetMode()) routes.stream().filter(route -> station.equals(route.getInterlockStation()) && route.isFlt() && route.isFleetMode())
.filter(route -> station.equals(route.getInterlockStation()) && route.isFleetMode()) .filter(route -> station.equals(route.getInterlockStation()) && route.isFleetMode())
.map(Route::getStart) .map(Route::getStart)
.forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode())); .forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode()));
@ -417,4 +417,14 @@ public class AtsStationService {
signalList.forEach(signal -> signal.setForcePhysical(false)); signalList.forEach(signal -> signal.setForcePhysical(false));
} }
} }
public void applyControl(Simulation simulation, List<Station> stations, SimulationMember member) {
stations.forEach(station -> {
if (station.getController() == null) {
station.setController(member);
} else {
station.setControlApplicant(member);
}
});
}
} }

View File

@ -896,4 +896,12 @@ public class AtsTrainService {
public void setRouteTo(Simulation simulation, RoutePathVO routePath) { public void setRouteTo(Simulation simulation, RoutePathVO routePath) {
routePath.getRouteList().forEach(routeCode -> ciApiService.settingRoute(simulation, routeCode)); routePath.getRouteList().forEach(routeCode -> ciApiService.settingRoute(simulation, routeCode));
} }
/**
* 设置列车运行类型
*/
public void setRunType(Simulation simulation, String groupNumber, VirtualRealityTrain.RunType runType) {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
train.setRunType(runType);
}
} }

View File

@ -341,4 +341,9 @@ public interface CiApiService {
* 挤岔恢复 * 挤岔恢复
*/ */
void switchSqueezeRecovery(Simulation simulation, String switchCode); void switchSqueezeRecovery(Simulation simulation, String switchCode);
/**
* 命令
*/
void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal);
} }

View File

@ -153,6 +153,13 @@ public class CiApiServiceImpl implements CiApiService {
@Override @Override
public void blockadeSwitch(Simulation simulation, String switchCode) { public void blockadeSwitch(Simulation simulation, String switchCode) {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
if (simulation.getRepository().getConfig().isBlockadeCommandOnlyValidInStandbyMode()) {
boolean standbyMode = simulation.getRepository().getRouteList()
.stream().filter(route -> route.isRouteSwitch(aSwitch)).anyMatch(route -> !route.isCbtcMode()); //包含该道岔的进路是否有处于后备模式的
if (!standbyMode) {
return;
}
}
this.switchService.blockade(aSwitch); this.switchService.blockade(aSwitch);
} }
@ -223,12 +230,18 @@ public class CiApiServiceImpl implements CiApiService {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class); Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
if (section.isCross()) { if (section.isCross()) {
Optional<Section> crossLockedSectionOptional = section.getLogicList().stream().filter(Section::isLocked).findAny(); Optional<Section> crossLockedSectionOptional = section.getLogicList().stream().filter(Section::isLocked).findAny();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(crossLockedSectionOptional.isPresent(), if (crossLockedSectionOptional.isEmpty()) {
section.debugStr() + "未锁闭,无需解锁"); return;
}
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(crossLockedSectionOptional.isPresent(),
// section.debugStr() + "未锁闭,无需解锁");
section = crossLockedSectionOptional.get(); section = crossLockedSectionOptional.get();
} }
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isLocked(), if (!section.isLocked()) {
section.debugStr() + "未锁闭,无需解锁"); return;
}
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isLocked(),
// section.debugStr() + "未锁闭,无需解锁");
List<Route> lockedRouteList = simulation.getRepository().queryAllLockedRoute(); List<Route> lockedRouteList = simulation.getRepository().queryAllLockedRoute();
Route lockedRoute = null; Route lockedRoute = null;
for (Route route : lockedRouteList) { for (Route route : lockedRouteList) {
@ -414,8 +427,10 @@ public class CiApiServiceImpl implements CiApiService {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode())); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode()));
boolean signalApproachOccupied = signal.getApproachPathList() boolean signalApproachOccupied = signal.getApproachPathList()
.stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied)); .stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
if (config.isNeedApproachLockBeforeSetGuide()) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied, BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied,
String.format("对%s开放引导操作失败接近区段没有列车占用", signal.getName())); String.format("对%s开放引导操作失败接近区段没有列车占用", signal.getName()));
}
//办理引导进路或开放引导信号 //办理引导进路或开放引导信号
if (config.isGuideNeedRouteSettingFirst()) { if (config.isGuideNeedRouteSettingFirst()) {
signalService.openGuideSignal(simulation, signal); signalService.openGuideSignal(simulation, signal);
@ -551,4 +566,24 @@ public class CiApiServiceImpl implements CiApiService {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
Switch.SwitchFault.SQUEEZE.fix(aSwitch); Switch.SwitchFault.SQUEEZE.fix(aSwitch);
} }
@Override
public void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal) {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
if (auto != null) {
aSwitch.setAuto(auto);
} else {
if (normal != null) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!aSwitch.isAuto(), "道岔未处于人工模式");
if (normal) {
switchService.turn2NormalPosition(simulation, aSwitch);
} else {
switchService.turn2ReversePosition(simulation, aSwitch);
}
}
}
if (reserve != null) {
aSwitch.setDispatcherReserve(reserve);
}
}
} }

View File

@ -778,6 +778,9 @@ public class RouteService {
* @param route * @param route
*/ */
public boolean humanCancel(Simulation simulation, Route route) { public boolean humanCancel(Simulation simulation, Route route) {
if (route.isGuideSignalOpen()) { //根据宁波一HMI教学视频添加该分支
this.cancelGuideRoute(simulation, route);
} else {
if (route.isDelayUnlocking()) { // 已经在延时解锁中 if (route.isDelayUnlocking()) { // 已经在延时解锁中
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
String.format("正在延时解锁")); String.format("正在延时解锁"));
@ -798,6 +801,7 @@ public class RouteService {
route.getStart().setDelayTime(route.getDelayReleaseTime() * 1000); route.getStart().setDelayTime(route.getDelayReleaseTime() * 1000);
route.setDelayUnlocking(true); route.setDelayUnlocking(true);
route.getLogicSections().forEach(section -> section.setDelayUnlock(true)); route.getLogicSections().forEach(section -> section.setDelayUnlock(true));
}
return true; return true;
} }

View File

@ -176,6 +176,16 @@ public class MapConfig {
*/ */
private boolean cancelRouteWhenCancelFlt; private boolean cancelRouteWhenCancelFlt;
/**
* 办理引导前需要信号机接近锁闭
*/
private boolean needApproachLockBeforeSetGuide;
/**
* 封锁命令状态仅在后备模式下有效
*/
private boolean blockadeCommandOnlyValidInStandbyMode;
private Set<SimulationMember.Type> needConfirmConnectMembers = private Set<SimulationMember.Type> needConfirmConnectMembers =
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet()); Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
@ -212,6 +222,8 @@ public class MapConfig {
setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically()); setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically());
setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt()); setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt());
setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt()); setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt());
setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide());
setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode());
} }
} }

View File

@ -162,6 +162,21 @@ public class Station extends MayOutOfOrderDevice {
*/ */
private LocalTime restartTime; private LocalTime restartTime;
/**
* 该车站的控制权拥有者
*/
private SimulationMember controller;
/**
* 是否紧急控制
*/
private boolean emergencyController;
/**
* 控制权申请者
*/
private SimulationMember controlApplicant;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -180,6 +195,10 @@ public class Station extends MayOutOfOrderDevice {
this.apply2TheControlMode = null; this.apply2TheControlMode = null;
this.validDuration = null; this.validDuration = null;
this.interlockMachineStarting = false; this.interlockMachineStarting = false;
this.restartTime = null;
this.controller = null;
this.emergencyController = false;
this.controlApplicant = null;
} }
public List<Stand> getStandOf(boolean right) { public List<Stand> getStandOf(boolean right) {
@ -362,6 +381,20 @@ public class Station extends MayOutOfOrderDevice {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, String.format("区段[%s]不是车站[%s]的站台轨", section.getCode(), this.getCode())); throw new SimulationException(SimulationExceptionType.Illegal_Argument, String.format("区段[%s]不是车站[%s]的站台轨", section.getCode(), this.getCode()));
} }
public String getControllerId() {
if (controller == null) {
return null;
}
return controller.getId();
}
public String getControlApplicantId() {
if (controlApplicant == null) {
return null;
}
return controlApplicant.getId();
}
public enum ControlMode { public enum ControlMode {
/** /**
* 交出未被接收 * 交出未被接收

View File

@ -104,6 +104,26 @@ public class Switch extends MayOutOfOrderDevice {
*/ */
private boolean preReset; private boolean preReset;
/**
* 自动
*/
private boolean auto;
/**
* 中央调度员预留
*/
private boolean dispatcherReserve;
/**
* 联锁预留
*/
private boolean interlockReserve;
/**
* 封锁失效
*/
private boolean blockadeInvalid;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -118,6 +138,10 @@ public class Switch extends MayOutOfOrderDevice {
this.delayTime = 0; this.delayTime = 0;
this.noStatus = false; this.noStatus = false;
this.preReset = false; this.preReset = false;
this.auto = false;
this.dispatcherReserve = false;
this.interlockReserve = false;
this.blockadeInvalid = false;
} }
/** /**

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.simulation.cbtc.data.status; package club.joylink.rtss.simulation.cbtc.data.status;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.StationStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.StationStatusVO;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import java.time.LocalTime; import java.time.LocalTime;
@ -54,6 +54,21 @@ public class StationStatus extends DeviceStatus {
/**连锁机上电重启时间*/ /**连锁机上电重启时间*/
private LocalTime restartTime; private LocalTime restartTime;
/**
* 该车站的控制权拥有者
*/
private String controller;
/**
* 是否紧急控制
*/
private boolean emergencyController;
/**
* 控制权申请者
*/
private String controlApplicant;
public StationStatus(Station station) { public StationStatus(Station station) {
super(station.getCode(), station.getDeviceType()); super(station.getCode(), station.getDeviceType());
this.controlMode = station.getControlMode(); this.controlMode = station.getControlMode();
@ -63,6 +78,9 @@ public class StationStatus extends DeviceStatus {
this.apply2TheControlMode = station.getApply2TheControlMode(); this.apply2TheControlMode = station.getApply2TheControlMode();
this.validDuration = station.getValidDurationInSeconds(); this.validDuration = station.getValidDurationInSeconds();
this.restartTime = station.getRestartTime(); this.restartTime = station.getRestartTime();
this.controller = station.getControllerId();
this.emergencyController = station.isEmergencyController();
this.controlApplicant = station.getControlApplicantId();
} }
@Override @Override
@ -106,6 +124,21 @@ public class StationStatus extends DeviceStatus {
this.restartTime = station.getRestartTime(); this.restartTime = station.getRestartTime();
status.setRestartTime(restartTime); status.setRestartTime(restartTime);
} }
if (!Objects.equals(this.controller, station.getControllerId())) {
change = true;
this.controller = station.getControllerId();
}
status.setController(this.controller);
if (!Objects.equals(this.emergencyController, station.isEmergencyController())) {
change = true;
this.emergencyController = station.isEmergencyController();
status.setEmergencyController(this.emergencyController);
}
if (!Objects.equals(this.controlApplicant, station.getControlApplicantId())) {
change = true;
this.controlApplicant = station.getControlApplicantId();
}
status.setControlApplicant(this.controlApplicant);
return change; return change;
} }
@ -119,6 +152,9 @@ public class StationStatus extends DeviceStatus {
statusVO.setApply2TheControlMode(apply2TheControlMode); statusVO.setApply2TheControlMode(apply2TheControlMode);
statusVO.setValidDuration(validDuration); statusVO.setValidDuration(validDuration);
statusVO.setRestartTime(restartTime); statusVO.setRestartTime(restartTime);
statusVO.setController(controller);
statusVO.setEmergencyController(emergencyController);
statusVO.setControlApplicant(controlApplicant);
return statusVO; return statusVO;
} }
} }

View File

@ -1,15 +1,14 @@
package club.joylink.rtss.simulation.cbtc.data.vo; package club.joylink.rtss.simulation.cbtc.data.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
/** /**
@ -52,6 +51,23 @@ public class StationStatusVO extends DeviceStatusVO {
private LocalTime restartTime; private LocalTime restartTime;
/**
* 该车站的控制权拥有者
*/
@JsonInclude()
private String controller;
/**
* 是否紧急控制
*/
private Boolean emergencyController;
/**
* 控制权申请者
*/
@JsonInclude()
private String controlApplicant;
public StationStatusVO(Station station) { public StationStatusVO(Station station) {
super(station.getCode(), station.getDeviceType()); super(station.getCode(), station.getDeviceType());
} }

View File

@ -368,6 +368,39 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**最近经过的两个应答器*/ /**最近经过的两个应答器*/
private Queue<Responder> lastTwoPassedResponders = new FixedQueue<>(Responders_Record); private Queue<Responder> lastTwoPassedResponders = new FixedQueue<>(Responders_Record);
/**
* 运行类型
*/
private RunType runType;
public void setRunType(RunType runType) {
this.runType = runType;
switch (runType) {
case ENERGY_CONSERVATION:
this.atoSpeedMax = this.atpSpeedMax * 0.2f * 0.9f;
break;
case MIDDLE_ONE:
this.atoSpeedMax = this.atpSpeedMax * 0.4f * 0.9f;
break;
case MIDDLE_TWO:
this.atoSpeedMax = this.atpSpeedMax * 0.6f * 0.9f;
break;
case NORMAL:
this.atoSpeedMax = this.atpSpeedMax * 0.8f * 0.9f;
break;
case ACCELERATE:
this.atoSpeedMax = this.atpSpeedMax * 0.9f;
break;
}
}
public void setAtoSpeedMax(float atoSpeedMax) {
if (runType != null) {
return;
}
this.atoSpeedMax = atoSpeedMax;
}
public void setAtpOn(boolean on) { public void setAtpOn(boolean on) {
this.atpOn = on; this.atpOn = on;
if (!on) { //如果是关闭ATP取消信号EB if (!on) { //如果是关闭ATP取消信号EB
@ -432,6 +465,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
this.pantograph2Up = true; this.pantograph2Up = true;
this.linkTrain = null; this.linkTrain = null;
this.lastTwoPassedResponders = new FixedQueue<>(Responders_Record); this.lastTwoPassedResponders = new FixedQueue<>(Responders_Record);
this.runType = null;
} }
public boolean isEB() { public boolean isEB() {
@ -1056,4 +1090,17 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
} }
} }
public enum RunType{
/** 节能 */
ENERGY_CONSERVATION,
/** 中间的1 */
MIDDLE_ONE,
/** 中间的2 */
MIDDLE_TWO,
/** 正常 */
NORMAL,
/** 加速 */
ACCELERATE,
}
} }

View File

@ -161,7 +161,7 @@ public class ATPLogicLoop {
} }
// 列车倒车限速 // 列车倒车限速
if (ControlGear.Reverse.equals(train.getGear())) { if (ControlGear.Reverse.equals(train.getGear())) {
if (train.getSpeed() > 25 / 3.6) { if (train.getSpeed() > 5 / 3.6) { //5km/h从西安二操作手册得来
atpService.triggerSignalEB(train); atpService.triggerSignalEB(train);
} }
} }

View File

@ -34,49 +34,70 @@ public class MapTrainModelVO {
/** /**
* 车长-- * 车长--
*/ */
@ApiModelProperty(value = "车长") @ApiModelProperty(value = "车长/m")
@NotNull(message = "车长不能为空") @NotNull(message = "车长不能为空")
private Float length; private Float length;
/** /**
* 平均速度 * 车重--
*/ */
@ApiModelProperty(value = "平均速度") @ApiModelProperty(value = "重量/t")
@NotNull(message = "平均速度不能为空") @NotNull(message = "重量不能为空")
private Float averageVelocity; private Float weight;
/** /**
* 平均减速度 * 车厢数量
*/ */
@ApiModelProperty(value = "平均减速度") @ApiModelProperty(value = "车厢数量")
@NotNull(message = "平均减速度不能为空") @NotNull(message = "车厢数量不能为空")
private Float averageDeceleration; private Integer numberOfCars;
//
/** // /**
* 默认速度 // * 车长--
*/ // */
@ApiModelProperty(value = "默认速度") // @ApiModelProperty(value = "车长")
@NotNull(message = "默认速度不能为空") // @NotNull(message = "车长不能为空")
private Float defaultVelocity; // private Float length;
//
/** // /**
* 最大速度 // * 平均速度
*/ // */
@ApiModelProperty(value = "最大速度") // @ApiModelProperty(value = "平均速度")
@NotNull(message = "最大速度不能为空") // @NotNull(message = "平均速度不能为空")
private Float maxVelocity; // private Float averageVelocity;
//
/** // /**
* 安全运行距离 // * 平均减速度
*/ // */
@ApiModelProperty(value = "安全运行距离,单位:米") // @ApiModelProperty(value = "平均减速度")
@NotNull(message = "安全运行距离不能为空") // @NotNull(message = "平均减速度不能为空")
private Float safeDistance; // private Float averageDeceleration;
//
/** // /**
* 安全运行距离上限 // * 默认速度
*/ // */
@ApiModelProperty(value = "安全运行距离上限,单位:米") // @ApiModelProperty(value = "默认速度")
@NotNull(message = "安全运行距离上限不能为空") // @NotNull(message = "默认速度不能为空")
private Float maxSafeDistance; // private Float defaultVelocity;
//
// /**
// * 最大速度
// */
// @ApiModelProperty(value = "最大速度")
// @NotNull(message = "最大速度不能为空")
// private Float maxVelocity;
//
// /**
// * 安全运行距离
// */
// @ApiModelProperty(value = "安全运行距离,单位:米")
// @NotNull(message = "安全运行距离不能为空")
// private Float safeDistance;
//
// /**
// * 安全运行距离上限
// */
// @ApiModelProperty(value = "安全运行距离上限,单位:米")
// @NotNull(message = "安全运行距离上限不能为空")
// private Float maxSafeDistance;
} }

View File

@ -115,6 +115,16 @@ public class RealLineConfigVO {
*/ */
private boolean cancelRouteWhenCancelFlt; private boolean cancelRouteWhenCancelFlt;
/**
* 办理引导前需要信号机接近锁闭
*/
private boolean needApproachLockBeforeSetGuide = true;
/**
* 封锁命令状态仅在后备模式下有效
*/
private boolean blockadeCommandOnlyValidInStandbyMode;
public static RealLineConfigVO parseJsonStr(String configData) { public static RealLineConfigVO parseJsonStr(String configData) {
if (StringUtils.hasText(configData)) { if (StringUtils.hasText(configData)) {
return JsonUtils.read(configData, RealLineConfigVO.class); return JsonUtils.read(configData, RealLineConfigVO.class);

View File

@ -28,6 +28,11 @@ public class OrderCreateVO implements Serializable {
private Float price; private Float price;
/**
* 以分为单位的价格
*/
private Integer priceInCents;
private String payWays; private String payWays;
@NotBlank(message = "支付状态不能为空") @NotBlank(message = "支付状态不能为空")
@ -55,7 +60,9 @@ public class OrderCreateVO implements Serializable {
public SaleOrder convert2DB() { public SaleOrder convert2DB() {
SaleOrder saleOrder = new SaleOrder(); SaleOrder saleOrder = new SaleOrder();
saleOrder.setOrganizationId(organizationId); saleOrder.setOrganizationId(organizationId);
if (price != null) { if (priceInCents != null) {
saleOrder.setPrice(priceInCents.longValue());
} else if (price != null) {
saleOrder.setPrice((long) (price * 100)); saleOrder.setPrice((long) (price * 100));
} }
saleOrder.setPayWays(payWays); saleOrder.setPayWays(payWays);