1.携程打车数据基本数据赋值

This commit is contained in:
wanglf3 2024-03-13 21:59:26 +08:00
parent cba5af2478
commit 016937b871
7 changed files with 134 additions and 25 deletions

View File

@ -6,7 +6,8 @@ import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.infrastructure.constant.BelongSystemConstant;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarBasicInfo;
import com.chint.interfaces.rest.ctrip.dto.search.car.*;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarQuickOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.flight.*;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.ClientInfo;
@ -21,6 +22,7 @@ import java.util.Optional;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
@Component
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@ -39,9 +41,112 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
return null;
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
CarOrderDetail carOrderDetail = new CarOrderDetail();
// CarOrderInfoEntity carOrderInfoEntity = (CarOrderInfoEntity) carOrderDetailData;
// CarBasicInfo carBasicInfo = carOrderInfoEntity.getBasicInfo();
CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo();
String orderNo = carBasicInfo.getOrderId();
String journeyNo = carBasicInfo.getOrderId();
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
Optional<OrderDetail> first = routeOrder
.getOrderDetails()
.stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
.findFirst();
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
carOrderDetail.setOrderNo(orderNo);
carOrderDetail.setDetailId(orderNo);
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}
}
);
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
if (user != null) {
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());
carOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
carOrderDetail.setCreateTime(carBasicInfo.getCreateTime());
CarPassengerInfo passengerInfo = carQuickOrderInfoEntity.getPassengerInfo();
carOrderDetail.setOrderAmount(String.valueOf(carBasicInfo.getOrderAmount()));
carOrderDetail.setUserName(passengerInfo.getPassengerName());
carOrderDetail.setUserCode(passengerInfo.getIntlCode());
// carOrderDetail.setPhone(passengerInfo.get());
carOrderDetail.setPersonalPaymentAmount(String.valueOf(carBasicInfo.getAccntAmount()));
carOrderDetail.setCompanyPaymentAmount(String.valueOf(carBasicInfo.getPersonAmount()));
carOrderDetail.setPaymentType(String.valueOf(carBasicInfo.getPaymentType())); //
carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
//
// carOrderDetail.setStartTime(carBasicInfo.getCreateTime());
// carOrderDetail.setArriveTime(carBasicInfo.get());
// carOrderDetail.setFromStationName(carBasicInfo.get());
// carOrderDetail.setToStationName(carBasicInfo.getEndAddress());
// carOrderDetail.setCarModel(String.valueOf(carBasicInfo.getCarType()));
// carOrderDetail.setFromCity(carBasicInfo.getStartCityName());
// carOrderDetail.setToCity(carBasicInfo.getEndCityName());
// carOrderDetail.setRunTime(carBasicInfo.getDuration());
// carOrderDetail.setMileage(carBasicInfo.getMileage());
//
//
// ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
// if (approveOrderNo != null){
// carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
// carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
// carOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
// carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
// }
//
// carOrderDetail.setOverStandard(); //
// carOrderDetail.setParentOrderNo(parentOrderNo); //
// carOrderDetail.setOriginalOrderNo(originalOrderNo); //
//
// carOrderDetail.setScheduleNum(scheduleNum); //
// carOrderDetail.setBookingName(bookingName); //
// carOrderDetail.setBookingUserPhone(bookingUserPhone);//
//
// carOrderDetail.setCancellationFee(cancellationFee); //
// carOrderDetail.setStandardItems(standardItems); //
//
//
// carOrderDetail.setOverStandardReason(overStandardReason); contactName
// carOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); //
// carOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); //
// carOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); //
// carOrderDetail.setTollFee(tollFee); //
return carOrderDetail;
}
@Override

View File

