订单创建类添加以分为单位的价格;列车添加运行类型;修改<全站取消自动通过进路功能无效>bug;倒车限速改为5km/h

This commit is contained in:
joylink_zhangsai 2021-02-19 09:44:18 +08:00
parent bec904c711
commit 8ce8504521
9 changed files with 88 additions and 7 deletions

View File

@ -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<OrderVO> 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;

View File

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

View File

@ -315,6 +315,8 @@ public class Operation {
Train_Link,
/** 排列进路到 */
Train_Set_Route,
/** 设置运行类型 */
Train_Set_Run_Type,
//--------------------------- 司机 ---------------------------
/** 改变列车的牵引/制动力 */

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) {
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) {
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())
.map(Route::getStart)
.forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode()));

View File

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

View File

@ -368,6 +368,39 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**最近经过的两个应答器*/
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) {
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,
}
}

View File

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

View File

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