@Override public OrderResponse submitOrder(OrderRequest orderRequest) throws Exception { BookInfo bookInfo = new BookInfo(); bookInfo.setHotelId(Integer.valueOf(orderRequest.getHotelID())); bookInfo.setOrderId(orderRequest.getOrderId()); bookInfo.setRoomId(Integer.valueOf(orderRequest.getRoomTypeID())); bookInfo.setRoomCount(Integer.valueOf(String.valueOf(orderRequest.getQuantity()))); bookInfo.setGuestName(orderRequest.getContactName()); bookInfo.setCheckinDate(orderRequest.getCheckInDate()); bookInfo.setCheckoutDate(orderRequest.getCheckOutDate()); bookInfo.setBedType(toBranchType(orderRequest.getBedType())); List<AdditionalProduct> addiProdList = new ArrayList<AdditionalProduct>(); for (Append append : orderRequest.getAppendList()) { AdditionalProduct addInfo = new AdditionalProduct(); addInfo.setAddiOrderId(orderRequest.getOrderId()); addInfo.setAddiProductId(Integer.parseInt(append.getProductIdSupplier())); addInfo.setAddiCount(Integer.valueOf(String.valueOf(append.getQuantity()))); addInfo.setAddisDate(append.getTimePriceDate()); addInfo.setAddieDate(append.getTimePriceDateEnd()); addiProdList.add(addInfo); } bookInfo.setAddiProdList(addiProdList); if (Constant.getInstance().isHotelMockEnabled()) { return new OrderResponse( "CN1304070008F9", xinghaiHolidayMock.queryOrderMock("CN1304070008F9")); } else { return xinghaiHolidayClient.bookAdd(bookInfo); } }
@Override public OrderStatus cancelOrder(String orderID) throws Exception { if (Constant.getInstance().isHotelMockEnabled()) { return xinghaiHolidayMock.cancelOrderMock(); } else { return xinghaiHolidayClient.bookApply(orderID); } }
@Override public OrderStatus queryOrder(String partnerOrderID) throws Exception { if (Constant.getInstance().isHotelMockEnabled()) { return xinghaiHolidayMock.queryOrderMock(partnerOrderID); } else { return xinghaiHolidayClient.getOrder(partnerOrderID); } }
@Override public List<RoomType> queryRoomTypeTimePrice(TimePriceRequest timePriceRequest) throws Exception { String hotelCode = timePriceRequest.getHotelCode(); String roomTypeID = timePriceRequest.getRoomTypeID(); Date startDate = timePriceRequest.getStartDate(); Date endDate = timePriceRequest.getEndDate(); if (Constant.getInstance().isHotelMockEnabled()) { return xinghaiHolidayMock.getRoomTypePriceJson(hotelCode, roomTypeID); } else { return xinghaiHolidayClient.getHotelPrice(hotelCode, roomTypeID, startDate, endDate); } }
@Override public List<Append> queryAppendTimePrice(TimePriceRequest timePriceRequest) throws Exception { String hotelCode = timePriceRequest.getHotelCode(); return xinghaiHolidayClient.getHotelInfo(hotelCode); }