map 集合的遍历

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);

猜你喜欢

转载自www.cnblogs.com/wangchuanfu/p/9567162.html