修复酒店数据回推无法成功的问题

This commit is contained in:
lulz1 2024-03-21 20:50:29 +08:00
parent 58069e3c6c
commit 591ac54dd7
9 changed files with 100 additions and 78 deletions

View File

@ -160,6 +160,10 @@ public class OrderDetailQuery {
Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0) { Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0) {
return null; return null;
} }
HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail); HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail);
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
orderDetailDto.setApplicantId(routeOrder.getUserId()); orderDetailDto.setApplicantId(routeOrder.getUserId());

View File

@ -4,6 +4,7 @@ package com.chint.domain.aggregates.order;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
@ -124,7 +125,8 @@ public class HotelOrderDetail implements Serializable {
private String refundAmount; private String refundAmount;
// 入住人信息 // 入住人信息
@MappedCollection(idColumn = "hotel_order_detail_id", keyColumn = "hotel_order_detail_key") // @MappedCollection(idColumn = "hotel_order_detail_id", keyColumn = "hotel_order_detail_key")
@Transient
private List<HotelOrderDetailCustomer> customers; private List<HotelOrderDetailCustomer> customers;
// 入离日期内差标 // 入离日期内差标

View File

@ -7,6 +7,7 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
@Data @Data
@Table("hotel_order_detail_customer") @Table("hotel_order_detail_customer")
@ -27,4 +28,17 @@ public class HotelOrderDetailCustomer implements Serializable {
// 入住人手机号 // 入住人手机号
private String phone; private String phone;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HotelOrderDetailCustomer that = (HotelOrderDetailCustomer) o;
return Objects.equals(userName, that.userName);
}
@Override
public int hashCode() {
return Objects.hash(userName);
}
} }

View File

@ -221,7 +221,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
} else { } else {
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
} }
//携程创建的飞机订单只有取消和预定成功两个状态 //携程创建的飞机订单只有
if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){ if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
} }

View File

@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -82,18 +83,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first); FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first);
//飞机票状态属性保存 //飞机票状态属性保存
OrderEvent lastEvent = orderDetail.getLastEvent(); //根据查询到的订单信息重新进行映射
if (lastEvent != null) { Integer orderStatus = orderDetails.getOrderStatus();
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus()); flightOrderDetail.setOrderStatus(
} else { OrderEvent.mapToFlightOrderDetailStatus(
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射 LYOrderUtil.mapFlightStatus(orderStatus.toString())
Integer orderStatus = orderDetails.getOrderStatus(); )
flightOrderDetail.setOrderStatus( );
OrderEvent.mapToFlightOrderDetailStatus(
LYOrderUtil.mapFlightStatus(orderStatus.toString())
)
);
}
if (orderDetails.getIsChangeOrder()) { if (orderDetails.getIsChangeOrder()) {
//如果发现同程的订单号里面还有C就能够判断出 它是改签订单 //如果发现同程的订单号里面还有C就能够判断出 它是改签订单
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE); flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
@ -272,7 +269,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
customer.setUserName(resident.getName()); customer.setUserName(resident.getName());
customer.setPhone(resident.getContactPhone()); customer.setPhone(resident.getContactPhone());
customer.setUserCode(resident.getEmployeeCode()); customer.setUserCode(resident.getEmployeeCode());
hotelOrderDetail.addCustomer(customer); // hotelOrderDetail.addCustomer(customer);
} }
} }
@ -280,7 +277,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
List<HotelDetailResponse.Room> roomList = data.getRoomList(); List<HotelDetailResponse.Room> roomList = data.getRoomList();
if (roomList != null && !roomList.isEmpty()) { if (roomList != null && !roomList.isEmpty()) {
HotelDetailResponse.Room room = roomList.get(0); HotelDetailResponse.Room room = roomList.get(0);
hotelOrderDetail.setStandardItems(room.getDayStandardPrice()); String dayStandardPrice = room.getDayStandardPrice();
String[] split = dayStandardPrice.split(",");
List<String> list = Arrays.asList(split);
if (!list.isEmpty()) {
hotelOrderDetail.setStandardItems(list.get(0));
}
} }
return hotelOrderDetail; return hotelOrderDetail;
@ -430,7 +432,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
customer.setUserName(resident.getName()); customer.setUserName(resident.getName());
customer.setPhone(resident.getContactPhone()); customer.setPhone(resident.getContactPhone());
customer.setUserCode(resident.getEmployeeCode()); customer.setUserCode(resident.getEmployeeCode());
hotelOrderDetail.addCustomer(customer); // hotelOrderDetail.addCustomer(customer);
} }
} }

