修复同程订单创建缺少 订单状态的问题

This commit is contained in:
lulz1 2024-03-17 14:51:32 +08:00
parent a610556b9a
commit b14b70e2b5
6 changed files with 203 additions and 187 deletions

View File

@ -97,7 +97,7 @@ public class OrderEvent implements Serializable {
public String mapToHotelOrderDetailStatus(){
return switch (this.eventType) {
case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_REFUND; //未下单 改成3
case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_SUCCESS; //未下单 改成3
case ORDER_EVENT_PAYED -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_HOTEL_STATUS_SUCCESS; //e额外生成的单子为3 退票虽然是3 返回为1

View File

@ -44,7 +44,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
CarOrderDetail carOrderDetail = new CarOrderDetail();
CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo();
String orderNo = carBasicInfo.getOrderId();
@ -56,6 +56,17 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
.findFirst();
CarOrderDetail carOrderDetail;
if (first.isPresent()) {
if (first.get().getCarOrderDetail() == null) {
carOrderDetail = new CarOrderDetail();
} else {
return first.get().getCarOrderDetail();
}
} else {
carOrderDetail = new CarOrderDetail();
}
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
@ -78,7 +89,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS);
}
});
String employeeNo = routeOrder.getUserId();
@ -191,7 +204,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
FlightOrderInfoEntity flightOrderInfoEntity = (FlightOrderInfoEntity) flightOrderDetailData;
BasicInfo flightOrderBasicInfo = flightOrderInfoEntity.getBasicInfo();
@ -265,7 +277,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
flightOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
} else {
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
}
});
@ -414,7 +428,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (byOrderNo.get().getHotelOrderDetail() == null) {
hotelOrderDetail = new HotelOrderDetail();
} else {
hotelOrderDetail = byOrderNo.get().getHotelOrderDetail();
return byOrderNo.get().getHotelOrderDetail();
}
} else {
hotelOrderDetail = new HotelOrderDetail();
@ -453,7 +467,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
hotelOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
hotelOrderDetail.setOrderStatus(lastEvent.mapToHotelOrderDetailStatus());
} else {
hotelOrderDetail.setOrderStatus(FSSC_HOTEL_STATUS_SUCCESS);
}
});

View File

@ -11,7 +11,7 @@ public interface OrderExtensionFactory {
FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData);
HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) throws NoSuchFieldException, IllegalAccessException;
HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData);
OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData);

View File

@ -65,21 +65,19 @@ public class SupplierServiceImpl implements SupplierService {
}
}
case LegConstant.LEG_TYPE_HOTEL -> {
try {
if (orderLegData.getHotelOrderDetailData() != null) {
orderDetail.addHotelOrderData(
orderExtensionFactory.createHotelOrderDetail(orderLegData.getHotelOrderDetailData())
);
}
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
if (orderLegData.getHotelOrderDetailData() != null) {
orderDetail.addHotelOrderData(
orderExtensionFactory.createHotelOrderDetail(orderLegData.getHotelOrderDetailData())
);
}
}
case LegConstant.LEG_TYPE_TAXI -> {
if (orderLegData.getCarOrderDetailData() != null) {
orderDetail.addCarOrderData(
orderExtensionFactory.createCarOrderDetail(orderLegData.getCarOrderDetailData())
);
}
}
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
orderExtensionFactory.createCarOrderDetail(orderLegData.getCarOrderDetailData())
);
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
orderExtensionFactory.createOtherOrderDetail(orderLegData.getOtherOrderDetailData())
);

View File

