From 591ac54dd7d6d80ea68056af4e69ec9e747d8ac9 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 21 Mar 2024 20:50:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=92=E5=BA=97=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=9B=9E=E6=8E=A8=E6=97=A0=E6=B3=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/OrderDetailQuery.java | 4 + .../aggregates/order/HotelOrderDetail.java | 4 +- .../order/HotelOrderDetailCustomer.java | 14 +++ .../CTripOrderExtensionFactoryImpl.java | 2 +- .../LYOrderExtensionFactoryImpl.java | 32 +++---- .../order_detail/OrderDetailFactoryImpl.java | 89 ++++++++++--------- .../infrastructure/constant/LYConstant.java | 8 ++ .../dto/orderdetail/HotelOrderDetailDto.java | 7 +- .../rest/ly/in/CommonController.java | 18 +--- 9 files changed, 100 insertions(+), 78 deletions(-) diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index 632bc85f..0c945738 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -160,6 +160,10 @@ public class OrderDetailQuery { Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0) { return null; } + + + + HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail); RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); orderDetailDto.setApplicantId(routeOrder.getUserId()); 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 a23d4812..b155c553 100644 --- a/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetail.java @@ -4,6 +4,7 @@ package com.chint.domain.aggregates.order; import lombok.Data; import lombok.experimental.Accessors; 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.Table; @@ -124,7 +125,8 @@ public class HotelOrderDetail implements Serializable { 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 customers; // 入离日期内差标 diff --git a/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetailCustomer.java b/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetailCustomer.java index 834e6147..eb5c44a3 100644 --- a/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetailCustomer.java +++ b/src/main/java/com/chint/domain/aggregates/order/HotelOrderDetailCustomer.java @@ -7,6 +7,7 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; +import java.util.Objects; @Data @Table("hotel_order_detail_customer") @@ -27,4 +28,17 @@ public class HotelOrderDetailCustomer implements Serializable { // 入住人手机号 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); + } } 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 index ebe48ca7..f83d353a 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -221,7 +221,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { } else { flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); } - //携程创建的飞机订单只有取消和预定成功两个状态 + //携程创建的飞机订单只有 if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){ flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); } 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 index 52b8fe4a..dd2230e6 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -19,6 +19,7 @@ import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -82,18 +83,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first); //飞机票状态属性保存 - OrderEvent lastEvent = orderDetail.getLastEvent(); - if (lastEvent != null) { - flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus()); - } else { - //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 - Integer orderStatus = orderDetails.getOrderStatus(); - flightOrderDetail.setOrderStatus( - OrderEvent.mapToFlightOrderDetailStatus( - LYOrderUtil.mapFlightStatus(orderStatus.toString()) - ) - ); - } + //根据查询到的订单信息重新进行映射 + Integer orderStatus = orderDetails.getOrderStatus(); + flightOrderDetail.setOrderStatus( + OrderEvent.mapToFlightOrderDetailStatus( + LYOrderUtil.mapFlightStatus(orderStatus.toString()) + ) + ); + if (orderDetails.getIsChangeOrder()) { //如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单 flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE); @@ -272,7 +269,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { customer.setUserName(resident.getName()); customer.setPhone(resident.getContactPhone()); customer.setUserCode(resident.getEmployeeCode()); - hotelOrderDetail.addCustomer(customer); +// hotelOrderDetail.addCustomer(customer); } } @@ -280,7 +277,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { List roomList = data.getRoomList(); if (roomList != null && !roomList.isEmpty()) { HotelDetailResponse.Room room = roomList.get(0); - hotelOrderDetail.setStandardItems(room.getDayStandardPrice()); + String dayStandardPrice = room.getDayStandardPrice(); + String[] split = dayStandardPrice.split(","); + List list = Arrays.asList(split); + if (!list.isEmpty()) { + hotelOrderDetail.setStandardItems(list.get(0)); + } } return hotelOrderDetail; @@ -430,7 +432,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { customer.setUserName(resident.getName()); customer.setPhone(resident.getContactPhone()); customer.setUserCode(resident.getEmployeeCode()); - hotelOrderDetail.addCustomer(customer); +// hotelOrderDetail.addCustomer(customer); } } 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 557dd5b7..ace0abe6 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 @@ -110,17 +110,19 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { //如果已经存在的话 ,那么这些基础字段就不用重新构建了 return orderDetail.getFlightOrderDetail(); } - //如果订单存在,直接配置该订单的超标信息和原因 - orderDetail.getOrderEventList() - .stream() - .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) - .findFirst() - .ifPresentOrElse(it -> { - flightOrderDetail.setOverStandard("是"); - flightOrderDetail.setOverStandardReason(it.getExtension()); - }, () -> flightOrderDetail.setOverStandard("否")); - flightOrderDetail.setOrderNo(orderDetail.getOrderNo()); - flightOrderDetail.setDetailId(orderDetail.getOrderNo()); + if(orderDetail.getOrderEventList() != null){ + //如果订单存在,直接配置该订单的超标信息和原因 + orderDetail.getOrderEventList() + .stream() + .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) + .findFirst() + .ifPresentOrElse(it -> { + flightOrderDetail.setOverStandard("是"); + flightOrderDetail.setOverStandardReason(it.getExtension()); + }, () -> flightOrderDetail.setOverStandard("否")); + flightOrderDetail.setOrderNo(orderDetail.getOrderNo()); + flightOrderDetail.setDetailId(orderDetail.getOrderNo()); + } } else { flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class); } @@ -139,22 +141,24 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { //如果已经存在的话 ,那么这些基础字段就不用重新构建了 return order.getTrainOrderDetail(); } - //如果订单存在,直接配置该订单的超标信息和原因 - order.getOrderEventList() - .stream() - .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) - .findFirst() - .ifPresentOrElse(it -> { - trainOrderDetail.setOverStandard("是"); - trainOrderDetail.setOverStandardReason(it.getExtension()); - }, () -> trainOrderDetail.setOverStandard("否")); - trainOrderDetail.setOrderNo(order.getOrderNo()); - trainOrderDetail.setDetailId(order.getOrderNo()); + if(order.getOrderEventList() != null){ + //如果订单存在,直接配置该订单的超标信息和原因 + order.getOrderEventList() + .stream() + .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) + .findFirst() + .ifPresentOrElse(it -> { + trainOrderDetail.setOverStandard("是"); + trainOrderDetail.setOverStandardReason(it.getExtension()); + }, () -> trainOrderDetail.setOverStandard("否")); + trainOrderDetail.setOrderNo(order.getOrderNo()); + trainOrderDetail.setDetailId(order.getOrderNo()); - User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); - trainOrderDetail.setBookingUserCode(user.getEmployeeNo()); - trainOrderDetail.setBookingName(user.getName()); - trainOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); + trainOrderDetail.setBookingUserCode(user.getEmployeeNo()); + trainOrderDetail.setBookingName(user.getName()); + trainOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + } } else { trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class); } @@ -172,22 +176,25 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { //如果已经存在的话 ,那么这些基础字段就不用重新构建了 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()); - hotelOrderDetail.setBookingName(user.getName()); - hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + //如果订单存在,直接配置该订单的超标信息和原因 + if(orderDetail.getOrderEventList() != null){ + 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()); + hotelOrderDetail.setBookingName(user.getName()); + hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + } return hotelOrderDetail; } diff --git a/src/main/java/com/chint/infrastructure/constant/LYConstant.java b/src/main/java/com/chint/infrastructure/constant/LYConstant.java index a241adf5..76ad4711 100644 --- a/src/main/java/com/chint/infrastructure/constant/LYConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/LYConstant.java @@ -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_CAR = 6; //用车 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; //酒店 + + } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java index 52faafac..317a1e45 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/HotelOrderDetailDto.java @@ -4,10 +4,7 @@ package com.chint.interfaces.rest.bpm.dto.orderdetail; import cn.hutool.core.bean.BeanUtil; import com.chint.domain.aggregates.order.HotelOrderDetail; 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 org.springframework.data.relational.core.mapping.MappedCollection; import java.io.Serializable; import java.util.List; @@ -165,6 +162,10 @@ public class HotelOrderDetailDto implements Serializable { return null; } HotelOrderDetailDto hotelOrderDetailDto = BeanUtil.copyProperties(hotelOrderDetail, HotelOrderDetailDto.class); + //这里执行逻辑用于筛选重复的入住人 + hotelOrderDetailDto.setCustomers( + hotelOrderDetail.getCustomers().stream().distinct().toList() + ); return hotelOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java index 54def113..bd3488a1 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java +++ b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java @@ -125,11 +125,6 @@ public class CommonController { orderTravel.setTravelNo(travelApplyNo); saveOrderTravel(orderTravel); lyCallBackDataHandler.carCallBackData(orderSerialNo, 0); - /* - if (subNotifyType == 2 || subNotifyType == 3 || subNotifyType == 1){ - sendMsg(travelApplyNo); - }*/ - } return new LYNoteResponse("100", "OK"); } @@ -146,10 +141,6 @@ public class CommonController { if (Objects.nonNull(notifyData)) { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); 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; if (subNotifyType == 16) { changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo()); @@ -175,15 +166,7 @@ public class CommonController { if (Objects.nonNull(notifyData)) { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class); - // Gson gson = new Gson(); - // ResultBackHotel common = gson.fromJson(notifyData.toString(), ResultBackHotel.class); 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; String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo(); String foulReason = dataObject.getOrderInfo().getFoulReason();//超标原因 @@ -204,6 +187,7 @@ public class CommonController { public LYNoteResponse getOrderFlight(Notification notification) { Object notifyData = notification.notifyData; int subNotifyType = notification.getSubNotifyType(); + if (Objects.nonNull(notifyData)) { JSONObject jsonObj = JSON.parseObject(notifyData.toString()); ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class);