From dfa1248fe04b0b2895f3fb5fbf8943a4daebe12d Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 17:06:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/domain/aggregates/order/OrderEvent.java | 4 ++-- .../aggregates/order/order_record/OrderHotelRecord.java | 7 +++++-- src/main/resources/application-test.yml | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java index ba689c23..aabf860f 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java @@ -112,10 +112,10 @@ public class OrderEvent implements Serializable { public static String mapToHotelOrderDetailStatus(Integer eventType){ return switch (eventType) { - case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_REFUND; //未下单 改成3 + case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_SUCCESS; //未下单 改成3 case ORDER_EVENT_PAYED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_CHANGE -> FSSC_HOTEL_STATUS_SUCCESS; - case ORDER_EVENT_CANCEL -> FSSC_HOTEL_STATUS_SUCCESS; //e额外生成的单子为3 退票虽然是3 返回为1 + case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL; //e额外生成的单子为3 退票虽然是3 返回为1 case ORDER_EVENT_ORDERED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_REFUND -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL; 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 f40ebcd6..b6280dc8 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 @@ -227,8 +227,11 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载发票和费用信息 - public OrderHotelRecord loadInvoiceAndFeeInfo(String invoiceType, String invoiceFee, String custodayFee, - String noTaxCusFee, String taxCusFee) { + public OrderHotelRecord loadInvoiceAndFeeInfo(String invoiceType, + String invoiceFee, + String custodayFee, + String noTaxCusFee, + String taxCusFee) { this.setInvoiceType(invoiceType); this.setInvoiceFee(invoiceFee); this.setCustodayFee(custodayFee); diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index f4381294..0e552aab 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -48,10 +48,10 @@ logging: #正式 ly: appId: zhengtai - account: 4f9cb1080b564dd0a94aa95f7a19c8b5 - password: 1fD3SutgzfS48qznYQiq - secret: WOHzCMvHd823iHgH - baseUrl: https://api.qa.dttrip.cn/openapi + account: ab9fe0c19dd64a99b936fded72c3bb94 + password: glHRJJ9JMUwNfQ8OwAQi + secret: MnghmYJpM1U2RaLx + baseUrl: https://api.dttrip.cn/openapi ifForwardRequest: false forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz From 5ad1e6f6f453cbff471108907403fabe75594a76 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 10:27:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderFlightRecord.java | 2 + .../order/order_record/OrderHotelRecord.java | 9 +- .../ctrip_order_record/CTripFlightRecord.java | 8 +- .../CTripFlightTripInfo.java | 90 +++++++++++++++++++ .../CTripHotelOrderDetail.java | 10 ++- .../CTripHotelRoomDetail.java | 35 ++++++++ .../CTripOrderRecordExtensionFactory.java | 78 +++++++++++----- .../OrderCarRecordRepositoryImpl.java | 3 +- .../OrderFlightRecordRepositoryImpl.java | 3 +- .../OrderHotelRecordRepositoryImpl.java | 9 +- .../OrderTrainRecordRepositoryImpl.java | 8 +- .../jdbc/JdbcOrderCarRecordRepository.java | 1 + .../jdbc/JdbcOrderFlightRecordRepository.java | 1 + .../jdbc/JdbcOrderHotelRecordRepository.java | 2 + .../jdbc/JdbcOrderTrainRecordRepository.java | 2 + .../ctrip/order/CTripOrderRecordAutoSave.java | 11 ++- 16 files changed, 227 insertions(+), 45 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.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 795e137c..7d5ced56 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 @@ -119,9 +119,11 @@ public class OrderFlightRecord extends OrderBaseRecord { // 加载机票信息 public OrderFlightRecord loadTicketInfo(String issueTicketTime, + String ticketNo, String facePrice, String useStatus) { this.setIssueTicketTime(issueTicketTime); + this.setTicketNo(ticketNo); this.setFacePrice(facePrice); this.setUseStatus(useStatus); return this; 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 b6280dc8..befe93e2 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 @@ -79,6 +79,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//支付总金额 + // 加载基础订单信息 public OrderHotelRecord loadBasicOrderInfo(String orderNo, String orderStatus, @@ -90,10 +91,9 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载酒店和入住信息 - public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, + public OrderHotelRecord loadHotelInfo(String hotelName, String checkInDate, String departureDate, int roomCount, String roomTypeName) { this.setHotelName(hotelName); - this.setHotelAddress(hotelAddress); this.setCheckInDate(checkInDate); this.setDepartureDate(departureDate); this.setRoomCount(roomCount); @@ -102,10 +102,11 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载地理信息位置 - public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity) { + public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity, String hotelAddress) { this.setCountry(country); this.setProvince(province); this.setCheckInCity(checkInCity); + this.setHotelAddress(hotelAddress); return this; } @@ -239,6 +240,4 @@ public class OrderHotelRecord extends OrderBaseRecord { this.setTaxCusFee(taxCusFee); return this; } - - } \ No newline at end of file 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 98ea8dc8..4eb90c4a 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 @@ -26,14 +26,20 @@ public class CTripFlightRecord implements Serializable { private CTripFlightInfo cTripFlightInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightBaseInfo cTripFlightBaseInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightTripInfo cTripFlightTripInfo; - public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { + public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, + CTripFlightInfo cTripFlightInfo, + CTripFlightBaseInfo cTripOrderBaseInfo, + CTripFlightTripInfo cTripFlightTripInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo); + cTripFlightRecord.setCTripFlightTripInfo(cTripFlightTripInfo); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java new file mode 100644 index 00000000..304f9744 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java @@ -0,0 +1,90 @@ +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_trip_info") +public class CTripFlightTripInfo implements Serializable { + @Serial + private static final long serialVersionUID = -2541232534673683466L; + @Id + private Long id; + private Long cTripFlightRecordId; + private Long TripId; + private Integer SectorId; + private String PassengerName; + private String RecordStatus; + private Integer ValidFlag;// + private String FlightClass; + private String Flight; + private String ClassGrade; + private String SubClass; + private String TakeOffTime; + private String ArrivalTime; + private Integer DCity; + private String DepartureDistrictCode; + private String DPort; + private String DPortBuilding; + private Integer DPortBuildingId; + private Integer ACity; + private String ArrivalDistrictCode; + private String APort; + private String APortBuilding; + private Integer APortBuildingId; + private Integer OpenTranFlag;// + private Double PrintPrice; + private Double Oil; + private Double Tax; + private String RecordNo; + private String AirlineRecordNo; + private Integer SharedFlag;// + private String SharedFlight; + private Integer SurfaceFlag; // + private String AirLineCode; + private String TicketNo; + private Integer TicketNoStatus; + private String TicketNoStatusName; + private String DCityName; + private String DPortName; + private String ACityName; + private String APortName; + // private OrderFlightResponse.StandardGeoInfo StandardGeoInfo; + private String ClassTypeName; + private String AirlineName; + + public static CTripFlightTripInfo of(OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo) { + CTripFlightTripInfo cTripFlightTripInfo = BeanUtil.copyProperties(flightTripRecordInfo, CTripFlightTripInfo.class); + cTripFlightTripInfo.setValidFlag(flightTripRecordInfo.isValidFlag() ? 1 : 0); + cTripFlightTripInfo.setOpenTranFlag(flightTripRecordInfo.isOpenTranFlag() ? 1 : 0); + cTripFlightTripInfo.setSharedFlag(flightTripRecordInfo.isSharedFlag() ? 1 : 0); + cTripFlightTripInfo.setSurfaceFlag(flightTripRecordInfo.isSurfaceFlag() ? 1 : 0); + cTripFlightTripInfo.setTicketNoStatusName(translateTicketStatus(flightTripRecordInfo.getTicketNoStatus())); + return cTripFlightTripInfo; + } + + private static String translateTicketStatus(Integer ticketNoStatus) { + return switch (ticketNoStatus) { + case -2 -> "未知"; + case -1 -> "未知"; + case 1 -> "待使用"; + case 2 -> "已使用"; + case 3 -> "已经办理登记"; + case 4 -> "已离港"; + case 5 -> "已作废"; + case 6 -> "已退票"; + case 7 -> "换开"; + case 8 -> "挂起"; + case 9 -> "机场控制"; + case 10 -> "机场控制"; + case 11 -> "未查到"; + default -> "未知"; + }; + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java index 96b8da25..1bbfa1ba 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; 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.MappedCollection; import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; @@ -19,6 +20,8 @@ public class CTripHotelOrderDetail implements Serializable { private Long id; private Long cTripHotelRecordId; private Long OrderId; + @MappedCollection(idColumn = "c_trip_hotel_order_detail_id", keyColumn = "c_trip_hotel_order_detail_key") + private List cTripHotelRoomDetailList; private String EmployeeName; private String EmployeeID; private String WorkCity; @@ -100,8 +103,13 @@ public class CTripHotelOrderDetail implements Serializable { private Double TPConfigMaxPrice; private String ReservationType; private String PreEmail; + public static CTripHotelOrderDetail of(OrderHotelResponse.SettlementOrderDetail data) { - return BeanUtil.copyProperties(data, CTripHotelOrderDetail.class); + CTripHotelOrderDetail cTripHotelOrderDetail = BeanUtil.copyProperties(data, CTripHotelOrderDetail.class); + List roomDetailList = data.getRoomDetailList(); + List res = roomDetailList.stream().map(CTripHotelRoomDetail::of).toList(); + cTripHotelOrderDetail.setCTripHotelRoomDetailList(res); + return cTripHotelOrderDetail; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java new file mode 100644 index 00000000..91d65f3d --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.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.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_room_detail") +public class CTripHotelRoomDetail implements Serializable { + @Serial + private static final long serialVersionUID = 1027124557206346513L; + @Id + private Long id; + private Long cTripHotelOrderDetailId; + private Integer cTripHotelOrderDetailKey; + private String BasicRoomTypeName; + private String BasicRoomTypeEnName; + private Integer Breakfast; + private Integer AddBreakfast; + private Integer Meals; + private String ETA; + private String ETD; + private Double Price; + private Integer remainQuantity; + private Integer refundQuantity; + + public static CTripHotelRoomDetail of(OrderHotelResponse.SettlementRoomDetail roomDetail) { + return BeanUtil.copyProperties(roomDetail, CTripHotelRoomDetail.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 06fe0202..98eba36d 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 @@ -49,16 +49,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5()); String sysCode = cTripCarPassengerInfo.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -208,16 +208,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5()); String sysCode = cTripFlightBaseInfo.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -231,6 +231,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); + CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) @@ -257,13 +258,22 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac "", cTripFlightInfo.getACityCode(), "") - .loadTicketInfo(cTripFlightRecordBase.getCreateTime(), - String.valueOf(cTripFlightRecordBase.getPrice()), - "") .loadSeatInfo(cTripFlightInfo.getClassName(), cTripFlightInfo.getClassName(), String.valueOf(cTripFlightInfo.getPriceRate())); + if (cTripFlightTripInfo != null) { + orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + cTripFlightTripInfo.getTicketNo(), + cTripFlightTripInfo.getTicketNoStatusName()); + } else { + orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + "", + "无机票信息"); + } + // 加载财务与价格信息 String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6); @@ -349,16 +359,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5()); String sysCode = cTripHotelOrderDetail.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -386,7 +396,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载酒店和入住信息 orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), - cTripHotelInfo.getHotelName(), cTripHotelOrderDetail.getStartTime(), cTripHotelOrderDetail.getEndTime(), cTripHotelOrderDetail.getRoomQuantity(), @@ -399,7 +408,15 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } else { isAgreement = "否"; } - orderHotelRecord.loadRoomAndBreakfastInfo("", + List roomDetails = cTripHotelOrderDetail.getCTripHotelRoomDetailList(); + Integer averageMeals; + if (roomDetails != null && !roomDetails.isEmpty()) { + averageMeals = roomDetails.stream().map(CTripHotelRoomDetail::getBreakfast).reduce(Integer::sum).get(); + + } else { + averageMeals = 0; + } + orderHotelRecord.loadRoomAndBreakfastInfo(String.valueOf(averageMeals), isAgreement, cTripHotelRecordBase.getQuantity(), cTripHotelRecordBase.getQuantity(), @@ -413,10 +430,19 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac if (locations != null && !locations.isEmpty()) { Location location = locations.get(0); LocationRes locationRes = LocationRes.copyFrom(location); - orderHotelRecord.loadLocationInfo(locationRes.getCountry(), locationRes.getProvince(), cTripHotelInfo.getCityName()); + String address = locationRes.getCountry() + locationRes.getProvince() + cTripHotelInfo.getCityName(); + if (cTripHotelInfo.getDistrictName() != null) { + address = address + cTripHotelInfo.getDistrictName(); + } + address = address + cTripHotelInfo.getHotelName(); + orderHotelRecord.loadLocationInfo( + address, + locationRes.getCountry(), + locationRes.getProvince(), + cTripHotelInfo.getCityName()); } else { //如果找不到该地区,那么只能先用空的 - orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName()); + orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName(), cTripHotelInfo.getHotelName()); } // 加载酒店品牌和星级信息 @@ -458,11 +484,17 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelRecordBase.getCreateTime())); // 加载财务信息 + String invoiceType = cTripHotelOrderDetail.getIsHasSpecialInvoice().equals("T") ? "增值税专用发票" : "增值税普通发票"; //发票类型 orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getBatchStartDate().substring(0, 6), - cTripHotelRecordBase.getSubAccCheckBatchNo(), - String.valueOf(cTripHotelRecordBase.getAmount()), - "", - cTripHotelRecordBase.getPaidAmount()); + cTripHotelRecordBase.getSubAccCheckBatchNo(), + String.valueOf(cTripHotelRecordBase.getAmount()), + "", + cTripHotelRecordBase.getPaidAmount()) + .loadInvoiceAndFeeInfo(invoiceType, + String.valueOf(cTripHotelRecordBase.getExtraCharge()), + String.valueOf(cTripHotelRecordBase.getServiceFee()), + "", + ""); // 加载付款 付款方式,公司付款金额, 个人付款金额 diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index bd675e95..26d0ae29 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -40,7 +40,8 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = orderCarRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 87e8436d..68268d29 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -37,7 +37,8 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderFlightRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index 50b7e88c..23c216ef 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -1,10 +1,7 @@ package com.chint.infrastructure.repository; -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; import com.chint.domain.repository.OrderHotelRecordRepository; -import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +20,7 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor @Autowired private JdbcOrderHotelRecordRepository jdbcOrderHotelRecordRepository; + @Override public List saveAll(List orderHotelRecordList) { List res = new ArrayList<>(); @@ -36,10 +34,11 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor } @Override - public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderHotelRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index e9a8df6d..64041ced 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -1,9 +1,7 @@ package com.chint.infrastructure.repository; -import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderTrainRecordRepository; -import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +19,7 @@ import java.util.Optional; public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository { @Autowired private JdbcOrderTrainRecordRepository jdbcOrderTrainRecordRepository; + @Override public List saveAll(List orderTrainRecordList) { List res = new ArrayList<>(); @@ -34,10 +33,11 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor } @Override - public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderTrainRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } 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 bf1fac92..6e0a4bdc 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -15,4 +15,5 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 a6d053d7..e6dd5c8d 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -14,4 +14,5 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 4bf5cd9a..658e713c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -1,5 +1,6 @@ package com.chint.infrastructure.repository.jdbc; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -15,4 +16,5 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 ee634c0a..690dc56c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -14,4 +14,6 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 8b588697..97ca04d3 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 @@ -55,20 +55,23 @@ public class CTripOrderRecordAutoSave { .map(it -> { //对数据库进行查找 ,如果发现已经存在 , 就使用查找出来的 OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo(); + 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()) + CTripFlightBaseInfo.of(it.getOrderBaseInfo()), + CTripFlightTripInfo.of(flightTripRecordInfo) ); } else { Long originId = record.getId(); record = CTripFlightRecord.of( CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), CTripFlightInfo.of(it.getOrderFlightInfo()), - CTripFlightBaseInfo.of(it.getOrderBaseInfo())); + CTripFlightBaseInfo.of(it.getOrderBaseInfo()), + CTripFlightTripInfo.of(flightTripRecordInfo)); record.setId(originId); } //补充额外的字段 @@ -120,7 +123,7 @@ public class CTripOrderRecordAutoSave { public void cTripTrainRecordAutoSave(Optional date) { - OrderTrainResponse trainOrder = date + OrderTrainResponse trainOrder = date .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getTrainOrderByDate(it))) .orElseGet(() -> cTripOrderDetailRequest.getTrainOrder()); @@ -150,7 +153,7 @@ public class CTripOrderRecordAutoSave { } public void cTripCarRecordAutoSave(Optional date) { - OrderCarResponse carOrder = date + OrderCarResponse carOrder = date .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getCarOrderByDate(it))) .orElseGet(() -> cTripOrderDetailRequest.getCarOrder()); From 346ea697dae737c10e16983f4e34c1f8b6873060 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 13:13:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=90=BA=E7=A8=8B=E6=9C=BA=E7=A5=A8?= =?UTF-8?q?=E7=BB=93=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()); From 00b61fd55bb7e04f337a81b38ecf22782f322cf9 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 14:20:16 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=8F=AA?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=8A=E4=B8=AA=E6=9C=88=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/OrderDetailQuery.java | 13 ++++------- .../order/order_record/OrderFlightRecord.java | 7 +++--- .../CTripOrderRecordExtensionFactory.java | 14 +++++++---- .../repository/OrderCarRecordRepository.java | 7 +++++- .../OrderFlightRecordRepository.java | 4 ++++ .../OrderHotelRecordRepository.java | 8 ++++++- .../OrderTrainRecordRepository.java | 7 +++++- .../service/OrderRecordDomainService.java | 23 +++++++++++++++++++ .../OrderCarRecordRepositoryImpl.java | 10 ++++++++ .../OrderFlightRecordRepositoryImpl.java | 9 ++++++++ .../OrderHotelRecordRepositoryImpl.java | 11 +++++++++ .../OrderTrainRecordRepositoryImpl.java | 10 ++++++++ .../jdbc/JdbcOrderCarRecordRepository.java | 3 +++ .../jdbc/JdbcOrderFlightRecordRepository.java | 2 ++ .../jdbc/JdbcOrderHotelRecordRepository.java | 4 +++- .../jdbc/JdbcOrderTrainRecordRepository.java | 1 + .../infrastructure/util/DateTimeUtil.java | 16 +++++++++++++ .../java/com/chint/RouteApplicationTests.java | 4 +++- 18 files changed, 132 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/chint/domain/service/OrderRecordDomainService.java diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index f701e7b1..13a943e3 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -57,15 +57,12 @@ public class OrderDetailQuery { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); + //只获取账期号为上个月的结算数据 return switch (productType) { - case 1 -> orderFlightRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 2 -> orderHotelRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 3 -> orderTrainRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 4 -> orderCarRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); + case 1 -> orderFlightRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 2 -> orderHotelRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 3 -> orderTrainRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 4 -> orderCarRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); default -> throw new NotFoundException("错误产品类型"); }; } 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 49b3c18a..5967781b 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 @@ -118,19 +118,20 @@ public class OrderFlightRecord extends OrderBaseRecord { } // 加载机票信息 - public OrderFlightRecord loadTicketInfo(String issueTicketTime, + public OrderFlightRecord loadTicketInfo( String ticketNo, String facePrice, String useStatus) { - this.setIssueTicketTime(issueTicketTime); + this.setTicketNo(ticketNo); this.setFacePrice(facePrice); this.setUseStatus(useStatus); return this; } - public OrderFlightRecord loadScheduleNum(String scheduleNum){ + public OrderFlightRecord loadScheduleNum(String issueTicketTime,String scheduleNum){ this.setScheduleNum(scheduleNum); + this.setIssueTicketTime(issueTicketTime); return this; } 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 7f88235a..3d2897b2 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 @@ -11,6 +11,7 @@ import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.RouteRepository; import com.chint.domain.service.OrderDetailDomainService; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; +import com.chint.infrastructure.util.DateTimeUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,6 +47,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripCarPassengerInfo.getCostCenter1()); orderRecordBasic.setAccountCompanyName(cTripCarPassengerInfo.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripCarPassengerInfo.getCostCenter1()); orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5()); String sysCode = cTripCarPassengerInfo.getCostCenter3(); if (sysCode != null) { @@ -205,6 +207,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripFlightBaseInfo.getCostCenter()); orderRecordBasic.setAccountCompanyName(cTripFlightBaseInfo.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripFlightBaseInfo.getCostCenter()); orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5()); String sysCode = cTripFlightBaseInfo.getCostCenter3(); if (sysCode != null) { @@ -279,17 +282,17 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac return b; } }); - orderFlightRecord.loadScheduleNum(print.isPresent() ? print.get().getPrintNo() : ""); + orderFlightRecord.loadScheduleNum(print.map(cTripFlightSegmentPrint -> DateTimeUtil.timeFromInstant(cTripFlightSegmentPrint.getPrintTime())).orElse(""), + print.isPresent() ? print.get().getPrintNo() : ""); } + // 加载机票信息 if (cTripFlightTripInfo != null) { - orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + orderFlightRecord.loadTicketInfo(cTripFlightTripInfo.getTicketNo(), String.valueOf(cTripFlightRecordBase.getPrice()), - cTripFlightTripInfo.getTicketNo(), cTripFlightTripInfo.getTicketNoStatusName()); } else { - orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), - String.valueOf(cTripFlightRecordBase.getPrice()), + orderFlightRecord.loadTicketInfo(String.valueOf(cTripFlightRecordBase.getPrice()), "", "无机票信息"); } @@ -376,6 +379,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripHotelOrderDetail.getCostCenter()); orderRecordBasic.setAccountCompanyName(cTripHotelOrderDetail.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripHotelOrderDetail.getCostCenter()); orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5()); String sysCode = cTripHotelOrderDetail.getCostCenter3(); if (sysCode != null) { diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 435ed60c..edfed599 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -1,6 +1,7 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.infrastructure.util.PageResult; import java.time.LocalDateTime; @@ -12,5 +13,9 @@ public interface OrderCarRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index 26776622..6312ebcf 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -17,4 +17,8 @@ public interface OrderFlightRecordRepository { Integer pageSize, Integer pageNum, String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index be2cc0fd..2bc09547 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -1,6 +1,7 @@ package com.chint.domain.repository; 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; import com.chint.infrastructure.util.PageResult; @@ -13,5 +14,10 @@ public interface OrderHotelRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 3a50a491..7b136f16 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -14,5 +14,10 @@ public interface OrderTrainRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/service/OrderRecordDomainService.java b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java new file mode 100644 index 00000000..6b257d55 --- /dev/null +++ b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java @@ -0,0 +1,23 @@ +package com.chint.domain.service; + +import com.chint.domain.repository.OrderCarRecordRepository; +import com.chint.domain.repository.OrderFlightRecordRepository; +import com.chint.domain.repository.OrderHotelRecordRepository; +import com.chint.domain.repository.OrderTrainRecordRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class OrderRecordDomainService { + + @Autowired + private OrderCarRecordRepository orderCarRecordRepository; + @Autowired + private OrderHotelRecordRepository orderHotelRecordRepository; + @Autowired + private OrderFlightRecordRepository orderFlightRecordRepository; + @Autowired + private OrderTrainRecordRepository orderTrainRecordRepository; + + +} diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index 26d0ae29..edfdd80a 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.repository.OrderCarRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -44,4 +45,13 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = orderCarRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 68268d29..5c49ae4d 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.repository.OrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -42,4 +43,12 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderFlightRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index 23c216ef..8c13259b 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -1,8 +1,10 @@ package com.chint.infrastructure.repository; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.repository.OrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -41,4 +43,13 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderHotelRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 64041ced..e098a800 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderTrainRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -40,4 +41,13 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderTrainRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } 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 6e0a4bdc..d8ec2073 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -15,5 +15,8 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 e6dd5c8d..81b3fe7c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -14,5 +14,7 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 658e713c..f3059438 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -1,6 +1,5 @@ package com.chint.infrastructure.repository.jdbc; -import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -16,5 +15,8 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 690dc56c..64736afc 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -14,6 +14,7 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java index 347d89c2..a9b50110 100644 --- a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java +++ b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java @@ -1,7 +1,9 @@ package com.chint.infrastructure.util; +import java.time.Instant; import java.time.LocalDateTime; import java.time.YearMonth; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; public class DateTimeUtil { @@ -14,6 +16,11 @@ public class DateTimeUtil { private final static DateTimeFormatter formatterDateYYYYMMDD = DateTimeFormatter.ofPattern("yyyyMMdd"); + public static String timeFromInstant(Long instant) { + LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(instant), ZoneId.systemDefault()); + return formatter.format(localDateTime); + } + public static String timeToStr(LocalDateTime input) { return input.format(formatterDate); } @@ -53,4 +60,13 @@ public class DateTimeUtil { return yearMonth.atEndOfMonth().atTime(23, 59, 59); } + public static String lastMonthStr() { + // 获取当前日期和时间 + LocalDateTime currentDateTime = LocalDateTime.now(); + // 获取上个月的同一时间 + LocalDateTime lastMonthDateTime = currentDateTime.minusMonths(1); + // 指定所需格式 + // 格式化日期时间 + return lastMonthDateTime.format(formatterDateYYYYMM); + } } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 0a70fb33..fcb90b91 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -55,6 +55,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.chint.infrastructure.constant.LocationConstant.*; +import static com.chint.infrastructure.util.DateTimeUtil.lastMonthStr; @Slf4j @SpringBootTest @@ -1249,9 +1250,10 @@ class RouteApplicationTests { orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司"); } -// @Test + @Test void testSplid(){ String str = "20240301"; System.out.println(str.substring(0, 5)); + System.out.println(lastMonthStr()); } }