1.同程携程必要字段对接

This commit is contained in:
wanglf3 2024-03-12 18:44:31 +08:00
parent 56c92b5e7d
commit 7629e1f8ab
2 changed files with 260 additions and 157 deletions

View File

@ -9,6 +9,7 @@ import com.chint.domain.repository.UserRepository;
import com.chint.interfaces.rest.ctrip.dto.search.flight.*;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.ClientInfo;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -17,8 +18,8 @@ import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP_EXTENSION_NAME;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP_EXTENSION_NAME;
@Component
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@ -108,7 +109,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
flightOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
// flightOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
flightOrderDetail.setTrvaleSysType("XC");
if (sysCode != null) {
@ -209,16 +210,17 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setReceiptsNum(journeyNo);
}
first.flatMap(orderDetail -> routeOrder.getLegItems()
.stream()
.filter(it -> first.get().getLegId().equals(it.getLegId()))
.findFirst()).ifPresent(it ->
flightOrderDetail.setScheduleNum(it.getLegNo()));
// first.flatMap(orderDetail -> routeOrder.getLegItems()
// .stream()
// .filter(it -> first.get().getLegId().equals(it.getLegId()))
// .findFirst()).ifPresent(it ->
// flightOrderDetail.setScheduleNum(it.getLegNo()));
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
flightOrderDetail.setBookingName(user.getName());
flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
// flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
if (flightOrderFeeDetail != null) {
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderFeeDetail.getTransactionAmount()));
@ -272,9 +274,11 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
// hotelOrderDetail.setOverStandard("false");
// }
hotelOrderDetail.setTrvaleSysType("XC");
hotelOrderDetail.setOverStandard(null); //是否超标
hotelOrderDetail.setOrderStatus(ORDER_DETAIL_STATUS_SUCCESS);
hotelOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
// hotelOrderDetail.setOrderStatus(ORDER_DETAIL_STATUS_SUCCESS);
// hotelOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
if (routeOrder != null) {
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
@ -296,26 +300,38 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setBelongSysType("AN_FK");
}
}
byOrderNo.flatMap(orderDetail -> routeOrder.getLegItems()
.stream()
.filter(it -> byOrderNo.get().getLegId().equals(it.getLegId()))
.findFirst()).ifPresent(it ->
hotelOrderDetail.setScheduleNum(it.getLegNo()));
// byOrderNo.flatMap(orderDetail -> routeOrder.getLegItems()
// .stream()
// .filter(it -> byOrderNo.get().getLegId().equals(it.getLegId()))
// .findFirst()).ifPresent(it ->
// hotelOrderDetail.setScheduleNum(it.getLegNo()));
String EmployeeNo = routeOrder.getUserId();
user = userRepository.findByUserEmployeeNo(EmployeeNo);
}
Optional<OrderDetail> first = routeOrder
.getOrderDetails()
.stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
.findFirst();
first.ifPresent(orderDetail ->{
OrderEvent lastEvent = orderDetail.getLastEvent();
if(lastEvent != null){
hotelOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
}}
);
if (user != null) {
hotelOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo()));
hotelOrderDetail.setBookingName(user.getName());
hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber());
// hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber());
List<HotelOrderDetailCustomer> customers = new ArrayList<>();
HotelOrderDetailCustomer hotelOrderDetailCustomer = new HotelOrderDetailCustomer();
hotelOrderDetailCustomer.setUserCode(user.getEmployeeNo().toString());
hotelOrderDetailCustomer.setUserName(user.getName());
hotelOrderDetailCustomer.setPhone(user.getPhoneNumber());
// hotelOrderDetailCustomer.setPhone(user.getPhoneNumber());
customers.add(hotelOrderDetailCustomer);
hotelOrderDetail.setCustomers(customers);
}
@ -326,7 +342,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
if (hotelOrderInfoEntity != null) {
if (hotelOrderInfoEntity != null){
hotelOrderDetail.setPaymentType(hotelOrderInfoEntity.getPayType());
hotelOrderDetail.setReceiptsNum(hotelOrderInfoEntity.getJourneyNo());
hotelOrderDetail.setOrderNo(hotelOrderInfoEntity.getOrderID()); //订单号
hotelOrderDetail.setCreateTime(hotelOrderInfoEntity.getOrderDate());
@ -358,15 +375,18 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (Double.parseDouble(hotelOrderInfoEntity.getAmount()) > 0) {
hotelOrderDetail.setOrderAmount(hotelOrderInfoEntity.getAmount());
hotelOrderDetail.setRefundAmount(KEEP_TWO_DECIMAL_ZERO);
// hotelOrderDetail.setRefundAmount(KEEP_TWO_DECIMAL_ZERO);
} else {
hotelOrderDetail.setOrderAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setRefundAmount(hotelOrderInfoEntity.getAmount());
// hotelOrderDetail.setRefundAmount(hotelOrderInfoEntity.getAmount());
}
hotelOrderDetail.setPreServiceFee(hotelOrderInfoEntity.getFrontendServiceFee());
hotelOrderDetail.setPostServiceFee(hotelOrderInfoEntity.getServicefee());
hotelOrderDetail.setStandardItems(hotelOrderInfoEntity.getTPMaxPrice());
hotelOrderDetail.setOverStandardReason(hotelOrderInfoEntity.getLowPriceRCInfo());
hotelOrderDetail.setOverStandard(hotelOrderInfoEntity.getLowPriceRCInfo() == null ? "":""); //是否超标
hotelOrderDetail.setAgreementHotel(hotelOrderInfoEntity.getHotelType());
@ -383,10 +403,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setCostCenter(clientInfo.getCostCenter6());
}
}
hotelOrderDetail.setPaymentType("1"); //付款方式 0公司统付1个人付 2混付
// hotelOrderDetail.setRefundRoomNightCount()
// hotelOrderDetail.setNightRates(); //携程文档说明删除
return hotelOrderDetail;
}

