From fda49ff6c3793394040ea9331d03b86f85bb3970 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 1 Apr 2024 09:26:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=90=BA=E7=A8=8B=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/in/AutoWorkController.java | 2 +- .../application/queryies/OrderQuery.java | 1 - .../order/order_record/OrderCarRecord.java | 2 +- .../order/order_record/OrderFlightRecord.java | 164 ++++++++++------ .../order/order_record/OrderHotelRecord.java | 83 +++++--- .../CTripFlightBaseInfo.java | 73 +++++++ .../ctrip_order_record/CTripFlightRecord.java | 5 +- .../chint/domain/aggregates/user/User.java | 7 + .../aggregates/user/UserDepartmentInfo.java | 36 ++++ .../CTripOrderRecordExtensionFactory.java | 183 +++++++++++++++++- .../repository/OrderCarRecordRepository.java | 3 + .../OrderFlightRecordRepository.java | 3 +- .../OrderHotelRecordRepository.java | 3 + .../OrderTrainRecordRepository.java | 3 + .../service/OrderDetailDomainService.java | 18 ++ .../CTripOrderRecordDomainService.java | 8 +- .../OrderCarRecordRepositoryImpl.java | 6 + .../OrderFlightRecordRepositoryImpl.java | 5 + .../OrderHotelRecordRepositoryImpl.java | 6 + .../OrderTrainRecordRepositoryImpl.java | 6 + .../jdbc/JdbcOrderCarRecordRepository.java | 4 + .../jdbc/JdbcOrderFlightRecordRepository.java | 3 + .../jdbc/JdbcOrderHotelRecordRepository.java | 4 + .../jdbc/JdbcOrderTrainRecordRepository.java | 3 + .../ctrip/order/CTripOrderRecordAutoSave.java | 9 +- 25 files changed, 535 insertions(+), 105 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 7b4fb30f..0e84d69e 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -41,7 +41,7 @@ public class AutoWorkController { public Result autoSaveCTripRecord() { cTripOrderRecordAutoSave.saveAll(); //将昨天的结算数据生成为财务共享需要的数据 -// Command.of(OrderRecordGenerateCommand.class).sendToQueue(); + Command.of(OrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index c5d1ace5..56002faf 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -521,7 +521,6 @@ public class OrderQuery { if (legItems != null && !legItems.isEmpty()) { //这里使用领域事件进行检查leg的订单状态 ,用户每次想要查看行程都会进行一次检查 legItems.forEach(leg -> legDomainService.legCheckOrder(leg)); - orderDomainService.queryLocation(legItems); List list = legItems.stream().map(LegRes::copyFrom).toList(); routeOrderRes.setLegResList(list); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 69eba259..4c8bac06 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -164,7 +164,7 @@ public class OrderCarRecord extends OrderBaseRecord { public OrderCarRecord loadComplianceInfo(OrderDetail orderDetail) { orderDetail.getETAEvent().ifPresentOrElse(it->{ this.setOverStandard("是"); - this.setOverStandardReason(overStandardReason); + this.setOverStandardReason(it.getExtension()); },()->{ this.setOverStandard("否"); this.setOverStandardReason(""); 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 02b2fde8..872349fc 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 @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record; +import com.chint.domain.aggregates.order.OrderDetail; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,7 +13,7 @@ import org.springframework.data.relational.core.mapping.Table; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -public class OrderFlightRecord extends OrderBaseRecord{ +public class OrderFlightRecord extends OrderBaseRecord { @Id private Long id; private Long orderDetailId; @@ -75,31 +76,71 @@ public class OrderFlightRecord extends OrderBaseRecord{ private String bookOrgCode3; // 出行人组织架构信息3 private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 + private String orderStatus; + private String createTime; // 加载基础订单信息 - public OrderFlightRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { - this.setId(id); + public OrderFlightRecord loadBasicOrderInfo(String orderNo, + String orderStatus, + String createTime) { this.setOrderNo(orderNo); -// this.setOrderStatus(orderStatus); -// this.setCreateTime(createTime); + this.setOrderStatus(orderStatus); + this.setCreateTime(createTime); return this; } - // 加载航班信息 - public OrderFlightRecord loadFlightInfo(String flightNum, String startAirportName, String endAirportName, - String startCityName, String endCityName, String startTime, String endTime) { + // 加载航班信息 , 航线 + public OrderFlightRecord loadFlightInfo(String flightNum, + String flightCompName, + String startAirportName, + String endAirportName, + String startCityName, + String endCityName, + String startTime, + String endTime, + String distance, + String endAirportCode, + String endTerminal) { + this.setDistance(distance); this.setFlightNum(flightNum); + this.setFlightCompName(flightCompName); this.setStartAirportName(startAirportName); - this.setEndAirportName(endAirportName); this.setStartCityName(startCityName); - this.setEndCityName(endCityName); this.setStartTime(startTime); + this.setEndAirportName(endAirportName); + this.setEndCityName(endCityName); this.setEndTime(endTime); + this.setEndAirportCode(endAirportCode); + this.setEndTerminal(endTerminal); + return this; + } + + // 加载机票信息 + public OrderFlightRecord loadTicketInfo(String issueTicketTime, + String facePrice, + String useStatus) { + this.setIssueTicketTime(issueTicketTime); + this.setFacePrice(facePrice); + this.setUseStatus(useStatus); + return this; + } + + // 加载座位细节 + public OrderFlightRecord loadSeatInfo(String seatPoint, + String seatPointName, + + String seatDiscount) { + this.setSeatDiscount(seatDiscount); + this.setSeatPoint(seatPoint); + this.setSeatPointName(seatPointName); return this; } // 加载预订与乘机人信息 - public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode, String bookingName, String userName, String userCode) { + public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode, + String bookingName, + String userName, + String userCode) { this.setBookingUserCode(bookingUserCode); this.setBookingName(bookingName); this.setUserName(userName); @@ -108,86 +149,95 @@ public class OrderFlightRecord extends OrderBaseRecord{ } // 加载财务与价格信息 - public OrderFlightRecord loadFinancialAndPricingInfo(String accountCompanyId, String accountCompanyName, - String accountPeriod, String billNo, String orderAmount, - String facePrice, String noTaxAmt, String taxAmt) { - this.setAccountCompanyId(accountCompanyId); - this.setAccountCompanyName(accountCompanyName); + public OrderFlightRecord loadFinancialAndPricingInfo(String accountPeriod, + String billNo, + String orderAmount, + + String ycabinFullPrice, + String policyLowestPrice, + String flightLowestPrice) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); - this.setFacePrice(facePrice); + this.setYcabinFullPrice(ycabinFullPrice); //经济舱全价 + this.setPolicyLowestPrice(policyLowestPrice); // 比价范围最低价 + this.setFlightLowestPrice(flightLowestPrice); // 航班最低价 + return this; + } + + // 加载税务信息 + public OrderFlightRecord loadTaxInfo(String noTaxAmt, + String taxAmt, + String airportTax, + String fuelTax) { this.setNoTaxAmt(noTaxAmt); this.setTaxAmt(taxAmt); - return this; - } - - // 加载额外费用信息 - public OrderFlightRecord loadExtraFeeInfo(String serviceFee, String airportTax, String fuelTax, - String changeFee, String refundFee) { - this.setPreServiceFee(serviceFee); this.setAirportTax(airportTax); this.setFuelTax(fuelTax); + return this; + } + + // 加载费用信息, 服务费, 改签费, 退票费 , 升舱费 + public OrderFlightRecord loadExtraFeeInfo(String preServiceFee, + String changeFee, + String refundFee, + String upFee, + String postServiceFee) { + this.setPreServiceFee(preServiceFee); this.setChangeFee(changeFee); this.setRefundFee(refundFee); - return this; - } - - // 加载航班额外细节 - public OrderFlightRecord loadFlightExtraDetails(String ycabinFullPrice, String seatDiscount, String policyLowestPrice, - String issueTicketTime, String flightLowestPrice, String useStatus, - String upFee, String postServiceFee, String endAirportCode, String endTerminal) { - this.setYcabinFullPrice(ycabinFullPrice); - this.setSeatDiscount(seatDiscount); - this.setPolicyLowestPrice(policyLowestPrice); - this.setIssueTicketTime(issueTicketTime); - this.setFlightLowestPrice(flightLowestPrice); - this.setUseStatus(useStatus); this.setUpFee(upFee); this.setPostServiceFee(postServiceFee); - this.setEndAirportCode(endAirportCode); - this.setEndTerminal(endTerminal); return this; } + // 加载组织架构与项目信息 - public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3, - String projectOrderNo, String offlineCcomyCode) { + public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, + String bookOrgCode2, + String bookOrgCode3) { this.setBookOrgCode1(bookOrgCode1); this.setBookOrgCode2(bookOrgCode2); this.setBookOrgCode3(bookOrgCode3); - this.setProjectOrderNo(projectOrderNo); - this.setOfflineCcomyCode(offlineCcomyCode); return this; } // 加载来源和系统归属信息 - public OrderFlightRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) { - this.setTrvaleSysType(trvaleSysType); - this.setBelongSysType(belongSysType); + public OrderFlightRecord loadSourceInfo(String orderSource) { this.setOrderSource(orderSource); return this; } // 加载违规信息 - public OrderFlightRecord loadComplianceInfo(String overStandard, String overStandardReason) { - this.setOverStandard(overStandard); - this.setOverStandardReason(overStandardReason); + public OrderFlightRecord loadComplianceInfo(OrderDetail orderDetail) { + orderDetail.getETAEvent().ifPresentOrElse(it->{ + this.setOverStandard("是"); + this.setOverStandardReason(it.getExtension()); + },()->{ + this.setOverStandard("否"); + this.setOverStandardReason(""); + }); return this; } - // 加载航班细节 - public OrderFlightRecord loadFlightDetails(String seatPoint, String seatPointName, String distance, String flightCompName) { - this.setSeatPoint(seatPoint); - this.setSeatPointName(seatPointName); - this.setDistance(distance); - this.setFlightCompName(flightCompName); - return this; - } // 加载未预订最低价原因 public OrderFlightRecord loadNotLowReason(String notLowReason) { this.setNotLowReason(notLowReason); return this; } + + // 加载关联订单信息 + public OrderFlightRecord loadRelatedOrderInfo(Long orderDetailId, + String detailId, + String receiptsNum, + String parentOrderNo, + String originalOrderNo) { + this.setOrderDetailId(orderDetailId); + this.setDetailId(detailId); + this.setReceiptsNum(receiptsNum); + this.setParentOrderNo(parentOrderNo); + this.setOriginalOrderNo(originalOrderNo); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index f693ed26..4e4c8113 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record; +import com.chint.domain.aggregates.order.OrderDetail; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -72,19 +73,23 @@ public class OrderHotelRecord extends OrderBaseRecord { private String bookOrgCode3; // 入住人组织架构信息3 private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 + private String payAmount; // 支付总金额 + private String orderStatus; + private String createTime; // 加载基础订单信息 - public OrderHotelRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { - this.setId(id); + public OrderHotelRecord loadBasicOrderInfo(String orderNo, + String orderStatus, + String createTime) { this.setOrderNo(orderNo); -// this.setOrderStatus(orderStatus); -// this.setCreateTime(createTime); + this.setOrderStatus(orderStatus); + this.setCreateTime(createTime); return this; } // 加载酒店和入住信息 public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, - int roomCount, String roomTypeName) { + int roomCount, String roomTypeName) { this.setHotelName(hotelName); this.setHotelAddress(hotelAddress); this.setCheckInDate(checkInDate); @@ -112,22 +117,36 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载财务信息 - public OrderHotelRecord loadFinancialInfo(String accountCompanyId, String accountCompanyName, String accountPeriod, String billNo, - String orderAmount, String noTaxAmt, String taxAmt, String companyAmount, String personalAmount) { - this.setAccountCompanyId(accountCompanyId); - this.setAccountCompanyName(accountCompanyName); + public OrderHotelRecord loadFinancialInfo(String accountPeriod, + String billNo, + String orderAmount, + String ticketClerk, + String payAmount + ) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); + this.setPayAmount(payAmount); + this.setTicketClerk(ticketClerk); + return this; + } + + // 加载税类信息 + public OrderHotelRecord loadTaxInfo(String noTaxAmt, + String taxAmt) { this.setNoTaxAmt(noTaxAmt); this.setTaxAmt(taxAmt); - this.setCompanyAmount(companyAmount); - this.setPersonalAmount(personalAmount); return this; } // 加载支付和服务费信息 - public OrderHotelRecord loadPaymentAndServiceFeeInfo(int paymentType, String unifiedPayAmt, String personalPayAmt) { + public OrderHotelRecord loadPaymentInfo(Integer paymentType, + String unifiedPayAmt, + String personalPayAmt, + String companyAmount, + String personalAmount) { + this.setCompanyAmount(companyAmount); + this.setPersonalAmount(personalAmount); this.setPaymentType(paymentType); this.setUnifiedPayAmt(unifiedPayAmt); this.setPersonalPayAmt(personalPayAmt); @@ -143,37 +162,41 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载订单来源和系统归属信息 - public OrderHotelRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) { - this.setTrvaleSysType(trvaleSysType); - this.setBelongSysType(belongSysType); + public OrderHotelRecord loadSourceInfo(String orderSource) { this.setOrderSource(orderSource); return this; } // 加载违规信息 - public OrderHotelRecord loadComplianceInfo(int overStandard, String overStandardReason) { - this.setOverStandard(overStandard); - this.setOverStandardReason(overStandardReason); + public OrderHotelRecord loadComplianceInfo(OrderDetail orderDetail) { + orderDetail.getETAEvent().ifPresentOrElse(it -> { + this.setOverStandard(1); + this.setOverStandardReason(it.getExtension()); + }, () -> { + this.setOverStandard(0); + this.setOverStandardReason(""); + }); return this; } // 加载组织架构和项目信息 - public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3, - String projectOrderNo, String offlineCcomyCode) { + public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, + String bookOrgCode2, + String bookOrgCode3) { this.setBookOrgCode1(bookOrgCode1); this.setBookOrgCode2(bookOrgCode2); this.setBookOrgCode3(bookOrgCode3); - this.setProjectOrderNo(projectOrderNo); - this.setOfflineCcomyCode(offlineCcomyCode); return this; } - // 加载订单详情和结算信息 - public OrderHotelRecord loadOrderDetailAndSettlementInfo(Long orderDetailId, String detailId, String ticketClerk, - String receiptsNum, String parentOrderNo, String originalOrderNo) { + // 加载订单关联号信息 + public OrderHotelRecord loadOrderNoInfo(Long orderDetailId, + String detailId, + String receiptsNum, + String parentOrderNo, + String originalOrderNo) { this.setOrderDetailId(orderDetailId); this.setDetailId(detailId); - this.setTicketClerk(ticketClerk); this.setReceiptsNum(receiptsNum); this.setParentOrderNo(parentOrderNo); this.setOriginalOrderNo(originalOrderNo); @@ -181,8 +204,12 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载房间和早餐信息 - public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, int isAgreement, int roomNightCount, - int nightCount, String roomPrice, String roomRate) { + public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, + int isAgreement, + int roomNightCount, + int nightCount, + String roomPrice, + String roomRate) { this.setIncludeAmount(includeAmount); this.setIsAgreement(isAgreement); this.setRoomNightCount(roomNightCount); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java new file mode 100644 index 00000000..29d46cb9 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java @@ -0,0 +1,73 @@ +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; + + +@Data +@Table("c_trip_flight_base_info") +public class CTripFlightBaseInfo { + @Id + private Long id; + private Long cTripFlightRecordId; + private String Uid; + private String Rank; + private String ConfirmType; + private String ConfirmType2; + private String ConfirmPerson; + private String ConfirmPerson2; + private String ConfirmPersonCC; + private String ConfirmPersonCC2; + private String ConfirmPersonName; + private String ConfirmPersonName2; + private String ConfirmPersonCCName; + private String ConfirmPersonCCName2; + private String CostCenter; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String CostCenter5; + private String CostCenter6; + private String JourneyReason; + private String Project; + private String DefineFlag; + private String DefineFlag2; + private String EmployeeID; + private String WorkCity; + private String Dept1; + private String Dept2; + private String Dept3; + private String Dept4; + private String Dept5; + private String Dept6; + private String Dept7; + private String Dept8; + private String Dept9; + private String Dept10; + private String CtripCardNo; + private String Name; + private String FlightClass; + private String IsOnline; + private String NickName; + private String JourneyID; + private String PrintTicketTime; + private String OrderDate; + private String PreEmployeeID; + private long RebookOrderID; + private String RankName; + private String RankNameEn; + private String ConfirmPersonEID; + private String ConfirmPerson2EID; + private String OrderStatus; + private String ProjectCode; + private String PrepayType; + private String ReservationType; + private String PreEmail; + + public static CTripFlightBaseInfo of(OrderFlightResponse.FlightOrderBaseInfo flightOrderBaseInfo) { + return BeanUtil.copyProperties(flightOrderBaseInfo, CTripFlightBaseInfo.class); + } +} 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 b52fbef5..76097dbe 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,13 +20,16 @@ public class CTripFlightRecord { private CTripFlightRecordBase cTripFlightRecordBase; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightInfo cTripFlightInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightBaseInfo cTripOrderBaseInfo; - public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo) { + public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); + cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index edc6462d..a99fead0 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -13,6 +13,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; +import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; @@ -44,6 +45,8 @@ public class User implements Serializable { private String phoneNumber; private String password; private LocalDateTime syncTime; + @MappedCollection(idColumn = "user_id", keyColumn = "user_key") + private List userDepartmentInfo; @Transient private List fsscSystemList; @Transient @@ -68,6 +71,10 @@ public class User implements Serializable { this.employeeNo = employeeNo; } +// public User addDeptInfo(){ +// +// } + public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) { this.userId = userId; this.employeeNo = employeeNo; diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java new file mode 100644 index 00000000..34a47136 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -0,0 +1,36 @@ +package com.chint.domain.aggregates.user; + +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("user_department_info") +public class UserDepartmentInfo implements Serializable { + @Serial + private static final long serialVersionUID = 5602115854952241146L; + @Id + private Long id; + private Long userId; + private Integer userKey; + private String companyCode; + private String companyName; + private String departmentCodeOne; + private String departmentNameOne; + private String departmentCodeTwo; + private String departmentNameTwo; + private String departmentCodeThree; + private String departmentNameThree; + private String departmentCodeFour; + private String departmentNameFour; + private String departmentCodeFive; + private String departmentNameFive; + private String departmentCodeSix; + private String departmentNameSix; + private String departmentCodeSeven; + private String departmentNameSeven; + private Integer ifPrimary; +} 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 3c95a733..d5ff7381 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 @@ -1,10 +1,7 @@ package com.chint.domain.factoriy.order_record; import com.chint.application.dtos.response.LocationRes; -import com.chint.domain.aggregates.order.CarOrderDetail; -import com.chint.domain.aggregates.order.Location; -import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; @@ -20,6 +17,8 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; +import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; + @Component public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFactory { @@ -44,7 +43,10 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 - Optional orderDetail = byOrderNo.getOrderDetails().stream().filter(it -> it.getOrderNo().equals(String.valueOf( + Optional orderDetail = byOrderNo + .getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf( cTripCarRecordBase.getOrderId() ))).findFirst(); @@ -115,7 +117,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CarOrderDetail carOrderDetail = it.getCarOrderDetail(); orderCarRecord.loadComplianceInfo(it) .loadRelatedOrderInfo(it.getOrderId(), - carOrderDetail.getDetailId(), + cTripCarRecord.getRecordId(), carOrderDetail.getReceiptsNum(), carOrderDetail.getParentOrderNo(), carOrderDetail.getOriginalOrderNo()) @@ -135,8 +137,91 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Override public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { + CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; + String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); + RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo) + .flightRecord(); - return null; + CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); + CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase(); + //携程的打车订单可以直接通过订单号获取对应的订单 + Optional orderDetail = byOrderNo. + getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId() + ))).findFirst(); + + // 加载航班信息 , 航线 + orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(), + cTripFlightInfo.getAirLineName(), + cTripFlightInfo.getDPortName(), + cTripFlightInfo.getAPortName(), + cTripFlightInfo.getDCityName(), + cTripFlightInfo.getACityName(), + cTripFlightInfo.getTakeOffTime(), + cTripFlightInfo.getArrivalTime(), + "", + cTripFlightInfo.getACityCode(), + "") + .loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + "") + .loadSeatInfo(cTripFlightInfo.getClassName(), + cTripFlightInfo.getClassName(), + String.valueOf(cTripFlightInfo.getPriceRate())); + + + // 加载财务与价格信息 + String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6); + orderFlightRecord.loadFinancialAndPricingInfo(batchNo, + cTripFlightRecordBase.getSubAccCheckBatchNo(), + String.valueOf(cTripFlightRecordBase.getPrice()), + String.valueOf(cTripFlightInfo.getEClassStandardPrice()), + String.valueOf(cTripFlightInfo.getLowPrice()), + String.valueOf(cTripFlightInfo.getLowPrice())); + + + // 加载税务信息 + orderFlightRecord.loadTaxInfo(String.valueOf(cTripFlightRecordBase.getNonDeductibleTax()), + String.valueOf(cTripFlightRecordBase.getDeductibleTax()), + String.valueOf(cTripFlightRecordBase.getTax()), + String.valueOf(cTripFlightRecordBase.getOilFee())); + + // 加载费用信息, 服务费, 改签费, 退票费 , 升舱费 + orderFlightRecord.loadExtraFeeInfo(String.valueOf(cTripFlightRecordBase.getPostServiceFee()), + String.valueOf(cTripFlightRecordBase.getRebookQueryFee()), + String.valueOf(cTripFlightRecordBase.getRefund()), + String.valueOf(cTripFlightRecordBase.getAmount()), + String.valueOf(cTripFlightRecordBase.getSettItineraryFee())); + + // 加载来源 + if (cTripFlightRecord.getRouteOrderNo() == null || + cTripFlightRecord.getRouteOrderNo().isEmpty() || + cTripFlightRecord.getRouteOrderNo().isBlank()) { + orderFlightRecord.loadSourceInfo("N"); + } else { + orderFlightRecord.loadSourceInfo("Y"); + } + + // 加载关联票价原因 + orderDetail.ifPresent(it -> { + FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); + orderFlightRecord.loadComplianceInfo(it) + .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), + flightOrderDetail.getOrderStatus(), + cTripFlightRecordBase.getCreateTime()) + .loadRelatedOrderInfo(it.getOrderId(), + String.valueOf(cTripFlightRecordBase.getRecordId()), + flightOrderDetail.getReceiptsNum(), + flightOrderDetail.getParentOrderNo(), + it.getOrderNo()); + }); + + // 加载未预订最低价原因 + orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); + + return orderFlightRecord; } @Override @@ -150,6 +235,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .hotelRecord(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); + CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase(); // 加载酒店和入住信息 orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), cTripHotelInfo.getHotelName(), @@ -158,6 +244,21 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelOrderDetail.getRoomQuantity(), cTripHotelOrderDetail.getRoomName()); + // 加载房间和早餐信息 , 含早分数先为空 + String isAgreement; + if (cTripHotelRecordBase.getOrderType().equals(4) || cTripHotelRecordBase.getOrderType().equals(6)) { + isAgreement = "1"; + } else { + isAgreement = "0"; + } + orderHotelRecord.loadRoomAndBreakfastInfo("", + Integer.parseInt(isAgreement), + cTripHotelRecordBase.getQuantity(), + cTripHotelRecordBase.getQuantity(), + String.valueOf(cTripHotelRecordBase.getPrice()), + String.valueOf(cTripHotelRecordBase.getAmount())); + + // 加载地理信息位置 Integer cityID = cTripHotelInfo.getCityID(); List locations = locationRepository.findByCityId(Long.valueOf(cityID)); @@ -171,9 +272,73 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } // 加载酒店品牌和星级信息 -// orderHotelRecord.loadBrandAndStarRateInfo() + orderHotelRecord.loadBrandAndStarRateInfo(cTripHotelInfo.getHotelGroupName(), + cTripHotelInfo.getBrandName(), + String.valueOf(cTripHotelInfo.getStar())); + + // 加载订单来源和系统归属信息 + String sourceInfo; + if (cTripHotelRecord.getRouteOrderNo() == null) { + sourceInfo = "N"; + } else { + sourceInfo = "Y"; + } + orderHotelRecord.loadSourceInfo(sourceInfo); + + Optional orderDetailOptional = byOrderNo.getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId()))) + .findFirst(); + + orderDetailOptional.ifPresent(it -> { + orderHotelRecord.loadComplianceInfo(it); // 加载违规信息 + HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail(); + orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息 + cTripHotelRecord.getRecordId(), + hotelOrderDetail.getReceiptsNum(), + hotelOrderDetail.getOrderNo(), + hotelOrderDetail.getOrderNo()); + orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 + hotelOrderDetail.getOrderStatus(), + cTripHotelRecordBase.getCreateTime()); + }); + + // 加载财务信息 + orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(), + cTripHotelRecordBase.getBatchStartDate().substring(0, 6), + String.valueOf(cTripHotelRecordBase.getAmount()), + "", + cTripHotelRecordBase.getPaidAmount()); - return null; + // 加载付款 付款方式,公司付款金额, 个人付款金额 + String paymentType; + Double personAmount = cTripHotelRecordBase.getPersonAmount(); + Double paidAmount = Double.parseDouble(cTripHotelRecordBase.getPaidAmount()); + if (personAmount > 0 && personAmount < paidAmount) { + paymentType = "2"; + } else if (personAmount.equals(paidAmount)) { + paymentType = "1"; + } else { + paymentType = "0"; + } + orderHotelRecord.loadPaymentInfo(Integer.parseInt(paymentType), + cTripHotelRecordBase.getBookServiceFee(), + KEEP_TWO_DECIMAL_ZERO, + String.valueOf(paidAmount - personAmount), + String.valueOf(personAmount)); + + // 加载预订人和入住人信息 + orderHotelRecord.loadBookerAndGuestInfo(cTripHotelOrderDetail.getEmployeeID(), + cTripHotelOrderDetail.getEmployeeName(), + cTripHotelOrderDetail.getEmployeeID(), + cTripHotelOrderDetail.getEmployeeName()); + + // 加载组织架构 + orderHotelRecord.loadOrganizationalAndProjectInfo(cTripHotelOrderDetail.getDept1(), + cTripHotelOrderDetail.getDept2(), + cTripHotelOrderDetail.getDept3()); + + return orderHotelRecord; } } diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 62642c15..1bd7acab 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -3,7 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import java.util.List; +import java.util.Optional; public interface OrderCarRecordRepository { List saveAll(List orderCarRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index c7d47ebd..5a11f804 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -3,9 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import java.util.List; +import java.util.Optional; public interface OrderFlightRecordRepository { List saveAll(List orderFlightRecordList); - + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index 6f2d18f4..b7b51daa 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -3,7 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import java.util.List; +import java.util.Optional; public interface OrderHotelRecordRepository { List saveAll(List orderHotelRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 35dfdca9..110ab308 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -4,7 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import java.util.List; +import java.util.Optional; public interface OrderTrainRecordRepository { List saveAll(List orderTrainRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/service/OrderDetailDomainService.java b/src/main/java/com/chint/domain/service/OrderDetailDomainService.java index 190c8df3..64050c49 100644 --- a/src/main/java/com/chint/domain/service/OrderDetailDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDetailDomainService.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; @@ -85,15 +86,32 @@ public class OrderDetailDomainService { } public List saveCarOrderRecordBatch(List orderCarRecordList) { + //如果发现唯一键已经存在, 那么就做更新处理 + orderCarRecordList.forEach(needSave-> orderCarRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderCarRecordRepository.saveAll(orderCarRecordList); } public List saveFlightOrderRecordBatch(List orderFlightRecordList) { + orderFlightRecordList.forEach(needSave-> orderFlightRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderFlightRecordRepository.saveAll(orderFlightRecordList); } public List saveTrainOrderRecordBatch(List orderTrainRecordList) { + orderTrainRecordList.forEach(needSave-> orderTrainRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderTrainRecordRepository.saveAll(orderTrainRecordList); } public List saveHotelOrderRecordBatch(List orderHotelRecordList) { + orderHotelRecordList.forEach(needSave-> orderHotelRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderHotelRecordRepository.saveAll(orderHotelRecordList); } diff --git a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java index c323e9a4..38906319 100644 --- a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java @@ -17,30 +17,34 @@ import java.util.List; @Component public class CTripOrderRecordDomainService implements OrderRecordDomainService{ - @Autowired - private JdbcCtripHotelOrderDetailRepository jdbcCtripHotelOrderDetailRepository; + @Autowired private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; @Autowired private OrderDetailDomainService orderDetailDomainService; + @Override public List generateHotelRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateTrainRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateFlightRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateCarRecord(OrderRecordGenerateCommand command) { + return null; } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index f76fe4ad..3d9018b9 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { @@ -19,4 +20,9 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { orderCarRecordRepository.saveAll(orderCarRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return orderCarRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 92e4b59b..0d28efee 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordRepository { @@ -22,5 +23,9 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return res; } + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderFlightRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index e7a4cf8a..fced6b8c 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepository { @@ -22,4 +23,9 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor jdbcOrderHotelRecordRepository.saveAll(orderHotelRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderHotelRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 71aac4f9..9581a020 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository { @@ -21,4 +22,9 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor jdbcOrderTrainRecordRepository.saveAll(orderTrainRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderTrainRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index 43f5f58a..70b21aa6 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderCarRecordRepository extends CrudRepository { + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index cfc7e5f2..88a5ce4a 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderFlightRecordRepository extends CrudRepository { + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index 03d806dc..919524e5 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderHotelRecordRepository extends CrudRepository { + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index bc274d54..36457a1d 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderTrainRecordRepository extends CrudRepository { + Optional findByDetailId(String detailId); } 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 1c5545df..92b38c3f 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 @@ -45,9 +45,9 @@ public class CTripOrderRecordAutoSave { String.valueOf(orderSettlementBaseInfo.getRecordID())); if (record == null) { record = CTripFlightRecord.of( - CTripFlightRecordBase.changeInfo( - orderSettlementBaseInfo - ), CTripFlightInfo.of(it.getOrderFlightInfo()) + CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), + CTripFlightInfo.of(it.getOrderFlightInfo()), + CTripFlightBaseInfo.of(it.getOrderBaseInfo()) ); } //补充额外的字段 @@ -72,7 +72,8 @@ public class CTripOrderRecordAutoSave { String.valueOf(settlementDetail.getRecordId())); if (record == null) { record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), - CTripHotelInfo.of(it.getHotelDetail()),CTripHotelOrderDetail.of(it.getOrderDetail())); + CTripHotelInfo.of(it.getHotelDetail()), + CTripHotelOrderDetail.of(it.getOrderDetail())); } //补充额外的字段 OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail();