From 346ea697dae737c10e16983f4e34c1f8b6873060 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 13:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=BA=E7=A8=8B=E6=9C=BA=E7=A5=A8=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E5=8A=A0=E5=85=A5=E8=A1=8C=E7=A8=8B=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderFlightRecord.java | 5 +++ .../CTripFlightPrintInfo.java | 37 +++++++++++++++++++ .../ctrip_order_record/CTripFlightRecord.java | 7 ++++ .../CTripFlightSegmentPrint.java | 35 ++++++++++++++++++ .../CTripOrderRecordExtensionFactory.java | 22 ++++++++++- .../ctrip/order/CTripOrderRecordAutoSave.java | 7 +++- 6 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 7d5ced56..49b3c18a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -129,6 +129,11 @@ public class OrderFlightRecord extends OrderBaseRecord { return this; } + public OrderFlightRecord loadScheduleNum(String scheduleNum){ + this.setScheduleNum(scheduleNum); + return this; + } + // 加载座位细节 public OrderFlightRecord loadSeatInfo(String seatPoint, String seatPointName, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java new file mode 100644 index 00000000..dd53805a --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java @@ -0,0 +1,37 @@ +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.OrderFlightResponse; +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; +import java.util.List; + +@Data +@Table("c_trip_flight_print_info") +public class CTripFlightPrintInfo implements Serializable { + @Serial + private static final long serialVersionUID = 8423142133557758145L; + @Id + private Long id; + private Long cTripFlightRecordId; + private long OrderID; + private String CorpID; + @MappedCollection(idColumn = "c_trip_flight_print_info_id", keyColumn = "c_trip_flight_print_info_key") + private List FlightOrderSegmentPrintInfoList; + // private List RegularExpressInfoListFieldList; + private String TicketNoSignCode; + + public static CTripFlightPrintInfo of(OrderFlightResponse.FlightOrderPrintDetailInfo printDetailInfo) { + List list = printDetailInfo + .getFlightOrderSegmentPrintInfoList().stream() + .map(CTripFlightSegmentPrint::of).toList(); + CTripFlightPrintInfo cTripFlightPrintInfo = BeanUtil.copyProperties(printDetailInfo, CTripFlightPrintInfo.class); + cTripFlightPrintInfo.setFlightOrderSegmentPrintInfoList(list); + return cTripFlightPrintInfo; + } +} 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 4eb90c4a..77175a55 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 @@ -28,6 +28,8 @@ public class CTripFlightRecord implements Serializable { private CTripFlightBaseInfo cTripFlightBaseInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightTripInfo cTripFlightTripInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightPrintInfo cTripFlightPrintInfo; public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo, @@ -42,4 +44,9 @@ public class CTripFlightRecord implements Serializable { cTripFlightRecord.setCTripFlightTripInfo(cTripFlightTripInfo); return cTripFlightRecord; } + + public CTripFlightRecord printInfo(CTripFlightPrintInfo cTripFlightPrintInfo) { + this.setCTripFlightPrintInfo(cTripFlightPrintInfo); + return this; + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java new file mode 100644 index 00000000..5f239e0b --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java @@ -0,0 +1,35 @@ +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.OrderFlightResponse; +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_flight_segment_print") +public class CTripFlightSegmentPrint implements Serializable { + @Serial + private static final long serialVersionUID = 8454314678965758235L; + @Id + private Long id; + private Long cTripFlightPrintInfoId; + private Integer cTripFlightPrintInfoKey; + private Long OrderID; + private String ExpressNo; + private String CorpId; + private Integer PrintType; + private String PassengerName; + private String TicketNo; + private String PrintNo; + private Double SegmentPrintPrice; + private Long PrintTime; + private String AirLineCode; + + public static CTripFlightSegmentPrint of(OrderFlightResponse.FlightOrderSegmentPrintInfo printInfo) { + return BeanUtil.copyProperties(printInfo, CTripFlightSegmentPrint.class); + } +} diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index 98eba36d..7f88235a 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -111,7 +111,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(cTripCarRecordBase.getRealAmountHasPost())); // 加载费用细节, 未税金额,税费,服务费,取消费,额外费用,额外费用名称 , 携程马上用车产品没有税费和额外费用字段 - orderCarRecord.loadFeeDetails(String.valueOf(cTripCarRecordBase.getAmount()), + orderCarRecord.loadFeeDetails("", "", String.valueOf(cTripCarRecordBase.getServerFee()), String.valueOf(cTripCarRecordBase.getPenaltyFee()), @@ -262,6 +262,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripFlightInfo.getClassName(), String.valueOf(cTripFlightInfo.getPriceRate())); + + CTripFlightPrintInfo cTripFlightPrintInfo = cTripFlightRecord.getCTripFlightPrintInfo(); + if (cTripFlightPrintInfo != null && + cTripFlightPrintInfo.getFlightOrderSegmentPrintInfoList() != null && + !cTripFlightPrintInfo.getFlightOrderSegmentPrintInfoList().isEmpty()) { + //获取最新的行程号 + Optional print = cTripFlightRecord + .getCTripFlightPrintInfo() + .getFlightOrderSegmentPrintInfoList() + .stream() + .reduce((a, b) -> { + if (a.getPrintTime() > b.getPrintTime()) { + return a; + } else { + return b; + } + }); + orderFlightRecord.loadScheduleNum(print.isPresent() ? print.get().getPrintNo() : ""); + } + if (cTripFlightTripInfo != null) { orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), String.valueOf(cTripFlightRecordBase.getPrice()), 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 97ca04d3..29e8a489 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 @@ -58,13 +58,13 @@ public class CTripOrderRecordAutoSave { OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo = it.getFlightTripRecordInfo(); CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId( String.valueOf(orderSettlementBaseInfo.getRecordID())); + if (record == null) { record = CTripFlightRecord.of( CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), CTripFlightInfo.of(it.getOrderFlightInfo()), CTripFlightBaseInfo.of(it.getOrderBaseInfo()), - CTripFlightTripInfo.of(flightTripRecordInfo) - ); + CTripFlightTripInfo.of(flightTripRecordInfo)); } else { Long originId = record.getId(); record = CTripFlightRecord.of( @@ -74,6 +74,9 @@ public class CTripOrderRecordAutoSave { CTripFlightTripInfo.of(flightTripRecordInfo)); record.setId(originId); } + if (it.getOrderPrintDetailInfo() != null) { + record.printInfo(CTripFlightPrintInfo.of(it.getOrderPrintDetailInfo())); + } //补充额外的字段 OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); record.setRouteOrderNo(orderBaseInfo.getJourneyID());