Ejemplo n.º 1
0
  /**
   * 详情页
   *
   * @param url 电商的商品地址
   * @return
   * @throws IOException
   */
  @RequestMapping("/pageDetailed")
  public String pageDetailed(YouSearchDto dto, Model model) throws IOException {
    logger.info("----pageDetailedPage page004-----");
    dto.setAjaxType(dto.getPageType());
    YouHotel youHotel = null;
    YouGoods youGoods = null;
    // 按点击id获取对应商品
    if (Constants.YOU_HOTEL.equals(dto.getAjaxType())) {
      // 按点击id获取对应商品
      youHotel = hotelService.getYouHotelById(dto);
      model.addAttribute("youGoods", youHotel);
      // 酒店详细信息
      List<YouHotelDetail> hotelDetailList = hotelDetailService.getYouHotelDetailById(dto);
      model.addAttribute("hotelDetailList", hotelDetailList);
      // 设置为详情页标志
      dto.setSearchType(Constants.B5M_HOTEL_SAME_CITY);
      // 相关酒店
      dto.setPageSize(Constants.DEFAULT_HOT_COUNT);
      B5MPageList<YouHotel> hotelList = hotelService.getYouHotelList(dto);
      model.addAttribute("pageList", hotelList);
    } else {
      // 按点击id获取对应商品
      youGoods = goodsService.findYouGoodsById(dto);
      model.addAttribute("youGoods", youGoods);
      // 设置为详情页标志
      dto.setSearchType(Constants.B5M_YOU_SAME_TYPE);
      dto.setPageSize(Constants.DEFAULT_HOT_COUNT);
      B5MPageList<YouGoods> pageList = dealAjaxType(dto);
      model.addAttribute("pageList", pageList);
    }

    // 数据源
    Map<String, String> dataSource = taoSourceService.findTaoSource();

    model.addAttribute("dataSource", dataSource);
    model.addAttribute("fromType", "detail");
    model.addAttribute("searchDto", dto);
    model.addAttribute("dataCityKey", Constants.XML_CITY_KEY);
    model.addAttribute("dataCityKeyId", Constants.XML_CITY);
    model.addAttribute("menuCurPageTag", dto.getPageType());
    model.addAttribute("loginAndRegisterURL", ucServer);
    model.addAttribute("ucServer", ucServer);
    if ((Constants.YOU_HOTEL.equals(dto.getAjaxType()) && youHotel == null)
        || (!Constants.YOU_HOTEL.equals(dto.getAjaxType()) && youGoods == null)) {
      return taoError(dto, model);
    }
    return "pageDetailed";
  }
Ejemplo n.º 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));
    }
  }
Ejemplo n.º 3
0
  /**
   * 查询结果页
   *
   * @param dto
   * @param model
   * @return
   */
  @RequestMapping("/search")
  public String toSearch(YouSearchDto dto, Model model, HttpServletRequest request) {
    logger.info("----search finds-----");
    String pageSize = "-1";
    model.addAttribute("autofillServer", autofillServer);
    setDtoParameter(dto, request);
    // 去掉搜索关键字中所有的空格
    // dto.setKeyWords(dto.getKeyWords().replaceAll(" ", ""));
    // 攻略列表页面无需推荐
    if (!Constants.NOTES_SEARCH.equals(dto.getAjaxType())) {
      // 攻略hot数据
      List<YouGuideNotes> searchNotes = guideNotesService.findGuideNotesBySearchResul(null, "9");
      model.addAttribute("searchNotes", searchNotes);
    }
    dto.setPageSize(Constants.DEFAULT_PAGE_SIZE);
    if (Constants.HOTEL_SEARCH.equals(dto.getAjaxType())
        || "hotelSearchresult".equals(dto.getAjaxType())
        || Constants.INDEX_HOTEL_SEARCH.equals(dto.getAjaxType())) {
      String tempFalg = request.getParameter("f");
      // 酒店下拉框 更多链接地址
      if (tempFalg != null && "map".equals(tempFalg)) {
        return "address";
      }

      getCtiys(dto, model, "hotel");
      B5MPageList<YouHotel> hotelList = hotelService.getYouHotelList(dto);
      boolean hotelSearchFlag =
          (StringUtils.isNotBlank(dto.getHotelPrice())
              || StringUtils.isNotBlank(dto.getHotelStar()));
      String returnRuelt = attributeList(dto, model, hotelList);
      if (!"".equals(returnRuelt) && !hotelSearchFlag) {
        return returnRuelt;
      }
    } else if (Constants.NOTES_SEARCH.equals(dto.getAjaxType())
        || Constants.INDEX_NOTE_SEARCH.equals(dto.getAjaxType())) {
      getCtiys(dto, model, "");
      pageSize = toNotesList(dto, model, request);
    } else {
      // 默认 访问search.html的时候
      if ("".equals(dto.getAjaxType())) {
        dto.setAjaxType("searchresult");
      }
      getCtiys(dto, model, "you");

      // 商品数据查询
      B5MPageList<YouGoods> searchList = goodsService.getYouGoodsSearch(dto);
      model.addAttribute("pageList", searchList);

      String returnRuelt = attributeList(dto, model, searchList);
      boolean searchFlag =
          (StringUtils.isNotBlank(dto.getType0())
              || StringUtils.isNotBlank(dto.getType1())
              || StringUtils.isNotBlank(dto.getDays())
              || StringUtils.isNotBlank(dto.getPriceStart() + "")
              || StringUtils.isNotBlank(dto.getPriceEnd() + "")
              || StringUtils.isNotBlank(dto.getTimeStart())
              || StringUtils.isNotBlank(dto.getTimeEnd()));
      // 搜索无结果页
      if (!"".equals(returnRuelt) && !searchFlag) {
        return returnRuelt;
      }
    }

    // 数据源
    Map<String, String> dataSource = taoSourceService.findTaoSource();
    model.addAttribute("dataSource", dataSource);

    // keywords
    List<YouKeyWords> dataKeyWords = keywordsService.findKeyWords();
    model.addAttribute("keyWords", dataKeyWords);
    // 目的地城市列表
    // model.addAttribute("dcList", goodsService.getCitysByKeyword(dto.getKeyWords()));

    model.addAttribute("searchDto", dto);
    model.addAttribute("curPageTag", dto.getAjaxType());
    model.addAttribute("dataCityKey", Constants.XML_CITY_KEY);
    model.addAttribute("dataCityKeyId", Constants.XML_CITY);
    model.addAttribute("loginAndRegisterURL", ucServer);
    model.addAttribute("autofillFlag", dto.getAjaxType());
    if (Constants.NOTES_SEARCH.equals(dto.getAjaxType())
        || Constants.INDEX_NOTE_SEARCH.equals(dto.getAjaxType())) {
      if (Integer.parseInt(pageSize) <= 0) {
        logger.info("----notes_list---->" + pageSize);
        model.addAttribute("curPageTag", "noNoteResult");
        model.addAttribute("menuCurPageTag", dto.getAjaxType());
        model.addAttribute("keyWords", dto.getKeyWords());
        dto.setKeyWords("");
        B5MPageList<YouGuideNotes> pageList = guideNotesService.findGuideNotesBySearchResult(dto);
        model.addAttribute("hotList", pageList.getAll());
        return "noresult";
      }
      return "notesList";
    }
    return "searchResult";
  }