From a5892a97fa83c95d3d4a95441af188eab2f75839 Mon Sep 17 00:00:00 2001 From: dengwc Date: Tue, 27 Feb 2024 17:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=92=E5=BA=97=E5=9B=9E=E6=8E=A8=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=95=B0=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aggregates/order/TrainOrderDetail.java | 2 + .../LYOrderExtensionFactoryImpl.java | 95 ++++++++++--------- .../service/supplier/LYOrderDataAdapter.java | 8 +- .../interfaces/rest/bpm/BPMController.java | 2 +- .../response/train/TrainDetailResponse.java | 2 +- 5 files changed, 58 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java index 4b0e62ac..20e11766 100644 --- a/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java @@ -2,11 +2,13 @@ package com.chint.domain.aggregates.order; import lombok.Data; +import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; @Data @Table("train_order_detail") +@Accessors(chain = true) public class TrainOrderDetail { @Id private Long id; diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java index 06366c55..bc9c4c05 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -6,6 +6,7 @@ import com.chint.domain.repository.UserRepository; import com.chint.domain.value_object.*; import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; +import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,9 +18,9 @@ import java.util.stream.Collectors; public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { - @Autowired private UserRepository userRepository; + @Override public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { return null; @@ -27,9 +28,15 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @Override public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { + TrainDetailResponse trainDetailResponse = (TrainDetailResponse) trainOrderDetailData; + TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData(); + TrainOrderDetail trainOrderDetail = new TrainOrderDetail(); + //映射值 + trainOrderDetail.setOrderNo(data.getOrderNo()) + .setOverStandard(String.valueOf(data.getRuleViolate())) + ; - - return null; + return trainOrderDetail; } @Override @@ -56,11 +63,9 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { private FlightOrderDetail convertFlight(HotelDetailResponse hotelDetailResponse) { - - - return null; } + private HotelOrderDetail convertHotel(HotelDetailResponse hotelDetailResponse) { HotelOrderDetail hotelOrderDetail = new HotelOrderDetail(); HotelDetailResponse.Data data = hotelDetailResponse.getData(); @@ -68,50 +73,50 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo(); List roomList = data.getRoomList(); hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo()) - .setOverStandard(String.valueOf(orderInfo.getRuleViolate())) - .setOrderStatus(String.valueOf(orderInfo.getOrderStatus())) - .setReceiptsNum(orderInfo.getTravelApplyNo()) - .setBookingUserCode(orderInfo.getOutEmployeeId()) + .setOverStandard(String.valueOf(orderInfo.getRuleViolate())) + .setOrderStatus(String.valueOf(orderInfo.getOrderStatus())) + .setReceiptsNum(orderInfo.getTravelApplyNo()) + .setBookingUserCode(orderInfo.getOutEmployeeId()) // .setBookingName(orderInfo.getEmployeeName()) - .setCreateTime("2023-04-26 13:15:17") - .setCheckInCity(orderInfo.getCreateTime()) - .setHotelName(hotelInfo.getHotelName()) - .setContactPhone(hotelInfo.getHotelTel()) - .setHotelAddress(hotelInfo.getHotelAddress()) - .setStarRate("4") - .setCheckInDate(hotelInfo.getCheckInDate()) - .setDepartureDate(hotelInfo.getCheckOutDate()) - .setNightCount(String.valueOf(hotelInfo.getNightNum())) - .setRoomCount(String.valueOf(hotelInfo.getRoomNum())) - //.setRefundRoomNightCount("0") - .setRoomTypeName(hotelInfo.getRoomName()) - .setPaymentType(String.valueOf(orderInfo.getPaymentType())) - .setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice())) - .setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice())) - .setCompanyRefundAmount(String.valueOf(orderInfo.getCompanyRefundPrice())) - .setPersonalRefundAmount(String.valueOf(orderInfo.getPersonalRefundPrice())) - .setOrderAmount(String.valueOf(orderInfo.getBusinessAmount())) - .setPreServiceFee(String.valueOf(orderInfo.getServicePrice())) - .setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice())) - .setRefundAmount(String.valueOf(orderInfo.getRefundPrice())) - .setCustomers(getCustomers(data.getResidentList())) - .setStandardItems(data.getItems().getPolicyName()) - // .setNightRates() - .setSupplier("Supplier XYZ") - .setAmountFields("Amount A, Amount B") - .setOverStandardReason(orderInfo.getFoulReason()) - .setAgreementHotel(String.valueOf(orderInfo.getProtocolType())); - // .setBOOK_ORG_STRUCT_1("Org A") - // .setBOOK_ORG_STRUCT_2("Org B") - // .setBOOK_ORG_STRUCT_3("Org C") - // .setProjectOrderNo("PROJ789") - // .setCostCenter("COST123") + .setCreateTime("2023-04-26 13:15:17") + .setCheckInCity(orderInfo.getCreateTime()) + .setHotelName(hotelInfo.getHotelName()) + .setContactPhone(hotelInfo.getHotelTel()) + .setHotelAddress(hotelInfo.getHotelAddress()) + .setStarRate("4") + .setCheckInDate(hotelInfo.getCheckInDate()) + .setDepartureDate(hotelInfo.getCheckOutDate()) + .setNightCount(String.valueOf(hotelInfo.getNightNum())) + .setRoomCount(String.valueOf(hotelInfo.getRoomNum())) + //.setRefundRoomNightCount("0") + .setRoomTypeName(hotelInfo.getRoomName()) + .setPaymentType(String.valueOf(orderInfo.getPaymentType())) + .setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice())) + .setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice())) + .setCompanyRefundAmount(String.valueOf(orderInfo.getCompanyRefundPrice())) + .setPersonalRefundAmount(String.valueOf(orderInfo.getPersonalRefundPrice())) + .setOrderAmount(String.valueOf(orderInfo.getBusinessAmount())) + .setPreServiceFee(String.valueOf(orderInfo.getServicePrice())) + .setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice())) + .setRefundAmount(String.valueOf(orderInfo.getRefundPrice())) + .setCustomers(getCustomers(data.getResidentList())) + .setStandardItems(data.getItems().getPolicyName()) + // .setNightRates() + .setSupplier("Supplier XYZ") + .setAmountFields("Amount A, Amount B") + .setOverStandardReason(orderInfo.getFoulReason()) + .setAgreementHotel(String.valueOf(orderInfo.getProtocolType())); + // .setBOOK_ORG_STRUCT_1("Org A") + // .setBOOK_ORG_STRUCT_2("Org B") + // .setBOOK_ORG_STRUCT_3("Org C") + // .setProjectOrderNo("PROJ789") + // .setCostCenter("COST123") - return hotelOrderDetail; + return hotelOrderDetail; } - private List getCustomers(List residentList) { + private List getCustomers(List residentList) { List list = residentList.stream() .map(resident -> { diff --git a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java index d4883a98..e31806fe 100644 --- a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java +++ b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; import java.util.Optional; -import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN; +import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y; @Component @@ -49,7 +49,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { HotelDetailResponse.Data data = hotelDetailResponse.getData(); return Optional.of( OrderLegData.builder() - .productType(LEG_TYPE_TRAIN) + .productType(LEG_TYPE_HOTEL) .outOrderNo(data.getOrderInfo().getOrderSerialNo()) .price(String.valueOf(data.getOrderInfo().getTotalPrice())) .actualOrderNo(data.getOrderInfo().getOrderSerialNo()) @@ -63,7 +63,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { CarDetailResponse.Data data = carDetailResponse.getData(); return Optional.of( OrderLegData.builder() - .productType(LEG_TYPE_TRAIN) + .productType(LEG_TYPE_TAXI) .outOrderNo(data.getOrderNo()) .price(String.valueOf(data.getTotalAmount())) .actualOrderNo(data.getOutOrderNo()) @@ -78,7 +78,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { FlightOrderDetail.Data data = flightOrderDetail.getData(); return Optional.of( OrderLegData.builder() - .productType(LEG_TYPE_TRAIN) + .productType(LEG_TYPE_AIRPLANE) // .orderNo(data.get()) // .price(String.valueOf( data.getTotalAmount())) // .actualOrderNo(data.getOutOrderNo()) diff --git a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java index 8ae3319f..85668c5b 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java @@ -38,7 +38,7 @@ public class BPMController { @PostMapping("/reschedule/back") public Result rescheduleBack(@RequestBody BPMBack bpmBack) { //获取订单号和审批结果 - + System.out.println("bpmBack = " + bpmBack); return Result.Success(CommonMessageConstant.SUCCESS); } } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java index 3217e55b..3bdd6e6f 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/train/TrainDetailResponse.java @@ -53,7 +53,7 @@ public class TrainDetailResponse { private int bookType; private int trainIndex; private String relationOrderNo; - + private Boolean ruleViolate; // Constructors, Getters, and Setters } @Data