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);