Пример #1
0
  private void getCtiys(YouSearchDto dto, Model model, String type) {
    // 酒店站点城市
    Map<String, String> hotelMap = hotelService.getHotelCity();
    model.addAttribute("hotelCity", hotelMap);

    // 帮5游站点城市
    Map<String, String> youCity = goodsService.getYouCity(dto);
    model.addAttribute("youCity", youCity);

    // 攻略站点城市
    Map<String, String> notesCity = guideNotesService.findNotesCity();
    model.addAttribute("notesCity", notesCity);

    if (("hotel").equals(type)) {
      String isCity = hotelMap.get(Constants.XML_CITY_KEY.get(dto.getIpLocate()));
      if (null == isCity || ("").equals(isCity)) {
        String shCity = hotelMap.get(Constants.XML_CITY_KEY.get("上海"));
        if ((null == shCity || ("").equals(shCity)) && hotelMap.keySet().size() > 0)
          dto.setIpLocate((String) ((hotelMap.keySet().toArray())[0]));
        else dto.setIpLocate("2");
      }
    } else if (("you").equals(type)) {
      String isCity = youCity.get(Constants.XML_CITY_KEY.get(dto.getIpLocate()));
      if (null == isCity || ("").equals(isCity)) {
        String shCity = youCity.get(Constants.XML_CITY_KEY.get("上海"));
        if ((null == shCity || ("").equals(shCity)) && youCity.keySet().size() > 0)
          dto.setIpLocate((String) ((youCity.keySet().toArray())[0]));
        else dto.setIpLocate("2");
      }
    } else {
      if ("-1".equals(dto.getSelectedCityId())) {
        dto.setIpLocate("全部");
      }
    }
  }
Пример #2
0
  private void setDtoParameter(YouSearchDto dto, HttpServletRequest request) {
    String keyWords = (String) request.getParameter("keywords");
    String city = (String) request.getParameter("city");
    String ajaxType = (String) request.getParameter("ajaxType");
    String currPageNo = (String) request.getParameter("currPageNo");
    String order = (String) request.getParameter("order");
    // 新添加的搜索条件
    String type0 = request.getParameter("type0");
    String destination = request.getParameter("destination");
    String days = request.getParameter("days");
    String type1 = request.getParameter("type1");
    String priceStart = request.getParameter("price_start");
    String priceEnd = request.getParameter("price_end");
    String timeStart = request.getParameter("J_date1");
    String timeEnd = request.getParameter("J_date2");

    // 酒店新添加的条件
    String hotelPrice = request.getParameter("hotel_price");
    String hotelStar = request.getParameter("hotel_star");

    if (keyWords != null) {
      dto.setKeyWords(DefaultParameterUtil.dealParamters(keyWords, ""));
    } else {
      dto.setKeyWords(DefaultParameterUtil.dealParamters(dto.getKeyWords(), ""));
    }
    if (city != null) {
      dto.setIpLocate(DefaultParameterUtil.dealParamters(city, ""));
    }

    if (ajaxType != null) {
      dto.setAjaxType(DefaultParameterUtil.dealParamters(ajaxType, ""));
    }
    if (currPageNo != null) {
      dto.setCurrPageNoTemp(DefaultParameterUtil.dealParamters(currPageNo, ""));
    }
    if (order != null) {
      dto.setOrder(DefaultParameterUtil.dealParamters(order, ""));
    }
    // 新的搜索条件
    if (type0 != null) {
      dto.setType0(type0);
    }
    if (destination != null) {
      dto.setDestination(destination);
    }
    if (days != null) {
      dto.setDays(days);
    }
    if (type1 != null) {
      dto.setType1(type1);
    }
    if (!"".equals(priceStart) && priceStart != null) {
      dto.setPriceStart(priceStart);
    } else {
      dto.setPriceStart("");
    }

    if (!"".equals(priceEnd) && priceEnd != null) {
      dto.setPriceEnd(priceEnd);
    } else {
      dto.setPriceEnd("");
    }

    if (timeStart != null) {
      dto.setTimeStart(timeStart);
    }
    if (timeEnd != null) {
      dto.setTimeEnd(timeEnd);
    }

    // 酒店新的条件
    if (hotelPrice != null) {
      dto.setHotelPrice(hotelPrice);
    }
    if (hotelStar != null) {
      dto.setHotelStar(hotelStar);
      dto.setHotelStarChn(Constants.HOTEL_INT_CHN_MAP.get(hotelStar));
    }
  }