예제 #1
0
 protected boolean isValidCredentials(RateUpdateRequest request) {
   if (userName.equals(request.getUserName()) == false
       || password.equals(request.getPassword()) == false) {
     return false;
   }
   return true;
 }
예제 #2
0
 @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();
 }
예제 #3
0
  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);
  }