| | |
| | | import com.cloud.count.model.Config; |
| | | import com.cloud.count.model.People; |
| | | import com.cloud.count.service.CountService; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import java.text.ParseException; |
| | |
| | | private static String[] time2={"00","05","10","15","20","25", |
| | | "30","35","40","45","50","55"}; |
| | | public static volatile int countType = 0; |
| | | |
| | | private static Map<Integer,Integer> dayAllMap = new HashMap<>(); |
| | | private static Map<Integer,Integer> dayOutMap = new HashMap<>(); |
| | | private static Map<Integer,Integer> dayInMap = new HashMap<>(); |
| | | |
| | | /** |
| | | * 统计参数初始化,用于统计设备重启情况(发送的第一条报文) |
| | |
| | | if (now>start-1 && now<start+11){//表示从设置的初始化时间开始重新计数 |
| | | baseEnters = totalEnters; |
| | | baseExits = totalExits; |
| | | |
| | | dayAllMap = new HashMap<>(); |
| | | dayInMap = new HashMap<>(); |
| | | dayOutMap = new HashMap<>(); |
| | | } |
| | | |
| | | // 从开始计算时间到现在的进校数 |
| | |
| | | // 开始统计时间 分开 如06:40 |
| | | String[] times = config.getCountStartTime().split(":"); |
| | | // 初始设置时间分开 |
| | | String[] times2 = initialTime.split(":"); |
| | | String[] times2 = initialTime.split(":");//初始化时间06:00 |
| | | // 设置时间图表的项 |
| | | int charat = Integer.parseInt(times[0]); |
| | | int mm =Integer.parseInt(times2[0])-charat; |
| | | int charat = Integer.parseInt(times[0]);//统计开始时间06:00 |
| | | int mm =Integer.parseInt(times2[0])-charat;//分钟是00 |
| | | // 设置时间图表的项,比如图表的开始统计时间为06:40,则time_set就是[06:40,07:40,08:40,09:40,10:40,11:40,12:40,] |
| | | for(int i=0;i<minute;i++){ |
| | | //time_set[i]=time[charat]+":"+times[1]; |
| | |
| | | }else { |
| | | //System.out.println("第"+i+"个小时的数据:"); |
| | | // people[i] = dao.countInPeople(set-60,hourset+3599)- dao.countOutPeople(set-60,hourset+3599)+initialPeople+correctionPeople; |
| | | //使用缓存dayAllMap |
| | | people[i] = getDataValue(map,countType,set-60,hourset+1799,initialPeople,correctionPeople); |
| | | // if(countType == 1){ |
| | | // if(dayInMap.containsKey(i) && minute >1 && (i != minute-1)){ |
| | | // people[i] = dayInMap.get(i); |
| | | // }else{ |
| | | // people[i] = getDataValue(map,countType,set-60,hourset+1799,initialPeople,correctionPeople); |
| | | // dayInMap.put(i, people[i]); |
| | | // } |
| | | // } else if(countType == 0) { |
| | | // if(dayAllMap.containsKey(i) && minute >1 && (i != minute-1)){ |
| | | // people[i] = dayAllMap.get(i); |
| | | // }else{ |
| | | // people[i] = getDataValue(map,countType,set-60,hourset+1799,initialPeople,correctionPeople); |
| | | // dayAllMap.put(i, people[i]); |
| | | // } |
| | | // } else { |
| | | // if(dayOutMap.containsKey(i) && minute >1 && (i != minute-1)){ |
| | | // people[i] = dayOutMap.get(i); |
| | | // }else{ |
| | | // people[i] = getDataValue(map,countType,set-60,hourset+1799,initialPeople,correctionPeople); |
| | | // dayOutMap.put(i, people[i]); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } |
| | | hourset +=1800; |
| | | } |