From dc66f04e8b017adbdb81f923b88a298d3b5ef8f2 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 20 Mar 2024 23:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8C=E7=A8=8B=E9=85=92?= =?UTF-8?q?=E5=BA=97=E6=98=8E=E7=BB=86=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/aggregates/order/OrderEvent.java | 2 +- .../CTripOrderExtensionFactoryImpl.java | 5 + .../LYOrderExtensionFactoryImpl.java | 451 +++++++++++------- .../order_detail/OrderDetailFactory.java | 2 + .../order_detail/OrderDetailFactoryImpl.java | 35 +- .../order_detail/OrderExtensionFactory.java | 2 + .../domain/service/OrderDomainService.java | 38 +- .../hotelorderdatapushbach/RefundInfo.java | 1 - .../response/hotel/HotelDetailResponse.java | 25 +- 9 files changed, 374 insertions(+), 187 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java index 19552f78..1c76c580 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java @@ -100,7 +100,7 @@ public class OrderEvent implements Serializable { case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_SUCCESS; //未下单 改成3 case ORDER_EVENT_PAYED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_CHANGE -> FSSC_HOTEL_STATUS_SUCCESS; - case ORDER_EVENT_CANCEL -> FSSC_HOTEL_STATUS_SUCCESS; //e额外生成的单子为3 退票虽然是3 返回为1 + case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL; //e额外生成的单子为3 退票虽然是3 返回为1 case ORDER_EVENT_ORDERED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_REFUND -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL; 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 39fbde7c..ebe48ca7 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 @@ -537,6 +537,11 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { return hotelOrderDetail; } + @Override + public HotelOrderDetail updateHotelOrderDetailData(HotelOrderDetail hotelOrderDetail, Object hotelOrderInfo) { + 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 index 9da42ca4..f19d556c 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 @@ -29,6 +29,7 @@ import static com.chint.infrastructure.constant.FSSCConstant.*; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME; +import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; @Component @@ -172,9 +173,119 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @Override public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) { HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderDetailData; + HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); // 获取对象的Class对象 - HotelOrderDetail convertHotel = convertHotelOrderDetail(data); - return convertHotel; + OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderInfo.getOrderSerialNo()) + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); + HotelOrderDetail hotelOrderDetail = orderDetailFactory.buildHotelWithRouteOrderAndOrderDetail(routeOrder, orderDetail); + + //这里更新酒店订单明细的类型,酒店只有成功和退款 + OrderEvent lastEvent = orderDetail.getLastEvent(); + if (lastEvent != null) { + hotelOrderDetail.setOrderStatus(lastEvent.mapToHotelOrderDetailStatus()); + } else { + //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 + int orderStatus = orderInfo.getOrderStatus(); + hotelOrderDetail.setOrderStatus( + OrderEvent.mapToHotelOrderDetailStatus( + LYOrderUtil.mapHotelStatus(Integer.toString(orderStatus)) + ) + ); + } + //这里再进行判断, + if (!hotelOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)) { + hotelOrderDetail.setOrderStatus(FSSC_HOTEL_STATUS_SUCCESS); + } + + return updateHotelOrderDetailData(hotelOrderDetail, data); + } + + @Override + public HotelOrderDetail updateHotelOrderDetailData(HotelOrderDetail hotelOrderDetail, Object hotelOrderInfo) { + HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderInfo; + HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); + HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo(); + + if (hotelInfo != null && orderInfo != null) { + hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo()) + .setDetailId(orderInfo.getOrderSerialNo()) + .setSupplier(SUPPLIER_L_Y_EXTENSION_NAME) + .setOrderAmount(String.valueOf(orderInfo.getBusinessAmount())) + .setCreateTime(orderInfo.getCreateTime()) + .setCheckInCity(hotelInfo.getCityName()) + .setHotelName(hotelInfo.getHotelName()) + .setContactPhone(hotelInfo.getHotelTel()) + .setHotelAddress(hotelInfo.getHotelAddress()) + .setCheckInDate(hotelInfo.getCheckInDate()) + .setDepartureDate(hotelInfo.getCheckOutDate()) + .setNightCount(String.valueOf(hotelInfo.getNightNum())) + .setRoomCount(String.valueOf(hotelInfo.getRoomNum())) + .setRoomTypeName(hotelInfo.getRoomName()) + .setPreServiceFee(String.valueOf(orderInfo.getServicePrice())) + .setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice())) + .setRefundAmount(String.valueOf(orderInfo.getRefundPrice())) + .setAgreementHotel(orderInfo.getProtocolType() == 0 ? "否" : "是"); + + //下单成功的总金额要和退款状态的总金额区分开 + if (hotelOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) { + hotelOrderDetail.setOrderAmount(String.valueOf(orderInfo.getTotalPrice())); + } + + //配置付款类型 + if (orderInfo.getPaymentType() == 1) { + hotelOrderDetail.setPaymentType("0"); + hotelOrderDetail.setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice())); + hotelOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO); + + } else { + hotelOrderDetail.setPaymentType("1"); + hotelOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO); + hotelOrderDetail.setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice())); + } + + List refundInfoList = data.getRefundInfoList(); + //如果是退款状态的话,要进入这里进行更新 + if (refundInfoList != null && + !refundInfoList.isEmpty() && + hotelOrderDetail.getOrderStatus().equals(FSSC_HOTEL_STATUS_REFUND)) { + HotelDetailResponse.RefundInfo refundInfo = refundInfoList.get(0); + hotelOrderDetail.setRefundAmount(String.valueOf(refundInfo.getRefundPrice())); + //这里录入退款方式 + List refundProductOrderInfo = refundInfo.getRefundProductOrderInfo(); + if (refundProductOrderInfo != null && !refundProductOrderInfo.isEmpty()) { + HotelDetailResponse.RefundInfo.RefundProductOrder refundProductOrder = refundProductOrderInfo.get(0); + if (refundProductOrder.getRefundPayType() == 0) { + hotelOrderDetail.setCompanyRefundAmount(String.valueOf(refundProductOrder.getRefundAmout())); + hotelOrderDetail.setPersonalRefundAmount(KEEP_TWO_DECIMAL_ZERO); + } else { + hotelOrderDetail.setCompanyRefundAmount(KEEP_TWO_DECIMAL_ZERO); + hotelOrderDetail.setPersonalRefundAmount(String.valueOf(refundProductOrder.getRefundAmout())); + } + } + } + } + + //入住人信息 + List residentList = data.getResidentList(); + if (residentList != null && !residentList.isEmpty()) { + for (Resident resident : residentList) { + HotelOrderDetailCustomer customer = new HotelOrderDetailCustomer(); + customer.setUserName(resident.getName()); + customer.setPhone(resident.getContactPhone()); + customer.setUserCode(resident.getEmployeeCode()); + hotelOrderDetail.addCustomer(customer); + } + } + + //房间信息 + List roomList = data.getRoomList(); + if (roomList != null && !roomList.isEmpty()) { + HotelDetailResponse.Room room = roomList.get(0); + hotelOrderDetail.setStandardItems(room.getDayStandardPrice()); + } + + return hotelOrderDetail; } @Override @@ -183,173 +294,9 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { } - private FlightOrderDetail convertFlightOrderDetail(FlightOrderResponse.Data data) { - FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails(); - OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo()) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - FlightOrderDetail flightOrderDetail = new FlightOrderDetail(); - if (approveOrderNo != null) { - flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); - flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); - } - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - FlightOrderResponse.FlightSegment flightSegment = null; - if (!data.getFlightSegmentList().isEmpty()) { - flightSegment = data.getFlightSegmentList().get(0); - } - - FlightOrderResponse.Passenger passenger = null; - if (!data.getPassengerList().isEmpty()) { - passenger = data.getPassengerList().get(0); - } - -// flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME); - flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } - } - - String EmployeeNo = routeOrder.getUserId(); - User user = userRepository.findByUserEmployeeNo(EmployeeNo); - if (user != null) { - flightOrderDetail.setBookingUserCode(user.getEmployeeNo()); - flightOrderDetail.setBookingName(user.getName()); - flightOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - } - if (orderDetails != null) { - flightOrderDetail.setOrderNo(orderDetails.getOrderSerialNo()); - flightOrderDetail.setDetailId(orderDetails.getOrderSerialNo()); - flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo()); - flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo()); - - Optional first1 = routeOrder - .getOrderDetails() - .stream() - .filter(it -> it.getOrderNo().equals(flightOrderDetail.getOrderNo())) - .findFirst(); - - first1.ifPresent(it -> { - OrderEvent lastEvent = it.getLastEvent(); - if (orderDetail.getOrderNo().contains("C") && orderDetails.getIsChangeOrder()) { - //如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单 - flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE); - } - if (lastEvent != null) { - flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus()); - } else { - //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 - Integer orderStatus = orderDetails.getOrderStatus(); - flightOrderDetail.setOrderStatus( - OrderEvent.mapToFlightOrderDetailStatus( - LYOrderUtil.mapFlightStatus(orderStatus.toString()) - ) - ); - } - } - ); -// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo()); - flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo()); - FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo(); - if (flightOrderRefundInfo != null) { - flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee())); - flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice - } - flightOrderDetail.setCreateTime(orderDetails.getBookDate()); - flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice())); - flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice())); - flightOrderDetail.setPostServiceFee(orderDetails.getAfterSettlementServicePrice().toString()); - flightOrderDetail.setCompanyPaymentAmount(orderDetails.getTotalPrice().toString()); - flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason()); -// flightOrderDetail.setPaymentType(orderDetails.getPayType().toString()); //贵司都是公司支付所以为0 - - flightOrderDetail.setPaymentType("0"); - } - if (flightSegment != null) { - flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport()); - flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode()); - flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal()); - flightOrderDetail.setDistance(flightSegment.getMileAge().toString()); -// flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName()); - flightOrderDetail.setFlightCompName(flightSegment.getAirline()); - - flightOrderDetail.setFlightNum(flightSegment.getFlightNo()); - flightOrderDetail.setSeatPoint(flightSegment.getSeatCode()); - flightOrderDetail.setSeatPointName(flightSegment.getSeatName()); - flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull()); - flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull()); - flightOrderDetail.setStartCityName(flightSegment.getDepartCity()); -// flightOrderDetail.setStartCityCode(flightSegment.getDep()); - flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport()); - flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode()); - flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal()); - flightOrderDetail.setEndCityName(flightSegment.getArriveCity()); - flightOrderDetail.setFlightModel(flightSegment.getFlightNo()); - flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount()); - } - flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); - if (passenger != null) { - flightOrderDetail.setFuelTax(passenger.getFuelTax().toString()); - flightOrderDetail.setAirportTax(passenger.getAirportTax().toString()); - flightOrderDetail.setFacePrice(passenger.getParPrice().toString()); - flightOrderDetail.setChangeFee(passenger.getChangeFee().toString()); - flightOrderDetail.setUpFee(passenger.getChangePrice().toString()); - flightOrderDetail.setTicketNo(passenger.getTicketNo()); - flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号 - flightOrderDetail.setUserName(passenger.getPassengerName()); - flightOrderDetail.setUserCode(passenger.getOutEmployeeId()); - flightOrderDetail.setPhone(passenger.getContractPhone()); - flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString()); - } - - - Optional firstOrderEvent = orderDetail.getOrderEventList() - .stream() - .map(OrderEvent::getEventType) - .filter(it -> it.equals(ORDER_EVENT_ETA)) - .findFirst(); - - if (firstOrderEvent.isEmpty()) { - flightOrderDetail.setOverStandard("否"); //无 - } else { - flightOrderDetail.setOverStandard("是"); //无 - } - Optional first1 = orderDetail.getOrderEventList() - .stream() - .findFirst(); - first1.ifPresent(orderEvent -> flightOrderDetail.setOverStandardReason(orderEvent.getExtension())); - - - // flightOrderDetail.setBookingUserPhone(data.get); //无 -// flightOrderDetail.setEndCityCode(flightSegment.getarrivecit()); //无 -// FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = -// orderDetails.getFlightOrderRefundInfo().getRefundFee(); -// flightOrderDetail.setTickets(tickets); -// flightOrderDetail.setPaymentType("0"); //贵司都是公司支付所以为0 -// flightOrderDetail.setPersonalPaymentAmount(personalPaymentAmount); //无个人支付金额 -// flightOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); -// flightOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); -// flightOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); - return flightOrderDetail; - } - private HotelOrderDetail convertHotelOrderDetail(HotelDetailResponse.Data data) { + + HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo(); List roomList = data.getRoomList(); @@ -491,7 +438,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { if (room != null) { hotelOrderDetail.setStandardItems(room.getDayStandardPrice()); - } @@ -563,7 +509,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode()); //配置付款类型 - if (String.valueOf(trainDetailData.getPaymentType()).equals("1")) { + if (String.valueOf(trainDetailData.getPaymentType()).equals("1.0")) { trainOrderDetail.setPaymentType("0"); trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString()); trainOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO); @@ -979,5 +925,170 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { return list; } + private FlightOrderDetail convertFlightOrderDetail(FlightOrderResponse.Data data) { + FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails(); + OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo()) + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); + + ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); + FlightOrderDetail flightOrderDetail = new FlightOrderDetail(); + if (approveOrderNo != null) { + flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); + flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); + flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); + flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); + } + String sysCode = routeOrder.getApproveOrderNo().getSysCode(); + FlightOrderResponse.FlightSegment flightSegment = null; + if (!data.getFlightSegmentList().isEmpty()) { + flightSegment = data.getFlightSegmentList().get(0); + } + + FlightOrderResponse.Passenger passenger = null; + if (!data.getPassengerList().isEmpty()) { + passenger = data.getPassengerList().get(0); + } + +// flightOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME); + flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); + if (sysCode != null) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); + + } + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); + } + } + + String EmployeeNo = routeOrder.getUserId(); + User user = userRepository.findByUserEmployeeNo(EmployeeNo); + if (user != null) { + flightOrderDetail.setBookingUserCode(user.getEmployeeNo()); + flightOrderDetail.setBookingName(user.getName()); + flightOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + } + if (orderDetails != null) { + flightOrderDetail.setOrderNo(orderDetails.getOrderSerialNo()); + flightOrderDetail.setDetailId(orderDetails.getOrderSerialNo()); + flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo()); + flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo()); + + Optional first1 = routeOrder + .getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(flightOrderDetail.getOrderNo())) + .findFirst(); + + first1.ifPresent(it -> { + OrderEvent lastEvent = it.getLastEvent(); + if (orderDetail.getOrderNo().contains("C") && orderDetails.getIsChangeOrder()) { + //如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单 + flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE); + } + if (lastEvent != null) { + flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus()); + } else { + //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 + Integer orderStatus = orderDetails.getOrderStatus(); + flightOrderDetail.setOrderStatus( + OrderEvent.mapToFlightOrderDetailStatus( + LYOrderUtil.mapFlightStatus(orderStatus.toString()) + ) + ); + } + } + ); +// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo()); + flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo()); + FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo(); + if (flightOrderRefundInfo != null) { + flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee())); + flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice + } + flightOrderDetail.setCreateTime(orderDetails.getBookDate()); + flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice())); + flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice())); + flightOrderDetail.setPostServiceFee(orderDetails.getAfterSettlementServicePrice().toString()); + flightOrderDetail.setCompanyPaymentAmount(orderDetails.getTotalPrice().toString()); + flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason()); +// flightOrderDetail.setPaymentType(orderDetails.getPayType().toString()); //贵司都是公司支付所以为0 + + flightOrderDetail.setPaymentType("0"); + } + if (flightSegment != null) { + flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport()); + flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode()); + flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal()); + flightOrderDetail.setDistance(flightSegment.getMileAge().toString()); +// flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName()); + flightOrderDetail.setFlightCompName(flightSegment.getAirline()); + + flightOrderDetail.setFlightNum(flightSegment.getFlightNo()); + flightOrderDetail.setSeatPoint(flightSegment.getSeatCode()); + flightOrderDetail.setSeatPointName(flightSegment.getSeatName()); + flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull()); + flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull()); + flightOrderDetail.setStartCityName(flightSegment.getDepartCity()); +// flightOrderDetail.setStartCityCode(flightSegment.getDep()); + flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport()); + flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode()); + flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal()); + flightOrderDetail.setEndCityName(flightSegment.getArriveCity()); + flightOrderDetail.setFlightModel(flightSegment.getFlightNo()); + flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount()); + } + flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); + if (passenger != null) { + flightOrderDetail.setFuelTax(passenger.getFuelTax().toString()); + flightOrderDetail.setAirportTax(passenger.getAirportTax().toString()); + flightOrderDetail.setFacePrice(passenger.getParPrice().toString()); + flightOrderDetail.setChangeFee(passenger.getChangeFee().toString()); + flightOrderDetail.setUpFee(passenger.getChangePrice().toString()); + flightOrderDetail.setTicketNo(passenger.getTicketNo()); + flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号 + flightOrderDetail.setUserName(passenger.getPassengerName()); + flightOrderDetail.setUserCode(passenger.getOutEmployeeId()); + flightOrderDetail.setPhone(passenger.getContractPhone()); + flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString()); + } + + + Optional firstOrderEvent = orderDetail.getOrderEventList() + .stream() + .map(OrderEvent::getEventType) + .filter(it -> it.equals(ORDER_EVENT_ETA)) + .findFirst(); + + if (firstOrderEvent.isEmpty()) { + flightOrderDetail.setOverStandard("否"); //无 + } else { + flightOrderDetail.setOverStandard("是"); //无 + } + Optional first1 = orderDetail.getOrderEventList() + .stream() + .findFirst(); + first1.ifPresent(orderEvent -> flightOrderDetail.setOverStandardReason(orderEvent.getExtension())); + + + // flightOrderDetail.setBookingUserPhone(data.get); //无 +// flightOrderDetail.setEndCityCode(flightSegment.getarrivecit()); //无 +// FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = +// orderDetails.getFlightOrderRefundInfo().getRefundFee(); +// flightOrderDetail.setTickets(tickets); +// flightOrderDetail.setPaymentType("0"); //贵司都是公司支付所以为0 +// flightOrderDetail.setPersonalPaymentAmount(personalPaymentAmount); //无个人支付金额 +// flightOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); +// flightOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); +// flightOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); + return flightOrderDetail; + } } 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 1c94e3b6..7cf32a8a 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 @@ -15,4 +15,6 @@ public interface OrderDetailFactory { FlightOrderDetail buildFlightWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional orderDetail); TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional orderDetail); + + HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); } 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 3490b503..557dd5b7 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 @@ -107,6 +107,7 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { if (orderDetail.getFlightOrderDetail() == null) { flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class); } else { + //如果已经存在的话 ,那么这些基础字段就不用重新构建了 return orderDetail.getFlightOrderDetail(); } //如果订单存在,直接配置该订单的超标信息和原因 @@ -135,6 +136,7 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { if (order.getFlightOrderDetail() == null) { trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class); } else { + //如果已经存在的话 ,那么这些基础字段就不用重新构建了 return order.getTrainOrderDetail(); } //如果订单存在,直接配置该订单的超标信息和原因 @@ -153,9 +155,40 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { trainOrderDetail.setBookingUserCode(user.getEmployeeNo()); trainOrderDetail.setBookingName(user.getName()); trainOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - }else { + } else { trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class); } return trainOrderDetail; } + + @Override + public HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail) { + + //获取飞机订单明细 + HotelOrderDetail hotelOrderDetail; + if (orderDetail.getHotelOrderDetail() == null) { + hotelOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), HotelOrderDetail.class); + } else { + //如果已经存在的话 ,那么这些基础字段就不用重新构建了 + 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()); + + return hotelOrderDetail; + } } 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 index c49791fd..00f4e721 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java @@ -16,6 +16,8 @@ public interface OrderExtensionFactory { HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData); + HotelOrderDetail updateHotelOrderDetailData(HotelOrderDetail hotelOrderDetail, Object hotelOrderInfo); + 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 ffa7f8af..977010c9 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -575,22 +575,36 @@ public class OrderDomainService { return; } HotelDetailResponse.Data data = hotelOrderDetail.getData(); - if (data != null && data.getRefundInfoList() != null && !data.getRefundInfoList().isEmpty()) { - List refundInfoList = data.getRefundInfoList(); - for (com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo refundInfo : refundInfoList) { - Command.of(RefundOrderGenerateCommand.class).Info( - refundInfo.getRefundTime().replace(" ", "") - .replace("-", "") - .replace(":", ""), - data.getOrderInfo().getOrderSerialNo(), - "-" + refundInfo.getRefundPrice(), - "3", - refundInfo.getRefundTime() - ).sendToQueue(); + if (data != null) { + List refundInfoList = data.getRefundInfoList(); + if (refundInfoList != null && !refundInfoList.isEmpty()) { + for (HotelDetailResponse.RefundInfo refundInfo : refundInfoList) { + String recordId = getLYHotelRecordId(refundInfo); + Command.of(RefundOrderGenerateCommand.class).Info( + recordId, + data.getOrderInfo().getOrderSerialNo(), + "-" + refundInfo.getRefundPrice(), + "3", + refundInfo.getRefundTime() + ).sendToQueue(); + } } } } + private static String getLYHotelRecordId(HotelDetailResponse.RefundInfo refundInfo) { + List refundProductOrderInfo = refundInfo.getRefundProductOrderInfo(); + String recordId; + if (refundProductOrderInfo != null && !refundProductOrderInfo.isEmpty()) { + recordId = refundProductOrderInfo.get(0).getProductOrderSerialNo(); + } else { + recordId = refundInfo.getRefundTime().replace(" ", "") + .replace("-", "") + .replace(":", ""); + } + return recordId; + } + private void lyCarRefundGenerate(String orderNo) { CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo); diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/RefundInfo.java b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/RefundInfo.java index 04a98dd4..d68e6809 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/RefundInfo.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/hotelorderdatapushbach/RefundInfo.java @@ -22,5 +22,4 @@ public class RefundInfo { private String refundAccount; private BigDecimal changeFee; private List refundInfoList; - } diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java index e4c24715..21798ce0 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ly/dto/search/response/hotel/HotelDetailResponse.java @@ -1,8 +1,7 @@ package com.chint.interfaces.rest.ly.dto.search.response.hotel; -import com.chint.interfaces.rest.ly.dto.ResultBackHotel; + import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.ContactPerson; -import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo; import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; import lombok.Data; @@ -250,4 +249,26 @@ public class HotelDetailResponse { private String approvalRemark; // Assuming this is a string representing any remarks // Getters and Setters } + @lombok.Data + public static class RefundInfo{ + private int refundStatusId; + private Double refundFee; + private Double servicePrice; + private Double refundPrice; + private Double comRefundFee; + private String refundTime; + private String refundAccount; + + private List refundProductOrderInfo; + + + @lombok.Data + public static class RefundProductOrder{ + private String productOrderSerialNo; + private Double refundAmout; + private Double refundFee; + private int refundPayType; + } + + } }