public Map<String, Object> placeAutoComplete(Map<String, Object> params) { ArgCheckUtils.validataRequiredArgs("keyword", params); Map<String, Object> resultMap = new HashMap<String, Object>(); ClientPlaceSearchVO searchVo = new ClientPlaceSearchVO(); searchVo.setStage(ClientUtils.convetToList("1,2")); List<String> productTypes = new ArrayList<String>(); productTypes.add(Constant.PRODUCT_TYPE.TICKET.name()); searchVo.setProductType(productTypes); searchVo.setChannel(Constant.CHANNEL.CLIENT.name()); searchVo.setKeyword(StringUtil.subStringStrNoSuffix(params.get("keyword").toString(), 60)); List<AutoCompletePlaceObject> list = vstClientPlaceService.getAutoCompletePlace(searchVo); List<Map<String, Object>> keyList = new ArrayList<Map<String, Object>>(); if (list != null) { for (AutoCompletePlaceObject autoCompletePlaceObject : list) { Map<String, Object> map = new HashMap<String, Object>(); map.put("name", autoCompletePlaceObject.getWords()); map.put("id", autoCompletePlaceObject.getShortId()); map.put("stage", autoCompletePlaceObject.getStage()); keyList.add(map); } } resultMap.put("datas", keyList); return resultMap; }
public Map<String, Object> routeAutoComplete(Map<String, Object> params) { ArgCheckUtils.validataRequiredArgs("keyword", params); Map<String, Object> resultMap = new HashMap<String, Object>(); // ClientPlaceSearchVO searchVo = new ClientPlaceSearchVO(); ClientRouteSearchVO searchVo = new ClientRouteSearchVO(); // searchVo.setStage(ClientUtils.convetToList("1,2")); /** 补全所有目的地关键字 */ if (params.get("subProductType") != null) { if (this.isFreness(params)) { params.put("fromDest", null); } searchVo.setSubProductType(ClientUtils.convetToList(params.get("subProductType").toString())); } if (params.get("fromDest") != null) { searchVo.setFromDest(params.get("fromDest").toString()); } List<String> productTypes = new ArrayList<String>(); productTypes.add(Constant.PRODUCT_TYPE.ROUTE.name()); searchVo.setProductType(productTypes); searchVo.setChannel(Constant.CHANNEL.CLIENT.name()); // searchVo.setKeyword(params.get("keyword").toString()); searchVo.setToDest(StringUtil.subStringStrNoSuffix(params.get("keyword").toString(), 60)); // List<AutoCompletePlaceObject> list = // clientPlaceService.getAutoCompletePlace(searchVo); List<AutoCompletePlaceObject> list = vstClientProductService.getAutoComplete(searchVo); List<Map<String, Object>> keyList = new ArrayList<Map<String, Object>>(); Map<String, Object> tempMap = new HashMap<String, Object>(); if (list != null) { for (AutoCompletePlaceObject bean : list) { tempMap.put(bean.getShortId(), bean); } } Iterator<Entry<String, Object>> it = tempMap.entrySet().iterator(); while (it.hasNext()) { Entry<String, Object> entry = it.next(); AutoCompletePlaceObject bean = (AutoCompletePlaceObject) entry.getValue(); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", bean.getWords()); map.put("id", bean.getShortId()); map.put("stage", bean.getStage()); keyList.add(map); } resultMap.put("datas", keyList); return resultMap; }