View File

@ -110,17 +110,19 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
//如果已经存在的话 那么这些基础字段就不用重新构建了 //如果已经存在的话 那么这些基础字段就不用重新构建了
return orderDetail.getFlightOrderDetail(); return orderDetail.getFlightOrderDetail();
} }
//如果订单存在直接配置该订单的超标信息和原因 if(orderDetail.getOrderEventList() != null){
orderDetail.getOrderEventList() //如果订单存在直接配置该订单的超标信息和原因
.stream() orderDetail.getOrderEventList()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) .stream()
.findFirst() .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.ifPresentOrElse(it -> { .findFirst()
flightOrderDetail.setOverStandard(""); .ifPresentOrElse(it -> {
flightOrderDetail.setOverStandardReason(it.getExtension()); flightOrderDetail.setOverStandard("");
}, () -> flightOrderDetail.setOverStandard("")); flightOrderDetail.setOverStandardReason(it.getExtension());
flightOrderDetail.setOrderNo(orderDetail.getOrderNo()); }, () -> flightOrderDetail.setOverStandard(""));
flightOrderDetail.setDetailId(orderDetail.getOrderNo()); flightOrderDetail.setOrderNo(orderDetail.getOrderNo());
flightOrderDetail.setDetailId(orderDetail.getOrderNo());
}
} else { } else {
flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class); flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class);
} }
@ -139,22 +141,24 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
//如果已经存在的话 那么这些基础字段就不用重新构建了 //如果已经存在的话 那么这些基础字段就不用重新构建了
return order.getTrainOrderDetail(); return order.getTrainOrderDetail();
} }
//如果订单存在直接配置该订单的超标信息和原因 if(order.getOrderEventList() != null){
order.getOrderEventList() //如果订单存在直接配置该订单的超标信息和原因
.stream() order.getOrderEventList()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) .stream()
.findFirst() .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.ifPresentOrElse(it -> { .findFirst()
trainOrderDetail.setOverStandard(""); .ifPresentOrElse(it -> {
trainOrderDetail.setOverStandardReason(it.getExtension()); trainOrderDetail.setOverStandard("");
}, () -> trainOrderDetail.setOverStandard("")); trainOrderDetail.setOverStandardReason(it.getExtension());
trainOrderDetail.setOrderNo(order.getOrderNo()); }, () -> trainOrderDetail.setOverStandard(""));
trainOrderDetail.setDetailId(order.getOrderNo()); trainOrderDetail.setOrderNo(order.getOrderNo());
trainOrderDetail.setDetailId(order.getOrderNo());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
trainOrderDetail.setBookingUserCode(user.getEmployeeNo()); trainOrderDetail.setBookingUserCode(user.getEmployeeNo());
trainOrderDetail.setBookingName(user.getName()); trainOrderDetail.setBookingName(user.getName());
trainOrderDetail.setBookingUserPhone(user.getPhoneNumber()); trainOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
} else { } else {
trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class); trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class);
} }
@ -172,22 +176,25 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
//如果已经存在的话 那么这些基础字段就不用重新构建了 //如果已经存在的话 那么这些基础字段就不用重新构建了
return orderDetail.getHotelOrderDetail(); return orderDetail.getHotelOrderDetail();
} }
//如果订单存在直接配置该订单的超标信息和原因
orderDetail.getOrderEventList()
.stream()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.findFirst()
.ifPresentOrElse(it -> {
hotelOrderDetail.setOverStandard("");
hotelOrderDetail.setOverStandardReason(it.getExtension());
}, () -> hotelOrderDetail.setOverStandard(""));
hotelOrderDetail.setOrderNo(orderDetail.getOrderNo());
hotelOrderDetail.setDetailId(orderDetail.getOrderNo());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); //如果订单存在直接配置该订单的超标信息和原因
hotelOrderDetail.setBookingUserCode(user.getEmployeeNo()); if(orderDetail.getOrderEventList() != null){
hotelOrderDetail.setBookingName(user.getName()); orderDetail.getOrderEventList()
hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber()); .stream()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.findFirst()
.ifPresentOrElse(it -> {
hotelOrderDetail.setOverStandard("");
hotelOrderDetail.setOverStandardReason(it.getExtension());
}, () -> hotelOrderDetail.setOverStandard(""));
hotelOrderDetail.setOrderNo(orderDetail.getOrderNo());
hotelOrderDetail.setDetailId(orderDetail.getOrderNo());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
hotelOrderDetail.setBookingUserCode(user.getEmployeeNo());
hotelOrderDetail.setBookingName(user.getName());
hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
return hotelOrderDetail; return hotelOrderDetail;
} }

