From 8ce8504521be31e96efd04e1aa9169bfdd648a4d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 19 Feb 2021 09:44:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=B1=BB=E6=B7=BB=E5=8A=A0=E4=BB=A5=E5=88=86=E4=B8=BA=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E7=9A=84=E4=BB=B7=E6=A0=BC=EF=BC=9B=E5=88=97=E8=BD=A6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=90=E8=A1=8C=E7=B1=BB=E5=9E=8B=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9<=E5=85=A8=E7=AB=99=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=80=9A=E8=BF=87=E8=BF=9B=E8=B7=AF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=97=A0=E6=95=88>bug=EF=BC=9B=E5=80=92=E8=BD=A6?= =?UTF-8?q?=E9=99=90=E9=80=9F=E6=94=B9=E4=B8=BA5km/h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/services/OrderService.java | 13 ++++- .../CompetitionPracticalService.java | 2 +- .../cbtc/ATS/operation/Operation.java | 2 + .../handler/TrainOperateHandler.java | 10 +++- .../cbtc/ATS/service/AtsStationService.java | 2 +- .../cbtc/ATS/service/AtsTrainService.java | 8 ++++ .../cbtc/data/vr/VirtualRealityTrain.java | 47 +++++++++++++++++++ .../cbtc/onboard/ATP/ATPLogicLoop.java | 2 +- .../rtss/vo/client/order/OrderCreateVO.java | 9 +++- 9 files changed, 88 insertions(+), 7 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/OrderService.java b/src/main/java/club/joylink/rtss/services/OrderService.java index 8121208a4..a87b4af9c 100644 --- a/src/main/java/club/joylink/rtss/services/OrderService.java +++ b/src/main/java/club/joylink/rtss/services/OrderService.java @@ -1,8 +1,10 @@ package club.joylink.rtss.services; +import club.joylink.rtss.configuration.configProp.OtherConfig; import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.SaleOrderPayStatusEnum; import club.joylink.rtss.constants.SaleOrderTypeEnum; +import club.joylink.rtss.constants.SystemEnv; import club.joylink.rtss.dao.SaleOrderDAO; import club.joylink.rtss.dao.SaleOrderDetailDAO; import club.joylink.rtss.entity.SaleOrder; @@ -57,6 +59,9 @@ public class OrderService implements IOrderService { @Autowired private WechatPayService wechatPayService; + @Autowired + private OtherConfig otherConfig; + @Override public PageVO queryPagedOrders(OrderQueryVO queryVO) { return queryPagedOrders(queryVO, null); @@ -155,6 +160,9 @@ public class OrderService implements IOrderService { @Override public WxPayUnifiedOrderResultVO pay(long id, String payType, String description) { SaleOrder order = getEntity(id); + if (!SystemEnv.isPrdEnv(otherConfig.getEnv())) { + order.setCode(order.getCode() + "-" + otherConfig.getEnv()); + } if (!StringUtils.hasText(description)) { description = "城轨平台权限"; } @@ -281,7 +289,8 @@ public class OrderService implements IOrderService { SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType()); switch (type) { case Individual: - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPrice(), "个人订单价格不能为空"); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(createVO.getPrice() != null || createVO.getPriceInCents() != null, + "个人订单价格不能为空"); case Business_Contract: // BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空"); // 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.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.getPayStatus(), "订单支付状态不能为空"); break; diff --git a/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java b/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java index eb91b98bf..d86c819a9 100644 --- a/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java +++ b/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java @@ -437,7 +437,7 @@ public class CompetitionPracticalService implements ICompetitionPracticalService SaleGoods goods = iGoodsService.getByPermissionId(permission.getId()); //创建订单 OrderCreateVO orderCreate = new OrderCreateVO(); - orderCreate.setPrice(200f * monthAmount); + orderCreate.setPriceInCents(20000 * monthAmount); orderCreate.setPayWays(SaleOrderPayWaysEnum.Wechat.getCode()); orderCreate.setPayStatus(SaleOrderPayStatusEnum.Unpaid.getCode()); orderCreate.setOrderType(SaleOrderTypeEnum.Individual.getCode()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 179dba8df..17b35e042 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -315,6 +315,8 @@ public class Operation { Train_Link, /** 排列进路到 */ Train_Set_Route, + /** 设置运行类型 */ + Train_Set_Run_Type, //--------------------------- 司机 --------------------------- /** 改变列车的牵引/制动力 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java index 04bbe75ef..deeb6b1a9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java @@ -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) { 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); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index 57c10d632..e01ca89a4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -398,7 +398,7 @@ public class AtsStationService { public void cancelCIAuto(Simulation simulation, @NonNull Station station) { List 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()) .map(Route::getStart) .forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode())); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java index 2b12c983f..e4fdded5c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsTrainService.java @@ -896,4 +896,12 @@ public class AtsTrainService { public void setRouteTo(Simulation simulation, RoutePathVO routePath) { 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); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java index 2fc7b9538..537665562 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityTrain.java @@ -368,6 +368,39 @@ public class VirtualRealityTrain extends VirtualRealityDevice { /**最近经过的两个应答器*/ private Queue 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) { this.atpOn = on; if (!on) { //如果是关闭ATP,取消信号EB @@ -432,6 +465,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice { this.pantograph2Up = true; this.linkTrain = null; this.lastTwoPassedResponders = new FixedQueue<>(Responders_Record); + this.runType = null; } 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, + } + } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java index eb789ee07..73cef0511 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java @@ -161,7 +161,7 @@ public class ATPLogicLoop { } // 列车倒车限速 if (ControlGear.Reverse.equals(train.getGear())) { - if (train.getSpeed() > 25 / 3.6) { + if (train.getSpeed() > 5 / 3.6) { //5km/h从西安二操作手册得来 atpService.triggerSignalEB(train); } } diff --git a/src/main/java/club/joylink/rtss/vo/client/order/OrderCreateVO.java b/src/main/java/club/joylink/rtss/vo/client/order/OrderCreateVO.java index 6ba87366d..6ec7c7b60 100644 --- a/src/main/java/club/joylink/rtss/vo/client/order/OrderCreateVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/order/OrderCreateVO.java @@ -28,6 +28,11 @@ public class OrderCreateVO implements Serializable { private Float price; + /** + * 以分为单位的价格 + */ + private Integer priceInCents; + private String payWays; @NotBlank(message = "支付状态不能为空") @@ -55,7 +60,9 @@ public class OrderCreateVO implements Serializable { public SaleOrder convert2DB() { SaleOrder saleOrder = new SaleOrder(); saleOrder.setOrganizationId(organizationId); - if (price != null) { + if (priceInCents != null) { + saleOrder.setPrice(priceInCents.longValue()); + } else if (price != null) { saleOrder.setPrice((long) (price * 100)); } saleOrder.setPayWays(payWays); From 71ddb49505a4522b00114c08e244fe20d598ecc0 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 19 Feb 2021 13:16:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=97=E8=BD=A6=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9=EF=BC=9B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?<=E5=8A=9E=E7=90=86=E5=BC=95=E5=AF=BC=E5=89=8D=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E9=9C=80=E8=A6=81=E4=BF=A1=E5=8F=B7=E6=9C=BA=E6=8E=A5?= =?UTF-8?q?=E8=BF=91=E9=94=81=E9=97=AD>=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=EF=BC=9B=E4=BA=BA=E8=A7=A3=E5=BC=95=E5=AF=BC=E8=BF=9B=E8=B7=AF?= =?UTF-8?q?=E6=97=B6=E8=B5=B0=E5=8F=96=E6=B6=88=E5=BC=95=E5=AF=BC=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/CI/CiApiServiceImpl.java | 6 +- .../cbtc/CI/service/RouteService.java | 40 ++++---- .../simulation/cbtc/data/map/MapConfig.java | 6 ++ .../rtss/vo/client/map/MapTrainModelVO.java | 95 +++++++++++-------- .../rtss/vo/client/map/RealLineConfigVO.java | 5 + 5 files changed, 95 insertions(+), 57 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index c76285380..473df89cb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -402,8 +402,10 @@ public class CiApiServiceImpl implements CiApiService { BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode())); boolean signalApproachOccupied = signal.getApproachPathList() .stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied)); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied, - String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName())); + if (config.isNeedApproachLockBeforeSetGuide()) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied, + String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName())); + } //办理引导进路或开放引导信号 if (config.isGuideNeedRouteSettingFirst()) { signalService.openGuideSignal(simulation, signal); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index 783060e18..1f77405f5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -778,26 +778,30 @@ public class RouteService { * @param route */ public boolean humanCancel(Simulation simulation, Route route) { - if (route.isDelayUnlocking()) { // 已经在延时解锁中 - throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, - String.format("正在延时解锁")); - } - if (simulation.getRepository().getConfig().isCancelAtsControlOfAllRoutesWhenCancelRoute()) { - route.getStart().getRouteList().forEach(aRoute -> { - aRoute.setAtsControl(false); - aRoute.setCiControl(false); - }); + if (route.isGuideSignalOpen()) { //根据宁波一HMI教学视频添加该分支 + this.cancelGuideRoute(simulation, route); } else { - route.setAtsControl(false); + if (route.isDelayUnlocking()) { // 已经在延时解锁中 + throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, + String.format("正在延时解锁")); + } + if (simulation.getRepository().getConfig().isCancelAtsControlOfAllRoutesWhenCancelRoute()) { + route.getStart().getRouteList().forEach(aRoute -> { + aRoute.setAtsControl(false); + aRoute.setCiControl(false); + }); + } else { + route.setAtsControl(false); + } + // 关闭始端信号 + this.routeClose(simulation, route); + log.debug(String.format("人解进路,信号机[%s(%s)]关灯", + route.getStart().getName(), route.getStart().getCode())); + // 设置延时 + route.getStart().setDelayTime(route.getDelayReleaseTime() * 1000); + route.setDelayUnlocking(true); + route.getLogicSections().forEach(section -> section.setDelayUnlock(true)); } - // 关闭始端信号 - this.routeClose(simulation, route); - log.debug(String.format("人解进路,信号机[%s(%s)]关灯", - route.getStart().getName(), route.getStart().getCode())); - // 设置延时 - route.getStart().setDelayTime(route.getDelayReleaseTime() * 1000); - route.setDelayUnlocking(true); - route.getLogicSections().forEach(section -> section.setDelayUnlock(true)); return true; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java index f0091d81e..a9b44d215 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java @@ -176,6 +176,11 @@ public class MapConfig { */ private boolean cancelRouteWhenCancelFlt; + /** + * 办理引导前需要信号机接近锁闭 + */ + private boolean needApproachLockBeforeSetGuide; + private Set needConfirmConnectMembers = Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet()); @@ -212,6 +217,7 @@ public class MapConfig { setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically()); setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt()); setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt()); + setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide()); } } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/MapTrainModelVO.java b/src/main/java/club/joylink/rtss/vo/client/map/MapTrainModelVO.java index c985d3e07..add226a23 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/MapTrainModelVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/MapTrainModelVO.java @@ -34,49 +34,70 @@ public class MapTrainModelVO { /** * 车长-- 米 */ - @ApiModelProperty(value = "车长") + @ApiModelProperty(value = "车长/m") @NotNull(message = "车长不能为空") private Float length; /** - * 平均速度 + * 车重-- 吨 */ - @ApiModelProperty(value = "平均速度") - @NotNull(message = "平均速度不能为空") - private Float averageVelocity; + @ApiModelProperty(value = "重量/t") + @NotNull(message = "重量不能为空") + private Float weight; /** - * 平均减速度 + * 车厢数量 */ - @ApiModelProperty(value = "平均减速度") - @NotNull(message = "平均减速度不能为空") - private Float averageDeceleration; - - /** - * 默认速度 - */ - @ApiModelProperty(value = "默认速度") - @NotNull(message = "默认速度不能为空") - private Float defaultVelocity; - - /** - * 最大速度 - */ - @ApiModelProperty(value = "最大速度") - @NotNull(message = "最大速度不能为空") - private Float maxVelocity; - - /** - * 安全运行距离(米) - */ - @ApiModelProperty(value = "安全运行距离,单位:米") - @NotNull(message = "安全运行距离不能为空") - private Float safeDistance; - - /** - * 安全运行距离上限(米) - */ - @ApiModelProperty(value = "安全运行距离上限,单位:米") - @NotNull(message = "安全运行距离上限不能为空") - private Float maxSafeDistance; + @ApiModelProperty(value = "车厢数量") + @NotNull(message = "车厢数量不能为空") + private Integer numberOfCars; +// +// /** +// * 车长-- 米 +// */ +// @ApiModelProperty(value = "车长") +// @NotNull(message = "车长不能为空") +// private Float length; +// +// /** +// * 平均速度 +// */ +// @ApiModelProperty(value = "平均速度") +// @NotNull(message = "平均速度不能为空") +// private Float averageVelocity; +// +// /** +// * 平均减速度 +// */ +// @ApiModelProperty(value = "平均减速度") +// @NotNull(message = "平均减速度不能为空") +// private Float averageDeceleration; +// +// /** +// * 默认速度 +// */ +// @ApiModelProperty(value = "默认速度") +// @NotNull(message = "默认速度不能为空") +// private Float defaultVelocity; +// +// /** +// * 最大速度 +// */ +// @ApiModelProperty(value = "最大速度") +// @NotNull(message = "最大速度不能为空") +// private Float maxVelocity; +// +// /** +// * 安全运行距离(米) +// */ +// @ApiModelProperty(value = "安全运行距离,单位:米") +// @NotNull(message = "安全运行距离不能为空") +// private Float safeDistance; +// +// /** +// * 安全运行距离上限(米) +// */ +// @ApiModelProperty(value = "安全运行距离上限,单位:米") +// @NotNull(message = "安全运行距离上限不能为空") +// private Float maxSafeDistance; } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java index 9a9c76d87..53bda1a33 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java @@ -115,6 +115,11 @@ public class RealLineConfigVO { */ private boolean cancelRouteWhenCancelFlt; + /** + * 办理引导前需要信号机接近锁闭 + */ + private boolean needApproachLockBeforeSetGuide = true; + public static RealLineConfigVO parseJsonStr(String configData) { if (StringUtils.hasText(configData)) { return JsonUtils.read(configData, RealLineConfigVO.class); From 0a84cbb69089b746d85c821e82b9ed39fe7b7545 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 19 Feb 2021 14:01:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AF=B9=E6=9C=AA=E9=94=81=E9=97=AD?= =?UTF-8?q?=E7=9A=84=E5=8C=BA=E6=AE=B5=E6=89=A7=E8=A1=8C=E5=8C=BA=E6=95=85?= =?UTF-8?q?=E8=A7=A3=E5=8E=BB=E6=8E=89=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/simulation/cbtc/CI/CiApiServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index 473df89cb..fa59b443c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -223,12 +223,18 @@ public class CiApiServiceImpl implements CiApiService { Section section = simulation.getRepository().getByCode(sectionCode, Section.class); if (section.isCross()) { Optional
crossLockedSectionOptional = section.getLogicList().stream().filter(Section::isLocked).findAny(); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(crossLockedSectionOptional.isPresent(), - section.debugStr() + "未锁闭,无需解锁"); + if (crossLockedSectionOptional.isEmpty()) { + return; + } +// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(crossLockedSectionOptional.isPresent(), +// section.debugStr() + "未锁闭,无需解锁"); section = crossLockedSectionOptional.get(); } - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isLocked(), - section.debugStr() + "未锁闭,无需解锁"); + if (!section.isLocked()) { + return; + } +// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section.isLocked(), +// section.debugStr() + "未锁闭,无需解锁"); List lockedRouteList = simulation.getRepository().queryAllLockedRoute(); Route lockedRoute = null; for (Route route : lockedRouteList) { From 572f4f1b6d40f30a11ea39ab60ff387c9c27156d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Sat, 20 Feb 2021 13:34:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E6=8E=A7=E5=88=B6=E6=9D=83(=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E9=80=89=E6=8B=A9)=E7=9B=B8=E5=85=B3=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E3=80=81=E6=93=8D=E4=BD=9C=E3=80=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=9B=E6=B7=BB=E5=8A=A0=E6=B3=B0=E9=9B=B7=E5=85=B9=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=B1=9E=E6=80=A7=E3=80=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 4 ++ .../handler/StationOperateHandler.java | 10 +++++ .../handler/SwitchOperateHandler.java | 6 +++ .../cbtc/ATS/service/AtsStationService.java | 10 +++++ .../rtss/simulation/cbtc/CI/CiApiService.java | 5 +++ .../simulation/cbtc/CI/CiApiServiceImpl.java | 27 +++++++++++++ .../simulation/cbtc/data/map/MapConfig.java | 6 +++ .../simulation/cbtc/data/map/Station.java | 33 +++++++++++++++ .../rtss/simulation/cbtc/data/map/Switch.java | 24 +++++++++++ .../cbtc/data/status/StationStatus.java | 40 ++++++++++++++++++- .../cbtc/data/vo/StationStatusVO.java | 24 +++++++++-- .../rtss/vo/client/map/RealLineConfigVO.java | 5 +++ 12 files changed, 188 insertions(+), 6 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 17b35e042..50323b832 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -79,6 +79,8 @@ public class Operation { Switch_Force_Unlock, /** 挤岔恢复 */ Switch_Squeeze_Recovery, + /** 命令 */ + Switch_Command, //--------------------------- 区段 --------------------------- /** 封锁 */ @@ -245,6 +247,8 @@ public class Operation { Station_Cancel_CI_Auto, /** 设置/取消强制点灯 */ Station_Set_Or_Cancel_Force_Physical_Signal, + /** 区域选择(请求区域控制权【泰雷兹】) */ + Station_Apply_Control, //--------------------------- 列车 --------------------------- /** 在指定区段加载一辆计划列车(本地开发使用) */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java index 23d0e809d..7f0bd0f12 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationOperateHandler.java @@ -1,5 +1,6 @@ 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.annotation.OperateHandler; 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.Objects; +import java.util.stream.Collectors; @Slf4j @OperateHandler @@ -224,4 +226,12 @@ public class StationOperateHandler { SimulationDataRepository repository = simulation.getRepository(); this.atsStationService.setOrCancelForcePhysicalSignal(simulation, repository.getByCode(stationCode, Station.class)); } + + @OperateHandlerMapping(type = Operation.Type.Station_Apply_Control) + public void applyControl(Simulation simulation, List stationCodes, SimulationMember simulationMember) { + SimulationDataRepository repository = simulation.getRepository(); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(stationCodes, "未选择车站"); + List stations = stationCodes.stream().map(stationCode -> repository.getByCode(stationCode, Station.class)).collect(Collectors.toList()); + this.atsStationService.applyControl(simulation, stations, simulationMember); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java index f431421c5..784a0afc3 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SwitchOperateHandler.java @@ -266,4 +266,10 @@ public class SwitchOperateHandler { public void switchSqueezeRecovery(Simulation simulation, String 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); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index e01ca89a4..8a2b551d8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -417,4 +417,14 @@ public class AtsStationService { signalList.forEach(signal -> signal.setForcePhysical(false)); } } + + public void applyControl(Simulation simulation, List stations, SimulationMember member) { + stations.forEach(station -> { + if (station.getController() == null) { + station.setController(member); + } else { + station.setControlApplicant(member); + } + }); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java index ff007355b..77a5e868e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java @@ -337,4 +337,9 @@ public interface CiApiService { * 挤岔恢复 */ void switchSqueezeRecovery(Simulation simulation, String switchCode); + + /** + * 命令 + */ + void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index fa59b443c..179f94931 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -153,6 +153,13 @@ public class CiApiServiceImpl implements CiApiService { @Override public void blockadeSwitch(Simulation simulation, String switchCode) { 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); } @@ -547,4 +554,24 @@ public class CiApiServiceImpl implements CiApiService { Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); 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); + } + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java index a9b44d215..8477af003 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java @@ -181,6 +181,11 @@ public class MapConfig { */ private boolean needApproachLockBeforeSetGuide; + /** + * 封锁命令(状态)仅在后备模式下有效 + */ + private boolean blockadeCommandOnlyValidInStandbyMode; + private Set needConfirmConnectMembers = Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet()); @@ -218,6 +223,7 @@ public class MapConfig { setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt()); setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt()); setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide()); + setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode()); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java index 4feee7ea2..717624066 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Station.java @@ -162,6 +162,21 @@ public class Station extends MayOutOfOrderDevice { */ private LocalTime restartTime; + /** + * 该车站的控制权拥有者 + */ + private SimulationMember controller; + + /** + * 是否紧急控制 + */ + private boolean emergencyController; + + /** + * 控制权申请者 + */ + private SimulationMember controlApplicant; + @Override public void reset() { super.reset(); @@ -180,6 +195,10 @@ public class Station extends MayOutOfOrderDevice { this.apply2TheControlMode = null; this.validDuration = null; this.interlockMachineStarting = false; + this.restartTime = null; + this.controller = null; + this.emergencyController = false; + this.controlApplicant = null; } public List 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())); } + 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 { /** * 交出未被接收 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index 6d245a7de..ebac99e20 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -104,6 +104,26 @@ public class Switch extends MayOutOfOrderDevice { */ private boolean preReset; + /** + * 自动 + */ + private boolean auto; + + /** + * 中央调度员预留 + */ + private boolean dispatcherReserve; + + /** + * 联锁预留 + */ + private boolean interlockReserve; + + /** + * 封锁失效 + */ + private boolean blockadeInvalid; + @Override public void reset() { super.reset(); @@ -118,6 +138,10 @@ public class Switch extends MayOutOfOrderDevice { this.delayTime = 0; this.noStatus = false; this.preReset = false; + this.auto = false; + this.dispatcherReserve = false; + this.interlockReserve = false; + this.blockadeInvalid = false; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java index 9fccfba2c..cabed56e0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StationStatus.java @@ -1,13 +1,13 @@ 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.Station; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.StationStatusVO; import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer; 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 java.time.LocalTime; @@ -54,6 +54,21 @@ public class StationStatus extends DeviceStatus { /**连锁机上电重启时间*/ private LocalTime restartTime; + /** + * 该车站的控制权拥有者 + */ + private String controller; + + /** + * 是否紧急控制 + */ + private boolean emergencyController; + + /** + * 控制权申请者 + */ + private String controlApplicant; + public StationStatus(Station station) { super(station.getCode(), station.getDeviceType()); this.controlMode = station.getControlMode(); @@ -63,6 +78,9 @@ public class StationStatus extends DeviceStatus { this.apply2TheControlMode = station.getApply2TheControlMode(); this.validDuration = station.getValidDurationInSeconds(); this.restartTime = station.getRestartTime(); + this.controller = station.getControllerId(); + this.emergencyController = station.isEmergencyController(); + this.controlApplicant = station.getControlApplicantId(); } @Override @@ -106,6 +124,21 @@ public class StationStatus extends DeviceStatus { this.restartTime = station.getRestartTime(); 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; } @@ -119,6 +152,9 @@ public class StationStatus extends DeviceStatus { statusVO.setApply2TheControlMode(apply2TheControlMode); statusVO.setValidDuration(validDuration); statusVO.setRestartTime(restartTime); + statusVO.setController(controller); + statusVO.setEmergencyController(emergencyController); + statusVO.setControlApplicant(controlApplicant); return statusVO; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java index 526f9fa20..b61cd1b83 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StationStatusVO.java @@ -1,15 +1,14 @@ 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.util.jsonSerialize.Boolean2NumDeserializer; 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.Setter; -import java.time.LocalDateTime; import java.time.LocalTime; /** @@ -52,6 +51,23 @@ public class StationStatusVO extends DeviceStatusVO { private LocalTime restartTime; + /** + * 该车站的控制权拥有者 + */ + @JsonInclude() + private String controller; + + /** + * 是否紧急控制 + */ + private Boolean emergencyController; + + /** + * 控制权申请者 + */ + @JsonInclude() + private String controlApplicant; + public StationStatusVO(Station station) { super(station.getCode(), station.getDeviceType()); } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java index 53bda1a33..1b8e3b3e0 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java @@ -120,6 +120,11 @@ public class RealLineConfigVO { */ private boolean needApproachLockBeforeSetGuide = true; + /** + * 封锁命令(状态)仅在后备模式下有效 + */ + private boolean blockadeCommandOnlyValidInStandbyMode; + public static RealLineConfigVO parseJsonStr(String configData) { if (StringUtils.hasText(configData)) { return JsonUtils.read(configData, RealLineConfigVO.class);