|
|
|
@ -29,6 +29,7 @@ import static com.chint.infrastructure.constant.FSSCConstant.*;
|
|
|
|
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
|
|
|
|
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
|
|
|
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME;
|
|
|
|
|
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME;
|
|
|
|
|
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@ -172,9 +173,119 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|
|
|
|
@Override
|
|
|
|
|
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
|
|
|
|
|
HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderDetailData;
|
|
|
|
|
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
|
|
|
|
// 获取对象的Class对象
|
|
|
|
|
HotelOrderDetail convertHotel = convertHotelOrderDetail(data);
|
|
|
|
|
return convertHotel;
|
|
|
|
|
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderInfo.getOrderSerialNo())
|
|
|
|
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
|
|
|
|
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
|
|
|
|
HotelOrderDetail hotelOrderDetail = orderDetailFactory.buildHotelWithRouteOrderAndOrderDetail(routeOrder, orderDetail);
|
|
|
|
|
|
|
|
|
|
//这里更新酒店订单明细的类型,酒店只有成功和退款
|
|
|
|
|
OrderEvent lastEvent = orderDetail.getLastEvent();
|
|
|
|
|
if (lastEvent != null) {
|
|
|
|
|
hotelOrderDetail.setOrderStatus(lastEvent.mapToHotelOrderDetailStatus());
|
|
|
|
|
} else {
|
|
|
|
|
//如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射
|
|
|
|
|
int orderStatus = orderInfo.getOrderStatus();
|
|
|
|
|
hotelOrderDetail.setOrderStatus(
|
|
|
|
|
OrderEvent.mapToHotelOrderDetailStatus(
|
|
|
|
|
LYOrderUtil.mapHotelStatus(Integer.toString(orderStatus))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//这里再进行判断,
|
|
|
|
|
if (!hotelOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)) {
|
|
|
|
|
hotelOrderDetail.setOrderStatus(FSSC_HOTEL_STATUS_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return updateHotelOrderDetailData(hotelOrderDetail, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public HotelOrderDetail updateHotelOrderDetailData(HotelOrderDetail hotelOrderDetail, Object hotelOrderInfo) {
|
|
|
|
|
HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderInfo;
|
|
|
|
|
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
|
|
|
|
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
|
|
|
|
|
|
|
|
|
|
if (hotelInfo != null && orderInfo != null) {
|
|
|
|
|
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo())
|
|
|
|
|
.setDetailId(orderInfo.getOrderSerialNo())
|
|
|
|
|
.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME)
|
|
|
|
|
.setOrderAmount(String.valueOf(orderInfo.getBusinessAmount()))
|
|
|
|
|
.setCreateTime(orderInfo.getCreateTime())
|
|
|
|
|
.setCheckInCity(hotelInfo.getCityName())
|
|
|
|
|
.setHotelName(hotelInfo.getHotelName())
|
|
|
|
|
.setContactPhone(hotelInfo.getHotelTel())
|
|
|
|
|
.setHotelAddress(hotelInfo.getHotelAddress())
|
|
|
|
|
.setCheckInDate(hotelInfo.getCheckInDate())
|
|
|
|
|
.setDepartureDate(hotelInfo.getCheckOutDate())
|
|
|
|
|
.setNightCount(String.valueOf(hotelInfo.getNightNum()))
|
|
|
|
|
.setRoomCount(String.valueOf(hotelInfo.getRoomNum()))
|
|
|
|
|
.setRoomTypeName(hotelInfo.getRoomName())
|
|
|
|
|
.setPreServiceFee(String.valueOf(orderInfo.getServicePrice()))
|
|
|
|
|
.setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice()))
|
|
|
|
|
.setRefundAmount(String.valueOf(orderInfo.getRefundPrice()))
|
|
|
|
|
.setAgreementHotel(orderInfo.getProtocolType() == 0 ? "否" : "是");
|
|
|
|
|
|
|
|
|
|
//下单成功的总金额要和退款状态的总金额区分开
|
|
|
|
|
if (hotelOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
|
|
|
|
|
hotelOrderDetail.setOrderAmount(String.valueOf(orderInfo.getTotalPrice()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//配置付款类型
|
|
|
|
|
if (orderInfo.getPaymentType() == 1) {
|
|
|
|
|
hotelOrderDetail.setPaymentType("0");
|
|
|
|
|
hotelOrderDetail.setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice()));
|
|
|
|
|
hotelOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
hotelOrderDetail.setPaymentType("1");
|
|
|
|
|
hotelOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO);
|
|
|
|
|
hotelOrderDetail.setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<HotelDetailResponse.RefundInfo> refundInfoList = data.getRefundInfoList();
|
|
|
|
|
//如果是退款状态的话,要进入这里进行更新
|
|
|
|
|
if (refundInfoList != null &&
|
|
|
|
|
!refundInfoList.isEmpty() &&
|
|
|
|
|
hotelOrderDetail.getOrderStatus().equals(FSSC_HOTEL_STATUS_REFUND)) {
|
|
|
|
|
HotelDetailResponse.RefundInfo refundInfo = refundInfoList.get(0);
|
|
|
|
|
hotelOrderDetail.setRefundAmount(String.valueOf(refundInfo.getRefundPrice()));
|
|
|
|
|
//这里录入退款方式
|
|
|
|
|
List<HotelDetailResponse.RefundInfo.RefundProductOrder> refundProductOrderInfo = refundInfo.getRefundProductOrderInfo();
|
|
|
|
|
if (refundProductOrderInfo != null && !refundProductOrderInfo.isEmpty()) {
|
|
|
|
|
HotelDetailResponse.RefundInfo.RefundProductOrder refundProductOrder = refundProductOrderInfo.get(0);
|
|
|
|
|
if (refundProductOrder.getRefundPayType() == 0) {
|
|
|
|
|
hotelOrderDetail.setCompanyRefundAmount(String.valueOf(refundProductOrder.getRefundAmout()));
|
|
|
|
|
hotelOrderDetail.setPersonalRefundAmount(KEEP_TWO_DECIMAL_ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
hotelOrderDetail.setCompanyRefundAmount(KEEP_TWO_DECIMAL_ZERO);
|
|
|
|
|
hotelOrderDetail.setPersonalRefundAmount(String.valueOf(refundProductOrder.getRefundAmout()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//入住人信息
|
|
|
|
|
List<Resident> residentList = data.getResidentList();
|
|
|
|
|
if (residentList != null && !residentList.isEmpty()) {
|
|
|
|
|
for (Resident resident : residentList) {
|
|
|
|
|
HotelOrderDetailCustomer customer = new HotelOrderDetailCustomer();
|
|
|
|
|
customer.setUserName(resident.getName());
|
|
|
|
|
customer.setPhone(resident.getContactPhone());
|
|
|
|
|
customer.setUserCode(resident.getEmployeeCode());
|
|
|
|
|
hotelOrderDetail.addCustomer(customer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//房间信息
|
|
|
|
|
List<HotelDetailResponse.Room> roomList = data.getRoomList();
|
|
|
|
|
if (roomList != null && !roomList.isEmpty()) {
|
|
|
|
|
HotelDetailResponse.Room room = roomList.get(0);
|
|
|
|
|
hotelOrderDetail.setStandardItems(room.getDayStandardPrice());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hotelOrderDetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -183,173 +294,9 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FlightOrderDetail convertFlightOrderDetail(FlightOrderResponse.Data data) {
|
|
|
|
|
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
|
|
|
|
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo())
|
|
|
|
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
|
|
|
|
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
|
|
|
|
|
|
|
|
|
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
|
|
|
|
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
|
|
|
|
|
if (approveOrderNo != null) {
|
|
|
|
|
flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
|
|
|
|
|
flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
|
|
|
|
|
flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
|
|
|
|
|
flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
|
|
|
|
|
}
|
|
|
|
|
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
|
|
|
|
FlightOrderResponse.FlightSegment flightSegment = null;
|
|
|
|
|
if (!data.getFlightSegmentList().isEmpty()) {
|
|
|
|
|
flightSegment = data.getFlightSegmentList().get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlightOrderResponse.Passenger passenger = null;
|
|
|
|
|
if (!data.getPassengerList().isEmpty()) {
|
|
|
|
|
passenger = data.getPassengerList().get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
|
|
|
|
|
flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
|
|
|
|
|
if (sysCode != null) {
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String EmployeeNo = routeOrder.getUserId();
|
|
|
|
|
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
|
|
|
|
|
if (user != null) {
|
|
|
|
|
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
|
|
|
|
|
flightOrderDetail.setBookingName(user.getName());
|
|
|
|
|
flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
|
|
|
|
|
}
|
|
|
|
|
if (orderDetails != null) {
|
|
|
|
|
flightOrderDetail.setOrderNo(orderDetails.getOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setDetailId(orderDetails.getOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo());
|
|
|
|
|
|
|
|
|
|
Optional<OrderDetail> first1 = routeOrder
|
|
|
|
|
.getOrderDetails()
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(it -> it.getOrderNo().equals(flightOrderDetail.getOrderNo()))
|
|
|
|
|
.findFirst();
|
|
|
|
|
|
|
|
|
|
first1.ifPresent(it -> {
|
|
|
|
|
OrderEvent lastEvent = it.getLastEvent();
|
|
|
|
|
if (orderDetail.getOrderNo().contains("C") && orderDetails.getIsChangeOrder()) {
|
|
|
|
|
//如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单
|
|
|
|
|
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
|
|
|
|
|
}
|
|
|
|
|
if (lastEvent != null) {
|
|
|
|
|
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
|
|
|
|
|
} else {
|
|
|
|
|
//如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射
|
|
|
|
|
Integer orderStatus = orderDetails.getOrderStatus();
|
|
|
|
|
flightOrderDetail.setOrderStatus(
|
|
|
|
|
OrderEvent.mapToFlightOrderDetailStatus(
|
|
|
|
|
LYOrderUtil.mapFlightStatus(orderStatus.toString())
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo());
|
|
|
|
|
flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo());
|
|
|
|
|
FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo();
|
|
|
|
|
if (flightOrderRefundInfo != null) {
|
|
|
|
|
flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee()));
|
|
|
|
|
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice
|
|
|
|
|
}
|
|
|
|
|
flightOrderDetail.setCreateTime(orderDetails.getBookDate());
|
|
|
|
|
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
|
|
|
|
|
flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice()));
|
|
|
|
|
flightOrderDetail.setPostServiceFee(orderDetails.getAfterSettlementServicePrice().toString());
|
|
|
|
|
flightOrderDetail.setCompanyPaymentAmount(orderDetails.getTotalPrice().toString());
|
|
|
|
|
flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason());
|
|
|
|
|
// flightOrderDetail.setPaymentType(orderDetails.getPayType().toString()); //贵司都是公司支付所以为0
|
|
|
|
|
|
|
|
|
|
flightOrderDetail.setPaymentType("0");
|
|
|
|
|
}
|
|
|
|
|
if (flightSegment != null) {
|
|
|
|
|
flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport());
|
|
|
|
|
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
|
|
|
|
|
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
|
|
|
|
|
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
|
|
|
|
|
// flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
|
|
|
|
|
flightOrderDetail.setFlightCompName(flightSegment.getAirline());
|
|
|
|
|
|
|
|
|
|
flightOrderDetail.setFlightNum(flightSegment.getFlightNo());
|
|
|
|
|
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
|
|
|
|
|
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
|
|
|
|
|
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
|
|
|
|
|
flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull());
|
|
|
|
|
flightOrderDetail.setStartCityName(flightSegment.getDepartCity());
|
|
|
|
|
// flightOrderDetail.setStartCityCode(flightSegment.getDep());
|
|
|
|
|
flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport());
|
|
|
|
|
flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode());
|
|
|
|
|
flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal());
|
|
|
|
|
flightOrderDetail.setEndCityName(flightSegment.getArriveCity());
|
|
|
|
|
flightOrderDetail.setFlightModel(flightSegment.getFlightNo());
|
|
|
|
|
flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount());
|
|
|
|
|
}
|
|
|
|
|
flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
|
|
|
|
|
if (passenger != null) {
|
|
|
|
|
flightOrderDetail.setFuelTax(passenger.getFuelTax().toString());
|
|
|
|
|
flightOrderDetail.setAirportTax(passenger.getAirportTax().toString());
|
|
|
|
|
flightOrderDetail.setFacePrice(passenger.getParPrice().toString());
|
|
|
|
|
flightOrderDetail.setChangeFee(passenger.getChangeFee().toString());
|
|
|
|
|
flightOrderDetail.setUpFee(passenger.getChangePrice().toString());
|
|
|
|
|
flightOrderDetail.setTicketNo(passenger.getTicketNo());
|
|
|
|
|
flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号
|
|
|
|
|
flightOrderDetail.setUserName(passenger.getPassengerName());
|
|
|
|
|
flightOrderDetail.setUserCode(passenger.getOutEmployeeId());
|
|
|
|
|
flightOrderDetail.setPhone(passenger.getContractPhone());
|
|
|
|
|
flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
|
|
|
|
|
.stream()
|
|
|
|
|
.map(OrderEvent::getEventType)
|
|
|
|
|
.filter(it -> it.equals(ORDER_EVENT_ETA))
|
|
|
|
|
.findFirst();
|
|
|
|
|
|
|
|
|
|
if (firstOrderEvent.isEmpty()) {
|
|
|
|
|
flightOrderDetail.setOverStandard("否"); //无
|
|
|
|
|
} else {
|
|
|
|
|
flightOrderDetail.setOverStandard("是"); //无
|
|
|
|
|
}
|
|
|
|
|
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
|
|
|
|
|
.stream()
|
|
|
|
|
.findFirst();
|
|
|
|
|
first1.ifPresent(orderEvent -> flightOrderDetail.setOverStandardReason(orderEvent.getExtension()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// flightOrderDetail.setBookingUserPhone(data.get); //无
|
|
|
|
|
// flightOrderDetail.setEndCityCode(flightSegment.getarrivecit()); //无
|
|
|
|
|
// FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo =
|
|
|
|
|
// orderDetails.getFlightOrderRefundInfo().getRefundFee();
|
|
|
|
|
// flightOrderDetail.setTickets(tickets);
|
|
|
|
|
// flightOrderDetail.setPaymentType("0"); //贵司都是公司支付所以为0
|
|
|
|
|
// flightOrderDetail.setPersonalPaymentAmount(personalPaymentAmount); //无个人支付金额
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1);
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2);
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3);
|
|
|
|
|
return flightOrderDetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private HotelOrderDetail convertHotelOrderDetail(HotelDetailResponse.Data data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
|
|
|
|
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
|
|
|
|
|
List<HotelDetailResponse.Room> roomList = data.getRoomList();
|
|
|
|
@ -491,7 +438,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|
|
|
|
|
|
|
|
|
if (room != null) {
|
|
|
|
|
hotelOrderDetail.setStandardItems(room.getDayStandardPrice());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -563,7 +509,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|
|
|
|
trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode());
|
|
|
|
|
|
|
|
|
|
//配置付款类型
|
|
|
|
|
if (String.valueOf(trainDetailData.getPaymentType()).equals("1")) {
|
|
|
|
|
if (String.valueOf(trainDetailData.getPaymentType()).equals("1.0")) {
|
|
|
|
|
trainOrderDetail.setPaymentType("0");
|
|
|
|
|
trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString());
|
|
|
|
|
trainOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
|
|
|
|
@ -979,5 +925,170 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private FlightOrderDetail convertFlightOrderDetail(FlightOrderResponse.Data data) {
|
|
|
|
|
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
|
|
|
|
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo())
|
|
|
|
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
|
|
|
|
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
|
|
|
|
|
|
|
|
|
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
|
|
|
|
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
|
|
|
|
|
if (approveOrderNo != null) {
|
|
|
|
|
flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
|
|
|
|
|
flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
|
|
|
|
|
flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
|
|
|
|
|
flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
|
|
|
|
|
}
|
|
|
|
|
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
|
|
|
|
FlightOrderResponse.FlightSegment flightSegment = null;
|
|
|
|
|
if (!data.getFlightSegmentList().isEmpty()) {
|
|
|
|
|
flightSegment = data.getFlightSegmentList().get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FlightOrderResponse.Passenger passenger = null;
|
|
|
|
|
if (!data.getPassengerList().isEmpty()) {
|
|
|
|
|
passenger = data.getPassengerList().get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
|
|
|
|
|
flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
|
|
|
|
|
if (sysCode != null) {
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
|
|
|
|
}
|
|
|
|
|
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
|
|
|
|
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String EmployeeNo = routeOrder.getUserId();
|
|
|
|
|
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
|
|
|
|
|
if (user != null) {
|
|
|
|
|
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
|
|
|
|
|
flightOrderDetail.setBookingName(user.getName());
|
|
|
|
|
flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
|
|
|
|
|
}
|
|
|
|
|
if (orderDetails != null) {
|
|
|
|
|
flightOrderDetail.setOrderNo(orderDetails.getOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setDetailId(orderDetails.getOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo());
|
|
|
|
|
flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo());
|
|
|
|
|
|
|
|
|
|
Optional<OrderDetail> first1 = routeOrder
|
|
|
|
|
.getOrderDetails()
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(it -> it.getOrderNo().equals(flightOrderDetail.getOrderNo()))
|
|
|
|
|
.findFirst();
|
|
|
|
|
|
|
|
|
|
first1.ifPresent(it -> {
|
|
|
|
|
OrderEvent lastEvent = it.getLastEvent();
|
|
|
|
|
if (orderDetail.getOrderNo().contains("C") && orderDetails.getIsChangeOrder()) {
|
|
|
|
|
//如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单
|
|
|
|
|
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
|
|
|
|
|
}
|
|
|
|
|
if (lastEvent != null) {
|
|
|
|
|
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
|
|
|
|
|
} else {
|
|
|
|
|
//如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射
|
|
|
|
|
Integer orderStatus = orderDetails.getOrderStatus();
|
|
|
|
|
flightOrderDetail.setOrderStatus(
|
|
|
|
|
OrderEvent.mapToFlightOrderDetailStatus(
|
|
|
|
|
LYOrderUtil.mapFlightStatus(orderStatus.toString())
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo());
|
|
|
|
|
flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo());
|
|
|
|
|
FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo();
|
|
|
|
|
if (flightOrderRefundInfo != null) {
|
|
|
|
|
flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee()));
|
|
|
|
|
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice
|
|
|
|
|
}
|
|
|
|
|
flightOrderDetail.setCreateTime(orderDetails.getBookDate());
|
|
|
|
|
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
|
|
|
|
|
flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice()));
|
|
|
|
|
flightOrderDetail.setPostServiceFee(orderDetails.getAfterSettlementServicePrice().toString());
|
|
|
|
|
flightOrderDetail.setCompanyPaymentAmount(orderDetails.getTotalPrice().toString());
|
|
|
|
|
flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason());
|
|
|
|
|
// flightOrderDetail.setPaymentType(orderDetails.getPayType().toString()); //贵司都是公司支付所以为0
|
|
|
|
|
|
|
|
|
|
flightOrderDetail.setPaymentType("0");
|
|
|
|
|
}
|
|
|
|
|
if (flightSegment != null) {
|
|
|
|
|
flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport());
|
|
|
|
|
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
|
|
|
|
|
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
|
|
|
|
|
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
|
|
|
|
|
// flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
|
|
|
|
|
flightOrderDetail.setFlightCompName(flightSegment.getAirline());
|
|
|
|
|
|
|
|
|
|
flightOrderDetail.setFlightNum(flightSegment.getFlightNo());
|
|
|
|
|
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
|
|
|
|
|
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
|
|
|
|
|
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
|
|
|
|
|
flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull());
|
|
|
|
|
flightOrderDetail.setStartCityName(flightSegment.getDepartCity());
|
|
|
|
|
// flightOrderDetail.setStartCityCode(flightSegment.getDep());
|
|
|
|
|
flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport());
|
|
|
|
|
flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode());
|
|
|
|
|
flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal());
|
|
|
|
|
flightOrderDetail.setEndCityName(flightSegment.getArriveCity());
|
|
|
|
|
flightOrderDetail.setFlightModel(flightSegment.getFlightNo());
|
|
|
|
|
flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount());
|
|
|
|
|
}
|
|
|
|
|
flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
|
|
|
|
|
if (passenger != null) {
|
|
|
|
|
flightOrderDetail.setFuelTax(passenger.getFuelTax().toString());
|
|
|
|
|
flightOrderDetail.setAirportTax(passenger.getAirportTax().toString());
|
|
|
|
|
flightOrderDetail.setFacePrice(passenger.getParPrice().toString());
|
|
|
|
|
flightOrderDetail.setChangeFee(passenger.getChangeFee().toString());
|
|
|
|
|
flightOrderDetail.setUpFee(passenger.getChangePrice().toString());
|
|
|
|
|
flightOrderDetail.setTicketNo(passenger.getTicketNo());
|
|
|
|
|
flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号
|
|
|
|
|
flightOrderDetail.setUserName(passenger.getPassengerName());
|
|
|
|
|
flightOrderDetail.setUserCode(passenger.getOutEmployeeId());
|
|
|
|
|
flightOrderDetail.setPhone(passenger.getContractPhone());
|
|
|
|
|
flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
|
|
|
|
|
.stream()
|
|
|
|
|
.map(OrderEvent::getEventType)
|
|
|
|
|
.filter(it -> it.equals(ORDER_EVENT_ETA))
|
|
|
|
|
.findFirst();
|
|
|
|
|
|
|
|
|
|
if (firstOrderEvent.isEmpty()) {
|
|
|
|
|
flightOrderDetail.setOverStandard("否"); //无
|
|
|
|
|
} else {
|
|
|
|
|
flightOrderDetail.setOverStandard("是"); //无
|
|
|
|
|
}
|
|
|
|
|
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
|
|
|
|
|
.stream()
|
|
|
|
|
.findFirst();
|
|
|
|
|
first1.ifPresent(orderEvent -> flightOrderDetail.setOverStandardReason(orderEvent.getExtension()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// flightOrderDetail.setBookingUserPhone(data.get); //无
|
|
|
|
|
// flightOrderDetail.setEndCityCode(flightSegment.getarrivecit()); //无
|
|
|
|
|
// FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo =
|
|
|
|
|
// orderDetails.getFlightOrderRefundInfo().getRefundFee();
|
|
|
|
|
// flightOrderDetail.setTickets(tickets);
|
|
|
|
|
// flightOrderDetail.setPaymentType("0"); //贵司都是公司支付所以为0
|
|
|
|
|
// flightOrderDetail.setPersonalPaymentAmount(personalPaymentAmount); //无个人支付金额
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1);
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2);
|
|
|
|
|
// flightOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3);
|
|
|
|
|
return flightOrderDetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|