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