//long转integer
long count1 = (long) li.get("count");
Integer count = (int) count1;
total = total + count;
Object time = li.get("lastreporttime");
if(time==null){
onlineTotal = onlineTotal + count;
}else{
Date lastreporttime = (Date) li.get("lastreporttime");
//时间做加减(Date 转 Calendar )
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(lastreporttime);
rightNow.add(Calendar.HOUR, 3);// 日期加3小时
//Calendar 转 Date
Date date1 = rightNow.getTime();
//比较时间
boolean before = date1.before(currDate);
if(before){
unlineTotal = unlineTotal + count;
}else{
onlineTotal = onlineTotal + count;
}
}