Commit 79b13ba4 authored by duanruiming's avatar duanruiming

[update] 实时监控-优化方位时间计算逻辑

parent bada9b26
...@@ -205,8 +205,6 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService { ...@@ -205,8 +205,6 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService {
} }
} }
} }
// 记录已优化的路口
CROSS_OPT.add(crossId);
} }
} }
...@@ -292,7 +290,7 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService { ...@@ -292,7 +290,7 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService {
if (Objects.equals(startInDir, intCongestionDir)) { if (Objects.equals(startInDir, intCongestionDir)) {
crossTurnDataRealtimeDTO.setPassTime(-10.0); crossTurnDataRealtimeDTO.setPassTime(-10.0);
} }
if (Objects.equals(startInDir, (intCongestionDir + 2) == 9 ? 1 : intCongestionDir + 2) && Objects.equals("l", turnType)) { if (intCongestionDir > 7 && Objects.equals(startInDir, (intCongestionDir + 2) == 9 ? 1 : intCongestionDir + 2) && Objects.equals("l", turnType)) {
crossTurnDataRealtimeDTO.setPassTime(-10.0); crossTurnDataRealtimeDTO.setPassTime(-10.0);
} }
} }
...@@ -516,7 +514,8 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService { ...@@ -516,7 +514,8 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService {
Integer schemeId = crossPhaseDTO.getSchemeId(); Integer schemeId = crossPhaseDTO.getSchemeId();
CrossSchemePO crossSchemePO = geteSchemePOCache(String.join(Constants.SystemParam.SEPARATOR_UNDER_LINE, crossId, String.valueOf(schemeId))); CrossSchemePO crossSchemePO = geteSchemePOCache(String.join(Constants.SystemParam.SEPARATOR_UNDER_LINE, crossId, String.valueOf(schemeId)));
Map<Integer, List<CrossPhasePO>> ringNoPhasePOMap = getCrossPhaseCacheByCrossId(crossId).stream().collect(Collectors.groupingBy(CrossPhasePO::getRingNo)); // 当前路口方案号的相位参数
Map<Integer, List<CrossPhasePO>> ringNoPhasePOMap = getCrossPhaseCacheByCrossId(crossId).stream().filter(po -> Objects.equals(schemeId, po.getSchemeId())).collect(Collectors.groupingBy(CrossPhasePO::getRingNo));
SchemeSendVO schemeSendVO = new SchemeSendVO(); SchemeSendVO schemeSendVO = new SchemeSendVO();
List<SchemeSendVO.Pattern> patternList = new ArrayList<>(); List<SchemeSendVO.Pattern> patternList = new ArrayList<>();
...@@ -626,22 +625,24 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService { ...@@ -626,22 +625,24 @@ public class CrossOptimizeServiceImpl implements CrossOptimizeService {
if (countOffsetAdd <= 0 && countOffsetSub >= 0) { if (countOffsetAdd <= 0 && countOffsetSub >= 0) {
break; break;
} }
// 可减时间有可加时间 // 可加时间有可减时间
if (offsetTime < 0 && countOffsetSub < 0) { if (offsetTime > 0 && countOffsetSub < 0) {
countOffsetSub -= offsetTime; int currentSub = countOffsetSub;
countOffsetSub += offsetTime;
if (countOffsetSub <= 0) { if (countOffsetSub <= 0) {
phaseTimeOptResultMap.put(phaseNo, offsetTime); phaseTimeOptResultMap.put(phaseNo, offsetTime);
} else { } else {
phaseTimeOptResultMap.put(phaseNo, -countOffsetSub); phaseTimeOptResultMap.put(phaseNo, -currentSub);
} }
} }
// 可加时间有可减时间 // 可减时间有可加时间
if (offsetTime > 0 && countOffsetAdd > 0) { if (offsetTime < 0 && countOffsetAdd > 0) {
countOffsetAdd -= offsetTime; int cuttentAdd = countOffsetAdd;
countOffsetAdd += offsetTime;
if (countOffsetAdd >= 0) { if (countOffsetAdd >= 0) {
phaseTimeOptResultMap.put(phaseNo, offsetTime); phaseTimeOptResultMap.put(phaseNo, offsetTime);
} else { } else {
phaseTimeOptResultMap.put(phaseNo, countOffsetAdd); phaseTimeOptResultMap.put(phaseNo, cuttentAdd);
} }
} }
} }
......
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