From 8e0830d5888b1c2beed0c9d4e92e079d24edf55a Mon Sep 17 00:00:00 2001 From: huangxh3 Date: Fri, 1 Mar 2024 10:51:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/aggregates/order/OrderDetail.java | 1 + .../service/leg_event/LegEventHandler.java | 1 - .../service/supplier/LYOrderDataAdapter.java | 7 +- .../domain/value_object/OrderLegData.java | 14 ++- .../java/com/chint/RouteApplicationTests.java | 85 ++++++++++++++++++- 5 files changed, 103 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index 80881c49..a91158ca 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -38,6 +38,7 @@ public class OrderDetail { private LocalDateTime endTime; private LocalDateTime createTime; private LocalDateTime updateTime; + // 根据需要添加构造函数、getter、setter等 @MappedCollection(idColumn = "order_id", keyColumn = "order_key") private List orderEventList; diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index dd6cf0a5..17fdace9 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -153,7 +153,6 @@ public class LegEventHandler implements LegEventService { if (byOrderNo.isEmpty()) { //否则创建新的订单添加到routeOrder orderDetail = orderDetailFactory.create(data) - .price(data.getPrice()).productType(data.getProductType()) .employeeNo(routeOrder.getUserId()); routeOrder.addOrderDetail(orderDetail); routeOrder = routeRepository.save(routeOrder); 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 ccb4b370..baeb09cc 100644 --- a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java +++ b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java @@ -44,6 +44,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { .selfOrderNo(data.getOutOrderNo()) .price(String.valueOf(data.getTotalAmount())) .outOrderNo(data.getOutOrderNo()) + .selfOrderNo(data.getTravelData().getTravelApplyNo()) .trainOrderDetailData(trainDetailResult) .supplierName(SUPPLIER_L_Y) .build() @@ -58,9 +59,11 @@ public class LYOrderDataAdapter implements OrderDataAdapter { .productType(LEG_TYPE_HOTEL) .outOrderNo(data.getOrderInfo().getOrderSerialNo()) .price(String.valueOf(data.getOrderInfo().getTotalPrice())) - //.selfOrderNo() + .selfOrderNo(dataObject.getTravelData().getTravelApplyNo()) .actualOrderNo(data.getOrderInfo().getOrderSerialNo()) .hotelOrderDetailData(hotelDetailResult) + // .orderStatus() + // .originOrderStatus() .supplierName(SUPPLIER_L_Y) .build() ); @@ -74,6 +77,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { .outOrderNo(data.getOrderSerialNo()) .price(String.valueOf(data.getTotalAmount())) .actualOrderNo(data.getOutOrderNo()) + .selfOrderNo(data.getTravelData().getTravelApplyNo()) .carOrderDetailData(carDetailResult) .supplierName(SUPPLIER_L_Y) .build() @@ -89,6 +93,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter { // .orderNo(data.get()) // .price(String.valueOf( data.getTotalAmount())) // .actualOrderNo(data.getOutOrderNo()) + .selfOrderNo(data.getTravelData().getTravelApplyNo()) .flightOrderDetailData(flyDetailResult) .supplierName(SUPPLIER_L_Y) .build() diff --git a/src/main/java/com/chint/domain/value_object/OrderLegData.java b/src/main/java/com/chint/domain/value_object/OrderLegData.java index 95c66dca..bf63a9cf 100644 --- a/src/main/java/com/chint/domain/value_object/OrderLegData.java +++ b/src/main/java/com/chint/domain/value_object/OrderLegData.java @@ -21,7 +21,9 @@ public class OrderLegData { private String startTime; //开始时间 private String endTime; //结束时间 private Long originId; + private String originName; private Long destinationId; + private String destinationName; private String currencyCode; private Object carOrderDetailData; @@ -31,7 +33,6 @@ public class OrderLegData { private Object otherOrderDetailData; - private OrderLegData(Builder builder) { this.actualOrderNo = builder.actualOrderNo; this.outOrderNo = builder.outOrderNo; @@ -74,7 +75,8 @@ public class OrderLegData { private String endTime; //结束时间 private Long originId; private Long destinationId; - + private String originName; + private String destinationName; private String currencyCode; private Object carOrderDetailData; private Object trainOrderDetailData; @@ -89,18 +91,22 @@ public class OrderLegData { this.carOrderDetailData = carOrderDetailData; return this; } + public Builder trainOrderDetailData(Object trainOrderDetailData) { this.trainOrderDetailData = trainOrderDetailData; return this; } + public Builder hotelOrderDetailData(Object hotelOrderDetailData) { this.hotelOrderDetailData = hotelOrderDetailData; return this; } + public Builder flightOrderDetailData(Object flightOrderDetailData) { this.flightOrderDetailData = flightOrderDetailData; return this; } + public Builder otherOrderDetailData(Object otherOrderDetailData) { this.otherOrderDetailData = otherOrderDetailData; return this; @@ -115,18 +121,22 @@ public class OrderLegData { this.orderTime = orderTime; return this; } + public Builder startTime(String startTime) { this.startTime = startTime; return this; } + public Builder endTime(String endTime) { this.endTime = endTime; return this; } + public Builder originId(Long originId) { this.originId = originId; return this; } + public Builder destinationId(Long destinationId) { this.destinationId = destinationId; return this; diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 4562179d..5248a35b 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -1,6 +1,8 @@ package com.chint; import cn.hutool.extra.pinyin.PinyinUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.chint.application.services.login.strategy.PailaLoginStrategy; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.user.User; @@ -8,13 +10,22 @@ import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; import com.chint.infrastructure.util.Digest; +import com.chint.interfaces.rest.ly.LYSearchRequest; +import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.*; +import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.user.UserHttpRequest; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.lang.reflect.Type; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; @@ -33,6 +44,9 @@ class RouteApplicationTests { @Autowired private RouteRepository routeRepository; + @Autowired + private LYSearchRequest lySearchRequest; + @Autowired private OrderDetailRepository orderDetailRepository; @@ -55,10 +69,79 @@ class RouteApplicationTests { System.out.println(parse); } @Test + void test2(){ + String a= "HO20240229085100068373"; + HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(a); + } + + @Test + void test1(){ + String a = "{\n" + + " \"orderInfo\": {\n" + + " \"orderType\": 0,\n" + + " \"orderSerialNo\": \"HO20240228142000572942\",\n" + + " \"outEnterpriseId\": \"\",\n" + + " \"protocolType\": 2,\n" + + " \"saveTotalPrice\": 0,\n" + + " \"totalStandardPrice\": 240,\n" + + " \"outEmployeeId\": \"230615020\",\n" + + " \"employeeId\": \"0544b18aff8c5855\",\n" + + " \"employeeCode\": \"\",\n" + + " \"changeOrderSerialNo\": null,\n" + + " \"isChangeOrder\": false,\n" + + " \"orderStatus\": 1,\n" + + " \"orderStatusDesc\": \"确认中\",\n" + + " \"createTime\": \"2024-02-28T14:21:00\",\n" + + " \"payType\": 1,\n" + + " \"paymentType\": 1,\n" + + " \"totalPrice\": 20,\n" + + " \"diffPrice\": 0,\n" + + " \"personalDiffPrice\": 0,\n" + + " \"companyDiffPrice\": 0,\n" + + " \"roomTotalPrice\": 5,\n" + + " \"servicePrice\": 15,\n" + + " \"afterSettlementServicePrice\": 0,\n" + + " \"contactName\": \"卢麟哲\",\n" + + " \"contactPhone\": \"18188539959\",\n" + + " \"contactEmail\": \"\",\n" + + " \"refundRule\": \"不可取消和修改\",\n" + + " \"refundIntro\": \"订单经确认后,若因预订人自身或其他非法定原因要求变更、取消或者、未按时入住的,或将扣除您全部或部分房费。\",\n" + + " \"servicePhone\": \"请致电400-822-5060咨询客服\",\n" + + " \"canRefund\": false,\n" + + " \"companyPrice\": 20,\n" + + " \"personalPrice\": 0,\n" + + " \"supplierOrderCreateTime\": \"0001-01-01T00:00:00\",\n" + + " \"ruleViolate\": false,\n" + + " \"ruleViolateDetail\": {\n" + + " \"items\": [],\n" + + " \"policyName\": \"STANDARD_LEVEL_FOUR\"\n" + + " },\n" + + " \"foulReason\": \"\",\n" + + " \"foulReasonCode\": \"\",\n" + + " \"foulReasonNote\": \"\",\n" + + " \"apiNotifyUrl\": null,\n" + + " \"cancelReasons\": \"\",\n" + + " \"customerOrderNo\": \"\",\n" + + " \"customerRefundOrderNo\": \"\",\n" + + " \"customerInvoiceCode\": 0,\n" + + " \"customerInvoiceDesc\": \"普票\",\n" + + " \"halfDayRoom\": 0,\n" + + " \"businessAmount\": 20\n" + + " }\n" + + "}"; + + JSONObject jsonObj = JSON.parseObject(a); + OrderInfo orderInfo = jsonObj.getJSONObject("orderInfo").toJavaObject(OrderInfo.class); + + System.out.println(orderInfo); + + System.out.println(orderInfo.getOrderSerialNo()); + } + @Test void loginSign() { String sfno = "230615020"; String syscode = "FSSC"; - String billcode = "CLSQ240226000100"; + String billcode = "CLSQ20240228"; String companycode = "正泰集团股份有限公司"; String sec = "Superdandan"; String timespan = "1708908662738";