@ -2,18 +2,16 @@ package com.chint.interfaces.rest.ctrip.in;
import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.system.SupplierCallBackLog;
import com.chint.domain.repository.SupplierCallBackLogRepository;
import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.constant.OrderConstant;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.Result;
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.tools.CTripUtils;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -109,15 +107,15 @@ public class CTripNoteController {
switch (productType) {
case "FlightInternational":
case "FlightDomestic":
command.eventType(mapFlightStatus(orderStatus));
command.eventType(CTripUtils.mapFlightStatus(orderStatus));
break;
case "HotelMember":
case "HotelContract":
command.eventType(mapHotelStatus(orderStatus));
command.eventType(CTripUtils.mapHotelStatus(orderStatus));
break;
case "Train":
case "OverseaTrain":
command.eventType(mapTrainStatus(orderStatus));
command.eventType(CTripUtils.mapTrainStatus(orderStatus));
break;
case "CarPickUpInternational":
case "CarRentalDomestic":
@ -125,169 +123,10 @@ public class CTripNoteController {
case "CarPickUpDomesticNew":
case "CarCharterDomestic":
case "BusTicket":
command.eventType(mapCarStatus(orderStatus));
command.eventType(CTripUtils.mapCarStatus(orderStatus));
break;
}
command.sendToQueue();
return Result.Success("成功收到消息");
}
public Integer mapFlightStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备下单
case "Confirmed" -> OrderConstant.ORDER_EVENT_ORDERED; // "已客户确认"映射到已下单
case "Ticketed" -> OrderConstant.ORDER_EVENT_PAYED; // "已出票"可能意味着已经支付完成
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票
case "RefundSuccess" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票
case "RefundCancelled" ->
// 可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "Dealt" ->
// "已经成交"可能意味着订单已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "Rebooked" -> OrderConstant.ORDER_EVENT_PAYED;
case "rebookSuccess" -> OrderConstant.ORDER_EVENT_CHANGE; // "改签成功"映射到改签
case "RebookedFailed" ->
// "改签失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookSubmitted" ->
// "改签提交"可能意味着改签过程开始但没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookConfirmed" ->
// "改签确认"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookToBePaid" ->
// "改签待支付"可能意味着改签了但未支付但没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookCancelled" ->
// "改签取消"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public Integer mapHotelStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
case "Confirmed" -> OrderConstant.ORDER_EVENT_ORDERED; // "已客户确认"映射到已下单
case "Cancelled" -> OrderConstant.ORDER_EVENT_REFUND; // "已取消"映射到取消
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已取消"映射到取消
case "Wait" ->
// "确认中"可能表示订单正在处理中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定
case "Dealt" ->
// "已经成交"可能表示订单已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "CheckIn" ->
// "入店打卡"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "CheckOut" ->
// "离店打卡"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "CancellationFailed" ->
// "取消失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "submitFailed" ->
// "提交失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PREPARE;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public Integer mapTrainStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
case "Ticketed" ->
// "已出票"可能表示订单已完成出票但没有直接的映射可能需要新的状态常量或使用现有的常量
OrderConstant.ORDER_EVENT_PAYED;
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消状态
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票状态
case "Rebooked" -> OrderConstant.ORDER_EVENT_CHANGE; // "已经改签"映射到改签状态
case "IssueTicketFailed" ->
// "出票失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_ORDERED;
case "RebookedFailed" ->
// "改签失败"也可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "SubmitRefund" ->
// "退票成功"可能最接近"已经退票"但具体映射取决于业务逻辑
OrderConstant.ORDER_EVENT_REFUND; // 使用退票状态作为近似映射
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定状态
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public Integer mapCarStatus(String status) {
return switch (status) {
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消状态
case "Dealt" ->
// "已经成交"可能意味着订单已经确认或完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "WaitReply" ->
// "等待应答"可能表示订单正在等待确认但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "WaitService" ->
// "等待接驾"可能表示服务即将开始但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "Successful" ->
// 成功
OrderConstant.ORDER_EVENT_ORDERED;
case "Redispatched" ->
// "改派中"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "DriverArrived" ->
// "司机已到达"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "InService" ->
// "正在服务"表示服务正在进行中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "EndService" ->
// "行程结束"可能意味着服务已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "Canceling" ->
// "取消中"可能表示订单正在取消过程中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_REFUND;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
}

View File

@ -0,0 +1,163 @@
package com.chint.interfaces.rest.ctrip.tools;
import com.chint.infrastructure.constant.OrderConstant;
public class CTripUtils {
public static Integer mapFlightStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备下单
case "Confirmed" -> OrderConstant.ORDER_EVENT_ORDERED; // "已客户确认"映射到已下单
case "Ticketed" -> OrderConstant.ORDER_EVENT_PAYED; // "已出票"可能意味着已经支付完成
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票
case "RefundSuccess" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票
case "RefundCancelled" ->
// 可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "Dealt" ->
// "已经成交"可能意味着订单已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "Rebooked" -> OrderConstant.ORDER_EVENT_PAYED;
case "rebookSuccess" -> OrderConstant.ORDER_EVENT_CHANGE; // "改签成功"映射到改签
case "RebookedFailed" ->
// "改签失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookSubmitted" ->
// "改签提交"可能意味着改签过程开始但没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookConfirmed" ->
// "改签确认"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookToBePaid" ->
// "改签待支付"可能意味着改签了但未支付但没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "RebookCancelled" ->
// "改签取消"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public static Integer mapHotelStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
case "Confirmed" -> OrderConstant.ORDER_EVENT_ORDERED; // "已客户确认"映射到已下单
case "Cancelled" -> OrderConstant.ORDER_EVENT_REFUND; // "已取消"映射到取消
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已取消"映射到取消
case "Wait" ->
// "确认中"可能表示订单正在处理中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定
case "Dealt" ->
// "已经成交"可能表示订单已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "CheckIn" ->
// "入店打卡"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "CheckOut" ->
// "离店打卡"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "CancellationFailed" ->
// "取消失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "submitFailed" ->
// "提交失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PREPARE;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public static Integer mapTrainStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备状态
case "Ticketed" ->
// "已出票"可能表示订单已完成出票但没有直接的映射可能需要新的状态常量或使用现有的常量
OrderConstant.ORDER_EVENT_PAYED;
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消状态
case "Refunded" -> OrderConstant.ORDER_EVENT_REFUND; // "已经退票"映射到退票状态
case "Rebooked" -> OrderConstant.ORDER_EVENT_CHANGE; // "已经改签"映射到改签状态
case "IssueTicketFailed" ->
// "出票失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_ORDERED;
case "RebookedFailed" ->
// "改签失败"也可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "SubmitRefund" ->
// "退票成功"可能最接近"已经退票"但具体映射取决于业务逻辑
OrderConstant.ORDER_EVENT_REFUND; // 使用退票状态作为近似映射
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定状态
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
public static Integer mapCarStatus(String status) {
return switch (status) {
case "Cancelled" -> OrderConstant.ORDER_EVENT_CANCEL; // "已取消"映射到取消状态
case "Dealt" ->
// "已经成交"可能意味着订单已经确认或完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "WaitReply" ->
// "等待应答"可能表示订单正在等待确认但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "WaitService" ->
// "等待接驾"可能表示服务即将开始但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_ORDERED;
case "Successful" ->
// 成功
OrderConstant.ORDER_EVENT_ORDERED;
case "Redispatched" ->
// "改派中"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "DriverArrived" ->
// "司机已到达"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "InService" ->
// "正在服务"表示服务正在进行中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "EndService" ->
// "行程结束"可能意味着服务已完成但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_PAYED;
case "Canceling" ->
// "取消中"可能表示订单正在取消过程中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_REFUND;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
};
}
}