List<Map<String, Object>> foreList = forecastDataDao.getcityforeresults(param);
Map<String,List<Map<String, Object>>> timegroupby=foreList.stream().collect(groupingBy(p->p.get("citycode").toString()));
Map<String,Map<String,List<Map<String, Object>>>> ret=new HashMap<>();
if(timegroupby!=null){
for(String time:timegroupby.keySet()){
Map<String,List<Map<String, Object>>> citygroup=null;
citygroup=timegroupby.get(time).stream().collect(groupingBy(p->DateUtil.dateToStr((Date)p.get("datatime"),"yyyyMMdd")));
if(citygroup!=null){
ret.put(time,citygroup);
}
}
}
return JSONObject.toJSONString(ret);