Commit f7a95c30 authored by duanruiming's avatar duanruiming

[add] 海信灯态优化;易购数据推送优化

parent 40a20376
......@@ -279,7 +279,8 @@ public class SignalStatusServiceImpl implements SignalStatusService {
for (HisenseLightStatusPojo.Body body : bodies) {
HisenseLightStatusPojo.ContentBody content = body.getContent();
String crossId = content.getCrossId();
if (StringUtils.equalsIgnoreCase("255136", crossId)) {
List<String> list = Arrays.asList("255136", "209723", "198207", "132163");
if (list.contains(crossId)) {
OkHttpClientUtil.jsonPost(yiGouUrl, jackson.writeValueAsString(hisenseLightStatusPojos));
}
}
......
......@@ -76,7 +76,7 @@ public class HisensePhaseCountDownTask {
// 当前方案下一周期
setDirLampGroupMap(lightsStatusVO);
if (Objects.nonNull(lightsStatusVO.getDirLampGroupMap())) {
if (Objects.equals(crossId, "13NI00B5RM0")) {
if (Objects.equals(crossId, "13NG10B5RH0")) {
List<String> dirList = Arrays.asList("1", "3", "7");
Map<String, Object> dirLampGroupMap = lightsStatusVO.getDirLampGroupMap();
for (String dir : dirList) {
......@@ -119,7 +119,9 @@ public class HisensePhaseCountDownTask {
int redCountDown = 0;
if (!CollectionUtils.isEmpty(crossPhaseDirTurnCache)) {
for (CrossPhaseDirTurnPojo dirTurnPojo : crossPhaseDirTurnCache) {
// 当前方案
if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) {
// 当前相位
if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) {
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
......@@ -164,6 +166,7 @@ public class HisensePhaseCountDownTask {
}
} else {
// 当前方案当前相位绿灯
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
......@@ -178,11 +181,11 @@ public class HisensePhaseCountDownTask {
continue;
}
Integer type = lightsPOS.get(0).getType();
redCountDown = cyclePhaseCountDown;
Integer greenCountDown = cyclePhaseCountDown;
if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) {
turnCountDown.put(commonTurn, redCountDown);
turnCountDown.put(commonTurn, greenCountDown);
}
} else {
Map<Integer, List<CrossLightsPO>> turnMap = lightsPOS.stream().collect(Collectors.groupingBy(CrossLightsPO::getTurn));
......@@ -191,7 +194,7 @@ public class HisensePhaseCountDownTask {
List<CrossLightsPO> value = turnEntry.getValue();
for (CrossLightsPO lightsPO : value) {
if (lightsPO.getTurn() != 20) {
turnCountDown.put(turn, redCountDown);
turnCountDown.put(turn, greenCountDown);
}
}
}
......@@ -359,10 +362,44 @@ public class HisensePhaseCountDownTask {
Integer yellowTime = phaseCountDownDTO.getYellowTime();
Integer redTime = phaseCountDownDTO.getRedTime();
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
} else {
log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
//if (ObjectUtil.isNotEmpty(dirTurnMap)) {
// setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
//} else {
// log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
//}
for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) {
String dir = String.valueOf(entry.getKey());
Map<Integer, String> turnColor = null;
if (!dirLampGroupMap.containsKey(dir)) {
turnColor = new HashMap<>();
} else {
turnColor = (Map<Integer, String>) dirLampGroupMap.get(dir);
}
List<CrossLightsPO> value = entry.getValue();
int type = 1;
for (CrossLightsPO crossLightsPO : value) { //todo 需要处理,路口方向级别,灯组圆饼灯要区分,有没有左转,crossd dir级别,有几个转向
Integer turn = crossLightsPO.getTurn();
if (crossLightsPO.getType() != 3) { // 设置灯色时不处理行人
type = crossLightsPO.getType();
}
// 搭接相位跳过绿灯变红灯
if (turnColor.containsKey(turn) && turnColor.get(turn).equals("green")) {
continue;
}
turnColor.put(turn, "green");
}
List<CrossLightsPO> dirAllLights = crossLightsPOS.stream()
.filter(po -> Objects.equals(po.getDir(), entry.getKey()) && !Objects.equals(po.getType(), 3))
.collect(Collectors.toList());
if (type == 2) {
if (dirAllLights.size() == 1) {
setAllTurnColor(turnColor, "green"); //红灯时,圆饼灯操作
} else {
turnColor.put(2, "green");
}
}
turnColor.put(3, "green");
dirLampGroupMap.put(dir, turnColor);
}
}
}
......@@ -384,12 +421,17 @@ public class HisensePhaseCountDownTask {
} else {
turnColor = (Map<Integer, String>) dirLampGroupMap.get(dir);
}
Integer type = 2; // 灯组类型:1箭头;2圆饼;3行人;
// 灯组类型:1箭头;2圆饼;3行人;
Integer type = 2;
String color = null;
for (CrossLightsPO crossLightsPO : lightsList) {
type = crossLightsPO.getType();
Integer turn = crossLightsPO.getTurn();
color = setTurnColor(cyclePhaseCountDown, yellowTime, redTime, turnColor, color, turn);
// 搭接相位跳过绿灯变红灯
if (turnColor.containsKey(turn) && turnColor.get(turn).equals("green")) {
continue;
}
turnColor.put(turn, color);
}
List<CrossLightsPO> dirAllLights = crossLightsPOS.stream()
......
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