Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lulz1 2024-02-27 15:23:13 +08:00
commit 099238dc8b
8 changed files with 143 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package com.chint.domain.aggregates.order;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
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;
@ -10,6 +11,7 @@ import java.util.List;
@Data @Data
@Table("hotel_order_detail") @Table("hotel_order_detail")
@Accessors(chain = true)
public class HotelOrderDetail { public class HotelOrderDetail {
@Id @Id
private Long id; private Long id;

View File

@ -1,11 +1,25 @@
package com.chint.domain.factoriy.order_detail; package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.value_object.*; import com.chint.domain.value_object.*;
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident;
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Component @Component
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Autowired
private UserRepository userRepository;
@Override @Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
return null; return null;
@ -25,14 +39,93 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{
@Override @Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) { public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
HotelDetailResponse hotelDetailResponse = (HotelDetailResponse) hotelOrderDetailData;
HotelOrderDetail convertHotel = convertHotel(hotelDetailResponse);
return convertHotel;
return null;
} }
@Override @Override
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) { public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
return null; return null;
} }
private FlightOrderDetail convertFlight(HotelDetailResponse hotelDetailResponse) {
return null;
}
private HotelOrderDetail convertHotel(HotelDetailResponse hotelDetailResponse) {
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
HotelDetailResponse.Data data = hotelDetailResponse.getData();
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
List<HotelDetailResponse.Room> roomList = data.getRoomList();
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo())
.setOverStandard(String.valueOf(orderInfo.getRuleViolate()))
.setOrderStatus(String.valueOf(orderInfo.getOrderStatus()))
.setReceiptsNum(orderInfo.getTravelApplyNo())
.setBookingUserCode(orderInfo.getOutEmployeeId())
// .setBookingName(orderInfo.getEmployeeName())
.setCreateTime("2023-04-26 13:15:17")
.setCheckInCity(orderInfo.getCreateTime())
.setHotelName(hotelInfo.getHotelName())
.setContactPhone(hotelInfo.getHotelTel())
.setHotelAddress(hotelInfo.getHotelAddress())
.setStarRate("4")
.setCheckInDate(hotelInfo.getCheckInDate())
.setDepartureDate(hotelInfo.getCheckOutDate())
.setNightCount(String.valueOf(hotelInfo.getNightNum()))
.setRoomCount(String.valueOf(hotelInfo.getRoomNum()))
//.setRefundRoomNightCount("0")
.setRoomTypeName(hotelInfo.getRoomName())
.setPaymentType(String.valueOf(orderInfo.getPaymentType()))
.setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice()))
.setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice()))
.setCompanyRefundAmount(String.valueOf(orderInfo.getCompanyRefundPrice()))
.setPersonalRefundAmount(String.valueOf(orderInfo.getPersonalRefundPrice()))
.setOrderAmount(String.valueOf(orderInfo.getBusinessAmount()))
.setPreServiceFee(String.valueOf(orderInfo.getServicePrice()))
.setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice()))
.setRefundAmount(String.valueOf(orderInfo.getRefundPrice()))
.setCustomers(getCustomers(data.getResidentList()))
.setStandardItems(data.getItems().getPolicyName())
// .setNightRates()
.setSupplier("Supplier XYZ")
.setAmountFields("Amount A, Amount B")
.setOverStandardReason(orderInfo.getFoulReason())
.setAgreementHotel(String.valueOf(orderInfo.getProtocolType()));
// .setBOOK_ORG_STRUCT_1("Org A")
// .setBOOK_ORG_STRUCT_2("Org B")
// .setBOOK_ORG_STRUCT_3("Org C")
// .setProjectOrderNo("PROJ789")
// .setCostCenter("COST123")
return hotelOrderDetail;
}
private List<HotelOrderDetailCustomer> getCustomers(List<Resident> residentList) {
List<HotelOrderDetailCustomer> list = residentList.stream()
.map(resident -> {
HotelOrderDetailCustomer customer = new HotelOrderDetailCustomer();
customer.setId(Long.valueOf(resident.getEmployeeId()));
customer.setUserName(resident.getName());
User user = userRepository.findById(Long.valueOf(resident.getEmployeeId()));
customer.setGender(user.getGender());
customer.setUserCode(resident.getEmployeeCode());
customer.setPhone(resident.getContactPhone());
return customer;
})
.collect(Collectors.toList());
return list;
}
} }

View File

@ -39,6 +39,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
.outOrderNo(data.getOrderNo()) .outOrderNo(data.getOrderNo())
.price(String.valueOf(data.getTotalAmount())) .price(String.valueOf(data.getTotalAmount()))
.actualOrderNo(data.getOutOrderNo()) .actualOrderNo(data.getOutOrderNo())
.trainOrderDetailData(data)
.supplierName(SUPPLIER_L_Y) .supplierName(SUPPLIER_L_Y)
.build() .build()
); );
@ -52,6 +53,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
.outOrderNo(data.getOrderInfo().getOrderSerialNo()) .outOrderNo(data.getOrderInfo().getOrderSerialNo())
.price(String.valueOf(data.getOrderInfo().getTotalPrice())) .price(String.valueOf(data.getOrderInfo().getTotalPrice()))
.actualOrderNo(data.getOrderInfo().getOrderSerialNo()) .actualOrderNo(data.getOrderInfo().getOrderSerialNo())
.hotelOrderDetailData(data)
.supplierName(SUPPLIER_L_Y) .supplierName(SUPPLIER_L_Y)
.build() .build()
); );
@ -65,6 +67,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
.outOrderNo(data.getOrderNo()) .outOrderNo(data.getOrderNo())
.price(String.valueOf(data.getTotalAmount())) .price(String.valueOf(data.getTotalAmount()))
.actualOrderNo(data.getOutOrderNo()) .actualOrderNo(data.getOutOrderNo())
.carOrderDetailData(data)
.supplierName(SUPPLIER_L_Y) .supplierName(SUPPLIER_L_Y)
.build() .build()
); );
@ -79,6 +82,7 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
// .orderNo(data.get()) // .orderNo(data.get())
// .price(String.valueOf( data.getTotalAmount())) // .price(String.valueOf( data.getTotalAmount()))
// .actualOrderNo(data.getOutOrderNo()) // .actualOrderNo(data.getOutOrderNo())
.flightOrderDetailData(data)
.supplierName(SUPPLIER_L_Y) .supplierName(SUPPLIER_L_Y)
.build() .build()
); );

