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)); } }
/** 分页数据 */ @RequestMapping("/taoPage") public String findTaoGoodByPage(YouSearchDto searchDto, Model model, HttpServletRequest request) { String pageSize = "-1"; model.addAttribute("autofillServer", autofillServer); model.addAttribute("dataCityKeyId", Constants.XML_CITY); // 去掉搜索关键字中所有的空格 // searchDto.setKeyWords(searchDto.getKeyWords().replaceAll(" ", "")); // 酒店搜索:INDEX_HOTEL_SEARCH 表示从首页php进入的搜索 if (Constants.INDEX_HOTEL_SEARCH.equals(searchDto.getAjaxType()) || "hotelSearchresult".equals(searchDto.getAjaxType()) || Constants.YOU_HOTEL.equals(searchDto.getAjaxType()) || Constants.HOTEL_SEARCH.equals(searchDto.getAjaxType())) { logger.info("----taoPage page0020-----"); getCtiys(searchDto, model, "hotel"); searchDto.setHotelStarChn(Constants.HOTEL_INT_CHN_MAP.get(searchDto.getHotelStar())); searchDto.setPageSize(Constants.DEFAULT_PAGE_SIZE); if (Constants.HOTEL_SEARCH.equals(searchDto.getAjaxType())) { searchDto.setKeyWords(DefaultParameterUtil.dealParamters(searchDto.getKeyWords(), "")); } B5MPageList<YouHotel> hotelList = hotelService.getYouHotelList(searchDto); String returnRuelt = attributeList(searchDto, model, hotelList); if (!"".equals(returnRuelt)) { return returnRuelt; } // 攻略搜索:INDEX_NOTE_SEARCH 表示从首页php进入的搜索 } else if (Constants.INDEX_NOTE_SEARCH.equals(searchDto.getAjaxType()) || Constants.NOTES_SEARCH.equals(searchDto.getAjaxType())) { logger.info("----taoPage page0022-----"); getCtiys(searchDto, model, ""); pageSize = toNotesList(searchDto, model, request); // 旅游产品搜索 } else { logger.info("----taoPage page0021-----"); getCtiys(searchDto, model, "you"); // 获取数据集合 searchDto.setPageSize(Constants.DEFAULT_PAGE_SIZE); B5MPageList<YouGoods> pageList = dealAjaxType(searchDto); String returnRuelt = attributeList(searchDto, model, pageList); // 针对从“酒店”频道过来时无结果的页面(列表页面),跳回到对应频道的“全部”页面 if (!"".equals(returnRuelt)) { // 仅限于pageMode为list的情况 if (Constants.PAGE_MODE_LIST.equals(searchDto.getPageMode())) { searchDto.setSelectedCityId("-1"); pageList = dealAjaxType(searchDto); model.addAttribute("pageList", pageList); if (pageList.getAll().size() == 0) { return returnRuelt; } } else { return returnRuelt; } } } // true:内页的搜索模式, false:其他 boolean pageMode = ((Constants.DOMESTIC_TRAVEL.equals(searchDto.getAjaxType()) || Constants.ABROAD_TRAVEL.equals(searchDto.getAjaxType()) || Constants.PERIPHERY_TRAVEL.equals(searchDto.getAjaxType())) && Constants.PAGE_MODE_SEARCH.equals(searchDto.getPageMode())); if ("hotelSearchresult".equals(searchDto.getAjaxType()) || Constants.SEARCH.equals(searchDto.getAjaxType()) // 从国内游、境外游、周边游内页的搜索框进行搜索 || pageMode || Constants.INDEX_HOTEL_SEARCH.equals(searchDto.getAjaxType()) || Constants.INDEX_TRIP_SEARCH.equals(searchDto.getAjaxType())) { List<YouGuideNotes> searchNotes = guideNotesService.findGuideNotesBySearchResul(null, "9"); model.addAttribute("searchNotes", searchNotes); } // 数据源 Map<String, String> dataSource = taoSourceService.findTaoSource(); model.addAttribute("dataSource", dataSource); // keywords List<YouKeyWords> dataKeyWords = keywordsService.findKeyWords(); model.addAttribute("keyWords", dataKeyWords); model.addAttribute("curPageTag", searchDto.getAjaxType()); model.addAttribute("menuCurPageTag", searchDto.getPageType()); model.addAttribute("loginAndRegisterURL", ucServer); if ("hotelSearchresult".equals(searchDto.getAjaxType()) || Constants.SEARCH.equals(searchDto.getAjaxType()) // 从国内游、境外游、周边游内页的搜索框进行搜索,区分列表 和 搜索结果页面,此跳往搜索结果页 || pageMode || Constants.INDEX_HOTEL_SEARCH.equals(searchDto.getAjaxType()) || Constants.INDEX_TRIP_SEARCH.equals(searchDto.getAjaxType())) { return "searchResult"; } else if (Constants.NOTES_SEARCH.equals(searchDto.getAjaxType()) || Constants.INDEX_NOTE_SEARCH.equals(searchDto.getAjaxType())) { if (Integer.parseInt(pageSize) <= 0) { logger.info("----tao_page_notes_list---->" + pageSize); model.addAttribute("curPageTag", "noNoteResult"); model.addAttribute("keyWords", searchDto.getKeyWords()); model.addAttribute("menuCurPageTag", searchDto.getAjaxType()); searchDto.setKeyWords(""); B5MPageList<YouGuideNotes> pageList = guideNotesService.findGuideNotesBySearchResult(searchDto); model.addAttribute("hotList", pageList.getAll()); return "noresult"; } return "notesList"; } else { return "taoResult"; } }