View File

@ -2,6 +2,7 @@ package com.chint.domain.factoriy.order_detail;
import com.chint.application.queryies.estimate.EstimatePrice;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
@ -21,10 +22,12 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME;
@Component
@ -92,138 +95,18 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
private TrainOrderDetail convertTrainOrderDetail(TrainDetailResponse.TrainDetailData trainDetailData) {
// TrainDetailResponse.TrainDetailData trainDetailData = trainDetailResponse.getData();
List<TrainDetailResponse.Item> items = trainDetailData.getItems();
TrainDetailResponse.Item item = null;
TrainDetailResponse.ChangeInfo changeInfo = null;
if (!trainDetailData.getItems().isEmpty()) {
item = items.get(0);
changeInfo = item.getChangeInfo();
}
TrainDetailResponse.ChangeItem changeItem = null;
if (changeInfo != null) {
changeItem = changeInfo.getChangeItem();
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(trainDetailData.getOrderNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
if (sysCode != null) {
if (sysCode.equals("FSSC")) {
trainOrderDetail.setBelongSysType("GF_FK");
}
if (sysCode.equals("H3BPM")) {
trainOrderDetail.setBelongSysType("JT_BPM");
}
if (sysCode.equals("XNFSSC")) {
trainOrderDetail.setBelongSysType("XN_FK");
}
if (sysCode.equals("ANFSSC")) {
trainOrderDetail.setBelongSysType("AN_FK");
}
}
if (trainDetailData != null) {
trainOrderDetail.setOrderNo(trainDetailData.getOrderNo());
trainOrderDetail.setParentOrderNo(trainDetailData.getParentOrderSerialNo());
trainOrderDetail.setOrderStatus(trainDetailData.getOrderStatus());
trainOrderDetail.setReceiptsNum(trainDetailData.getTravelData().getTravelApplyNo());
trainOrderDetail.setBookingUserCode(trainDetailData.getOutEmployeeId());
trainOrderDetail.setCreateTime(trainDetailData.getOutTicketTime());
trainOrderDetail.setStartTime(trainDetailData.getPlanBeginDate());
trainOrderDetail.setArriveTime(trainDetailData.getPlanEndDate());
trainOrderDetail.setFromStationName(trainDetailData.getFromStation());
trainOrderDetail.setToStationName(trainDetailData.getToStation());
trainOrderDetail.setTrainNo(trainDetailData.getTrainNo());
trainOrderDetail.setFromCity(trainDetailData.getDepartCity());
trainOrderDetail.setToCity(trainDetailData.getArriveCity());
trainOrderDetail.setOrderAmount(String.valueOf(trainDetailData.getTotalAmount()));
trainOrderDetail.setPersonalAmount(trainDetailData.getPersonalPrice().toString());
trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString());
trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode());
trainOrderDetail.setPaymentType(trainDetailData.getPaymentType().toString());
List<TrainDetailResponse.TravelData.SubmitItem> submitItemList =
trainDetailData.getTravelData().getSubmitItemList();
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null){
trainOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
trainOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
}
if (submitItemList != null && !submitItemList.isEmpty()) {
for (TrainDetailResponse.TravelData.SubmitItem submitItem : submitItemList) {
String itemCode = submitItem.getItemCode();
if (itemCode.equals("CostCenter")) {
trainOrderDetail.setCostCenter(submitItem.getItemContent());
}
if (itemCode.equals("Custom3")) {
trainOrderDetail.setProjectOrderNo(submitItem.getItemContent());
}
}
}
}
if (item != null) {
trainOrderDetail.setPreServiceFee(String.valueOf(item.getServiceCharge()));
trainOrderDetail.setPostServiceFee(String.valueOf(item.getAfterServiceCharge()));
trainOrderDetail.setRefundAmount(String.valueOf(item.getRefundAmountCor()));
trainOrderDetail.setSeatType(item.getSeatClass());
trainOrderDetail.setSeatName(item.getSeatNo());
trainOrderDetail.setTicketPrice(String.valueOf(item.getTicketPrice()));
trainOrderDetail.setRefundCost(String.valueOf(item.getRefundFee()));
trainOrderDetail.setRefundPrice(String.valueOf(item.getRefundAmountCor()));
trainOrderDetail.setChangeCost(String.valueOf(item.getServiceCharge()));
trainOrderDetail.setPhone(item.getPassengerPhone());
trainOrderDetail.setUserName(item.getPassengerName());
}
if (changeItem != null) {
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
}
trainOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
// trainOrderDetail.setOverStandard("ruleViolate"); //
// trainOrderDetail.setOriginalOrderNo("originalOrderNo"); //
// trainOrderDetail.setBookingName(trainDetailData.getContactInfo().getPersonName()); //不确定是否是这个字段文档没写猜测
// trainOrderDetail.setBookingUserPhone(trainDetailData.getContactInfo().getPersonMobile() != null ?
// trainDetailData.getContactInfo().getPersonMobile() :
// trainDetailData.getContactInfo().getPersonTelephone()); //不确定是否是这个字段文档没写猜测
// trainOrderDetail.setScheduleNum(""); //
// trainOrderDetail.setRunTime(""); //
// trainOrderDetail.setTickets(trainDetailData.getTicketNo()); //ChangeInfo.changeItem里面的数据
// trainOrderDetail.setStandardItems("policyName"); //
// trainOrderDetail.setOverStandardReason("foulReason"); //
// trainOrderDetail.setBOOK_ORG_STRUCT_1(""); //
// trainOrderDetail.setBOOK_ORG_STRUCT_2(""); //
// trainOrderDetail.setBOOK_ORG_STRUCT_3(""); //
// trainOrderDetail.setInsuranceFee(""); //
return trainOrderDetail;
}
private FlightOrderDetail convertFlightOrderDetail(FlightOrderResponse.Data data) {
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
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.getAccountCompany());
flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
@ -260,27 +143,53 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setBelongSysType("AN_FK");
}
}
flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
// flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
if (user != null){
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
flightOrderDetail.setBookingName(user.getName());
}
if (orderDetails != null) {
flightOrderDetail.setOrderNo(orderDetails.getOrderSerialNo());
flightOrderDetail.setOverStandard(String.valueOf(orderDetails.getRuleViolate()));
flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo());
flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo());
flightOrderDetail.setOrderStatus(String.valueOf(orderDetails.getOrderStatus()));
flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo());
Optional<OrderDetail> first1 = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(flightOrderDetail.getOrderNo()))
.findFirst();
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
}}
);
// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo());
flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo());
flightOrderDetail.setBookingUserCode(orderDetails.getOutEmployeeId());
flightOrderDetail.setBookingName(orderDetails.getEmployeeName());
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.setRefundFee(String.valueOf(orderDetails.getFlightOrderRefundInfo().getRefundFee()));
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice()));
flightOrderDetail.setPostServiceFee(orderDetails.getAfterSettlementServicePrice().toString());
flightOrderDetail.setRefundAmount(String.valueOf(orderDetails.getFlightOrderRefundInfo().getRefundPrice())); //无refundPrice
flightOrderDetail.setCompanyPaymentAmount(orderDetails.getTotalPrice().toString());
flightOrderDetail.setOverStandardReason(orderDetails.getFoulReason());
flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason());
flightOrderDetail.setPaymentType(orderDetails.getPayType().toString()); //贵司都是公司支付所以为0
}
@ -296,11 +205,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setStartTime(flightSegment.getDepartTime());
flightOrderDetail.setArriveTime(flightSegment.getArriveTime());
flightOrderDetail.setStartCityName(flightSegment.getDepartCity());
flightOrderDetail.setStartCityCode(flightSegment.getDepartAirportCode());
// flightOrderDetail.setStartCityCode(flightSegment.getDep());
flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport());
flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode());
flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal());
flightOrderDetail.setEndCityName(flightSegment.getArriveCity());
flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount());
}
@ -405,7 +315,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo())
.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME)
.setOverStandard(String.valueOf(orderInfo.getRuleViolate()))
.setOrderStatus(String.valueOf(orderInfo.getOrderStatus()))
.setReceiptsNum(orderInfo.getTravelApplyNo())
.setBookingUserCode(orderInfo.getOutEmployeeId())
.setOrderAmount(String.valueOf(orderInfo.getBusinessAmount()))
@ -464,6 +373,19 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
Optional<OrderDetail> first1 = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(hotelOrderDetail.getOrderNo()))
.findFirst();
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
hotelOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
}}
);
List<Resident> residentList = data.getResidentList();
if (residentList != null && !residentList.isEmpty()) {
for (Resident resident : residentList) {
@ -484,6 +406,158 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
return hotelOrderDetail;
}
private TrainOrderDetail convertTrainOrderDetail(TrainDetailResponse.TrainDetailData trainDetailData) {
// TrainDetailResponse.TrainDetailData trainDetailData = trainDetailResponse.getData();
List<TrainDetailResponse.Item> items = trainDetailData.getItems();
TrainDetailResponse.Item item = null;
TrainDetailResponse.ChangeInfo changeInfo = null;
if (!trainDetailData.getItems().isEmpty()) {
item = items.get(0);
changeInfo = item.getChangeInfo();
}
TrainDetailResponse.ChangeItem changeItem = null;
if (changeInfo != null) {
changeItem = changeInfo.getChangeItem();
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(trainDetailData.getOrderNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
Optional<Integer> first = orderDetail.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.filter(it -> it.equals(ORDER_EVENT_ETA))
.findFirst();
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
trainOrderDetail.setTrvaleSysType("TC");
if (sysCode != null) {
if (sysCode.equals("FSSC")) {
trainOrderDetail.setBelongSysType("GF_FK");
}
if (sysCode.equals("H3BPM")) {
trainOrderDetail.setBelongSysType("JT_BPM");
}
if (sysCode.equals("XNFSSC")) {
trainOrderDetail.setBelongSysType("XN_FK");
}
if (sysCode.equals("ANFSSC")) {
trainOrderDetail.setBelongSysType("AN_FK");
}
}
if (trainDetailData != null) {
trainOrderDetail.setOrderNo(trainDetailData.getOrderNo());
trainOrderDetail.setParentOrderNo(trainDetailData.getParentOrderSerialNo());
Optional<OrderDetail> first1 = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(trainDetailData.getOrderNo()))
.findFirst();
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
trainOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
}}
);
trainOrderDetail.setReceiptsNum(trainDetailData.getTravelData().getTravelApplyNo());
trainOrderDetail.setBookingUserCode(trainDetailData.getOutEmployeeId());
trainOrderDetail.setCreateTime(trainDetailData.getOutTicketTime());
trainOrderDetail.setStartTime(trainDetailData.getPlanBeginDate());
trainOrderDetail.setArriveTime(trainDetailData.getPlanEndDate());
trainOrderDetail.setFromStationName(trainDetailData.getFromStation());
trainOrderDetail.setToStationName(trainDetailData.getToStation());
trainOrderDetail.setTrainNo(trainDetailData.getTrainNo());
trainOrderDetail.setFromCity(trainDetailData.getDepartCity());
trainOrderDetail.setToCity(trainDetailData.getArriveCity());
trainOrderDetail.setOrderAmount(String.valueOf(trainDetailData.getTotalAmount()));
trainOrderDetail.setPersonalAmount(trainDetailData.getPersonalPrice().toString());
trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString());
trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode());
trainOrderDetail.setPaymentType(trainDetailData.getPaymentType().toString());
List<TrainDetailResponse.TravelData.SubmitItem> submitItemList =
trainDetailData.getTravelData().getSubmitItemList();
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null){
trainOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
trainOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
}
if (submitItemList != null && !submitItemList.isEmpty()) {
for (TrainDetailResponse.TravelData.SubmitItem submitItem : submitItemList) {
String itemCode = submitItem.getItemCode();
if (itemCode.equals("CostCenter")) {
trainOrderDetail.setCostCenter(submitItem.getItemContent());
}
if (itemCode.equals("Custom3")) {
trainOrderDetail.setProjectOrderNo(submitItem.getItemContent());
}
}
}
}
if (item != null) {
trainOrderDetail.setPreServiceFee(String.valueOf(item.getServiceCharge()));
trainOrderDetail.setPostServiceFee(String.valueOf(item.getAfterServiceCharge()));
trainOrderDetail.setRefundAmount(String.valueOf(item.getRefundAmountCor()));
trainOrderDetail.setSeatType(item.getSeatClass());
trainOrderDetail.setSeatName(item.getSeatNo());
trainOrderDetail.setTicketPrice(String.valueOf(item.getTicketPrice()));
trainOrderDetail.setRefundCost(String.valueOf(item.getRefundFee()));
trainOrderDetail.setRefundPrice(String.valueOf(item.getRefundAmountCor()));
trainOrderDetail.setChangeCost(String.valueOf(item.getServiceCharge()));
trainOrderDetail.setPhone(item.getPassengerPhone());
trainOrderDetail.setUserName(item.getPassengerName());
}
if (changeItem != null) {
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
}
trainOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
if (first.isEmpty()) {
trainOrderDetail.setOverStandard(""); //
} else {
trainOrderDetail.setOverStandard(""); //
}
trainOrderDetail.setOverStandardReason(""); //
// trainOrderDetail.setOriginalOrderNo("originalOrderNo"); //
// trainOrderDetail.setBookingName(trainDetailData.getContactInfo().getPersonName()); //不确定是否是这个字段文档没写猜测
// trainOrderDetail.setBookingUserPhone(trainDetailData.getContactInfo().getPersonMobile() != null ?
// trainDetailData.getContactInfo().getPersonMobile() :
// trainDetailData.getContactInfo().getPersonTelephone()); //不确定是否是这个字段文档没写猜测
// trainOrderDetail.setScheduleNum(""); //
// trainOrderDetail.setRunTime(""); //
// trainOrderDetail.setTickets(trainDetailData.getTicketNo()); //ChangeInfo.changeItem里面的数据
// trainOrderDetail.setStandardItems("policyName"); //
// trainOrderDetail.setOverStandardReason("foulReason"); //
// trainOrderDetail.setBOOK_ORG_STRUCT_1(""); //
// trainOrderDetail.setBOOK_ORG_STRUCT_2(""); //
// trainOrderDetail.setBOOK_ORG_STRUCT_3(""); //
// trainOrderDetail.setInsuranceFee(""); //
return trainOrderDetail;
}
private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) {
// CarDetailResponse.Data data = carDetailResponse.getData();
@ -520,7 +594,18 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
}
carOrderDetail.setOrderNo(carOrderDetailInfo.getOrderSerialNo());
carOrderDetail.setOrderStatus(String.valueOf(carOrderDetailInfo.getOrderStatus()));
Optional<OrderDetail> first1 = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(carOrderDetail.getOrderNo()))
.findFirst();
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
carOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
}}
);
carOrderDetail.setBookingUserCode(carOrderDetailInfo.getOutEmployeeId());
carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime());
carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice()));