@Override public RoseResponse handlerRequest(RoseRequest req) throws RequestHandlerException { RateUpdateRequest request = (RateUpdateRequest) req; if (isValidCredentials(request)) { throw new RequestHandlerException("001", "用户名密码错误"); } RateUpdate rateUpdate = convertToRateUpdate(request); RateUpdateWrap RateUpdateWrap = new RateUpdateWrap(rateUpdate, queryContracts(request.getHotelCode())); supplierUpdateService.updateRate(RateUpdateWrap); return new RateUpdateResponse(); }
private RateUpdate convertToRateUpdate(RateUpdateRequest request) { String hotelCode = request.getHotelCode(); List<SingleRateUpdate> singleRateUpdates = new ArrayList<SingleRateUpdate>(); for (com.rose.mps.update.domain.SingleRateUpdate singleRateUpdate : request.getSingleRateUpdates()) { SingleRateUpdate _singleRateUpdate = new SingleRateUpdate(); _singleRateUpdate.setOccupancyRate( convertToOccupancyRate(singleRateUpdate.getOccupancyRate())); _singleRateUpdate.setDateSpan( new DateSpan( singleRateUpdate.getDateSpan().getStartTime(), singleRateUpdate.getDateSpan().getEndTime())); _singleRateUpdate.setRoomTypeCode(singleRateUpdate.getRoomTypeCode()); singleRateUpdates.add(_singleRateUpdate); } return new RateUpdate(hotelCode, singleRateUpdates); }