Commit 3c93e6a1 authored by duanruiming's avatar duanruiming

[update] 优化红灯倒计时,特殊控制时倒计时为0

parent efdd8a3e
......@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.databus.dao.entity.BaseCrossSchemePO;
import net.wanji.databus.dao.entity.CrossLightsPO;
import net.wanji.databus.dao.entity.CrossPhaseLightsPO;
import net.wanji.databus.dao.entity.CrossPhasePO;
import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.ManufacturerInfoPO;
......@@ -137,20 +138,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
for (PhaseInfoPO phaseInfoPO : phaseList) {
Integer phaseNo = phaseInfoPO.getPhaseNo();
Integer countdown = phaseInfoPO.getCountdown();
Integer phaseId = crossPhaseMapper.selectPhaseId(crossId, baseCrossSchemePO.getId(), phaseNo);
List<CrossPhaseLightsPO> crossPhaseLightsPOList = crossPhaseLightsMapper.selectByCrossId(crossId);
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
if (Objects.equals(phaseId, crossPhaseLightsPO.getPhaseId())) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
for (CrossLightsPO crossLightsPO : crossLightsPOList) {
if (Objects.equals(lightsId, crossLightsPO.getId())) {
Integer dir = crossLightsPO.getDir();
Integer turn = crossLightsPO.getTurn();
phaseMap.put(String.join("-", String.valueOf(dir), String.valueOf(turn)), countdown);
}
}
}
}
setDirTurnRedCountDown(crossId, crossLightsPOList, baseCrossSchemePO, phaseMap, phaseNo, countdown);
Integer vehicleStatus = phaseInfoPO.getVehicleStatus();
Integer phaseLength = phaseInfoPO.getPhaseLength();
Integer red = phaseInfoPO.getRed();
......@@ -195,6 +183,43 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
return result;
}
private void setDirTurnRedCountDown(String crossId, List<CrossLightsPO> crossLightsPOList, BaseCrossSchemePO baseCrossSchemePO, Map<String, Object> phaseMap, Integer phaseNo, Integer countdown) {
if (Objects.nonNull(baseCrossSchemePO)) {
Integer phaseId = crossPhaseMapper.selectPhaseId(crossId, baseCrossSchemePO.getId(), phaseNo);
List<CrossPhaseLightsPO> crossPhaseLightsPOList = crossPhaseLightsMapper.selectByCrossId(crossId);
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
if (Objects.equals(phaseId, crossPhaseLightsPO.getPhaseId())) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
for (CrossLightsPO crossLightsPO : crossLightsPOList) {
if (Objects.equals(lightsId, crossLightsPO.getId())) {
Integer dir = crossLightsPO.getDir();
Integer turn = crossLightsPO.getTurn();
phaseMap.put(String.join("-", String.valueOf(dir), String.valueOf(turn)), countdown);
}
}
}
}
} else { // 特殊控制的时候
List<CrossPhasePO> crossPhasePOS = crossPhaseMapper.selectByCrossId(crossId);
for (CrossPhasePO crossPhasePO : crossPhasePOS) {
Integer phaseId = crossPhasePO.getId();
List<CrossPhaseLightsPO> crossPhaseLightsPOList = crossPhaseLightsMapper.selectByCrossId(crossId);
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
if (Objects.equals(phaseId, crossPhaseLightsPO.getPhaseId())) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
for (CrossLightsPO crossLightsPO : crossLightsPOList) {
if (Objects.equals(lightsId, crossLightsPO.getId())) {
Integer dir = crossLightsPO.getDir();
Integer turn = crossLightsPO.getTurn();
phaseMap.put(String.join("-", String.valueOf(dir), String.valueOf(turn)), 0);
}
}
}
}
}
}
}
/**
* 构建信号机请求参数
*
......
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