View File

@ -45,4 +45,12 @@ public class LYConstant {
public static final int L_Y_PRODUCT_TYPE_CHAILORDER = 4; //差旅单推送 public static final int L_Y_PRODUCT_TYPE_CHAILORDER = 4; //差旅单推送
public static final int L_Y_PRODUCT_TYPE_CAR = 6; //用车 public static final int L_Y_PRODUCT_TYPE_CAR = 6; //用车
public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店 public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店
//同程订单推送类型
// public static final int L_Y_NOTIFY_COMMON = 1; //酒店
// public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店
// public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店
// public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店
} }

View File

@ -4,10 +4,7 @@ package com.chint.interfaces.rest.bpm.dto.orderdetail;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.chint.domain.aggregates.order.HotelOrderDetail; import com.chint.domain.aggregates.order.HotelOrderDetail;
import com.chint.domain.aggregates.order.HotelOrderDetailCustomer; import com.chint.domain.aggregates.order.HotelOrderDetailCustomer;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.TrainOrderDetail;
import lombok.Data; import lombok.Data;
import org.springframework.data.relational.core.mapping.MappedCollection;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -165,6 +162,10 @@ public class HotelOrderDetailDto implements Serializable {
return null; return null;
} }
HotelOrderDetailDto hotelOrderDetailDto = BeanUtil.copyProperties(hotelOrderDetail, HotelOrderDetailDto.class); HotelOrderDetailDto hotelOrderDetailDto = BeanUtil.copyProperties(hotelOrderDetail, HotelOrderDetailDto.class);
//这里执行逻辑用于筛选重复的入住人
hotelOrderDetailDto.setCustomers(
hotelOrderDetail.getCustomers().stream().distinct().toList()
);
return hotelOrderDetailDto; return hotelOrderDetailDto;
} }
} }

View File

@ -125,11 +125,6 @@ public class CommonController {
orderTravel.setTravelNo(travelApplyNo); orderTravel.setTravelNo(travelApplyNo);
saveOrderTravel(orderTravel); saveOrderTravel(orderTravel);
lyCallBackDataHandler.carCallBackData(orderSerialNo, 0); lyCallBackDataHandler.carCallBackData(orderSerialNo, 0);
/*
if (subNotifyType == 2 || subNotifyType == 3 || subNotifyType == 1){
sendMsg(travelApplyNo);
}*/
} }
return new LYNoteResponse("100", "OK"); return new LYNoteResponse("100", "OK");
} }
@ -146,10 +141,6 @@ public class CommonController {
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class); ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class);
// OrderTravel orderTravel = new OrderTravel();
// orderTravel.setOrderNo(orderTrain.getOrderNo());
// orderTravel.setTravelNo( orderTrain.getTravelData().getTravelApplyNo());
// saveOrderTravel(orderTravel);
int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0; int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0;
if (subNotifyType == 16) { if (subNotifyType == 16) {
changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo()); changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo());
@ -175,15 +166,7 @@ public class CommonController {
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class); ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class);
// Gson gson = new Gson();
// ResultBackHotel common = gson.fromJson(notifyData.toString(), ResultBackHotel.class);
ResultBackHotel.DataObject dataObject = resultBackHotel.getData(); ResultBackHotel.DataObject dataObject = resultBackHotel.getData();
// OrderTravel orderTravel = new OrderTravel();
// orderTravel.setOrderNo(dataObject.getOrderInfo().getOrderSerialNo());
// orderTravel.setTravelNo(dataObject.getTravelData().getTravelApplyNo());
// saveOrderTravel(orderTravel);
int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0; int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0;
String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo(); String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo();
String foulReason = dataObject.getOrderInfo().getFoulReason();//超标原因 String foulReason = dataObject.getOrderInfo().getFoulReason();//超标原因
@ -204,6 +187,7 @@ public class CommonController {
public LYNoteResponse getOrderFlight(Notification notification) { public LYNoteResponse getOrderFlight(Notification notification) {
Object notifyData = notification.notifyData; Object notifyData = notification.notifyData;
int subNotifyType = notification.getSubNotifyType(); int subNotifyType = notification.getSubNotifyType();
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class); ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class);