@ -12,8 +12,7 @@ import com.chint.infrastructure.constant.OrderConstant;
import com.chint.infrastructure.constant.SupplierNameConstant;
import com.chint.interfaces.rest.ctrip.dto.search.ItineraryEntity;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.dto.search.car.BasicInfo;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarBasicInfo;
import com.chint.interfaces.rest.ctrip.dto.search.car.CarQuickOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.car.OrderProduct;
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightInfo;
@ -122,22 +121,22 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
if (carOrderInfoList != null && carOrderInfoList.size() == 1) {
CarQuickOrderInfoEntity carOrderInfo = carOrderInfoList.get(0);
OrderProduct orderProduct = carOrderInfo.getOrderProduct();
BasicInfo basicInfo = carOrderInfo.getBasicInfo();
CarBasicInfo carBasicInfo = carOrderInfo.getBasicInfo();
Location departCityName = locationRepository.findByCityNameAndLevelThree(orderProduct.getDepartAddress().getCityName()).get(0);
Location arriveCityName = locationRepository.findByCityNameAndLevelThree(orderProduct.getArriveAddress().getCityName()).get(0);
return builder.productType(LegConstant.LEG_TYPE_TAXI)
.flightOrderDetailData(carOrderInfo)
.currencyCode(CurrencyType.RENMINBI.getCode())
.orderTime(basicInfo.getCreateTime())
.orderTime(carBasicInfo.getCreateTime())
.startTime(orderProduct.getServiceBeginTime())
.endTime(orderProduct.getServiceEndTime())
.originId(departCityName.getLocationId())
.destinationId(arriveCityName.getLocationId())
.price(String.valueOf(basicInfo.getOrderAmount()))
.selfOrderNo(basicInfo.getJouneryID())
.outOrderNo(String.valueOf(basicInfo.getOrderId()))
.orderStatus(translateCarOrderStatus(basicInfo.getOrderStatus()))
.originOrderStatus(basicInfo.getOrderStatus());
.price(String.valueOf(carBasicInfo.getOrderAmount()))
.selfOrderNo(carBasicInfo.getJouneryID())
.outOrderNo(String.valueOf(carBasicInfo.getOrderId()))
.orderStatus(translateCarOrderStatus(carBasicInfo.getOrderStatus()))
.originOrderStatus(carBasicInfo.getOrderStatus());
}

View File

@ -4,7 +4,7 @@ import lombok.Data;
// 订单基本信息类
@Data
public class BasicInfo {
public class CarBasicInfo {
private String OrderId; // 订单ID
private Double EstimateAmount; // 预估金额
private Double OrderAmount; // 订单金额

View File

@ -6,12 +6,12 @@ import java.util.List;
@Data
public class CarOrderInfoEntity {
private BasicInfo BasicInfo; // 基本信息
private CarBasicInfo BasicInfo; // 基本信息
private OrderProduct OrderProduct; // 订单产品
private List<OrderFee> OrderFeeList; // 订单费用列表
private OrderInsurance OrderInsurance; // 订单保险信息
private OrderInvoice OrderInvoice; // 订单发票信息
private PassengerInfo PassengerInfo; // 乘客信息
private CarPassengerInfo PassengerInfo; // 乘客信息
private List<PaymentInfo> PaymentInfoList; // 支付信息列表
private List<PaymentSettlement> PaymentSettlementList; // 支付结算列表
private List<ChoosedVehicle> ChoosedVehicleList; // 选择的车辆列表

View File

@ -4,7 +4,7 @@ import lombok.Data;
// 乘客信息类
@Data
class PassengerInfo {
public class CarPassengerInfo {
private String CorpUserId;
private String EmployeeId;
private String IntlCode;

View File

@ -1,18 +1,17 @@
package com.chint.interfaces.rest.ctrip.dto.search.car;
import com.chint.interfaces.rest.ctrip.dto.search.car.*;
import lombok.Data;
import java.util.List;
@Data
public class CarQuickOrderInfoEntity {
private BasicInfo BasicInfo; // 基本信息
private CarBasicInfo BasicInfo; // 基本信息
private OrderProduct OrderProduct; // 订单产品
private List<OrderFee> OrderFeeList; // 订单费用列表
private OrderInsurance OrderInsurance; // 订单保险信息
private OrderInvoice OrderInvoice; // 订单发票信息
private PassengerInfo PassengerInfo; // 乘客信息
private CarPassengerInfo PassengerInfo; // 乘客信息
// private List<PaymentInfo> PaymentInfoList; // 支付信息列表
// private List<PaymentSettlement> PaymentSettlementList; // 支付结算列表
// private List<ChoosedVehicle> ChoosedVehicleList; // 选择的车辆列表

View File

@ -24,6 +24,7 @@ import com.chint.interfaces.rest.ly.dto.applyordersync.*;
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -785,13 +786,18 @@ public class LYTest {
System.out.println("join = " + join);
}
// @Test
@Test
void search(){
FlightOrderResponse t1 = lySearchRequest
.getFlightOrderDetail("DFR24031366553705767");
Gson gson = new Gson();
String json = gson.toJson(t1);
System.out.println(json);
// FlightOrderResponse t1 = lySearchRequest
// .getFlightOrderDetail("DT24031366640776789");
// Gson gson = new Gson();
// String json = gson.toJson(t1);
// System.out.println(json);
TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail("DT24031366640776789");
Gson gson = new Gson();
String json = gson.toJson(trainDetailResponse);
System.out.println(json);
}
}