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 baeb09cc..2b79dadc 100644 --- a/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java +++ b/src/main/java/com/chint/domain/service/supplier/LYOrderDataAdapter.java @@ -1,7 +1,10 @@ package com.chint.domain.service.supplier; +import com.chint.domain.aggregates.order.Location; +import com.chint.domain.repository.LocationRepository; import com.chint.domain.value_object.OrderLegData; import com.chint.domain.value_object.SupplierCallbackData; +import com.chint.infrastructure.constant.OrderConstant; import com.chint.interfaces.rest.ly.dto.ResultBackHotel; import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult; import com.chint.interfaces.rest.ly.dto.flydatapushback.FlyDetailResult; @@ -11,6 +14,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.TrainDetailResult; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Optional; @@ -20,6 +24,10 @@ import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_ @Component public class LYOrderDataAdapter implements OrderDataAdapter { + + @Autowired + private LocationRepository locationRepository; + @Override public Optional adapt(SupplierCallbackData supplierData) { return switch (supplierData.getProductType()) { @@ -54,6 +62,9 @@ public class LYOrderDataAdapter implements OrderDataAdapter { private Optional hotelDateProcess(HotelDetailResult hotelDetailResult) { HotelDetailResponse.Data data = hotelDetailResult.getHotelDetailResponse().getData(); ResultBackHotel.DataObject dataObject = hotelDetailResult.getDataObject(); + String cityName = data.getHotelInfo().getCityName(); + long cityId = data.getHotelInfo().getCityId(); + return Optional.of( OrderLegData.builder() .productType(LEG_TYPE_HOTEL) @@ -62,12 +73,30 @@ public class LYOrderDataAdapter implements OrderDataAdapter { .selfOrderNo(dataObject.getTravelData().getTravelApplyNo()) .actualOrderNo(data.getOrderInfo().getOrderSerialNo()) .hotelOrderDetailData(hotelDetailResult) - // .orderStatus() - // .originOrderStatus() + .orderTime(data.getOrderInfo().getCreateTime()) + .startTime(data.getOrderInfo().getOriginalCheckInDate()) + .endTime(data.getOrderInfo().getOriginalCheckOutDate()) + .orderStatus(hotelState(data.getOrderInfo().getOrderStatusDesc())) + .originOrderStatus(data.getOrderInfo().getOrderStatusDesc()) + .originId(cityId) + .originName(cityName) + .destinationId(cityId) + .destinationName(cityName) .supplierName(SUPPLIER_L_Y) .build() ); } + public Integer hotelState(String subNotifyType) { + return switch (subNotifyType) { + case "确认中" -> OrderConstant.ORDER_EVENT_PAYED;//确认中 + case "待入住" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单, + case "已退房","已入住" -> OrderConstant.ORDER_EVENT_FINISH;//已完成 + case "已取消" -> OrderConstant.ORDER_EVENT_CANCEL;//取消 + case "待提交" -> OrderConstant.ORDER_EVENT_PREPARE;//未下单 + case "待支付" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单 + default -> -99; + }; + } private Optional carDateProcess(CarDetailResult carDetailResult) { CarDetailResponse.Data data = carDetailResult.getCarDetailResponse().getData(); 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 bf63a9cf..fbe7ff2f 100644 --- a/src/main/java/com/chint/domain/value_object/OrderLegData.java +++ b/src/main/java/com/chint/domain/value_object/OrderLegData.java @@ -20,7 +20,7 @@ public class OrderLegData { private String orderTime; //下单时间 private String startTime; //开始时间 private String endTime; //结束时间 - private Long originId; + private Long originId; private String originName; private Long destinationId; private String destinationName; @@ -84,6 +84,7 @@ public class OrderLegData { private Object flightOrderDetailData; private Object otherOrderDetailData; + public Builder() { } @@ -92,6 +93,21 @@ public class OrderLegData { return this; } + public Builder originName(String originName) { + this.originName = originName; + return this; + } + + + public Builder destinationName(String destinationName) { + this.destinationName = destinationName; + return this; + } + + public void setDestinationName(String destinationName) { + this.destinationName = destinationName; + } + public Builder trainOrderDetailData(Object trainOrderDetailData) { this.trainOrderDetailData = trainOrderDetailData; return this; @@ -132,6 +148,7 @@ public class OrderLegData { return this; } + public Builder originId(Long originId) { this.originId = originId; return this; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java index eb7ac14a..3c1a6311 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/ResultBackHotel.java @@ -29,40 +29,40 @@ public class ResultBackHotel { @Data public static class OrderInfo { - private int orderType; + private Integer orderType; private String orderSerialNo; private String outEnterpriseId; - private int protocolType; - private double saveTotalPrice; - private double totalStandardPrice; + private Integer protocolType; + private Double saveTotalPrice; + private Double totalStandardPrice; private String outEmployeeId; private String employeeId; private String employeeCode; private String changeOrderSerialNo; - private boolean isChangeOrder; - private int orderStatus; + private Boolean isChangeOrder; + private Integer orderStatus; private String orderStatusDesc; private String createTime; - private int payType; - private int paymentType; - private double totalPrice; - private double diffPrice; - private double personalDiffPrice; - private double companyDiffPrice; - private double roomTotalPrice; - private double servicePrice; - private double afterSettlementServicePrice; + private Integer payType; + private Integer paymentType; + private Double totalPrice; + private Double diffPrice; + private Double personalDiffPrice; + private Double companyDiffPrice; + private Double roomTotalPrice; + private Double servicePrice; + private Double afterSettlementServicePrice; private String contactName; private String contactPhone; private String contactEmail; private String refundRule; - private String refundIntro; + private String refundIntegerro; private String servicePhone; - private boolean canRefund; - private double companyPrice; - private double personalPrice; + private Boolean canRefund; + private Double companyPrice; + private Double personalPrice; private String supplierOrderCreateTime; - private boolean ruleViolate; + private Boolean ruleViolate; private RuleViolateDetail ruleViolateDetail; private String foulReason; private String foulReasonCode; @@ -71,10 +71,10 @@ public class ResultBackHotel { private String cancelReasons; private String customerOrderNo; private String customerRefundOrderNo; - private int customerInvoiceCode; + private Integer customerInvoiceCode; private String customerInvoiceDesc; - private int halfDayRoom; - private double businessAmount; + private Integer halfDayRoom; + private Double businessAmount; } @Data @@ -92,23 +92,23 @@ public class ResultBackHotel { private String checkInDate; private String checkOutDate; private String hotelTel; - private int checkInTime; + private Integer checkIntegerime; private String roomName; private String bedType; private String breakfast; - private int roomNum; - private int nightNum; - private double bdLon; - private double bdLat; + private Integer roomNum; + private Integer nightNum; + private Double bdLon; + private Double bdLat; } @Data public static class DayPrice { private String date; private String dateStr; - private double price; - private double marketPrice; - private double savePrice; + private Double price; + private Double marketPrice; + private Double savePrice; private String breakfast; } @@ -146,16 +146,16 @@ public class ResultBackHotel { private String checkInDate; private String checkOutDate; private String confirmNo; - private int orderStatus; + private Integer orderStatus; private String orderStatusDesc; - private double salesPrice; - private double costPrice; - private double marketPrice; - private double savePrice; - private double standardPrice; + private Double salesPrice; + private Double costPrice; + private Double marketPrice; + private Double savePrice; + private Double standardPrice; private String dayStandardPrice; - private double servicePrice; - private double afterSettlementServicePrice; + private Double servicePrice; + private Double afterSettlementServicePrice; } diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java index d73c83bf..60f17e83 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import static com.chint.infrastructure.constant.Constant.*; +import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; /** * 酒店订单数据回推控制层 @@ -61,6 +62,14 @@ public class HotelBackController { //状态映射 command.eventType(mapHotelState(notification.getSubNotifyType())); command.sendToQueue(); + if (dataObject.getOrderInfo().getRuleViolate()){ + OrderStatusChangeCommand command2 = Command.of(OrderStatusChangeCommand.class) + .orderNo(serialNo) + .outStatus(String.valueOf(notification.getSubNotifyType())); + //状态映射 + command.eventType(ORDER_EVENT_ETA); + command.sendToQueue(); + } return new LYNoteResponse("100", "成功收到消息"); } return new LYNoteResponse("200", "未收到消息"); @@ -72,6 +81,7 @@ public class HotelBackController { case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中 case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房 case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败 + // case 50 -> OrderConstant.ORDER_EVENT_ETA;//超标 default -> -99; }; }