Commit 12f6403b authored by zhoushiguang's avatar zhoushiguang

干线拥堵持续时间单位改为分钟

parent 82a29932
......@@ -330,6 +330,7 @@ public class LineCongestionIndexMain {
}
Map<String, Double> ridTravelTime = new HashMap<>();
Map<String, Double> ridFreeTime = new HashMap<>();
groupByRid.forEach((k1, v1) -> {
double avgTransitTime = v1.stream().mapToDouble(SingleCarInfo::getTransitTime).average().orElse(0) / 1000;
double freeTime = v1.get(0).getFreeTime();
......@@ -343,6 +344,7 @@ public class LineCongestionIndexMain {
String crossDir = v1.get(0).getCrossId() + "_" + v1.get(0).getRidDir() + "_" + v1.get(0).getRid();
ridTravelTime.put(crossDir, avgTransitTime);
ridFreeTime.put(crossDir, freeTime);
//log.info("路段交通指数rid:{},index:{}", k1, ridIndex);
});
......@@ -358,6 +360,7 @@ public class LineCongestionIndexMain {
lineCongestion.setEndTimeFormat(DateUtil.toDateTime(lineCongestion.getEndTime(),"yyyy-MM-dd HH:mm:ss.SSS"));
lineCongestion.setDetectTime(list.get(0).getStartTime());
lineCongestion.setRidTravelTime(ridTravelTime);
lineCongestion.setRidFreeTime(ridFreeTime);
lineCongestion.setIndex(index);
lineCongestion.setTransitTime(atomicDoubleTime.get());
......@@ -377,7 +380,8 @@ public class LineCongestionIndexMain {
String[] sps = agoTime.split("_");
String congType = sps[0];
if (Objects.equals(congType,congestionType)) {
duration = (System.currentTimeMillis() - Long.valueOf(sps[1])) / 1000;
//单位分钟
duration = (System.currentTimeMillis() - Long.valueOf(sps[1])) / 1000 /60;
} else {
greenWaveState.put(key,congestionType+"_"+System.currentTimeMillis());
}
......@@ -385,6 +389,10 @@ public class LineCongestionIndexMain {
greenWaveState.put(key,congestionType+"_"+System.currentTimeMillis());
}
if (duration<1) {
//持续时间不足1分钟
congestionType = CongestEnum.NO_CONGEST.getCode();
}
lineCongestion.setCongestionType(congestionType);
lineCongestion.setGreenWaveId(waveId);
lineCongestion.setGreenWaveDir(dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment