Map分组排列
List<GgNoticeAllocate> ggNoticeAllocates = ggNoticeAllocateManager.findByProperty("noticeguid", getModel().getNoticeguid()); Map<String, List<GgNoticeAllocate>> ggNoticeAllocateMap = new HashMap<String, List<GgNoticeAllocate>>(); for (GgNoticeAllocate ggNoticeAllocate : ggNoticeAllocates) { String areaname = ggNoticeAllocate.getCityname(); List<GgNoticeAllocate> ggNoticeAllocateList = null; if(ggNoticeAllocateMap.containsKey(areaname) && Validator.isNotNull(ggNoticeAllocateMap.get(areaname))) { ggNoticeAllocateList = ggNoticeAllocateMap.get(areaname); ggNoticeAllocateList.add(ggNoticeAllocate); } else { ggNoticeAllocateList = new ArrayList<GgNoticeAllocate>(); ggNoticeAllocateList.add(ggNoticeAllocate); ggNoticeAllocateMap.put(areaname, ggNoticeAllocateList); } }
List<EventKeyword> eventKeywords = eventKeywordManager.getAll(criterions); //取到所有需要短信报警的事件 Map<String, List<EventKeyword>> eventKeywordMap = new HashMap<String, List<EventKeyword>>(); for (EventKeyword eventKeyword : eventKeywords) { EventScore es = eventScoreManager.findByProperty("kwid", eventKeyword.getId()).get(0); if(es.getScoresum() < eventKeyword.getAlertscore()) { continue; } String[] userids = eventKeyword.getSmsuserids().split(","); List<EventKeyword> eventKeywordList = null; for (String userid : userids) { if(eventKeywordMap.containsKey(userid) && Validator.isNotNull(eventKeywordMap.get(userid))) { eventKeywordList = eventKeywordMap.get(userid); eventKeywordList.add(eventKeyword); } else { eventKeywordList = new ArrayList<EventKeyword>(); eventKeywordList.add(eventKeyword); eventKeywordMap.put(userid, eventKeywordList); } } }
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了