Commit 33295e5d authored by zhouleilei's avatar zhouleilei

灯态优化

parent 4989b034
......@@ -295,16 +295,6 @@ public class ControlCommandServiceImpl implements ControlCommandService {
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.PATTERN).setText(tempSchemeSendVO.getPattern());
messageContent.addElement(HttpConstants.CYCLE).setText(tempSchemeSendVO.getCycle());
//如果为空赋值神思的默认值
if (ObjectUtils.isEmpty(tempSchemeSendVO.getOffset())) {
tempSchemeSendVO.setOffset("0");
}
if (ObjectUtils.isEmpty(tempSchemeSendVO.getType())) {
tempSchemeSendVO.setType("1");
}
if (ObjectUtils.isEmpty(tempSchemeSendVO.getSplit())) {
tempSchemeSendVO.setSplit("40,0,0,40,50,50,0,0,0,0,0,0,0,0,0,0");
}
messageContent.addElement(HttpConstants.OFFSET).setText(tempSchemeSendVO.getOffset());
messageContent.addElement(HttpConstants.TYPE).setText(tempSchemeSendVO.getType());
messageContent.addElement(HttpConstants.SPLIT).setText(tempSchemeSendVO.getSplit());
......
package net.wanji.utc.hisense.task;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.CrossLightsPO;
......@@ -113,79 +114,85 @@ public class HisensePhaseCountDownTask {
if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) {
if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) {
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
List<CrossLightsPO> lightsPOS = dirEntry.getValue();
if (!CollectionUtils.isEmpty(lightsPOS)) {
// 忽略行人
List<CrossLightsPO> person = lightsPOS.stream().filter(po -> po.getTurn() == 20).collect(Collectors.toList());
if (person.size() == lightsPOS.size()) {
continue;
}
Integer type = lightsPOS.get(0).getType();
redCountDown = changePhaseTime - runtime - phaseTime;
if (redCountDown <= 0) {
redCountDown = cycleLen - runtime;
}
//if (redCountDown <= 0) {
// redCountDown = 1;
//}
if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) {
turnCountDown.put(commonTurn, redCountDown);
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
List<CrossLightsPO> lightsPOS = dirEntry.getValue();
if (!CollectionUtils.isEmpty(lightsPOS)) {
// 忽略行人
List<CrossLightsPO> person = lightsPOS.stream().filter(po -> po.getTurn() == 20).collect(Collectors.toList());
if (person.size() == lightsPOS.size()) {
continue;
}
Integer type = lightsPOS.get(0).getType();
redCountDown = changePhaseTime - runtime - phaseTime;
if (redCountDown <= 0) {
redCountDown = cycleLen - runtime;
}
} else {
Map<Integer, List<CrossLightsPO>> turnMap = lightsPOS.stream().collect(Collectors.groupingBy(CrossLightsPO::getTurn));
for (Map.Entry<Integer, List<CrossLightsPO>> turnEntry : turnMap.entrySet()) {
Integer turn = turnEntry.getKey();
List<CrossLightsPO> value = turnEntry.getValue();
for (CrossLightsPO lightsPO : value) {
if (lightsPO.getTurn() != 20) {
turnCountDown.put(turn, redCountDown);
//if (redCountDown <= 0) {
// redCountDown = 1;
//}
if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) {
turnCountDown.put(commonTurn, redCountDown);
}
} else {
Map<Integer, List<CrossLightsPO>> turnMap = lightsPOS.stream().collect(Collectors.groupingBy(CrossLightsPO::getTurn));
for (Map.Entry<Integer, List<CrossLightsPO>> turnEntry : turnMap.entrySet()) {
Integer turn = turnEntry.getKey();
List<CrossLightsPO> value = turnEntry.getValue();
for (CrossLightsPO lightsPO : value) {
if (lightsPO.getTurn() != 20) {
turnCountDown.put(turn, redCountDown);
}
}
}
}
}
setPhaseMap(phaseMap, dir, turnCountDown);
}
setPhaseMap(phaseMap, dir, turnCountDown);
}
} else {
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
List<CrossLightsPO> lightsPOS = dirEntry.getValue();
if (!CollectionUtils.isEmpty(lightsPOS)) {
// 忽略行人
List<CrossLightsPO> person = lightsPOS.stream().filter(po -> po.getTurn() == 20).collect(Collectors.toList());
if (person.size() == lightsPOS.size()) {
continue;
}
Integer type = lightsPOS.get(0).getType();
redCountDown = cyclePhaseCountDown;
if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) {
turnCountDown.put(commonTurn, redCountDown);
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
List<CrossLightsPO> lightsPOS = dirEntry.getValue();
if (!CollectionUtils.isEmpty(lightsPOS)) {
// 忽略行人
List<CrossLightsPO> person = lightsPOS.stream().filter(po -> po.getTurn() == 20).collect(Collectors.toList());
if (person.size() == lightsPOS.size()) {
continue;
}
} else {
Map<Integer, List<CrossLightsPO>> turnMap = lightsPOS.stream().collect(Collectors.groupingBy(CrossLightsPO::getTurn));
for (Map.Entry<Integer, List<CrossLightsPO>> turnEntry : turnMap.entrySet()) {
Integer turn = turnEntry.getKey();
List<CrossLightsPO> value = turnEntry.getValue();
for (CrossLightsPO lightsPO : value) {
if (lightsPO.getTurn() != 20) {
turnCountDown.put(turn, redCountDown);
Integer type = lightsPOS.get(0).getType();
redCountDown = cyclePhaseCountDown;
if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) {
turnCountDown.put(commonTurn, redCountDown);
}
} else {
Map<Integer, List<CrossLightsPO>> turnMap = lightsPOS.stream().collect(Collectors.groupingBy(CrossLightsPO::getTurn));
for (Map.Entry<Integer, List<CrossLightsPO>> turnEntry : turnMap.entrySet()) {
Integer turn = turnEntry.getKey();
List<CrossLightsPO> value = turnEntry.getValue();
for (CrossLightsPO lightsPO : value) {
if (lightsPO.getTurn() != 20) {
turnCountDown.put(turn, redCountDown);
}
}
}
}
}
setPhaseMap(phaseMap, dir, turnCountDown);
}
setPhaseMap(phaseMap, dir, turnCountDown);
}
}
}
}
......@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask {
if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) {
// 相位红灯
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) {
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) {
String dir = String.valueOf(entry.getKey());
Map<Integer, String> turnColor = null;
......@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask {
Integer yellowTime = phaseCountDownDTO.getYellowTime();
Integer redTime = phaseCountDownDTO.getRedTime();
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) {
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
} else {
log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
}
}
}
......
......@@ -175,6 +175,7 @@ public class LocalDateTimeUtil {
LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT);
String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS));
System.out.println(time);
System.out.println(new Date().getTime());
}
/**
......
......@@ -32,8 +32,7 @@ public class TempSchemeSendVO {
@NotBlank(message = "offset不能为空")
private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=15(瓶颈模式,\n" +
"按比例调整)")
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=1 时为协调模式,Type=15(瓶颈模式,按比例调整)")
@NotBlank(message = "type不能为空")
private String type;
......
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