牛骨文教育服务平台(让学习变的简单)
博文笔记

Map分组排列

创建时间:2012-01-10 投稿人: 浏览次数:2927
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);
						}
					}
				}


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。