携程退改签机票字段调整
This commit is contained in:
parent
47521245ce
commit
1d28520538
|
@ -94,7 +94,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
|
||||
CarPassengerInfo passengerInfo = carQuickOrderInfoEntity.getPassengerInfo();
|
||||
|
||||
if (passengerInfo != null){
|
||||
if (passengerInfo != null) {
|
||||
carOrderDetail.setUserName(passengerInfo.getPassengerName());
|
||||
carOrderDetail.setUserCode(passengerInfo.getIntlCode());
|
||||
carOrderDetail.setPhone(passengerInfo.getPassengerPhone());
|
||||
|
@ -110,7 +110,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
carOrderDetail.setPaymentType(String.valueOf(carBasicInfo.getPaymentType())); //无
|
||||
|
||||
OrderProduct orderProduct = carQuickOrderInfoEntity.getOrderProduct();
|
||||
if (orderProduct != null){
|
||||
if (orderProduct != null) {
|
||||
carOrderDetail.setStartTime(orderProduct.getServiceBeginTime());
|
||||
carOrderDetail.setArriveTime(orderProduct.getServiceEndTime());
|
||||
carOrderDetail.setMileage(orderProduct.getNormalDistance());
|
||||
|
@ -203,8 +203,11 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
}
|
||||
}
|
||||
|
||||
FlightRefundInfo flightRefundInfo = flightOrderInfoEntity.getRefundInfo();
|
||||
|
||||
List<FlightRefundInfo> flightRefundInfoList = flightOrderInfoEntity.getRefundInfo();
|
||||
FlightRefundInfo flightRefundInfo=new FlightRefundInfo();
|
||||
if (flightRefundInfoList.size() > 1) {
|
||||
flightRefundInfo = flightRefundInfoList.get(0);
|
||||
}
|
||||
FlightOrderFeeDetail flightOrderFeeDetail = null;
|
||||
if (!flightOrderInfoEntity.getFlightOrderFeeDetailList().isEmpty()) {
|
||||
flightOrderFeeDetail = flightOrderInfoEntity.getFlightOrderFeeDetailList().get(0);
|
||||
|
@ -391,7 +394,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// hotelOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
|
||||
|
||||
hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.chint.domain.repository.*;
|
|||
import com.chint.domain.value_object.ApprovalSimpleData;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
|
@ -21,9 +20,15 @@ import com.chint.interfaces.rest.bpm.BPMParamFactory;
|
|||
import com.chint.interfaces.rest.bpm.BPMRequest;
|
||||
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
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.flight.ChangeInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -79,6 +84,8 @@ public class OrderDomainService {
|
|||
@Autowired
|
||||
private CompanyBlackListRepository companyBlackListRepository;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
private Set<String> companyBlackList = new HashSet<>();
|
||||
|
||||
|
@ -229,30 +236,110 @@ public class OrderDomainService {
|
|||
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
||||
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
||||
String reason = command.getReason();
|
||||
//创建改签对象
|
||||
RescheduleDto rescheduleDto = new RescheduleDto();
|
||||
|
||||
rescheduleDto.setFee(orderDetail.getPrice() == null ? new BigDecimal(0) : new BigDecimal(orderDetail.getPrice()))
|
||||
.setOrderNo(orderDetail.getOrderNo())
|
||||
.setReason(reason);
|
||||
|
||||
rescheduleDto.setFee(orderDetail.getPrice() == null ? new BigDecimal(0) : new BigDecimal(orderDetail.getPrice()))//费用
|
||||
.setOrderNo(orderDetail.getOrderNo())//订单号
|
||||
.setReason(reason);//原因
|
||||
//携程
|
||||
if (orderDetail.getSupplierName().equals(SUPPLIER_C_TRIP)) {
|
||||
rescheduleDto.setOrderSource(SUPPLIER_C_TRIP_BPM_NAME);
|
||||
} else if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) {
|
||||
rescheduleDto.setOrderSource(SUPPLIER_L_Y_BPM_NAME);
|
||||
rescheduleDto.setOrderSource(SUPPLIER_C_TRIP_BPM_NAME);//携程商旅
|
||||
//查询订单明细
|
||||
SearchOrderResponse searchOrderResponse = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderDetail.getOrderNo());
|
||||
//机票改签
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
//设置改签原时间、改签后时间、改签原因
|
||||
setCTripChangeFlight(rescheduleDto, searchOrderResponse);
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_FLIGHT);
|
||||
}
|
||||
//机票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
String refundResonDesc = "";
|
||||
try {
|
||||
FlightOrderInfoEntity flightOrderInfoList = searchOrderResponse.getItineraryList().get(0).getFlightOrderInfoList().get(0);
|
||||
refundResonDesc = flightOrderInfoList.getRefundInfo().get(0).getRefundResonDesc();
|
||||
rescheduleDto.setReason(StringUtils.isNotBlank(refundResonDesc) ? refundResonDesc : "计划有变,更改行程");
|
||||
} catch (Exception e) {
|
||||
//如果越界标识没有值
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_FLIGHT);
|
||||
}
|
||||
}
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_TRAIN);
|
||||
} else if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_FLIGHT);
|
||||
} else if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
|
||||
//同程
|
||||
if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) {
|
||||
rescheduleDto.setOrderSource(SUPPLIER_L_Y_BPM_NAME);//同程商旅
|
||||
//火车票改签
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
rescheduleDto
|
||||
/*.setStartTime()//原时间
|
||||
.setRebookStartTime()//改签后时间
|
||||
.setTrainNumber()//原车次
|
||||
.setSeatingStandard()//原席别
|
||||
.setRebookTrainNumber()//改签后车次
|
||||
.setRebookSeatingStandard()//改签后席别*/
|
||||
.setOrderType(RESCHEDULE_TYPE_TRAIN);
|
||||
}
|
||||
//机票改签
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_FLIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
//机票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_FLIGHT);
|
||||
} else if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_TRAIN);
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
|
||||
//火车票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_TRAIN);
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
//发送
|
||||
DelayDispatch.attemptToSend(() -> bpmRequest.reschedule(rescheduleDto, sysCode).getSuccess(),
|
||||
0);
|
||||
}
|
||||
|
||||
//携程机票改签
|
||||
private void setCTripChangeFlight(RescheduleDto rescheduleDto, SearchOrderResponse searchOrderResponse) {
|
||||
List<ItineraryEntity> itineraryList = searchOrderResponse.getItineraryList();
|
||||
try {
|
||||
ItineraryEntity itineraryEntity = itineraryList.get(0);
|
||||
FlightOrderInfoEntity flightOrderInfoList = itineraryEntity.getFlightOrderInfoList().get(0);
|
||||
//改签前时间
|
||||
String createTime = flightOrderInfoList.getFlightInfo().get(0).getTakeoffTime();
|
||||
List<ChangeInfo> changeInfoList = flightOrderInfoList.getPassengerInfo().get(0).getSequenceInfo().get(0).getChangeInfo();
|
||||
//多次改签
|
||||
if (changeInfoList.size() >= 2) {
|
||||
ChangeInfo changeInfoOld = changeInfoList.get(changeInfoList.size() - 2);
|
||||
String cTakeOffTimeOld = changeInfoOld.getCTakeOffTime();//前一次改签时间
|
||||
ChangeInfo changeInfoNew = changeInfoList.get(changeInfoList.size() - 1);
|
||||
String cTakeOffTimeNew = changeInfoNew.getCTakeOffTime();//最后一次改签时间
|
||||
String rebookReasonDescNew = changeInfoNew.getRebookReasonDesc();//最后一次改签原因
|
||||
//设置值
|
||||
rescheduleDto.setStartTime(cTakeOffTimeOld)
|
||||
.setRebookStartTime(cTakeOffTimeNew)
|
||||
.setReason(rebookReasonDescNew);
|
||||
} else {
|
||||
ChangeInfo changeInfo = changeInfoList.get(changeInfoList.size() - 1);
|
||||
//改签后时间
|
||||
String cTakeOffTime = changeInfo.getCTakeOffTime();
|
||||
//改签原因
|
||||
String RebookReasonDesc = changeInfo.getRebookReasonDesc();
|
||||
rescheduleDto.setStartTime(createTime)
|
||||
.setRebookStartTime(cTakeOffTime)
|
||||
.setReason(RebookReasonDesc);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rescheduleDto.setStartTime("")
|
||||
.setRebookStartTime("")
|
||||
.setReason("计划有变,更改行程");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean finishOrder(Long routeId) {
|
||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
if (routeOrder != null && routeOrder.getLegItems() != null && !routeOrder.getLegItems().isEmpty()) {
|
||||
|
|
|
@ -5,7 +5,75 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class ChangeInfo {
|
||||
private int sequence;
|
||||
|
||||
private int Sequence;
|
||||
private int RebookId;
|
||||
private String CPrepayType;
|
||||
private String PassengerName;
|
||||
private String CStatus;
|
||||
private double CFee;
|
||||
private double RebookServiceFee;
|
||||
private String RebookingTime;
|
||||
private String RebookedTime;
|
||||
private String OriTicketNo;
|
||||
private String PreTicketNo;
|
||||
private String CTicketNo;
|
||||
private String CTicketNoSignCode;
|
||||
private String CAirline;
|
||||
private String CAirlineName;
|
||||
private String CAirType;
|
||||
private String CFlight;
|
||||
private double CPrintPrice;
|
||||
private double OilFee;
|
||||
private double Tax;
|
||||
private int Subsidy;
|
||||
private String SubClass;
|
||||
private String CClass;
|
||||
private String CClassName;
|
||||
private String CTakeOffTime;
|
||||
private String CArrivalTime;
|
||||
private String CdCityName;
|
||||
private String CdPortName;
|
||||
private String CdTerminal;
|
||||
private String CaCityName;
|
||||
private String CaPortName;
|
||||
private String CaTerminal;
|
||||
private String RebookStatus;
|
||||
private double PriceDifferential;
|
||||
private double DateChangeFee;
|
||||
private double SendTicketFee;
|
||||
private String OriAirLineCode;
|
||||
private String CAirLineCode;
|
||||
private String RebookResonDesc;
|
||||
private String FlightTime;
|
||||
private Object FlightStopInfoList;
|
||||
private double OilFeeDifferential;
|
||||
private String SpecialClassName;
|
||||
private String SpecialClassDesc;
|
||||
private String JounaryNo;
|
||||
private String AuthorizeStatus;
|
||||
private String CdPortCode;
|
||||
private String CaPortCode;
|
||||
private String RebookReasonDesc;
|
||||
private String RebookType;
|
||||
private String CaCityCode;
|
||||
private String CdCityCode;
|
||||
private int TaxDifferential;
|
||||
private String TakeOffTimeUTC;
|
||||
private String ArrivalTimeUTC;
|
||||
private double PriceRate;
|
||||
private String DepartureCountryCode;
|
||||
private String ArrivalCountryCode;
|
||||
private String FlightWay;
|
||||
private String DepartureDistrictCode;
|
||||
private String ArrivalDistrictCode;
|
||||
private double CheckTicketPrice;
|
||||
private String ShareFlightNo;
|
||||
private String OriginalTicketNoSignCode;
|
||||
private String PreTicketNoSignCode;
|
||||
private String RebookReason;
|
||||
|
||||
/*private int sequence;
|
||||
private int rebookId;
|
||||
private String cPrepayType;
|
||||
private String passengerName;
|
||||
|
@ -70,7 +138,6 @@ public class ChangeInfo {
|
|||
private String shareFlightNo;
|
||||
private String originalTicketNoSignCode;
|
||||
private String preTicketNoSignCode;
|
||||
private String rebookReason;
|
||||
private String rebookReason;*/
|
||||
|
||||
// Other fields and getters/setters
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package com.chint.interfaces.rest.ctrip.dto.search.flight;
|
||||
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 携程-机票信息
|
||||
*
|
||||
|
@ -19,5 +21,5 @@ public class FlightOrderInfoEntity {
|
|||
private List<PassengerInfo> PassengerInfo;
|
||||
private List<FlightOrderFeeDetail> FlightOrderFeeDetailList;
|
||||
private List<TripRecordInfo> TripRecordInfoList;
|
||||
private FlightRefundInfo RefundInfo;
|
||||
private List<FlightRefundInfo> RefundInfo;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
@Data
|
||||
public class PassengerInfo {
|
||||
private PassengerBasic passengerBasic;
|
||||
private List<SequenceInfo> sequenceInfo;
|
||||
private List<SequenceInfo> SequenceInfo;
|
||||
|
||||
// Getters and setters
|
||||
}
|
Loading…
Reference in New Issue