diff --git a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java index 41e441b8..7c94fa24 100644 --- a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java +++ b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java @@ -423,7 +423,8 @@ public class TrafficAnalysis { // 对于不拥堵的路段,累加之前计算的默认拥堵距离 if (!ChannelCongestionLevelEnum.isMediumOrSevereCongestion(averageSpeed, dcTrafficSectionData.getTrafficVolume())) { - totalCongestionDistance.addAndGet(defaultCongestionDistance); + int congestionDistance = Math.abs(stakeMark - previousStakeMark); + totalCongestionDistance.addAndGet(Math.min(congestionDistance, defaultCongestionDistance)); previousStakeMark = stakeMark; defaultCongestionDistance = 0; previousAverageSpeed = 0; @@ -445,8 +446,6 @@ public class TrafficAnalysis { congestedSectionQuantity.addAndGet(1); } } else { - // 如果之前没有计算过任何路段,则直接累加默认拥堵距离 - totalCongestionDistance.addAndGet(defaultCongestionDistance); // 累加拥堵路段数量 congestedSectionQuantity.addAndGet(1); }