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

This commit is contained in:
lulz1 2024-03-17 14:00:17 +08:00
parent fcec95f5c2
commit 9672a66e21
3 changed files with 118 additions and 23 deletions

View File

@ -69,10 +69,25 @@ public class OrderEvent implements Serializable {
return switch (this.eventType) {
case ORDER_EVENT_PREPARE -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> "2";
case ORDER_EVENT_CANCEL -> "3";
case ORDER_EVENT_CHANGE -> FSSC_FLIGHT_STATUS_CHANGE;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> "3";
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_REFUND;
case ORDER_EVENT_UNKNOWN -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_FINISH -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_FLIGHT_STATUS_SUCCESS;
default -> "未知事件";
};
}
public static String mapToFlightOrderDetailStatus(Integer eventType){
return switch (eventType) {
case ORDER_EVENT_PREPARE -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_FLIGHT_STATUS_CHANGE;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_REFUND;
case ORDER_EVENT_UNKNOWN -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_FINISH -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_FLIGHT_STATUS_SUCCESS;
@ -88,7 +103,22 @@ public class OrderEvent implements Serializable {
case ORDER_EVENT_CANCEL -> FSSC_HOTEL_STATUS_SUCCESS; //e额外生成的单子为3 退票虽然是3 返回为1
case ORDER_EVENT_ORDERED -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> "0";
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_HOTEL_STATUS_SUCCESS;
default -> "未知事件";
};
}
public static String mapToHotelOrderDetailStatus(Integer eventType){
return switch (eventType) {
case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_REFUND; //未下单 改成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
case ORDER_EVENT_ORDERED -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_HOTEL_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_HOTEL_STATUS_SUCCESS;
default -> "未知事件";
@ -98,15 +128,30 @@ public class OrderEvent implements Serializable {
public String mapToTrainOrderDetailStatus(){
return switch (this.eventType) {
case ORDER_EVENT_PREPARE -> "1";
case ORDER_EVENT_PAYED -> "1";
case ORDER_EVENT_CHANGE -> "2";
case ORDER_EVENT_CANCEL -> "3";
case ORDER_EVENT_ORDERED -> "1";
case ORDER_EVENT_REFUND -> "3";
case ORDER_EVENT_UNKNOWN -> "0";
case ORDER_EVENT_FINISH -> "1";
case ORDER_EVENT_ETA -> "1";
case ORDER_EVENT_PREPARE -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_TRAIN_STATUS_CHANGE;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_TRAIN_STATUS_REFUND;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_TRAIN_STATUS_SUCCESS;
default -> "未知事件";
};
}
public static String mapToTrainOrderDetailStatus(Integer eventType){
return switch (eventType) {
case ORDER_EVENT_PREPARE -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_TRAIN_STATUS_CHANGE;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_TRAIN_STATUS_REFUND;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_TRAIN_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_TRAIN_STATUS_SUCCESS;
default -> "未知事件";
};
}
@ -114,19 +159,36 @@ public class OrderEvent implements Serializable {
public String mapToCarOrderDetailStatus(){
return switch (this.eventType) {
case ORDER_EVENT_PREPARE -> "1";
case ORDER_EVENT_PAYED -> "1";
case ORDER_EVENT_CHANGE -> "1";
case ORDER_EVENT_CANCEL -> "1";
case ORDER_EVENT_ORDERED -> "1";
case ORDER_EVENT_REFUND -> "1";
case ORDER_EVENT_UNKNOWN -> "0";
case ORDER_EVENT_FINISH -> "1";
case ORDER_EVENT_ETA -> "1";
case ORDER_EVENT_PREPARE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_ORDERED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_CAR_STATUS_SUCCESS;
default -> "未知事件";
};
}
public static String mapToCarOrderDetailStatus(Integer eventType){
return switch (eventType) {
case ORDER_EVENT_PREPARE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_ORDERED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_FINISH -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_CAR_STATUS_SUCCESS;
default -> "未知事件";
};
}
public OrderEvent reloadStatus() {
this.setEventName(translateOrderEvent(this.eventType));
return this;

View File

@ -12,6 +12,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -145,6 +146,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
OrderEvent lastEvent = it.getLastEvent();
if (lastEvent != null) {
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = orderDetails.getOrderStatus();
flightOrderDetail.setOrderStatus(
OrderEvent.mapToFlightOrderDetailStatus(
LYOrderUtil.mapFlightStatus(orderStatus.toString())
)
);
}
}
);
@ -332,7 +341,13 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (lastEvent != null) {
hotelOrderDetail.setOrderStatus(lastEvent.mapToHotelOrderDetailStatus());
} else {
hotelOrderDetail.setOrderStatus(FSSC_HOTEL_STATUS_SUCCESS);
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = orderInfo.getOrderStatus();
hotelOrderDetail.setOrderStatus(
OrderEvent.mapToHotelOrderDetailStatus(
LYOrderUtil.mapHotelStatus(orderStatus.toString())
)
);
}
}
);
@ -433,6 +448,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
OrderEvent lastEvent = it.getLastEvent();
if (lastEvent != null) {
trainOrderDetail.setOrderStatus(lastEvent.mapToTrainOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
String orderStatus = trainDetailData.getOrderStatus();
trainOrderDetail.setOrderStatus(
OrderEvent.mapToTrainOrderDetailStatus(
LYOrderUtil.mapTrainStatus(orderStatus)
)
);
}
}
);
@ -590,6 +613,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
OrderEvent lastEvent = it.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = carOrderDetailInfo.getOrderStatus();
carOrderDetail.setOrderStatus(
OrderEvent.mapToCarOrderDetailStatus(
LYOrderUtil.mapCarStatus(orderStatus)
)
);
}
}
);

View File

@ -17,6 +17,7 @@ public class FSSCConstant {
public static final String FSSC_REDIRECT_PATH_APPROVAL_TWO = "&data=%2F%23%2Fexpenseclaim%3FbillDefineId%3Dfcc76666fb1211e98e2019f4db5548fd%26scene%3DWRITE%26isNew%3Dtrue%26goback%3Dfalse";//申请单类型
public static final String JT_FSSC_REDIRECT_PATH_APPROVAL_ONE = "/FsscSSO?loginUser=";//申请单类型
public static final String XN_FSSC_REDIRECT_PATH_APPROVAL_ONE = "/XNFsscSSO?loginUser=";//申请单类型
public static final String FSSC_ORDER_STATUS_CANCEL = "0";//
public static final String FSSC_HOTEL_STATUS_SUCCESS = "1";//申请单类型
public static final String FSSC_HOTEL_STATUS_REFUND = "3";//申请单类型
public static final String FSSC_HOTEL_STATUS_PART_REFUND = "4";//申请单类型
@ -27,6 +28,7 @@ public class FSSCConstant {
public static final String FSSC_TRAIN_STATUS_CHANGE = "2";//申请单类型
public static final String FSSC_TRAIN_STATUS_REFUND = "3";//申请单类型
public static final String FSSC_CAR_STATUS_SUCCESS = "1";//申请单类型