From d88eced6a8a3b11d135e7038c4f2c5fcdc275229 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 14 May 2024 16:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=BA=E7=A8=8B=E9=85=92?= =?UTF-8?q?=E5=BA=97=E8=AE=A2=E5=8D=95=E4=BB=B7=E6=A0=BC=E5=8F=96=E5=80=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/OrderDetailQuery.java | 22 ++++------------ .../CTripOrderExtensionFactoryImpl.java | 26 ++++++++++++------- .../rest/amap/request/SettleBillRequest.java | 26 +++++++++++++++---- .../dto/orderdetail/CarOrderDetailDto.java | 2 ++ .../dto/orderdetail/FlightOrderDetailDto.java | 2 +- .../dto/orderdetail/HotelOrderDetailDto.java | 1 + .../dto/orderdetail/TrainOrderDetailDto.java | 1 + .../search/hotel/HotelOrderInfoEntity.java | 18 +++++++++++-- src/test/java/com/chint/AmapTest.java | 3 +-- src/test/java/com/chint/CTripTest.java | 2 +- .../java/com/chint/RouteApplicationTests.java | 2 +- 11 files changed, 66 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index a0e498fb..6c41ec34 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -243,11 +243,7 @@ public class OrderDetailQuery { Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0) { return null; } - - HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail); - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - orderDetailDto.setApplicantId(routeOrder.getUserId()); - return orderDetailDto; + return HotelOrderDetailDto.copyFrom(hotelOrderDetail); } return null; } @@ -269,10 +265,7 @@ public class OrderDetailQuery { if (receiptsNum != null) { trainOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum)); } - TrainOrderDetailDto orderDetailDto = TrainOrderDetailDto.copyFrom(trainOrderDetail); - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - orderDetailDto.setApplicantId(routeOrder.getUserId()); - return orderDetailDto; + return TrainOrderDetailDto.copyFrom(trainOrderDetail); } return null; } @@ -307,11 +300,7 @@ public class OrderDetailQuery { return null; } - CarOrderDetailDto orderDetailDto = CarOrderDetailDto.copyFrom(carOrderDetail); - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - orderDetailDto.setApplicantId(routeOrder.getUserId()); - orderDetailDto.setMiles(carOrderDetail.getMileage());//打车里程数映射 - return orderDetailDto; + return CarOrderDetailDto.copyFrom(carOrderDetail); } return null; } @@ -332,6 +321,7 @@ public class OrderDetailQuery { if (receiptsNum != null) { flightOrderDetail.setReceiptsNum(reGetReceiptsNum(receiptsNum)); } + FlightOrderDetailDto orderDetailDto = FlightOrderDetailDto.copyFrom(flightOrderDetail); String ticketNo = orderDetailDto.getTicketNo(); @@ -344,9 +334,7 @@ public class OrderDetailQuery { changedTicketNo = changedTicketNo.replace("-", ""); orderDetailDto.setChangedTicketNo(changedTicketNo); } - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - orderDetailDto.setApplicantId(routeOrder.getUserId()); - return orderDetailDto; + return routeRepository.queryById(orderDetail.getRouteId()); } return null; } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java index 3ab722ee..cf03b85d 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -91,7 +91,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { } carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); - if(carOrderDetail.getOrderNo() == null || carOrderDetail.getDetailId() == null){ + if (carOrderDetail.getOrderNo() == null || carOrderDetail.getDetailId() == null) { carOrderDetail.setOrderNo(orderNo); carOrderDetail.setDetailId(orderNo); } @@ -170,7 +170,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { BasicInfo flightOrderBasicInfo = flightOrderInfoEntity.getBasicInfo(); String orderNo = flightOrderBasicInfo.getOrderID(); String journeyNo = flightOrderBasicInfo.getJourneyID(); - RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo); Optional first = routeOrder .getOrderDetails() @@ -196,7 +196,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); updateFlightOrderDetailData(flightOrderDetail, flightOrderInfoEntity); - if(flightOrderDetail.getOrderNo() == null || flightOrderDetail.getDetailId() == null){ + if (flightOrderDetail.getOrderNo() == null || flightOrderDetail.getDetailId() == null) { flightOrderDetail.setOrderNo(orderNo); flightOrderDetail.setDetailId(orderNo); } @@ -377,7 +377,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { Optional byOrderNo = orderDetailRepository.findByOrderNo(orderNo); String journeyNo = hotelOrderInfoEntity.getJourneyNo(); - RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo).reloadStatus(); + RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(journeyNo).reloadStatus(); ApproveOrderNo approveOrderNo = null; User user = null; @@ -404,7 +404,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { } if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - } if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { hotelOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); @@ -487,14 +486,21 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { hotelOrderDetail.setRoomTypeName(hotelOrderInfoEntity.getRoomName()); //房型 if (Double.parseDouble(hotelOrderInfoEntity.getAmount()) > 0) { - hotelOrderDetail.setOrderAmount(hotelOrderInfoEntity.getAmount()); -// hotelOrderDetail.setRefundAmount(KEEP_TWO_DECIMAL_ZERO); + HotelOrderInfoEntity.PaymentInfoEntity paymentInfo = hotelOrderInfoEntity.getPaymentInfo(); + if (paymentInfo != null && paymentInfo.getPaymentItemList() != null && !paymentInfo.getPaymentItemList().isEmpty()) { + List paymentItemList = paymentInfo.getPaymentItemList(); + if (hotelOrderDetail.getOrderAmount() == null || hotelOrderDetail.getOrderAmount().isEmpty()) { + hotelOrderDetail.setOrderAmount(KEEP_TWO_DECIMAL_ZERO); + } + for (HotelOrderInfoEntity.PaymentItem paymentItem : paymentItemList) { + hotelOrderDetail.setOrderAmount(BigDecimalCalculator.add(hotelOrderDetail.getOrderAmount(), + String.valueOf(paymentItem.getAmount()))); + } + } } else { hotelOrderDetail.setOrderAmount(KEEP_TWO_DECIMAL_ZERO); -// hotelOrderDetail.setRefundAmount(hotelOrderInfoEntity.getAmount()); } - hotelOrderDetail.setPreServiceFee(hotelOrderInfoEntity.getFrontendServiceFee()); hotelOrderDetail.setPostServiceFee(hotelOrderInfoEntity.getAfterServiceFee()); hotelOrderDetail.setStandardItems(hotelOrderInfoEntity.getTPMaxPrice()); @@ -537,7 +543,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); - if(hotelOrderDetail.getOrderNo() == null || hotelOrderDetail.getDetailId() == null){ + if (hotelOrderDetail.getOrderNo() == null || hotelOrderDetail.getDetailId() == null) { hotelOrderDetail.setOrderNo(orderNo); hotelOrderDetail.setDetailId(orderNo); } diff --git a/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java b/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java index 85479f71..f92ff012 100644 --- a/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java +++ b/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java @@ -1,11 +1,13 @@ package com.chint.interfaces.rest.amap.request; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderDto; import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -24,8 +26,8 @@ public class SettleBillRequest { * * @return */ - public List pageFinishedOrder(String dsStart, String dsEnd) { - List result=new ArrayList<>(); + public List pageFinishedOrder(String dsStart, String dsEnd) { + List result = new ArrayList<>(); FinishedOrderDto finishedOrderDto = new FinishedOrderDto(); finishedOrderDto.setDsStart(dsStart); finishedOrderDto.setDsEnd(dsEnd); @@ -34,11 +36,25 @@ public class SettleBillRequest { finishedOrderDto.setPageSize(100); do { finishedOrderDto.setPageNum(page); - FinishedOrderResponse finishedOrderResponse = amapRequest.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class); - result.add(finishedOrderResponse); - flag = finishedOrderResponse.getData().getHasNextPage();//是否有下一页 + FinishedOrderResponse finishedOrderResponse = amapRequest + .post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class); + FinishedOrderResponse.Data data = finishedOrderResponse.getData(); + if (data != null && data.getList() != null && !data.getList().isEmpty()) { + result.addAll(data.getList()); + } + flag = data.getHasNextPage();//是否有下一页 page++; } while (flag); return result; } + + + public List amapRecordLastMonth(){ + String lastMonthStr = DateTimeUtil.lastMonthStr(); + LocalDateTime firstDayOfMonth = DateTimeUtil.firstDayOfMonth(lastMonthStr); + LocalDateTime endDayOfMonth = DateTimeUtil.endDayOfMonth(lastMonthStr); + + return null; + } + } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java index 875a7201..d417758f 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java @@ -159,6 +159,8 @@ public class CarOrderDetailDto implements Serializable { if(cancellationFee != null){ carOrderDetailDto.setCancelFee(cancellationFee); } + carOrderDetailDto.setApplicantId(carOrderDetail.getBookingUserCode()); + carOrderDetailDto.setMiles(carOrderDetail.getMileage());//打车里程数映射 return carOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/FlightOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/FlightOrderDetailDto.java index 88754885..6277f889 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/FlightOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/FlightOrderDetailDto.java @@ -213,7 +213,7 @@ public class FlightOrderDetailDto implements Serializable { return null; } FlightOrderDetailDto flightOrderDetailDto = BeanUtil.copyProperties(flightOrderDetail, FlightOrderDetailDto.class); - + flightOrderDetailDto.setApplicantId(flightOrderDetail.getBookingUserCode()); return flightOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java index 317a1e45..eeb681ad 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java @@ -166,6 +166,7 @@ public class HotelOrderDetailDto implements Serializable { hotelOrderDetailDto.setCustomers( hotelOrderDetail.getCustomers().stream().distinct().toList() ); + hotelOrderDetailDto.setApplicantId(hotelOrderDetail.getBookingUserCode()); return hotelOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/TrainOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/TrainOrderDetailDto.java index 02ffd7ac..cc893240 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/TrainOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/TrainOrderDetailDto.java @@ -179,6 +179,7 @@ public class TrainOrderDetailDto implements Serializable { if(Double.parseDouble(trainOrderDetail.getRefundCost()) > 0) { trainOrderDetailDto.setChangeCost(trainOrderDetail.getRefundCost()); } + trainOrderDetailDto.setApplicantId(trainOrderDetail.getBookingUserCode()); return trainOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java index 5cacf76c..15d60444 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/search/hotel/HotelOrderInfoEntity.java @@ -29,7 +29,6 @@ public class HotelOrderInfoEntity { private String FrontendServiceFee; // 前端服务费 private String AfterServiceFee; // 前端服务费 - private String HotelType; // 酒店类型 private String HotelName; // 酒店名称 private String HotelEnName; // 酒店英文名称 @@ -79,7 +78,7 @@ public class HotelOrderInfoEntity { private String LowPriceRC_VV;//超标原因是:其它 超标原因 private String AgreementRCInfo; //超标原因 可能是一个对象 private String LowPriceRC_W; //超标原因 可能是一个对象 - + private PaymentInfoEntity PaymentInfo; private String TPMaxPrice; //入离日期内差标 // 后续字段含义类似,可根据实际情况添加注释 @@ -90,6 +89,21 @@ public class HotelOrderInfoEntity { private List PaymentReceivedList; + + @Data + public static class PaymentInfoEntity { + private List paymentItemList; + private Double originalTotalAmountExclude; + } + + @Data + public static class PaymentItem { + private String prePayType; + private String paymentStatus; + private String currency; + private Double exchange; + private Double amount; + } } diff --git a/src/test/java/com/chint/AmapTest.java b/src/test/java/com/chint/AmapTest.java index 5b750746..4bb061bc 100644 --- a/src/test/java/com/chint/AmapTest.java +++ b/src/test/java/com/chint/AmapTest.java @@ -94,8 +94,7 @@ public class AmapTest { */ @Test public void pageFinishedOrder() { - List responses = settleBillRequest.pageFinishedOrder("20240401", "20240431"); - System.out.println(responses); +// List responses = settleBillRequest.pageFinishedOrder("20240401", "20240431"); } @Test diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 5b06f1f2..20d7a178 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -246,7 +246,7 @@ public class CTripTest { @Test void search() { BaseContext.setCurrentUser(user); - SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31445559547"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31900510524"); System.out.println(response); } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index eb7e75e3..c580151c 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -302,7 +302,7 @@ class RouteApplicationTests { @Test void loginSignProd() { - String sfno = "0001018592"; + String sfno = "001001002"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司";