map 集合的遍歷
阿新 • • 發佈:2018-08-31
[] word contains chat bsp ges repl 遍歷 cape
List<Map<String,Object>> autoReplyList= wechatService.queryAutoReplyByOrg(orgId); for(Map<String,Object> autoReply : autoReplyList) { String[] keywords = autoReply.get("keyword").toString().split("\\|"); //已豎線拆分關鍵字 for(String key : keywords) { if(StringUtil.stringNotNull(key.trim()) && wxMessage.getContent().toUpperCase().contains(key.toUpperCase())) { //有字母的都轉換成大寫判斷 String content=StringEscapeUtils.unescapeHtml(autoReply.get("content").toString());return echoTextMessage(wxMessage, content); } } } //String content=wechatService.queryAutoReplyByKeyWord(map); List<Map<String, Object>> autoReplyList = wechatService.queryAutoReplyByOrg(orgId);for (Map<String, Object> autoReply : autoReplyList) { if (autoReply.get("keyword").equals("gz")) { //有字母的都轉換成大寫判斷 autoReplyContent = autoReply.get("content").toString(); break; } } //轉義 //StringEscapeUtils.escapeHtml(content); //反轉義 autoReplyContent = StringEscapeUtils.unescapeHtml(autoReplyContent); autoReplyContent = autoReplyContent.replace("<br>", "\r\n"); return echoTextMessage(wxMessage, "歡迎關註" + autoReplyContent);
map 集合的遍歷