From 55f2ae28dde7cee7f9f9b91115711081a7964e16 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Sat, 24 Feb 2024 20:35:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=9B=9E=E6=8E=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aggregates/order/CarOrderDetail.java | 117 +++++++++++ .../aggregates/order/FlightOrderDetail.java | 183 ++++++++++++++++++ .../aggregates/order/HotelOrderDetail.java | 141 ++++++++++++++ .../aggregates/order/TrainOrderDetail.java | 144 ++++++++++++++ .../domain/aggregates/standards/Ranks.java | 34 ++-- .../aggregates/standards/TravelStandards.java | 2 - .../CTripOrderExtensionFactoryImpl.java | 32 +++ .../LYOrderExtensionFactoryImpl.java | 33 ++++ .../order_detail/OrderDetailFactory.java | 10 - .../order_detail/OrderDetailFactoryImpl.java | 25 --- .../order_detail/OrderExtensionCreator.java | 25 +++ .../order_detail/OrderExtensionFactory.java | 18 ++ .../domain/service/OrderDomainService.java | 2 + .../supplier/CTripOrderDataAdapter.java | 1 - .../domain/value_object/OrderLegData.java | 12 +- .../infrastructure/constant/Constant.java | 5 +- .../com/chint/infrastructure/util/Digest.java | 9 +- .../rest/ctrip/CTripApprovalRequest.java | 8 +- .../rest/ctrip/CTripAuditRequest.java | 59 ++++++ .../rest/ctrip/CTripEstimateRequest.java | 9 + .../rest/ctrip/CTripLocationHttpRequest.java | 11 +- .../rest/ctrip/CTripLoginRequest.java | 28 ++- .../rest/ctrip/CTripOrderSearchRequest.java | 8 +- .../rest/ctrip/CTripTicketRequest.java | 24 +++ .../rest/ctrip/CTripTokenRequest.java | 8 + .../rest/ctrip/CTripUserSaveRequest.java | 9 + .../rest/ctrip/dto/audit/AuditParam.java | 101 ++++++++++ .../rest/ctrip/dto/audit/AuditResponse.java | 11 ++ .../rest/ctrip/dto/login/H5TicketModel.java | 6 +- .../rest/ctrip/in/CTripNoteController.java | 8 +- .../rest/user/UserHttpRequestImpl.java | 150 +++++++------- src/main/resources/application-dev.yml | 9 + src/main/resources/application-prod.yml | 2 + src/main/resources/application-test.yml | 34 ++-- 34 files changed, 1104 insertions(+), 174 deletions(-) create mode 100644 src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java create mode 100644 src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java create mode 100644 src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionCreator.java create mode 100644 src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java create mode 100644 src/main/java/com/chint/interfaces/rest/ctrip/CTripAuditRequest.java create mode 100644 src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditParam.java create mode 100644 src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditResponse.java diff --git a/src/main/java/com/chint/domain/aggregates/order/CarOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/CarOrderDetail.java index edce6e8e..ae4d41e0 100644 --- a/src/main/java/com/chint/domain/aggregates/order/CarOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/CarOrderDetail.java @@ -9,4 +9,121 @@ import org.springframework.data.relational.core.mapping.Table; public class CarOrderDetail { @Id private Long id; + + // 订单号 + private String orderNo; + + // 是否超标 + private String overStandard; + + // 父级订单号 + private String parentOrderNo; + + // 原始订单号 + private String originalOrderNo; + + // 订单状态 + private String orderStatus; + + // 核算企业id + private String accountCompanyId; + + // 核算企业名称 + private String accountCompanyName; + + // 申请单号 + private String receiptsNum; + + // 行程编号 + private String scheduleNum; + + // 预订人Code + private String bookingUserCode; + + // 预订人姓名 + private String bookingName; + + // 预订人电话 + private String bookingUserPhone; + + // 订单创建时间 格式:2023-04-26 13:15:17 + private String createTime; + + // 出发时间 格式:2023-04-26 13:15:17 + private String startTime; + + // 到达时间 格式:2023-04-26 13:15:17 + private String arriveTime; + + // 出发地 + private String fromStationName; + + // 到达地 + private String toStationName; + + // 车型 + private String carModel; + + // 出发城市 + private String fromCity; + + // 到达城市 + private String toCity; + + // 运行时长 01:08 表示 1小时8分钟 + private String runTime; + + // 里程数 + private String mileage; + + // 订单总额(含前收服务费) + private String orderAmount; + + // 取消费 + private String cancellationFee; + + // 差标 + private String standardItems; + + // 用车人姓名 + private String userName; + + // 用车人code + private String userCode; + + // 用车人手机号 + private String phone; + + // 资源供应商 + private String supplier; + + // 个人支付金额 + private String personalPaymentAmount; + + // 公司统付金额 + private String companyPaymentAmount; + + // 超标原因 + private String overStandardReason; + + // 用车人组织架构信息1 + private String BOOK_ORG_STRUCT_1; + + // 用车人组织架构信息2 + private String BOOK_ORG_STRUCT_2; + + // 用车人组织架构信息3 + private String BOOK_ORG_STRUCT_3; + + // 付款方式 0:公司统付 1:个人付 2:混付 + private String paymentType; + + // 项目订单号 + private String projectOrderNo; + + // 成本中心 + private String costCenter; + + // 高速费 + private String tollFee; } diff --git a/src/main/java/com/chint/domain/aggregates/order/FlightOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/FlightOrderDetail.java index 66659d7e..7a9b591a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/FlightOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/FlightOrderDetail.java @@ -9,4 +9,187 @@ import org.springframework.data.relational.core.mapping.Table; public class FlightOrderDetail { @Id private Long id; + + // 订单号 + private String orderNo; + + // 是否超标 + private String overStandard; + + // 父级订单号 + private String parentOrderNo; + + // 原始订单号 + private String originalOrderNo; + + // 订单状态:1-出票成功,2-改签成功,3-退票成功 + private String orderStatus; + + // 核算企业id + private String accountCompanyId; + + // 核算企业名称 + private String accountCompanyName; + + // 差旅申请单 + private String receiptsNum; + + // 行程编号 + private String scheduleNum; + + // 改签后行程编号 + private String changedScheduleNum; + + // 预订人code + private String bookingUserCode; + + // 预订人姓名 + private String bookingName; + + // 预订人电话 + private String bookingUserPhone; + + // 订单创建时间 格式:2023-04-26 13:15:17 + private String createTime; + + // 起飞时间 格式:2023-04-26 13:15:17 + private String startTime; + + // 到达时间 格式:2023-04-26 13:15:17 + private String arriveTime; + + // 起飞城市名称 + private String startCityName; + + // 起飞城市编码 + private String startCityCode; + + // 起飞机场名称 + private String startAirportName; + + // 起飞机场三字码 + private String startAirportCode; + + // 起飞航站楼 + private String startTerminal; + + // 到达城市名称 + private String endCityName; + + // 到达城市编码 + private String endCityCode; + + // 到达机场名称 + private String endAirportName; + + // 到达机场三字码 + private String endAirportCode; + + // 到达航站楼 + private String endTerminal; + + // 航程公里数 + private String distance; + + // 航空公司名称 + private String flightCompName; + + // 航班号 + private String flightNum; + + // 舱位 + private String seatPoint; + + // 舱位名称 + private String seatPointName; + + // 订单总额 + private String orderAmount; + + // 前收服务费 + private String preServiceFee; + + // 后收服务费 + private String postServiceFee; + + // 退款总额 + private String refundAmount; + + // 机票信息 + private String tickets; + + // 燃油费 + private String fuelTax; + + // 机建费 + private String airportTax; + + // 票面价 + private String facePrice; + + // 改签费 + private String changeFee; + + // 退票手续费 + private String refundFee; + + // 升舱费 + private String upFee; + + // 舱位及折扣 + private String standard; + + // 票号 + private String ticketNo; + + // 改签后票号 + private String changedTicketNo; + + // 出行人姓名 + private String userName; + + // 出行人code + private String userCode; + + // 是否超标 + private String isOverStandard; + + // 出行人手机号 + private String phone; + + // 付款方式 0:公司统付 1:个人付 2:混付 + private String paymentType; + + // 未预订最低价原因 + private String notBookedLowestPriceReason; + + // 资源供应商 + private String supplier; + + // 个人支付金额 + private String personalPaymentAmount; + + // 公司统付金额 + private String companyPaymentAmount; + + // 超标原因 + private String overStandardReason; + + // 出行人组织架构信息1 + private String BOOK_ORG_STRUCT_1; + + // 出行人组织架构信息2 + private String BOOK_ORG_STRUCT_2; + + // 出行人组织架构信息3 + private String BOOK_ORG_STRUCT_3; + + // 保险费 + private String insuranceFee; + + // 项目订单号 + private String projectOrderNo; + + // 成本中心 + private String costCenter; } diff --git a/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java index b725f9c6..bff8204a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java @@ -10,4 +10,145 @@ import org.springframework.data.relational.core.mapping.Table; public class HotelOrderDetail { @Id private Long id; + + // 订单号 + private String orderNo; + + // 是否超标 + private String overStandard; + + // 订单状态:1-预订成功,3-全部退订成功,4-部分退订成功 + private String orderStatus; + + // 核算企业id + private String accountCompanyId; + + // 核算企业名称 + private String accountCompanyName; + + // 申请单号 + private String receiptsNum; + + // 行程编号 + private String scheduleNum; + + // 预订人Code + private String bookingUserCode; + + // 预订人姓名 + private String bookingName; + + // 预订人电话 + private String bookingUserPhone; + + // 订单创建时间 格式:2023-04-26 13:15:17 + private String createTime; + + // 入住城市 + private String checkInCity; + + // 酒店名称 + private String hotelName; + + // 酒店电话 + private String contactPhone; + + // 酒店地址 + private String hotelAddress; + + // 星级 + private String starRate; + + // 入住日期 格式:2022-09-10 + private String checkInDate; + + // 离店日期 格式:2022-09-10 + private String departureDate; + + // 夜晚数 + private String nightCount; + + // 房间数 + private String roomCount; + + // 退订夜间数 + private String refundRoomNightCount; + + // 房型 + private String roomTypeName; + + // 付款方式 0:公司统付 1:个人付 2:混付 + private String paymentType; + + // 企业统付总额 + private String companyAmount; + + // 个人支付总额 + private String personalAmount; + + // 企业退款金额 + private String companyRefundAmount; + + // 个人退款金额 + private String personalRefundAmount; + + // 订单总额 + private String orderAmount; + + // 前收服务费 + private String preServiceFee; + + // 后收服务费 + private String postServiceFee; + + // 退款总额 + private String refundAmount; + + // 入住人信息 + private String customers; + + // 入住人性别 + private String gender; + + // 入住人姓名 + private String userName; + + // 入住人code + private String userCode; + + // 入住人手机号 + private String phone; + + // 入离日期内差标 + private String standardItems; + + // 间夜信息 + private String nightRates; + + // 资源供应商 + private String supplier; + + // 涉及金额字段都要取回 + private String amountFields; + + // 超标原因 + private String overStandardReason; + + // 是否协议酒店 + private String agreementHotel; + + // 入住人组织架构信息1 + private String BOOK_ORG_STRUCT_1; + + // 入住人组织架构信息2 + private String BOOK_ORG_STRUCT_2; + + // 入住人组织架构信息3 + private String BOOK_ORG_STRUCT_3; + + // 项目订单号 + private String projectOrderNo; + + // 成本中心 + private String costCenter; } 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 bc94e5fc..4b0e62ac 100644 --- a/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/TrainOrderDetail.java @@ -10,4 +10,148 @@ import org.springframework.data.relational.core.mapping.Table; public class TrainOrderDetail { @Id private Long id; + + // 订单号 + private String orderNo; + + // 是否超标 + private String overStandard; + + // 父级订单号 + private String parentOrderNo; + + // 原始订单号 + private String originalOrderNo; + + // 订单状态:1-出票成功,2-改签成功,3-退票成功 + private String orderStatus; + + // 核算企业id + private String accountCompanyId; + + // 核算企业名称 + private String accountCompanyName; + + // 申请单号 + private String receiptsNum; + + // 行程编号 + private String scheduleNum; + + // 预订人Code + private String bookingUserCode; + + // 预订人姓名 + private String bookingName; + + // 预订人电话 + private String bookingUserPhone; + + // 订单创建时间 格式:2023-04-26 13:15:17 + private String createTime; + + // 出发时间 格式:2023-04-26 13:15:17 + private String startTime; + + // 到达时间 格式:2023-04-26 13:15:17 + private String arriveTime; + + // 出发站 + private String fromStationName; + + // 到达站 + private String toStationName; + + // 车次 + private String trainNo; + + // 出发城市 + private String fromCity; + + // 到达城市 + private String toCity; + + // 运行时长 01:08 表示 1小时8分钟 + private String runTime; + + // 订单总额(含前收服务费) + private String orderAmount; + + // 前收服务费 + private String preServiceFee; + + // 后收服务费 + private String postServiceFee; + + // 退款总额 + private String refundAmount; + + // 改签差额 高改低时为负数,平改时为0,低改高为正数 + private String changeDifference; + + // 改签手续费 + private String changeCost; + + // 火车票信息 + private String tickets; + + // 座位等级 + private String seatType; + + // 座位 + private String seatName; + + // 票价 + private String ticketPrice; + + // 退款手续费 + private String refundCost; + + // 退款金额 + private String refundPrice; + + // 差标 + private String standardItems; + + // 出行人姓名 + private String userName; + + // 出行人code + private String userCode; + + // 出行人手机号 + private String phone; + + // 资源供应商 + private String supplier; + + // 个人支付金额 + private String personalAmount; + + // 公司统付金额 + private String companyAmount; + + // 超标原因 + private String overStandardReason; + + // 出行人组织架构信息1 + private String BOOK_ORG_STRUCT_1; + + // 出行人组织架构信息2 + private String BOOK_ORG_STRUCT_2; + + // 出行人组织架构信息3 + private String BOOK_ORG_STRUCT_3; + + // 付款方式 0:公司统付 1:个人付 2:混付 + private String paymentType; + + // 保险费 + private String insuranceFee; + + // 项目订单号 + private String projectOrderNo; + + // 成本中心 + private String costCenter; } diff --git a/src/main/java/com/chint/domain/aggregates/standards/Ranks.java b/src/main/java/com/chint/domain/aggregates/standards/Ranks.java index df9df39f..ee3c33d9 100644 --- a/src/main/java/com/chint/domain/aggregates/standards/Ranks.java +++ b/src/main/java/com/chint/domain/aggregates/standards/Ranks.java @@ -18,23 +18,23 @@ public class Ranks { private String companyCode; private String standardLevel; private String uniqueWord; - @MappedCollection(idColumn = "rank_id", keyColumn = "rank_key") - private List differenceStandardsList; +// @MappedCollection(idColumn = "rank_id", keyColumn = "rank_key") +// private List differenceStandardsList; // 构造函数、getter和setter方法省略 - public Ranks addStandards(DifferenceStandards differenceStandards) { - if (this.differenceStandardsList == null) { - this.differenceStandardsList = new ArrayList<>(); - } - - // 查找并移除具有相同 productType 的 DifferenceStandards 对象 - // 移除相同 productType 的对象 - this.differenceStandardsList - .removeIf(existingStandards -> existingStandards.getProductType() - .equals(differenceStandards.getProductType())); - - // 添加新的 DifferenceStandards 对象 - this.differenceStandardsList.add(differenceStandards); - return this; - } +// public Ranks addStandards(DifferenceStandards differenceStandards) { +// if (this.differenceStandardsList == null) { +// this.differenceStandardsList = new ArrayList<>(); +// } +// +// // 查找并移除具有相同 productType 的 DifferenceStandards 对象 +// // 移除相同 productType 的对象 +// this.differenceStandardsList +// .removeIf(existingStandards -> existingStandards.getProductType() +// .equals(differenceStandards.getProductType())); +// +// // 添加新的 DifferenceStandards 对象 +// this.differenceStandardsList.add(differenceStandards); +// return this; +// } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/standards/TravelStandards.java b/src/main/java/com/chint/domain/aggregates/standards/TravelStandards.java index 0f05c231..a9237650 100644 --- a/src/main/java/com/chint/domain/aggregates/standards/TravelStandards.java +++ b/src/main/java/com/chint/domain/aggregates/standards/TravelStandards.java @@ -25,7 +25,5 @@ public class TravelStandards { private String standardLevel; //城市类别 private String cityTag;//1:直辖市,省会,特别行政区,2:其它城市 - - } 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 new file mode 100644 index 00000000..37f7257f --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -0,0 +1,32 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.aggregates.order.*; +import org.springframework.stereotype.Component; + +@Component +public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{ + @Override + public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { + return null; + } + + @Override + public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { + return null; + } + + @Override + public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) { + return null; + } + + @Override + public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) { + return null; + } + + @Override + public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) { + return null; + } +} 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 new file mode 100644 index 00000000..af182aa5 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -0,0 +1,33 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.aggregates.order.*; +import com.chint.domain.value_object.*; +import org.springframework.stereotype.Component; + +@Component +public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{ + @Override + public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { + return null; + } + + @Override + public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { + return null; + } + + @Override + public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) { + return null; + } + + @Override + public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) { + return null; + } + + @Override + public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) { + return null; + } +} diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java index 148120e3..8a0f6f7c 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java @@ -8,14 +8,4 @@ public interface OrderDetailFactory { OrderEvent createEvent(Integer eventType, String outStatus); - CarOrderDetail createCarOrderDetail(CarOrderDetailData carOrderDetailData); - - TrainOrderDetail createTrainOrderDetail(TrainOrderDetailData trainOrderDetailData); - - FlightOrderDetail createFlightOrderDetail(FlightOrderDetailData flightOrderDetailData); - - HotelOrderDetail createHotelOrderDetail(HotelOrderDetailData hotelOrderDetailData); - - OtherOrderDetail createOtherOrderDetail(OtherOrderDetailData otherOrderDetailData); - } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java index abf3b269..75305c62 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java @@ -29,29 +29,4 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { orderEvent.setHappenTime(LocalDateTime.now()); return orderEvent; } - - @Override - public CarOrderDetail createCarOrderDetail(CarOrderDetailData carOrderDetailData) { - return null; - } - - @Override - public TrainOrderDetail createTrainOrderDetail(TrainOrderDetailData trainOrderDetailData) { - return null; - } - - @Override - public FlightOrderDetail createFlightOrderDetail(FlightOrderDetailData flightOrderDetailData) { - return null; - } - - @Override - public HotelOrderDetail createHotelOrderDetail(HotelOrderDetailData hotelOrderDetailData) { - return null; - } - - @Override - public OtherOrderDetail createOtherOrderDetail(OtherOrderDetailData otherOrderDetailData) { - return null; - } } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionCreator.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionCreator.java new file mode 100644 index 00000000..57f89c35 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionCreator.java @@ -0,0 +1,25 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.exceptions.NotFoundException; +import com.chint.domain.service.order_sync.SupplierOrderSync; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.Constant.*; + +@Component +public class OrderExtensionCreator { + + @Autowired + private LYOrderExtensionFactoryImpl lyOrderExtensionFactory; + @Autowired + private CTripOrderExtensionFactoryImpl cTripOrderExtensionFactory; + + public OrderExtensionFactory of(String supplierName) { + return switch (supplierName) { + case SUPPLIER_C_TRIP -> cTripOrderExtensionFactory; + case SUPPLIER_L_Y -> lyOrderExtensionFactory; + default -> throw new NotFoundException(NOT_FOUND); + }; + } +} diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java new file mode 100644 index 00000000..edc2d8fc --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java @@ -0,0 +1,18 @@ +package com.chint.domain.factoriy.order_detail; + +import com.chint.domain.aggregates.order.*; +import com.chint.domain.value_object.*; + +public interface OrderExtensionFactory { + + CarOrderDetail createCarOrderDetail(Object carOrderDetailData); + + TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData); + + FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData); + + HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData); + + OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData); + +} diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index acb34138..9629f94b 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -97,5 +97,7 @@ public class OrderDomainService { orderDetail.addOrderEvent(event); orderDetailRepository.save(orderDetail); }); + + //这里如果发现事件的状态为Approving2 , 需要根据发送审批给bpm,需要先查询订单数据 } } diff --git a/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java b/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java index f9c310f4..f3865fb1 100644 --- a/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java +++ b/src/main/java/com/chint/domain/service/supplier/CTripOrderDataAdapter.java @@ -64,7 +64,6 @@ public class CTripOrderDataAdapter implements OrderDataAdapter { .orderStatus(translateHotelOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus())) .originOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus()) .price(hotelOrderInfoEntity.getAmount()); - } // 处理航班订单 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 a00c7537..c1d088d6 100644 --- a/src/main/java/com/chint/domain/value_object/OrderLegData.java +++ b/src/main/java/com/chint/domain/value_object/OrderLegData.java @@ -24,11 +24,13 @@ public class OrderLegData { private Long destinationId; private String currencyCode; - private CarOrderDetailData carOrderDetailData; - private TrainOrderDetailData trainOrderDetailData; - private HotelOrderDetailData hotelOrderDetailData; - private FlightOrderDetailData flightOrderDetailData; - private OtherOrderDetailData otherOrderDetailData; + private Object carOrderDetailData; + private Object trainOrderDetailData; + private Object hotelOrderDetailData; + private Object flightOrderDetailData; + private Object otherOrderDetailData; + + private OrderLegData(Builder builder) { this.actualOrderNo = builder.actualOrderNo; diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index ce920a17..a550c3a9 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -198,7 +198,6 @@ public class Constant { public static final String SUPPLIER_L_Y_CN_NAME = "同程"; // 携程 - public static final String C_TRIP_BASE_URL = "https://ct.ctrip.com"; public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket"; public static final String C_TRIP_LOGIN_PATH = "/singlesignon/openapi/saml/login"; public static final String C_TRIP_ENTITY_ID = "/zhengtai"; @@ -223,8 +222,12 @@ public class Constant { public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken"; public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login"; public static final String C_TRIP_SINGLE_LOGIN = "/m/SingleSignOn/H5SignInfo"; + public static final String C_TRIP_AUDIT_PATH = "/corpservice/AuditService/Audit"; public static final String C_TRIP_REQUEST_SECRET = "zhengtai2024_nEbmKfOo"; + public static final String C_TRIP_AUDIT_ACTION_SUCCESS = "T"; + public static final String C_TRIP_AUDIT_ACTION_FAIL = "F"; + //同程 public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi"; diff --git a/src/main/java/com/chint/infrastructure/util/Digest.java b/src/main/java/com/chint/infrastructure/util/Digest.java index ac754f9f..90f29b82 100644 --- a/src/main/java/com/chint/infrastructure/util/Digest.java +++ b/src/main/java/com/chint/infrastructure/util/Digest.java @@ -2,6 +2,8 @@ package com.chint.infrastructure.util; import com.chint.interfaces.rest.ctrip.dto.put.CTripNotification; import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; @@ -13,10 +15,10 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; -import static com.chint.infrastructure.constant.Constant.C_TRIP_REQUEST_SECRET; public class Digest { + public static String md5(String input) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -79,7 +81,8 @@ public class Digest { public static String getPutCTripStatusSign(String corpId, String productType, String orderStatus, - String orderId) { + String orderId, + String C_TRIP_REQUEST_SECRET) { //构造字典 HashMap hashMap = new HashMap(); hashMap.put("secret", C_TRIP_REQUEST_SECRET); @@ -102,7 +105,7 @@ public class Digest { return DigestUtils.sha1Hex(str).toUpperCase(); } - public static String getPutCTripEventSign(CTripNotification postRequest) { + public static String getPutCTripEventSign(CTripNotification postRequest,String C_TRIP_REQUEST_SECRET) { //构造字典 HashMap hashMap = new HashMap<>(); hashMap.put("secret", C_TRIP_REQUEST_SECRET); diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java index 32021ad6..37dce106 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripApprovalRequest.java @@ -6,6 +6,7 @@ import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequestOut; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult; import com.chint.interfaces.rest.ctrip.dto.Authentication; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import static com.chint.infrastructure.constant.Constant.*; @@ -13,14 +14,19 @@ import static com.chint.infrastructure.constant.Constant.*; @Service public class CTripApprovalRequest { + @Value("${cTrip.baseUrl}") + private String C_TRIP_BASE_URL; + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + private String approvalUrl = C_TRIP_BASE_URL + C_TRIP_APPROVAL_PATH; @Autowired private CTripTicketRequest ticketRequest; + @Autowired private PostRequest postRequest; - public ApprovalResult approval(ApprovalRequest approvalRequest) { ApprovalRequestOut approvalRequestOut = new ApprovalRequestOut(); approvalRequestOut.setRequest(approvalRequest); diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripAuditRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripAuditRequest.java new file mode 100644 index 00000000..745713b5 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripAuditRequest.java @@ -0,0 +1,59 @@ +package com.chint.interfaces.rest.ctrip; + + +import com.chint.infrastructure.util.Digest; +import com.chint.interfaces.rest.base.PostRequest; +import com.chint.interfaces.rest.ctrip.dto.audit.AuditParam; +import com.chint.interfaces.rest.ctrip.dto.audit.AuditResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.Constant.*; + +@Component +public class CTripAuditRequest { + + @Value("${cTrip.auditBaseUrl}") + private String auditBaseUrl; + + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + + @Value("${cTrip.appSecurity}") + private String C_TRIP_APP_SECURITY; + @Autowired + private PostRequest postRequest; + + @Autowired + private CTripTicketRequest cTripTicketRequest; + private final String auditUrl = auditBaseUrl + C_TRIP_AUDIT_PATH; + + public AuditResponse auditSuccess(String orderNo, Integer orderType) { + return audit(orderNo, orderType, C_TRIP_AUDIT_ACTION_SUCCESS); + } + + public AuditResponse auditFail(String orderNo, Integer orderType) { + return audit(orderNo, orderType, C_TRIP_AUDIT_ACTION_FAIL); + } + + private AuditResponse audit(String orderNo, Integer orderType, String auditType) { + String sign = Digest.md5( + orderNo + orderType + auditType + + Digest.md5(C_TRIP_APP_SECURITY) + ); + AuditParam auditParam = AuditParam.builder() + .auth() + .ticket(cTripTicketRequest.loadAuditTicket()) + .appkey(C_TRIP_APP_KEY) + .build() + .audittype(auditType) + .orderid(orderNo) + .ordertype(orderType) + .signature(sign) + .build(); + return postRequest.post(auditUrl, auditParam, AuditResponse.class); + } +} + + diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java index c9510b51..219da6b5 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripEstimateRequest.java @@ -11,6 +11,7 @@ import com.chint.interfaces.rest.ctrip.dto.estimate.request.TrainProductInfo; import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse; import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.nio.charset.StandardCharsets; @@ -20,6 +21,14 @@ import static com.chint.infrastructure.constant.Constant.*; @Component public class CTripEstimateRequest { + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Value("${cTrip.corpId}") + private String C_TRIP_CORP_ID; + private String apiName = "bookingRelatedOpenApi.valuateBudget"; private String estimateUrl = C_TRIP_BASE_URL + C_TRIP_ESTIMATE_PATH; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLocationHttpRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLocationHttpRequest.java index dcf42f7b..7e37af1f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLocationHttpRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLocationHttpRequest.java @@ -4,6 +4,7 @@ import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.dto.Authentification; import com.chint.interfaces.rest.ctrip.dto.location.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.List; @@ -14,14 +15,20 @@ import static com.chint.infrastructure.constant.Constant.*; public class CTripLocationHttpRequest implements LocationHttpRequest { + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Autowired private PostRequest postRequest; @Autowired private CTripTicketRequest ticketRequest; - private static final String locationCityUrl = C_TRIP_BASE_URL + HOTEL_CITY_PATH; - private static final String locationCountryUrl = C_TRIP_BASE_URL + HOTEL_COUNTRY_PATH; + private final String locationCityUrl = C_TRIP_BASE_URL + HOTEL_CITY_PATH; + private final String locationCountryUrl = C_TRIP_BASE_URL + HOTEL_COUNTRY_PATH; @Override diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java index 0d9340cd..f0502a66 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java @@ -15,6 +15,7 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.io.IOException; @@ -33,25 +34,36 @@ import static com.chint.infrastructure.constant.Constant.*; @Component public class CTripLoginRequest { + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + @Autowired private PostRequest postRequest; @Autowired private CTripTicketRequest ticketRequest; @Autowired private CTripTokenRequest tokenRequest; - private String loginUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_PATH; + @Value("${cTrip.appId}") + private String C_TRIP_APP_ID; + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Value("${cTrip.corpId}") + private String C_TRIP_CORP_ID; + @Value("${cTrip.appSecurity}") + private String C_TRIP_APP_SECURITY; + private final String loginUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_PATH; //PC单点登录 - private String authLoginUrl = C_TRIP_BASE_URL + C_TRIP_AUTH_LOGIN; + private final String authLoginUrl = C_TRIP_BASE_URL + C_TRIP_AUTH_LOGIN; - private String hSinngleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; + private final String hSinngleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; //H5单点登录 - private String singleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; + private final String singleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; - private String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_TICKET; - private String IDPEntityID = C_TRIP_ENTITY_ID; - private String corpId = C_TRIP_CORP_ID; + private final String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_TICKET; + private final String IDPEntityID = C_TRIP_ENTITY_ID; + private final String corpId = C_TRIP_CORP_ID; public String login(CTripLoginParam loginParam) { loginParam.setCorpID(corpId); @@ -127,7 +139,7 @@ public class CTripLoginRequest { } private String loadLoginToken() { - H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(), H5LoginToken.class); + H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(C_TRIP_APP_KEY, C_TRIP_APP_SECURITY), H5LoginToken.class); return h5TokenResponse.getToken(); } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java index 667d4894..3f59c6e7 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripOrderSearchRequest.java @@ -4,13 +4,19 @@ import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderRequest; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import static com.chint.infrastructure.constant.Constant.*; @Service public class CTripOrderSearchRequest { - private String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH; + + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + private final String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH; @Autowired private PostRequest postRequest; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripTicketRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripTicketRequest.java index c3b31520..d34bbb0e 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripTicketRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripTicketRequest.java @@ -4,6 +4,7 @@ import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.dto.ticket.TicketParam; import com.chint.interfaces.rest.ctrip.dto.ticket.TicketResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -16,7 +17,19 @@ public class CTripTicketRequest { @Autowired private PostRequest postRequest; + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + + @Value("${cTrip.auditBaseUrl}") + public String C_TRIP_AUDIT_BASE_URL; + + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Value("${cTrip.appSecurity}") + private String C_TRIP_APP_SECURITY; + private final String ticketUrl = C_TRIP_BASE_URL + TICKET_PATH; + private final String AuditTicketUrl = C_TRIP_AUDIT_BASE_URL + TICKET_PATH; private final TicketParam ticketParam = new TicketParam(C_TRIP_APP_KEY, C_TRIP_APP_SECURITY); // Data class to store ticket and expiry time @@ -40,6 +53,7 @@ public class CTripTicketRequest { // Cached ticket instance private CachedTicket cachedTicket = null; + private CachedTicket cachedAuditTicket = null; public String loadTicket() { // Check if the cached ticket exists and is valid @@ -52,4 +66,14 @@ public class CTripTicketRequest { cachedTicket = new CachedTicket(ticket.getTicket(), LocalDateTime.now().plusHours(2)); return ticket.getTicket(); } + + public String loadAuditTicket() { + if (cachedAuditTicket != null && cachedAuditTicket.getExpiryTime().isAfter(LocalDateTime.now())) { + return cachedAuditTicket.getTicket(); + } + System.out.println(ticketParam); + TicketResponse ticket = postRequest.post(AuditTicketUrl, ticketParam, TicketResponse.class); + cachedAuditTicket = new CachedTicket(ticket.getTicket(), LocalDateTime.now().plusHours(2)); + return ticket.getTicket(); + } } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripTokenRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripTokenRequest.java index 395ec8b1..a126102b 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripTokenRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripTokenRequest.java @@ -5,6 +5,7 @@ import com.chint.interfaces.rest.ctrip.dto.token.AccessTokenResponse; import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenRequest; import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import static com.chint.infrastructure.constant.Constant.*; @@ -12,6 +13,13 @@ import static com.chint.infrastructure.constant.Constant.*; @Service public class CTripTokenRequest { + + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Value("${cTrip.appSecurity}") + private String C_TRIP_APP_SECURITY; private String tokenUrl = C_TRIP_BASE_URL + C_TRIP_TOKEN_PATH; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java index c243433b..40942ba5 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java @@ -9,6 +9,7 @@ import com.chint.interfaces.rest.ctrip.dto.user.AuthenticationInfo; import com.chint.interfaces.rest.ctrip.dto.user.AuthenticationListRequest; import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.List; @@ -26,6 +27,14 @@ public class CTripUserSaveRequest { @Autowired private CTripTicketRequest ticketRequest; + @Value("${cTrip.baseUrl}") + public String C_TRIP_BASE_URL; + + @Value("${cTrip.appKey}") + private String C_TRIP_APP_KEY; + @Value("${cTrip.corpId}") + private String C_TRIP_CORP_ID; + private final String userUrl = C_TRIP_BASE_URL + C_TRIP_USER_SAVE_PATH; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditParam.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditParam.java new file mode 100644 index 00000000..14fd878f --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditParam.java @@ -0,0 +1,101 @@ +package com.chint.interfaces.rest.ctrip.dto.audit; + +import lombok.Data; + +@Data +public class AuditParam { + private final Auth Auth; + private final String OrderId; + private final int OrderType; + private final String AuditType; + private final String Signature; + + public static Builder builder() { + return new Builder(); + } + + private AuditParam(Builder builder) { + this.Auth = builder.auth; + this.OrderId = builder.orderid; + this.OrderType = builder.ordertype; + this.AuditType = builder.audittype; + this.Signature = builder.signature; + } + + // Getters + + @Data + public static class Auth { + private final String Ticket; + private final String AppKey; + + private Auth(AuthBuilder builder) { + this.Ticket = builder.ticket; + this.AppKey = builder.appkey; + } + + // Getters + + public static class AuthBuilder { + private Builder parentBuilder; + private String ticket; + private String appkey; + + + public AuthBuilder(Builder parentBuilder) { + this.parentBuilder = parentBuilder; + } + + public AuthBuilder ticket(String ticket) { + this.ticket = ticket; + return this; + } + + public AuthBuilder appkey(String appkey) { + this.appkey = appkey; + return this; + } + + public Builder build() { + parentBuilder.auth = new Auth(this); + return parentBuilder; + } + } + } + + public static class Builder { + private Auth auth; + private String orderid; + private int ordertype; + private String audittype; + private String signature; + + public Auth.AuthBuilder auth() { + return new Auth.AuthBuilder(this); + } + + public Builder orderid(String orderid) { + this.orderid = orderid; + return this; + } + + public Builder ordertype(int ordertype) { + this.ordertype = ordertype; + return this; + } + + public Builder audittype(String audittype) { + this.audittype = audittype; + return this; + } + + public Builder signature(String signature) { + this.signature = signature; + return this; + } + + public AuditParam build() { + return new AuditParam(this); + } + } +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditResponse.java new file mode 100644 index 00000000..4b6dbf1a --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/audit/AuditResponse.java @@ -0,0 +1,11 @@ +package com.chint.interfaces.rest.ctrip.dto.audit; + +import com.chint.interfaces.rest.ctrip.dto.ResponseStatus; +import lombok.Data; + +@Data +public class AuditResponse { + private Long OrderId; + private String AuditType; //订单类型 + private ResponseStatus Status; +} diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/H5TicketModel.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/H5TicketModel.java index 967b1966..1fe6b515 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/H5TicketModel.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/login/H5TicketModel.java @@ -2,15 +2,15 @@ package com.chint.interfaces.rest.ctrip.dto.login; import lombok.Data; -import static com.chint.infrastructure.constant.Constant.C_TRIP_APP_KEY; -import static com.chint.infrastructure.constant.Constant.C_TRIP_APP_SECURITY; @Data public class H5TicketModel { + + private String AppKey; private String AppSecurity; - public static H5TicketModel build(){ + public static H5TicketModel build(String C_TRIP_APP_KEY,String C_TRIP_APP_SECURITY){ H5TicketModel h5TicketModel = new H5TicketModel(); h5TicketModel.setAppKey(C_TRIP_APP_KEY); h5TicketModel.setAppSecurity(C_TRIP_APP_SECURITY); diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java index bcabd4f5..6998e125 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java @@ -10,6 +10,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification; import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -22,6 +23,9 @@ import static com.chint.infrastructure.constant.Constant.*; public class CTripNoteController { + @Value("${cTrip.requestSecret}") + private String C_TRIP_REQUEST_SECRET; + @Autowired private SupplierService supplierService; @@ -53,7 +57,7 @@ public class CTripNoteController { String productType = cTripStatusNotification.getProductType(); String orderStatus = cTripStatusNotification.getOrderStatus(); String orderId = cTripStatusNotification.getOrderId(); - String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId); + String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET); if (!putCTripSign.equals(cTripStatusNotification.getSign())) { return new CTripStatusResponse("1", "sign错误"); } @@ -64,7 +68,7 @@ public class CTripNoteController { .searchOrderResponseByOrderId(orderId); supplierCallbackData.data(response); supplierService.handleSupplierCallback(supplierCallbackData); - + OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) .orderNo(orderId) .outStatus(orderStatus); diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index c612bc79..11f87a31 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -5,18 +5,15 @@ package com.chint.interfaces.rest.user; //import com.chint.dc.api.dto.DataCenterOption; //import com.chint.dc.api.service.DataCenterService; -import com.chint.dc.api.DataCenterResult; -import com.chint.dc.api.dto.DataCenterOption; -import com.chint.dc.api.service.DataCenterService; import com.chint.domain.aggregates.standards.Ranks; import com.chint.domain.aggregates.user.User; import com.chint.domain.service.RankDomainService; -import com.chint.infrastructure.util.BaseContext; -import com.chint.infrastructure.util.StringCheck; import com.chint.interfaces.rest.base.PostRequest; -import com.chint.interfaces.rest.user.dto.*; +import com.chint.interfaces.rest.user.dto.AccessKeyDTO; +import com.chint.interfaces.rest.user.dto.TravelRankDTO; +import com.chint.interfaces.rest.user.dto.TravelRankParam; +import com.chint.interfaces.rest.user.dto.TravelRankResponseDTO; import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClients; @@ -24,11 +21,6 @@ import org.apache.http.util.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.reflect.Type; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Optional; - import static com.chint.infrastructure.constant.Constant.*; @Service @@ -79,73 +71,75 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private User loadSFInfo(User user) { - Gson gson = new Gson(); - AccessKeyDTO akSkLoad = akSkLoad(); - DataCenterOption option = new DataCenterOption(); - option.setSk(akSkLoad.sk); - option.setAk(akSkLoad.ak); - option.setUrl(OPENAI_BASE_URL); - DataCenterService dataCenterService = new DataCenterService(option); - LinkedHashMap map = new LinkedHashMap(); - map.put("LoginUsername", user.getEmployeeNo().toString()); - map.put("start", 0); - map.put("pageSize", 99); - DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); - Type type = new TypeToken>() { - }.getType(); - if (result.getData() != null) { - List fromJson = gson.fromJson(result.getData().toString(), type); -// UserDataDTO userDataDTO = fromJson.get(0); - String companyCode = user.getCompanyCode(); - if (companyCode == null) { - companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); - } - String newCompanyCode = companyCode; +// Gson gson = new Gson(); +// AccessKeyDTO akSkLoad = akSkLoad(); +// DataCenterOption option = new DataCenterOption(); +// option.setSk(akSkLoad.sk); +// option.setAk(akSkLoad.ak); +// option.setUrl(OPENAI_BASE_URL); +// DataCenterService dataCenterService = new DataCenterService(option); +// LinkedHashMap map = new LinkedHashMap(); +// map.put("LoginUsername", user.getEmployeeNo().toString()); +// map.put("start", 0); +// map.put("pageSize", 99); +// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); +// Type type = new TypeToken>() { +// }.getType(); +// if (result.getData() != null) { +//// List fromJson = gson.fromJson(result.getData().toString(), type); +//// UserDataDTO userDataDTO = fromJson.get(0); +// String companyCode = user.getCompanyCode(); +// if (companyCode == null) { +// companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); +// } +// String newCompanyCode = companyCode; +// +// if (fromJson.size() == 1) { +// UserDataDTO userData = fromJson.get(0); +// user.setCompanyCode(userData.getCompany()); +// user.setWorkStatus(userData.getStatus()); +// user.setGender(userData.getGender()); +// user.setName(userData.getUname()); +// user.setPhoneNumber(userData.getMobilePhone()); +// user.setManaLevel(userData.getCust_manaLevel()); +// user.setProfLevel(userData.getCust_profLevel()); +// } else { +// Optional first; +// +// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配 +// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) { +// first = fromJson.stream() +// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode)) +// .findFirst(); +// +// } else { +// first = fromJson.stream() +// .filter(userData -> userData.getCompany().equals(newCompanyCode)) +// .findFirst(); +// } +// first.ifPresent( +// userData -> { +// user.setCompanyCode(userData.getCompany()); +// user.setWorkStatus(userData.getStatus()); +// user.setGender(userData.getGender()); +// user.setName(userData.getUname()); +// user.setPhoneNumber(userData.getMobilePhone()); +// } +// ); +// fromJson.stream() +// .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal())) +// .findFirst() +// .ifPresent(userData -> { +// user.setManaLevel(userData.getCust_manaLevel()); +// user.setProfLevel(userData.getCust_profLevel()); +// }); +// } +// return user; +// } else { +// throw new RuntimeException("用户数据不存在"); +// } - if (fromJson.size() == 1) { - UserDataDTO userData = fromJson.get(0); - user.setCompanyCode(userData.getCompany()); - user.setWorkStatus(userData.getStatus()); - user.setGender(userData.getGender()); - user.setName(userData.getUname()); - user.setPhoneNumber(userData.getMobilePhone()); - user.setManaLevel(userData.getCust_manaLevel()); - user.setProfLevel(userData.getCust_profLevel()); - } else { - Optional first; - - //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配 - if (StringCheck.isFirstCharacterChinese(newCompanyCode)) { - first = fromJson.stream() - .filter(userData -> userData.getCompany_cn().equals(newCompanyCode)) - .findFirst(); - - } else { - first = fromJson.stream() - .filter(userData -> userData.getCompany().equals(newCompanyCode)) - .findFirst(); - } - first.ifPresent( - userData -> { - user.setCompanyCode(userData.getCompany()); - user.setWorkStatus(userData.getStatus()); - user.setGender(userData.getGender()); - user.setName(userData.getUname()); - user.setPhoneNumber(userData.getMobilePhone()); - } - ); - fromJson.stream() - .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal())) - .findFirst() - .ifPresent(userData -> { - user.setManaLevel(userData.getCust_manaLevel()); - user.setProfLevel(userData.getCust_profLevel()); - }); - } - return user; - } else { - throw new RuntimeException("用户数据不存在"); - } + return null; } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 4ddc4b34..799d13ca 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -15,3 +15,12 @@ logging: level: org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.StatementCreatorUtils: TRACE + +cTrip: + baseUrl: https://ct.ctrip.com + auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi + appId: zhengtai2024 + corpId: zhengtai2024 + appKey: obk_zhengtai2024 + appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO + requestSecret: zhengtai2024_nEbmKfOo diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 418f5ccb..5a6443c5 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -11,3 +11,5 @@ chint: password: 123456 url: https://gxdev03.chint.com/businesstravel/ +cTrip: + baseUrl: https://ct.ctrip.com \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index fc7169c1..77efa2e7 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,29 +1,33 @@ server: port: 8081 -#chint: -# datasource: -# driver-class-name: com.mysql.cj.jdbc.Driver -# host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com -# # host: 10.9.56.48 -# port: 3306 -# database: itinerary_booking -# username: echo -# password: R3nd0mP@ssw0rd! -# url: https://gxdev03.chint.com/businesstravel/ - chint: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - host: 10.10.24.44 + host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com # host: 10.9.56.48 - port: 6603 + port: 3306 database: itinerary_booking - username: tripbook - password: W@Xgf25d&lRk*L0X# + username: echo + password: R3nd0mP@ssw0rd! url: https://gxdev03.chint.com/businesstravel/ +#chint: +# datasource: +# driver-class-name: com.mysql.cj.jdbc.Driver +# host: 10.10.24.44 +# # host: 10.9.56.48 +# port: 6603 +# database: itinerary_booking +# username: tripbook +# password: W@Xgf25d&lRk*L0X# +# url: https://gxdev03.chint.com/businesstravel/ + logging: level: org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.StatementCreatorUtils: TRACE + + +cTrip: + baseUrl: https://ct.ctrip.com \ No newline at end of file