private String queryKeywords(String rspMsg, List<ArticleF> wML, WeixinMessageF wm) { // 判断session是否过期,过期清理表并返回菜单序号 int menuNo = weiXinSessionService.getMenuNo( wm.getFromUser(), StringUtils.parseDate2SecondStr(wm.getCreateDate())); List<WeiXinSessionPara> listWsp = new ArrayList<WeiXinSessionPara>(); for (int i = 0; i < wML.size(); i++) { WeiXinSessionPara wsp = new WeiXinSessionPara(); wsp.setOpenId(wm.getFromUser()); wsp.setMenuNo(menuNo + i); if (CF.title_val2.equals(wML.get(i).getTitle()) || CF.title_val4.equals(wML.get(i).getTitle())) { // 网点查询 和 ATM // 特殊处理 if (wm.getLocX() == null || "".equals(wm.getLocX())) { // 判断是否需要用户输入当前位置信息 key值为0 需要用户输入当前地理位置信息 wsp.setKey("0"); } else { // 用户已经上传过当前地理位置信息 wsp.setKey(String.valueOf(wm.getLocX() + "-" + wm.getLocY() + "-" + wm.getLocScale())); } } else { // 正常处理其他消息 wsp.setKey(String.valueOf(wML.get(i).getId())); } wsp.setValue(wML.get(i).getTitle()); weiXinSessionParaService.save(wsp); listWsp.add(wsp); } WeiXinSession wxs = weiXinSessionService.getByOpenId(wm.getFromUser()); if (wxs != null) { wxs.setNextMenuNo(menuNo + wML.size()); wxs.setLastVisitTime(StringUtils.parseDate2SecondStr(wm.getCreateDate())); } else { wxs = new WeiXinSession(); wxs.setOpenId(wm.getFromUser()); wxs.setLastVisitTime(StringUtils.parseDate2SecondStr(wm.getCreateDate())); wxs.setNextMenuNo(wML.size() + 1); wxs.setErrorNum(0); } weiXinSessionService.save(wxs); for (WeiXinSessionPara tmp : listWsp) { rspMsg += "\n【" + tmp.getMenuNo() + "】" + tmp.getValue(); } return rspMsg; }