日常提交

This commit is contained in:
huangxh3 2024-03-01 16:05:51 +08:00
parent 86e3b21554
commit d141719eec
4 changed files with 98 additions and 42 deletions

View File

@ -1,7 +1,10 @@
package com.chint.domain.service.supplier; 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.OrderLegData;
import com.chint.domain.value_object.SupplierCallbackData; 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.ResultBackHotel;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult; import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult;
import com.chint.interfaces.rest.ly.dto.flydatapushback.FlyDetailResult; 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.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.TrainDetailResult; import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.TrainDetailResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Optional; import java.util.Optional;
@ -20,6 +24,10 @@ import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_
@Component @Component
public class LYOrderDataAdapter implements OrderDataAdapter { public class LYOrderDataAdapter implements OrderDataAdapter {
@Autowired
private LocationRepository locationRepository;
@Override @Override
public Optional<OrderLegData> adapt(SupplierCallbackData supplierData) { public Optional<OrderLegData> adapt(SupplierCallbackData supplierData) {
return switch (supplierData.getProductType()) { return switch (supplierData.getProductType()) {
@ -54,6 +62,9 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
private Optional<OrderLegData> hotelDateProcess(HotelDetailResult hotelDetailResult) { private Optional<OrderLegData> hotelDateProcess(HotelDetailResult hotelDetailResult) {
HotelDetailResponse.Data data = hotelDetailResult.getHotelDetailResponse().getData(); HotelDetailResponse.Data data = hotelDetailResult.getHotelDetailResponse().getData();
ResultBackHotel.DataObject dataObject = hotelDetailResult.getDataObject(); ResultBackHotel.DataObject dataObject = hotelDetailResult.getDataObject();
String cityName = data.getHotelInfo().getCityName();
long cityId = data.getHotelInfo().getCityId();
return Optional.of( return Optional.of(
OrderLegData.builder() OrderLegData.builder()
.productType(LEG_TYPE_HOTEL) .productType(LEG_TYPE_HOTEL)
@ -62,12 +73,30 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
.selfOrderNo(dataObject.getTravelData().getTravelApplyNo()) .selfOrderNo(dataObject.getTravelData().getTravelApplyNo())
.actualOrderNo(data.getOrderInfo().getOrderSerialNo()) .actualOrderNo(data.getOrderInfo().getOrderSerialNo())
.hotelOrderDetailData(hotelDetailResult) .hotelOrderDetailData(hotelDetailResult)
// .orderStatus() .orderTime(data.getOrderInfo().getCreateTime())
// .originOrderStatus() .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) .supplierName(SUPPLIER_L_Y)
.build() .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<OrderLegData> carDateProcess(CarDetailResult carDetailResult) { private Optional<OrderLegData> carDateProcess(CarDetailResult carDetailResult) {
CarDetailResponse.Data data = carDetailResult.getCarDetailResponse().getData(); CarDetailResponse.Data data = carDetailResult.getCarDetailResponse().getData();

View File

@ -84,6 +84,7 @@ public class OrderLegData {
private Object flightOrderDetailData; private Object flightOrderDetailData;
private Object otherOrderDetailData; private Object otherOrderDetailData;
public Builder() { public Builder() {
} }
@ -92,6 +93,21 @@ public class OrderLegData {
return this; 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) { public Builder trainOrderDetailData(Object trainOrderDetailData) {
this.trainOrderDetailData = trainOrderDetailData; this.trainOrderDetailData = trainOrderDetailData;
return this; return this;
@ -132,6 +148,7 @@ public class OrderLegData {
return this; return this;
} }
public Builder originId(Long originId) { public Builder originId(Long originId) {
this.originId = originId; this.originId = originId;
return this; return this;

View File

@ -29,40 +29,40 @@ public class ResultBackHotel {
@Data @Data
public static class OrderInfo { public static class OrderInfo {
private int orderType; private Integer orderType;
private String orderSerialNo; private String orderSerialNo;
private String outEnterpriseId; private String outEnterpriseId;
private int protocolType; private Integer protocolType;
private double saveTotalPrice; private Double saveTotalPrice;
private double totalStandardPrice; private Double totalStandardPrice;
private String outEmployeeId; private String outEmployeeId;
private String employeeId; private String employeeId;
private String employeeCode; private String employeeCode;
private String changeOrderSerialNo; private String changeOrderSerialNo;
private boolean isChangeOrder; private Boolean isChangeOrder;
private int orderStatus; private Integer orderStatus;
private String orderStatusDesc; private String orderStatusDesc;
private String createTime; private String createTime;
private int payType; private Integer payType;
private int paymentType; private Integer paymentType;
private double totalPrice; private Double totalPrice;
private double diffPrice; private Double diffPrice;
private double personalDiffPrice; private Double personalDiffPrice;
private double companyDiffPrice; private Double companyDiffPrice;
private double roomTotalPrice; private Double roomTotalPrice;
private double servicePrice; private Double servicePrice;
private double afterSettlementServicePrice; private Double afterSettlementServicePrice;
private String contactName; private String contactName;
private String contactPhone; private String contactPhone;
private String contactEmail; private String contactEmail;
private String refundRule; private String refundRule;
private String refundIntro; private String refundIntegerro;
private String servicePhone; private String servicePhone;
private boolean canRefund; private Boolean canRefund;
private double companyPrice; private Double companyPrice;
private double personalPrice; private Double personalPrice;
private String supplierOrderCreateTime; private String supplierOrderCreateTime;
private boolean ruleViolate; private Boolean ruleViolate;
private RuleViolateDetail ruleViolateDetail; private RuleViolateDetail ruleViolateDetail;
private String foulReason; private String foulReason;
private String foulReasonCode; private String foulReasonCode;
@ -71,10 +71,10 @@ public class ResultBackHotel {
private String cancelReasons; private String cancelReasons;
private String customerOrderNo; private String customerOrderNo;
private String customerRefundOrderNo; private String customerRefundOrderNo;
private int customerInvoiceCode; private Integer customerInvoiceCode;
private String customerInvoiceDesc; private String customerInvoiceDesc;
private int halfDayRoom; private Integer halfDayRoom;
private double businessAmount; private Double businessAmount;
} }
@Data @Data
@ -92,23 +92,23 @@ public class ResultBackHotel {
private String checkInDate; private String checkInDate;
private String checkOutDate; private String checkOutDate;
private String hotelTel; private String hotelTel;
private int checkInTime; private Integer checkIntegerime;
private String roomName; private String roomName;
private String bedType; private String bedType;
private String breakfast; private String breakfast;
private int roomNum; private Integer roomNum;
private int nightNum; private Integer nightNum;
private double bdLon; private Double bdLon;
private double bdLat; private Double bdLat;
} }
@Data @Data
public static class DayPrice { public static class DayPrice {
private String date; private String date;
private String dateStr; private String dateStr;
private double price; private Double price;
private double marketPrice; private Double marketPrice;
private double savePrice; private Double savePrice;
private String breakfast; private String breakfast;
} }
@ -146,16 +146,16 @@ public class ResultBackHotel {
private String checkInDate; private String checkInDate;
private String checkOutDate; private String checkOutDate;
private String confirmNo; private String confirmNo;
private int orderStatus; private Integer orderStatus;
private String orderStatusDesc; private String orderStatusDesc;
private double salesPrice; private Double salesPrice;
private double costPrice; private Double costPrice;
private double marketPrice; private Double marketPrice;
private double savePrice; private Double savePrice;
private double standardPrice; private Double standardPrice;
private String dayStandardPrice; private String dayStandardPrice;
private double servicePrice; private Double servicePrice;
private double afterSettlementServicePrice; private Double afterSettlementServicePrice;
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import static com.chint.infrastructure.constant.Constant.*; 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.eventType(mapHotelState(notification.getSubNotifyType()));
command.sendToQueue(); 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("100", "成功收到消息");
} }
return new LYNoteResponse("200", "未收到消息"); return new LYNoteResponse("200", "未收到消息");
@ -72,6 +81,7 @@ public class HotelBackController {
case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中 case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中
case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房 case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房
case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败 case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败
// case 50 -> OrderConstant.ORDER_EVENT_ETA;//超标
default -> -99; default -> -99;
}; };
} }