From 6286be72bd3190c3eaf93a214cb000ee0eb2dd0b Mon Sep 17 00:00:00 2001 From: xiepufeng <1072271977@qq.com> Date: Tue, 9 Apr 2024 16:53:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=BD=91=E6=95=B4?= =?UTF-8?q?=E4=BD=93=E6=8B=A5=E5=A0=B5=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/statistics/handler/TrafficAnalysis.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); }