From 90a1b6994e73c3e32331cc7a9a6704dff68a545c Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Wed, 27 Mar 2024 22:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=90=BA=E7=A8=8B=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=98=8E=E7=BB=86=E4=BF=9D=E5=AD=98=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ctrip_order_record/CTripCarQuickInfo.java | 48 ++++++++ .../ctrip_order_record/CTripCarRecord.java | 23 +++- .../CTripCarRecordBase.java | 2 +- .../ctrip_order_record/CTripFlightRecord.java | 1 + .../ctrip_order_record/CTripHotelInfo.java | 42 +++++++ .../ctrip_order_record/CTripHotelRecord.java | 9 ++ .../CTripHotelRecordBase.java | 100 ++++++++------- .../ctrip_order_record/CTripTrainInfo.java | 74 ++++++++++++ .../ctrip_order_record/CTripTrainRecord.java | 31 +++++ .../CTripTrainRecordBase.java | 114 +++++++++--------- .../CTripOrderDetailRepository.java | 5 +- .../repository/CTripOrderDetailImpl.java | 34 +++++- .../jdbc/JdbcCTripCarRecordRepository.java | 11 ++ .../jdbc/JdbcCTripHotelRecordRepository.java | 10 ++ .../jdbc/JdbcCTripTrainRecordRepository.java | 10 ++ .../ctrip/order/CTripOrderRecordAutoSave.java | 33 ++--- 16 files changed, 413 insertions(+), 134 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarQuickInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarQuickInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarQuickInfo.java new file mode 100644 index 00000000..c7a40b6a --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarQuickInfo.java @@ -0,0 +1,48 @@ +package com.chint.domain.aggregates.order.order_record.ctrip_order_record; + + +import cn.hutool.core.bean.BeanUtil; +import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_car_quick_info") +public class CTripCarQuickInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2343214623512376645L; + @Id + private Long id; + private Long cTripCarRecordId; + private int BookingType; + private String UseTime; + private String DepartureCityId; + private String DepartureDistrictCode; + private String DepartureCityName; + private String DepartureAddressDetail; + private String ArrivalCityId; + private String ArrivalDistrictCode; + private String ArrivalCityName; + private String ArrivalAddressDetail; + private int VehicleId; + private String VehicleName; + private String NormalDistance; + private String NormalTime; + private String ServiceBeginTime; + private String ServiceEndTime; + private String SceneName; + private String StandardName; + // private List DestinationChangeList; + private String VendorName; + // 如果StandardGeoInfo是标准地理信息类 +// private OrderCarResponse.StandardGeoInfo StandardGeoInfo; + private String CancelTime; + + public static CTripCarQuickInfo of(OrderCarResponse.CarOrderQuickProductInfo data) { + return BeanUtil.copyProperties(data, CTripCarQuickInfo.class); + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java index e807650e..27f60b4f 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java @@ -1,16 +1,31 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; +import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; -@Table("c_trip_car_record") -public class CTripCarRecord { +import java.io.Serial; +import java.io.Serializable; +@Data +@Table("c_trip_car_record") +public class CTripCarRecord implements Serializable { + @Serial + private static final long serialVersionUID = 5553214622358970145L; @Id private Long id; - @MappedCollection(idColumn = "id") + private String recordId; + @MappedCollection(idColumn = "c_trip_car_record_id") private CTripCarRecordBase cTripCarRecordBase; + @MappedCollection(idColumn = "c_trip_car_record_id") + private CTripCarQuickInfo cTripCarQuickInfo; - + public static CTripCarRecord of(CTripCarRecordBase cTripCarRecordBase, CTripCarQuickInfo cTripCarQuickInfo) { + CTripCarRecord cTripCarRecord = new CTripCarRecord(); + cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo); + cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase); + cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId())); + return cTripCarRecord; + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java index 5272f5c6..112885a6 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java @@ -17,11 +17,11 @@ import java.io.Serializable; @Data @Table("c_trip_order_car_settlement_base_info") public class CTripCarRecordBase implements Serializable { - @Serial private static final long serialVersionUID = 4583214623558870145L; @Id private Long id; + private Long cTripCarRecordId; private Long recordId; private String batchNo; private String createTime; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java index e2f08b71..5597e65d 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java @@ -20,6 +20,7 @@ public class CTripFlightRecord { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); + cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java new file mode 100644 index 00000000..32822a7f --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java @@ -0,0 +1,42 @@ +package com.chint.domain.aggregates.order.order_record.ctrip_order_record; + +import cn.hutool.core.bean.BeanUtil; +import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; +import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_hotel_info") +public class CTripHotelInfo implements Serializable { + @Serial + private static final long serialVersionUID = 4027343172340686513L; + @Id + private Long id; + private Long cTripHotelRecordId; + private String HotelName; + private String HotelNameEN; + private String CityName; + private String CityNameEN; + private Integer Star; + private boolean IsDomestic; + private String ISCU; + private Integer CityID; + private String DistrictCode; + private Integer DistrictID; + private String DistrictName; + private String BrandName; + private Integer ParentCityID; + private String ParentCityName; + private String ParentCityEnName; + private Integer HotelGroupId; + private String HotelGroupName; + + public static CTripHotelInfo of(OrderHotelResponse.SettlementHotelDetail data) { + return BeanUtil.copyProperties(data, CTripHotelInfo.class); + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java index c1a1206b..25e081d4 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java @@ -13,5 +13,14 @@ public class CTripHotelRecord { private String recordId; @MappedCollection(idColumn = "c_trip_hotel_record_id") private CTripHotelRecordBase cTripHotelRecordBase; + @MappedCollection(idColumn = "c_trip_hotel_record_id") + private CTripHotelInfo cTripHotelInfo; + public static CTripHotelRecord of(CTripHotelRecordBase cTripHotelRecordBase, CTripHotelInfo cTripHotelInfo) { + CTripHotelRecord cTripHotelRecord = new CTripHotelRecord(); + cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId())); + cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase); + cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo); + return cTripHotelRecord; + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java index 819b3a66..18040ffc 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java @@ -21,6 +21,7 @@ public class CTripHotelRecordBase implements Serializable { private static final long serialVersionUID = 3087333171110684513L; @Id private Long id; + private Long cTripHotelRecordId; private Long recordId; private Long orderId; private Integer accountId; @@ -34,8 +35,8 @@ public class CTripHotelRecordBase implements Serializable { private Double serviceFee; private Double extraCharge; private String accCheckBatchNo; - private String createTime; - private String datachangeLasttime; + private String createTime; + private String datachangeLasttime; private Integer orderType; private String subAccCheckBatchNo; private Long tripId; @@ -69,59 +70,54 @@ public class CTripHotelRecordBase implements Serializable { private BigDecimal averageRoomPrice; - public static CTripHotelRecordBase changeInfo(OrderHotelResponse.SettlementDetail SettlementDetail) { CTripHotelRecordBase ctripHotelOrderDetail = new CTripHotelRecordBase(); - if (SettlementDetail != null){ - ctripHotelOrderDetail.setRecordId(SettlementDetail.getRecordId()); - ctripHotelOrderDetail.setOrderId(SettlementDetail.getOrderID()); - ctripHotelOrderDetail.setAccountId(SettlementDetail.getAccountId()); - ctripHotelOrderDetail.setUid(SettlementDetail.getUid()); - ctripHotelOrderDetail.setDetailType(SettlementDetail.getDetailType()); - ctripHotelOrderDetail.setPayType(SettlementDetail.getPayType()); - ctripHotelOrderDetail.setHotelType(SettlementDetail.getHotelType()); - ctripHotelOrderDetail.setPrice(SettlementDetail.getPrice()); - ctripHotelOrderDetail.setQuantity(SettlementDetail.getQuantity()); - ctripHotelOrderDetail.setAmount(SettlementDetail.getAmount()); - ctripHotelOrderDetail.setServiceFee(SettlementDetail.getServicefee()); - ctripHotelOrderDetail.setExtraCharge(SettlementDetail.getExtraCharge()); - ctripHotelOrderDetail.setAccCheckBatchNo(SettlementDetail.getAccCheckBatchNo()); - ctripHotelOrderDetail.setCreateTime(SettlementDetail.getCreatetime()); - ctripHotelOrderDetail.setDatachangeLasttime(SettlementDetail.getDatachange_Lasttime()); - ctripHotelOrderDetail.setOrderType(SettlementDetail.getOrderType()); - ctripHotelOrderDetail.setSubAccCheckBatchNo(SettlementDetail.getSubAccCheckBatchNo()); - ctripHotelOrderDetail.setTripId(SettlementDetail.getTripID()); - ctripHotelOrderDetail.setSettlementCurrency(SettlementDetail.getSettlementCurrency()); - ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked()); + ctripHotelOrderDetail.setRecordId(SettlementDetail.getRecordId()); + ctripHotelOrderDetail.setOrderId(SettlementDetail.getOrderID()); + ctripHotelOrderDetail.setAccountId(SettlementDetail.getAccountId()); + ctripHotelOrderDetail.setUid(SettlementDetail.getUid()); + ctripHotelOrderDetail.setDetailType(SettlementDetail.getDetailType()); + ctripHotelOrderDetail.setPayType(SettlementDetail.getPayType()); + ctripHotelOrderDetail.setHotelType(SettlementDetail.getHotelType()); + ctripHotelOrderDetail.setPrice(SettlementDetail.getPrice()); + ctripHotelOrderDetail.setQuantity(SettlementDetail.getQuantity()); + ctripHotelOrderDetail.setAmount(SettlementDetail.getAmount()); + ctripHotelOrderDetail.setServiceFee(SettlementDetail.getServicefee()); + ctripHotelOrderDetail.setExtraCharge(SettlementDetail.getExtraCharge()); + ctripHotelOrderDetail.setAccCheckBatchNo(SettlementDetail.getAccCheckBatchNo()); + ctripHotelOrderDetail.setCreateTime(SettlementDetail.getCreatetime()); + ctripHotelOrderDetail.setDatachangeLasttime(SettlementDetail.getDatachange_Lasttime()); + ctripHotelOrderDetail.setOrderType(SettlementDetail.getOrderType()); + ctripHotelOrderDetail.setSubAccCheckBatchNo(SettlementDetail.getSubAccCheckBatchNo()); + ctripHotelOrderDetail.setTripId(SettlementDetail.getTripID()); + ctripHotelOrderDetail.setSettlementCurrency(SettlementDetail.getSettlementCurrency()); + ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked()); // ctripHotelOrderDetailis.setDailyAvgPriceInfo(SettlementDetail.getDailyAvgPriceInfo()); // ctripHotelOrderDetailis.setInvoiceIds(SettlementDetail.getInvoiceIds()); - ctripHotelOrderDetail.setBatchStartDate(SettlementDetail.getBatchStartDate()); - ctripHotelOrderDetail.setBatchEndDate(SettlementDetail.getBatchEndDate()); - ctripHotelOrderDetail.setFrontendServiceFee(SettlementDetail.getFrontendServiceFee()); - ctripHotelOrderDetail.setCoupon(SettlementDetail.getCoupon()); - ctripHotelOrderDetail.setRelatedCostsId(SettlementDetail.getRelatedCostsID()); - ctripHotelOrderDetail.setApportionMode(SettlementDetail.getApportionMode()); - ctripHotelOrderDetail.setOrderRoomMode(SettlementDetail.getOrderRoomMode()); - ctripHotelOrderDetail.setClientApprovalNo(SettlementDetail.getClientApprovalNo()); - ctripHotelOrderDetail.setFellowApprovalNo(SettlementDetail.getFellowApprovalNo()); - ctripHotelOrderDetail.setLoanServiceFee(SettlementDetail.getLoanServiceFee()); - ctripHotelOrderDetail.setClientName(SettlementDetail.getClientName()); - ctripHotelOrderDetail.setEmployeeId(SettlementDetail.getEmployeeID()); - ctripHotelOrderDetail.setInsuranceAmount(SettlementDetail.getInsuranceAmount()); - ctripHotelOrderDetail.setPersonAmount(SettlementDetail.getPersonAmount()); - ctripHotelOrderDetail.setChannelFee(SettlementDetail.getChannelFee()); - ctripHotelOrderDetail.setPersonalChannelFee(SettlementDetail.getPersonalChannelFee()); - ctripHotelOrderDetail.setPaidAmount(SettlementDetail.getPaidAmount()); - ctripHotelOrderDetail.setPersonalTotalAmount(SettlementDetail.getPersonalTotalAmount()); - ctripHotelOrderDetail.setPersonalRemittedTax(SettlementDetail.getPersonalRemittedTax()); - ctripHotelOrderDetail.setBookServiceFee(SettlementDetail.getBookServiceFee()); - ctripHotelOrderDetail.setModifyServiceFee(SettlementDetail.getModifyServiceFee()); - ctripHotelOrderDetail.setCancelServiceFee(SettlementDetail.getCancelServiceFee()); - ctripHotelOrderDetail.setPayDiscountAmount(SettlementDetail.getPayDiscountAmount()); - ctripHotelOrderDetail.setAverageRoomPrice(SettlementDetail.getAverageRoomPrice()); - return ctripHotelOrderDetail; - } - return null; - + ctripHotelOrderDetail.setBatchStartDate(SettlementDetail.getBatchStartDate()); + ctripHotelOrderDetail.setBatchEndDate(SettlementDetail.getBatchEndDate()); + ctripHotelOrderDetail.setFrontendServiceFee(SettlementDetail.getFrontendServiceFee()); + ctripHotelOrderDetail.setCoupon(SettlementDetail.getCoupon()); + ctripHotelOrderDetail.setRelatedCostsId(SettlementDetail.getRelatedCostsID()); + ctripHotelOrderDetail.setApportionMode(SettlementDetail.getApportionMode()); + ctripHotelOrderDetail.setOrderRoomMode(SettlementDetail.getOrderRoomMode()); + ctripHotelOrderDetail.setClientApprovalNo(SettlementDetail.getClientApprovalNo()); + ctripHotelOrderDetail.setFellowApprovalNo(SettlementDetail.getFellowApprovalNo()); + ctripHotelOrderDetail.setLoanServiceFee(SettlementDetail.getLoanServiceFee()); + ctripHotelOrderDetail.setClientName(SettlementDetail.getClientName()); + ctripHotelOrderDetail.setEmployeeId(SettlementDetail.getEmployeeID()); + ctripHotelOrderDetail.setInsuranceAmount(SettlementDetail.getInsuranceAmount()); + ctripHotelOrderDetail.setPersonAmount(SettlementDetail.getPersonAmount()); + ctripHotelOrderDetail.setChannelFee(SettlementDetail.getChannelFee()); + ctripHotelOrderDetail.setPersonalChannelFee(SettlementDetail.getPersonalChannelFee()); + ctripHotelOrderDetail.setPaidAmount(SettlementDetail.getPaidAmount()); + ctripHotelOrderDetail.setPersonalTotalAmount(SettlementDetail.getPersonalTotalAmount()); + ctripHotelOrderDetail.setPersonalRemittedTax(SettlementDetail.getPersonalRemittedTax()); + ctripHotelOrderDetail.setBookServiceFee(SettlementDetail.getBookServiceFee()); + ctripHotelOrderDetail.setModifyServiceFee(SettlementDetail.getModifyServiceFee()); + ctripHotelOrderDetail.setCancelServiceFee(SettlementDetail.getCancelServiceFee()); + ctripHotelOrderDetail.setPayDiscountAmount(SettlementDetail.getPayDiscountAmount()); + ctripHotelOrderDetail.setAverageRoomPrice(SettlementDetail.getAverageRoomPrice()); + return ctripHotelOrderDetail; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainInfo.java new file mode 100644 index 00000000..987ba51f --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainInfo.java @@ -0,0 +1,74 @@ +package com.chint.domain.aggregates.order.order_record.ctrip_order_record; + +import cn.hutool.core.bean.BeanUtil; +import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; +import com.chint.interfaces.rest.ctrip.dto.order.OrderTrainResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +@Table("c_trip_train_info") +public class CTripTrainInfo implements Serializable { + @Serial + private static final long serialVersionUID = 3282323171110442253L; + @Id + private Long id; + private Long cTripTrainRecordId; + private long TicketInfoID; + private String TrainName; + private String FirstSeatTypeName; + private String TrainType; + private String DepartureCityName; + private String DepartureDate; + private String DepartureStationName; + private String DepartureStationEn; + private String ArrivalCityName; + private String ArrivalDate; + private String ArrivalStationName; + private String ArrivalStationEn; + private String ElectronicOrderNo; + private int CustomType; + private String CustomDetail; + private String TrainTicketType; +// private List TrainSeatPriceData; + private String ChangeStatus; + private double DealTicketPrice; + private double RebRefEstimateAmount; + private int DepartureCityID; + private String DepartureDistrictCode; + private int ArrivalCityID; + private String ArrivalDistrictCode; + private String ChangeCode; + private String DealSeatNo; + private String DealSeatName; + private long DepartureProvinceId; + private String DepartureProvinceName; + private long DepartureLocationId; + private String DepartureLocationName; + private int DepartureLocationCategoryId; + private long ArrivalProvinceId; + private String ArrivalProvinceName; + private long ArrivalLocationId; + private String ArrivalLocationName; + private int ArrivalLocationCategoryId; + private int Sequence; + private String RefundreasonCode; + private String RefundreasonCodeDesc; + private String IssueTicketTime; + private String RebookTicketSuccessTime; + private String RefundTicketSuccessTime; + private String ChangePreApprovalId; + private String RefundApprovalId; +// private OrderTrainResponse.StandardGeoInfo StandardGeoInfo; + private String ChangeDescription; + + + public static CTripTrainInfo of(OrderTrainResponse.CorpTrainSettlementTicketDetail data) { + return BeanUtil.copyProperties(data, CTripTrainInfo.class); + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java new file mode 100644 index 00000000..51394228 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java @@ -0,0 +1,31 @@ +package com.chint.domain.aggregates.order.order_record.ctrip_order_record; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.MappedCollection; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_train_record") +public class CTripTrainRecord implements Serializable { + @Serial + private static final long serialVersionUID = 4087333423450684513L; + @Id + private Long id; + private String recordId; + @MappedCollection(idColumn = "c_trip_train_record_id") + private CTripTrainRecordBase cTripTrainRecordBase; + @MappedCollection(idColumn = "c_trip_train_record_id") + private CTripTrainInfo cTripTrainInfo; + + public static CTripTrainRecord of(CTripTrainRecordBase cTripTrainRecordBase, CTripTrainInfo cTripTrainInfo) { + CTripTrainRecord cTripTrainRecord = new CTripTrainRecord(); + cTripTrainRecord.setRecordId(String.valueOf(cTripTrainRecordBase.getRecordId())); + cTripTrainRecord.setCTripTrainRecordBase(cTripTrainRecordBase); + cTripTrainRecord.setCTripTrainInfo(cTripTrainInfo); + return cTripTrainRecord; + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecordBase.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecordBase.java index 706f6e2f..ceb04934 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecordBase.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecordBase.java @@ -21,6 +21,7 @@ public class CTripTrainRecordBase implements Serializable { private static final long serialVersionUID = 1642492804808714974L; @Id private Long id; + private Long cTripTrainRecordId; private Long recordId; private Long orderId; private String corpId; @@ -78,65 +79,64 @@ public class CTripTrainRecordBase implements Serializable { public static CTripTrainRecordBase changeInfo(OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail) { CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase(); - if (trainSettlementDetail != null){ - ctripTrainOrderDetail.setRecordId(trainSettlementDetail.getRecordID()); - ctripTrainOrderDetail.setOrderId(trainSettlementDetail.getOrderID()); - ctripTrainOrderDetail.setCorpId(trainSettlementDetail.getCorpId()); - ctripTrainOrderDetail.setAccountId(trainSettlementDetail.getAccountID()); - ctripTrainOrderDetail.setUid(trainSettlementDetail.getUID()); - ctripTrainOrderDetail.setDetailType(trainSettlementDetail.getDetailType()); - ctripTrainOrderDetail.setPassengerName(trainSettlementDetail.getPassengerName()); - ctripTrainOrderDetail.setPrice(trainSettlementDetail.getPrice()); - ctripTrainOrderDetail.setServerFee(trainSettlementDetail.getServerFee()); - ctripTrainOrderDetail.setCancelFee(trainSettlementDetail.getCancelFee()); - ctripTrainOrderDetail.setInsureFee(trainSettlementDetail.getInsureFee()); - ctripTrainOrderDetail.setPaperTicketFee(trainSettlementDetail.getPaperTicketFee()); - ctripTrainOrderDetail.setDeliverFee(trainSettlementDetail.getDeliverFee()); - ctripTrainOrderDetail.setReBookingServiceFee(trainSettlementDetail.getReBookingServiceFee()); - ctripTrainOrderDetail.setRealAmount(trainSettlementDetail.getRealAmount()); - ctripTrainOrderDetail.setBatchNo(trainSettlementDetail.getBatchNo()); - ctripTrainOrderDetail.setSettlementType(trainSettlementDetail.getSettlementType()); - ctripTrainOrderDetail.setCreateTime(trainSettlementDetail.getCreatetime()); - ctripTrainOrderDetail.setChangeLastTime(trainSettlementDetail.getChangeLasttime()); - ctripTrainOrderDetail.setOrderType(trainSettlementDetail.getOrderType()); - ctripTrainOrderDetail.setSubAccCheckBatchNo(trainSettlementDetail.getSubAccCheckBatchNo()); - ctripTrainOrderDetail.setTripId(trainSettlementDetail.getTripID()); - ctripTrainOrderDetail.setSettlementCurrency(trainSettlementDetail.getSettlementCurrency()); - ctripTrainOrderDetail.setGrabServiceFee(trainSettlementDetail.getGrabServiceFee()); - ctripTrainOrderDetail.setPostServiceFee(trainSettlementDetail.getPostServiceFee()); - ctripTrainOrderDetail.setRealAmountHasPost(trainSettlementDetail.getRealAmountHasPost()); - ctripTrainOrderDetail.setIsChecked(trainSettlementDetail.isIsChecked()); - ctripTrainOrderDetail.setSubDetailType(trainSettlementDetail.getSubDetailType()); -// ctripTrainOrderDetailis.setInvoiceIds(trainSettlementDetail.getInvoiceIds()); - ctripTrainOrderDetail.setBatchStartDate(trainSettlementDetail.getBatchStartDate()); - ctripTrainOrderDetail.setBatchEndDate(trainSettlementDetail.getBatchEndDate()); - ctripTrainOrderDetail.setAfterTakeTicketFee(trainSettlementDetail.getAfterTakeTicketFee()); - ctripTrainOrderDetail.setEstimatePrice(trainSettlementDetail.getEstimatePrice()); - ctripTrainOrderDetail.setEstimaAmount(trainSettlementDetail.getEstimaAmount()); - ctripTrainOrderDetail.setPurchaseFee(trainSettlementDetail.getPurchaseFee()); - ctripTrainOrderDetail.setPayMixFlag(trainSettlementDetail.isPayMixFlag()); - ctripTrainOrderDetail.setPersonalPayTicketFee(trainSettlementDetail.getPersonalPayTicketFee()); - ctripTrainOrderDetail.setPersonalPayServiceFee(trainSettlementDetail.getPersonalPayServiceFee()); - ctripTrainOrderDetail.setPersonalPayOtherFee(trainSettlementDetail.getPersonalPayOtherFee()); - ctripTrainOrderDetail.setTrainChangePrice(trainSettlementDetail.getTrainChangePrice()); - ctripTrainOrderDetail.setTrainOtherFee(trainSettlementDetail.getTrainOtherFee()); - ctripTrainOrderDetail.setDealTime(trainSettlementDetail.getDealTime()); - ctripTrainOrderDetail.setProductType(trainSettlementDetail.getProductType()); - ctripTrainOrderDetail.setDepartureCountry(trainSettlementDetail.getDepartureCountry()); - ctripTrainOrderDetail.setArrivalCountry(trainSettlementDetail.getArrivalCountry()); - ctripTrainOrderDetail.setSequence(trainSettlementDetail.getSequence()); - ctripTrainOrderDetail.setLoanServiceFee(trainSettlementDetail.getLoanServiceFee()); - ctripTrainOrderDetail.setIntlIssueTicketFee(trainSettlementDetail.getIntlIssueTicketFee()); - ctripTrainOrderDetail.setDeductibleTax(trainSettlementDetail.getDeductibleTax()); - ctripTrainOrderDetail.setNotIncludeTaxPrice(trainSettlementDetail.getNotIncludeTaxPrice()); - ctripTrainOrderDetail.setOnsiteRefundFlag(trainSettlementDetail.isOnsiteRefundFlag()); - ctripTrainOrderDetail.setTicketPrice(trainSettlementDetail.getTicketPrice()); - ctripTrainOrderDetail.setRefundTicketServiceFee(trainSettlementDetail.getRefundTicketServiceFee()); - return ctripTrainOrderDetail; + ctripTrainOrderDetail.setRecordId(trainSettlementDetail.getRecordID()); + ctripTrainOrderDetail.setOrderId(trainSettlementDetail.getOrderID()); + ctripTrainOrderDetail.setCorpId(trainSettlementDetail.getCorpId()); + ctripTrainOrderDetail.setAccountId(trainSettlementDetail.getAccountID()); + ctripTrainOrderDetail.setUid(trainSettlementDetail.getUID()); + ctripTrainOrderDetail.setDetailType(trainSettlementDetail.getDetailType()); + ctripTrainOrderDetail.setPassengerName(trainSettlementDetail.getPassengerName()); + ctripTrainOrderDetail.setPrice(trainSettlementDetail.getPrice()); + ctripTrainOrderDetail.setServerFee(trainSettlementDetail.getServerFee()); + ctripTrainOrderDetail.setCancelFee(trainSettlementDetail.getCancelFee()); + ctripTrainOrderDetail.setInsureFee(trainSettlementDetail.getInsureFee()); + ctripTrainOrderDetail.setPaperTicketFee(trainSettlementDetail.getPaperTicketFee()); + ctripTrainOrderDetail.setDeliverFee(trainSettlementDetail.getDeliverFee()); + ctripTrainOrderDetail.setReBookingServiceFee(trainSettlementDetail.getReBookingServiceFee()); + ctripTrainOrderDetail.setRealAmount(trainSettlementDetail.getRealAmount()); + ctripTrainOrderDetail.setBatchNo(trainSettlementDetail.getBatchNo()); + ctripTrainOrderDetail.setSettlementType(trainSettlementDetail.getSettlementType()); + ctripTrainOrderDetail.setCreateTime(trainSettlementDetail.getCreatetime()); + ctripTrainOrderDetail.setChangeLastTime(trainSettlementDetail.getChangeLasttime()); + ctripTrainOrderDetail.setOrderType(trainSettlementDetail.getOrderType()); + ctripTrainOrderDetail.setSubAccCheckBatchNo(trainSettlementDetail.getSubAccCheckBatchNo()); + ctripTrainOrderDetail.setTripId(trainSettlementDetail.getTripID()); + ctripTrainOrderDetail.setSettlementCurrency(trainSettlementDetail.getSettlementCurrency()); + ctripTrainOrderDetail.setGrabServiceFee(trainSettlementDetail.getGrabServiceFee()); + ctripTrainOrderDetail.setPostServiceFee(trainSettlementDetail.getPostServiceFee()); + ctripTrainOrderDetail.setRealAmountHasPost(trainSettlementDetail.getRealAmountHasPost()); + ctripTrainOrderDetail.setIsChecked(trainSettlementDetail.isIsChecked()); + ctripTrainOrderDetail.setSubDetailType(trainSettlementDetail.getSubDetailType()); +// ctripTrainOrderDetailis.setInvoiceIds(trainSettlementDetail.getInvoiceIds()); + ctripTrainOrderDetail.setBatchStartDate(trainSettlementDetail.getBatchStartDate()); + ctripTrainOrderDetail.setBatchEndDate(trainSettlementDetail.getBatchEndDate()); + ctripTrainOrderDetail.setAfterTakeTicketFee(trainSettlementDetail.getAfterTakeTicketFee()); + ctripTrainOrderDetail.setEstimatePrice(trainSettlementDetail.getEstimatePrice()); + ctripTrainOrderDetail.setEstimaAmount(trainSettlementDetail.getEstimaAmount()); + ctripTrainOrderDetail.setPurchaseFee(trainSettlementDetail.getPurchaseFee()); + ctripTrainOrderDetail.setPayMixFlag(trainSettlementDetail.isPayMixFlag()); + ctripTrainOrderDetail.setPersonalPayTicketFee(trainSettlementDetail.getPersonalPayTicketFee()); + ctripTrainOrderDetail.setPersonalPayServiceFee(trainSettlementDetail.getPersonalPayServiceFee()); + ctripTrainOrderDetail.setPersonalPayOtherFee(trainSettlementDetail.getPersonalPayOtherFee()); + ctripTrainOrderDetail.setTrainChangePrice(trainSettlementDetail.getTrainChangePrice()); + ctripTrainOrderDetail.setTrainOtherFee(trainSettlementDetail.getTrainOtherFee()); + ctripTrainOrderDetail.setDealTime(trainSettlementDetail.getDealTime()); + ctripTrainOrderDetail.setProductType(trainSettlementDetail.getProductType()); + ctripTrainOrderDetail.setDepartureCountry(trainSettlementDetail.getDepartureCountry()); + ctripTrainOrderDetail.setArrivalCountry(trainSettlementDetail.getArrivalCountry()); + ctripTrainOrderDetail.setSequence(trainSettlementDetail.getSequence()); + ctripTrainOrderDetail.setLoanServiceFee(trainSettlementDetail.getLoanServiceFee()); + ctripTrainOrderDetail.setIntlIssueTicketFee(trainSettlementDetail.getIntlIssueTicketFee()); + ctripTrainOrderDetail.setDeductibleTax(trainSettlementDetail.getDeductibleTax()); + ctripTrainOrderDetail.setNotIncludeTaxPrice(trainSettlementDetail.getNotIncludeTaxPrice()); + ctripTrainOrderDetail.setOnsiteRefundFlag(trainSettlementDetail.isOnsiteRefundFlag()); + ctripTrainOrderDetail.setTicketPrice(trainSettlementDetail.getTicketPrice()); + ctripTrainOrderDetail.setRefundTicketServiceFee(trainSettlementDetail.getRefundTicketServiceFee()); + + return ctripTrainOrderDetail; // return BeanUtil.copyProperties(flightOrderSettlementBaseInfo,CtripFlightOrderDetail.class); - } - return null; + } } diff --git a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java index 6b968033..69c40f5d 100644 --- a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java +++ b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java @@ -17,7 +17,6 @@ public interface CTripOrderDetailRepository { CTripFlightRecord save(CTripFlightRecord cTripFlightRecord); - void saveAll(List cTripFlightRecordList); CTripFlightRecordBase findFlightByRecordId(Long id); @@ -38,4 +37,8 @@ public interface CTripOrderDetailRepository { void saveAllCarRecord(List ctripCarOrderDetailList); CTripCarRecordBase findCarByRecordId(Long id); + void saveAllCTripFlightRecord(List cTripFlightRecordList); + void saveAllCTripHotelRecord(List cTripHotelRecordList); + void saveAllCTripTrainRecord(List cTripTrainRecordList); + void saveAllCTripCarRecord(List cTripCarRecordList); } diff --git a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java index 114e88dd..a9aa924f 100644 --- a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java @@ -35,6 +35,16 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { @Autowired private JdbcCTripFlightRecordRepository jdbcCTripFlightRecordRepository; + @Autowired + private JdbcCTripCarRecordRepository jdbcCTripCarRecordRepository; + + @Autowired + private JdbcCTripHotelRecordRepository jdbcCTripHotelRecordRepository; + + @Autowired + private JdbcCTripTrainRecordRepository jdbcCTripTrainRecordRepository; + + @Override public CTripFlightRecordBase save(CTripFlightRecordBase ctripFlightOrderDetail) { return jdbcCtripFlightOrderDetailRepository.save(ctripFlightOrderDetail); @@ -50,10 +60,6 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { return jdbcCTripFlightRecordRepository.save(cTripFlightRecord); } - @Override - public void saveAll(List cTripFlightRecordList) { - jdbcCTripFlightRecordRepository.saveAll(cTripFlightRecordList); - } @Override public CTripFlightRecordBase findFlightByRecordId(Long recordId) { @@ -107,6 +113,26 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { public CTripCarRecordBase findCarByRecordId(Long recordId) { return jdbcCtripCarOrderDetailRepository.findByRecordId(recordId); } + + @Override + public void saveAllCTripFlightRecord(List cTripFlightRecordList) { + jdbcCTripFlightRecordRepository.saveAll(cTripFlightRecordList); + } + + @Override + public void saveAllCTripHotelRecord(List cTripHotelRecordList) { + jdbcCTripHotelRecordRepository.saveAll(cTripHotelRecordList); + } + + @Override + public void saveAllCTripTrainRecord(List cTripTrainRecordList) { + jdbcCTripTrainRecordRepository.saveAll(cTripTrainRecordList); + } + + @Override + public void saveAllCTripCarRecord(List cTripCarRecordList) { + jdbcCTripCarRecordRepository.saveAll(cTripCarRecordList); + } // // @Override // public Client findByClientId(String clientId){ diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java new file mode 100644 index 00000000..abd3cb0d --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java @@ -0,0 +1,11 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecordBase; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecordBase; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcCTripCarRecordRepository extends CrudRepository { +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java new file mode 100644 index 00000000..58a4c3ef --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java @@ -0,0 +1,10 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecordBase; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcCTripHotelRecordRepository extends CrudRepository { +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java new file mode 100644 index 00000000..5f64ecd0 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java @@ -0,0 +1,10 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripTrainRecord; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcCTripTrainRecordRepository extends CrudRepository { +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java index 1ddfc0ff..486e495f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java @@ -44,7 +44,7 @@ public class CTripOrderRecordAutoSave { ), CTripFlightInfo.of(it.getOrderFlightInfo()) )) .toList(); - cTripOrderDetailRepository.saveAll(cTripFlightRecords); + cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords); } } @@ -53,12 +53,14 @@ public class CTripOrderRecordAutoSave { OrderHotelResponse hotelOrder = cTripOrderDetailRequest.getHotelOrder(); List lstHtlSettlement = hotelOrder.getLstHtlSettlement(); if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) { - List list = lstHtlSettlement.stream() + List list = lstHtlSettlement.stream() .flatMap(it -> it.getLstHotelSettlementDetail().stream()) - .map(OrderHotelResponse.LstHotelSettlementDetail::getSettlementDetail) - .map(CTripHotelRecordBase::changeInfo) + .map(it -> + CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(it.getSettlementDetail()), + CTripHotelInfo.of(it.getHotelDetail())) + ) .toList(); - cTripOrderDetailRepository.saveAllHotelRecord(list); + cTripOrderDetailRepository.saveAllCTripHotelRecord(list); } } @@ -67,27 +69,28 @@ public class CTripOrderRecordAutoSave { OrderTrainResponse trainOrder = cTripOrderDetailRequest.getTrainOrder(); List lstTrainSettlement = trainOrder.getLstTrainSettlement(); if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) { - List list = lstTrainSettlement.stream() + List list = lstTrainSettlement.stream() .flatMap(it -> it.getLstTrainSettlementDetail().stream()) - .map(OrderTrainResponse.CorpTrainSettlementInfo::getTrainSettlementDetail) - .map(CTripTrainRecordBase::changeInfo) + .map(it -> + CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(it.getTrainSettlementDetail()), + CTripTrainInfo.of(it.getTrainSettlementTicket())) + ) .toList(); - cTripOrderDetailRepository.saveAllTrainRecord(list); + cTripOrderDetailRepository.saveAllCTripTrainRecord(list); } } - public void cTripCarRecordAutoSave() { OrderCarResponse carOrder = cTripOrderDetailRequest.getCarOrder(); List settlementList = carOrder.getCarOrderAccountSettlementList(); if (settlementList != null && !settlementList.isEmpty()) { - List list = settlementList.stream() + List list = settlementList.stream() .flatMap(it -> it.getCarSettlementDetailList().stream()) - .map(OrderCarResponse.CarOrderSettlementDetail::getSettlementBaseInfo) - .map(CTripCarRecordBase::changeInfo) + .map(it -> CTripCarRecord.of( + CTripCarRecordBase.changeInfo(it.getSettlementBaseInfo()), + CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()))) .toList(); - cTripOrderDetailRepository.saveAllCarRecord(list); + cTripOrderDetailRepository.saveAllCTripCarRecord(list); } } - }