//返回autocomplete的数据
@SuppressWarnings("unchecked")
@RequestMapping(value="/invite/getSuggestion")
public @ResponseBody Suggestion getSuggestion(String query){
Suggestion sgg = new Suggestion();
sgg.setQuery(query);
ArrayList<Fan> fanList = null;
fanList = (ArrayList<Fan>)WebHelper.getSessionAttribute(null, Constant.SESSION_FANS);
List<String> suggs = new ArrayList<String>();
List<String> datas = new ArrayList<String>();
for(Fan fan:fanList){
//忽略大小写 首字母匹配
if(fan.getFanNickname().toLowerCase().indexOf(query.toLowerCase()) == 0){
suggs.add(fan.getFanNickname());
datas.add(fan.getFanId()+","+fan.getFanNickname()+","+fan.getFanPortrait());
}
}
sgg.setSuggestions(suggs);
sgg.setData(datas);
return sgg;
}