1.处理携程酒店数据

This commit is contained in:
wanglf3 2024-03-17 14:01:15 +08:00
parent fcec95f5c2
commit 226099cfd3
4 changed files with 65 additions and 28 deletions

View File

@ -11,6 +11,7 @@ import com.chint.interfaces.rest.ctrip.dto.search.car.*;
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.ctrip.dto.search.hotel.PaymentReceived;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -104,8 +105,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setOrderAmount(String.valueOf(carBasicInfo.getOrderAmount()));
if (carBasicInfo.getPaymentType().equals("ACCNT")){
if (carBasicInfo.getPaymentType().equals("ACCNT")) {
carOrderDetail.setPaymentType("0");
} else {
carOrderDetail.setPaymentType("1");
@ -116,7 +116,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setPersonalPaymentAmount(String.valueOf(carBasicInfo.getAccntAmount()));
if (!carQuickOrderInfoEntity.getOrderFeeList().isEmpty()) {
OrderFee orderFee = carQuickOrderInfoEntity.getOrderFeeList().get(0);
if (orderFee.getFeeName().equals("取消费")) {
carOrderDetail.setCancellationFee(orderFee.getAmount().toString());
} else {
@ -150,7 +150,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
@ -287,7 +286,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setPaymentType("1");
}
//付款方式 ACCNT公司统付 其他类型个人支付
if (flightOrderBasicInfo.getPrepayType().equals("ACCNT")) {
if (flightOrderDetail.getPaymentType().equals("0")) {
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
} else {
flightOrderDetail.setPersonalPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
@ -477,6 +476,29 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
hotelOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
List<PaymentReceived> paymentReceivedList = hotelOrderInfoEntity.getPaymentReceivedList();
if (paymentReceivedList != null && !paymentReceivedList.isEmpty()) {
PaymentReceived paymentReceived = paymentReceivedList.get(0);
String paymentType = paymentReceived.getPaymentType();
if (paymentType.equals("ACCNT")) {
hotelOrderDetail.setPaymentType("0");
hotelOrderDetail.setCompanyAmount(paymentReceived.getAmount());
} else {
hotelOrderDetail.setPaymentType("1");
hotelOrderDetail.setPersonalAmount(paymentReceived.getAmount());
}
hotelOrderDetail.setPersonalRefundAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setCompanyRefundAmount(KEEP_TWO_DECIMAL_ZERO);
}
if (hotelOrderInfoEntity != null) {
hotelOrderDetail.setOrderNo(hotelOrderInfoEntity.getOrderID()); //订单号
hotelOrderDetail.setDetailId(hotelOrderInfoEntity.getOrderID());
@ -493,27 +515,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setRoomCount(hotelOrderInfoEntity.getRoomQuantity()); //退订夜间数
hotelOrderDetail.setRoomTypeName(hotelOrderInfoEntity.getRoomName()); //房型
if (Double.parseDouble(hotelOrderInfoEntity.getSettlementACCNTAmt()) > 0) {
hotelOrderDetail.setCompanyAmount(hotelOrderInfoEntity.getSettlementACCNTAmt());
hotelOrderDetail.setCompanyRefundAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPaymentType("0");
} else {
//如果公司统付为负数 那么表示退款
hotelOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setCompanyRefundAmount(hotelOrderInfoEntity.getSettlementACCNTAmt());
hotelOrderDetail.setPaymentType("0");
}
if (Double.parseDouble(hotelOrderInfoEntity.getSettlementPersonAmt()) > 0) {
hotelOrderDetail.setPersonalAmount(hotelOrderInfoEntity.getSettlementPersonAmt());
hotelOrderDetail.setPersonalRefundAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPaymentType("1");
} else {
hotelOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPersonalRefundAmount(hotelOrderInfoEntity.getSettlementPersonAmt());
hotelOrderDetail.setPaymentType("1");
}
if (Double.parseDouble(hotelOrderInfoEntity.getAmount()) > 0) {
hotelOrderDetail.setOrderAmount(hotelOrderInfoEntity.getAmount());
@ -522,8 +523,10 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setOrderAmount(KEEP_TWO_DECIMAL_ZERO);
// hotelOrderDetail.setRefundAmount(hotelOrderInfoEntity.getAmount());
}
hotelOrderDetail.setPreServiceFee(hotelOrderInfoEntity.getFrontendServiceFee());
hotelOrderDetail.setPostServiceFee(hotelOrderInfoEntity.getServicefee());
hotelOrderDetail.setPostServiceFee(hotelOrderInfoEntity.getAfterServiceFee());
hotelOrderDetail.setStandardItems(hotelOrderInfoEntity.getTPMaxPrice());
if (hotelOrderInfoEntity.getHotelType().equals("协议酒店")) {

View File

@ -27,6 +27,9 @@ public class HotelOrderInfoEntity {
private String SettlementPersonAmt; // 结算个人金额
private String AddedFees; // 额外费用
private String FrontendServiceFee; // 前端服务费
private String AfterServiceFee; // 前端服务费
private String HotelType; // 酒店类型
private String HotelName; // 酒店名称
private String HotelEnName; // 酒店英文名称
@ -79,4 +82,10 @@ public class HotelOrderInfoEntity {
private List<ClientInfo> ClientInfo; // 客户信息列表
private List<RefundInfo> RefundInfo; // 客户信息列表
private List<PaymentReceived> PaymentReceivedList;
}

View File

@ -0,0 +1,25 @@
package com.chint.interfaces.rest.ctrip.dto.search.hotel;
import lombok.Data;
/**
* @author wanglf3
* @date 2024-03-17
* @vsrsion 1.0
**/
@Data
public class PaymentReceived {
private String BillNo; // 客户名
private String RelatedBillNo; // 员工ID
private String Amount; // 成本中心1
private String Currency; // 成本中心2
private String ExchangeRate; // 成本中心3
private String TransactionType; // 成本中心4
private String PaymentStatus; // 成本中心5
private String PaymentTime; // 成本中心6
private String PaymentType; // 成本中心6
}

View File

@ -213,7 +213,7 @@ public class CTripTest {
@Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30352884087");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("29905600773");
System.out.println(response);
}