Commit 096311f7 authored by duanruiming's avatar duanruiming

[update] 优化倒计时行人

parent 07fb7658
...@@ -122,9 +122,12 @@ public class HisensePhaseCountDownTask { ...@@ -122,9 +122,12 @@ public class HisensePhaseCountDownTask {
} }
Integer type = lightsPOS.get(0).getType(); Integer type = lightsPOS.get(0).getType();
redCountDown = changePhaseTime - runtime - phaseTime; redCountDown = changePhaseTime - runtime - phaseTime;
if (redCountDown < 0) { if (redCountDown <= 0) {
redCountDown = cycleLen - runtime; redCountDown = cycleLen - runtime;
} }
//if (redCountDown <= 0) {
// redCountDown = 1;
//}
if (type == 2) { // 圆饼灯 if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3); List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) { for (Integer commonTurn : dirList) {
...@@ -143,7 +146,7 @@ public class HisensePhaseCountDownTask { ...@@ -143,7 +146,7 @@ public class HisensePhaseCountDownTask {
} }
} }
} }
phaseMap.put(String.valueOf(dir), turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
} else { } else {
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown(); Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
...@@ -178,7 +181,7 @@ public class HisensePhaseCountDownTask { ...@@ -178,7 +181,7 @@ public class HisensePhaseCountDownTask {
} }
} }
} }
phaseMap.put(String.valueOf(dir), turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
} }
} }
...@@ -189,6 +192,23 @@ public class HisensePhaseCountDownTask { ...@@ -189,6 +192,23 @@ public class HisensePhaseCountDownTask {
lightsStatusVO.setPhaseMap(phaseMap); lightsStatusVO.setPhaseMap(phaseMap);
} }
/**
* 统一方向转向倒计时
* @param phaseMap
* @param dir
* @param turnCountDown
*/
private static void setPhaseMap(Map<String, Object> phaseMap, Integer dir, Map<Integer, Integer> turnCountDown) {
String dirStr = String.valueOf(dir);
if (!phaseMap.isEmpty() && Objects.nonNull(phaseMap.get(dirStr))) {
Map<Integer, Integer> turnCountDownCahce = (Map<Integer, Integer>) phaseMap.get(dirStr);
turnCountDownCahce.putAll(turnCountDown);
phaseMap.put(String.valueOf(dir), turnCountDown);
} else {
phaseMap.put(String.valueOf(dir), turnCountDown);
}
}
/** /**
* @param crossId * @param crossId
* @param lightsStatusVO * @param lightsStatusVO
...@@ -200,6 +220,7 @@ public class HisensePhaseCountDownTask { ...@@ -200,6 +220,7 @@ public class HisensePhaseCountDownTask {
List<CrossPhasePO> nextSchemePhaseList = crossPhaseMapper.selectByCrossIdAndPlanId(crossId, String.valueOf(crossSchemePO.getId())); List<CrossPhasePO> nextSchemePhaseList = crossPhaseMapper.selectByCrossIdAndPlanId(crossId, String.valueOf(crossSchemePO.getId()));
Integer phaseTime = 0; Integer phaseTime = 0;
String phaseId = null; String phaseId = null;
if (!CollectionUtils.isEmpty(nextSchemePhaseList)) { if (!CollectionUtils.isEmpty(nextSchemePhaseList)) {
for (CrossPhasePO crossPhasePO : nextSchemePhaseList) { for (CrossPhasePO crossPhasePO : nextSchemePhaseList) {
if (Objects.equals(1, crossPhasePO.getSort())) { if (Objects.equals(1, crossPhasePO.getSort())) {
...@@ -357,7 +378,7 @@ public class HisensePhaseCountDownTask { ...@@ -357,7 +378,7 @@ public class HisensePhaseCountDownTask {
turnColor.put(turn, "red"); turnColor.put(turn, "red");
} }
} }
if (cyclePhaseCountDown < redTime) { if (cyclePhaseCountDown <= redTime) {
color = "red"; color = "red";
if (turn == 20) { if (turn == 20) {
turnColor.put(turn, "green"); turnColor.put(turn, "green");
......
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