View File

@ -39,7 +39,7 @@ public class SupplierServiceImpl implements SupplierService {
Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData); Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData);
if (data.isPresent()) { if (data.isPresent()) {
//获取使用RouteUpdateOrderCommand命令创建的orderDetail //获取使用RouteUpdateOrderCommand命令创建的orderDetail
OrderLegData orderLegData = data.get(); OrderLegData orderLegData = data.get();
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(orderLegData).sendToQueue(); Properties properties = Command.of(RouteUpdateOrderCommand.class).data(orderLegData).sendToQueue();
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL); ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue(); OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();

View File

@ -13,5 +13,6 @@ public class Resident {
private String employeeId; private String employeeId;
private String name; private String name;
private String contactPhone; private String contactPhone;
private String employeeCode;
private String contactEmail; private String contactEmail;
} }

View File

@ -18,6 +18,7 @@ public class HotelDetailResponse {
public static class Data { public static class Data {
private OrderInfo orderInfo; private OrderInfo orderInfo;
private HotelInfo hotelInfo; private HotelInfo hotelInfo;
private Items items;
private List<DayPrice> dayPrices; private List<DayPrice> dayPrices;
private List<ContactPerson> contactPersons; private List<ContactPerson> contactPersons;
private List<Resident> residentList; private List<Resident> residentList;
@ -31,9 +32,18 @@ public class HotelDetailResponse {
// Getters and Setters // Getters and Setters
} }
@lombok.Data @lombok.Data
public static class Items {
private String ruleTag;//违规标签
private String message;//违规提示消息
private boolean allowable;//违规是否允许预订
private String policyName;//差旅政策名称
}
@lombok.Data
public static class OrderInfo { public static class OrderInfo {
private String orderSerialNo; private String orderSerialNo;
private String travelOrderNo; private String travelOrderNo;
private Boolean ruleViolate;
private String foulReason;
private String businessTravelOrderNo; private String businessTravelOrderNo;
private int protocolType; private int protocolType;
private double totalStandardPrice; private double totalStandardPrice;
@ -59,6 +69,9 @@ public class HotelDetailResponse {
private double payPrice; private double payPrice;
private double personalPrice; private double personalPrice;
private double companyPrice; private double companyPrice;
private double companyRefundPrice;
private double personalRefundPrice;
private double refundPrice;
private String supplierOrderCreateTime; private String supplierOrderCreateTime;
private String employeeName; private String employeeName;
private String enterpriseName; private String enterpriseName;

View File

@ -32,7 +32,7 @@ public class FlyBackController {
private SupplierService supplierService; private SupplierService supplierService;
//机票订单数据回推 //机票订单数据回推d
@PostMapping("/back") @PostMapping("/back")
public LYNoteResponse ticketBack(@RequestBody NotificationFly notificationFly) { public LYNoteResponse ticketBack(@RequestBody NotificationFly notificationFly) {
String orderSerialNo = notificationFly.getOrderDetails().getOrderSerialNo(); String orderSerialNo = notificationFly.getOrderDetails().getOrderSerialNo();

View File

@ -15,6 +15,31 @@ logging:
level: level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.JdbcTemplate: DEBUG
org.springframework.jdbc.core.StatementCreatorUtils: TRACE org.springframework.jdbc.core.StatementCreatorUtils: TRACE
lYBase:
ly_app_id: "zhengtai"
ly_account: 4f9cb1080b564dd0a94aa95f7a19c8b5 # 测试appkey
ly_password: 1fD3SutgzfS48qznYQiq # 测试app秘钥
ly_secret: WOHzCMvHd823iHgH # 测试app秘钥
ly_base_url: https://api.qa.dttrip.cn/openapi
ly_strokepush: /api/TravelBizOrder/ExternalApproval
ly_token_path: /api/OAuth/v2/GetAccessToken
ly_order_path: /api/TravelApplyOrder/ApplyOrderSync
ly_user_path: /api/Employee/SyncEmployeeInfo
ly_login_path: /api/Employee/SSO
ly_flight_list_path: /api/DomesticFlight/GetFlightOrderList
ly_flight_detail_path: /api/DomesticFlight/GetFlightOrderDetail
ly_train_list_path: /api/Train/GetTrainOrderList
ly_train_detail_path: /api/Train/GetTrainOrderDetail
ly_hotel_list_path: /api/Hotel/GetHotelOrderList
ly_hotel_detail_path: /api/Hotel/GetHotelOrderDetail
ly_car_detail_path: /api/Car/QueryCarOrderDetailDistribution
ly_train_max_price: /api/Train/TrainHighPirceSearchByCityName
ly_fly_price: /api/DomesticFlight/CheckFlightOrderBookableStatus
ly_hotel_list: /api/Hotel/GetHotelCityList
ly_hotel_min_price: /api/Hotel/GetHotelMinPrice
cTrip: cTrip:
baseUrl: https://ct.ctrip.com baseUrl: https://ct.ctrip.com