Commit 33295e5d authored by zhouleilei's avatar zhouleilei

灯态优化

parent 4989b034
...@@ -295,16 +295,6 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -295,16 +295,6 @@ public class ControlCommandServiceImpl implements ControlCommandService {
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode()); messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.PATTERN).setText(tempSchemeSendVO.getPattern()); messageContent.addElement(HttpConstants.PATTERN).setText(tempSchemeSendVO.getPattern());
messageContent.addElement(HttpConstants.CYCLE).setText(tempSchemeSendVO.getCycle()); 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.OFFSET).setText(tempSchemeSendVO.getOffset());
messageContent.addElement(HttpConstants.TYPE).setText(tempSchemeSendVO.getType()); messageContent.addElement(HttpConstants.TYPE).setText(tempSchemeSendVO.getType());
messageContent.addElement(HttpConstants.SPLIT).setText(tempSchemeSendVO.getSplit()); messageContent.addElement(HttpConstants.SPLIT).setText(tempSchemeSendVO.getSplit());
......
package net.wanji.utc.hisense.task; package net.wanji.utc.hisense.task;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.CrossLightsPO; import net.wanji.databus.dao.entity.CrossLightsPO;
...@@ -113,6 +114,7 @@ public class HisensePhaseCountDownTask { ...@@ -113,6 +114,7 @@ public class HisensePhaseCountDownTask {
if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) { if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) {
if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) { if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) {
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey(); Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>(); Map<Integer, Integer> turnCountDown = new HashMap<>();
...@@ -151,9 +153,12 @@ public class HisensePhaseCountDownTask { ...@@ -151,9 +153,12 @@ public class HisensePhaseCountDownTask {
} }
setPhaseMap(phaseMap, dir, turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
}
} else { } else {
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown(); Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey(); Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>(); Map<Integer, Integer> turnCountDown = new HashMap<>();
...@@ -187,6 +192,8 @@ public class HisensePhaseCountDownTask { ...@@ -187,6 +192,8 @@ public class HisensePhaseCountDownTask {
setPhaseMap(phaseMap, dir, turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
} }
}
} }
} }
} }
...@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask { ...@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask {
if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) { if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) {
// 相位红灯 // 相位红灯
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) { if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) {
String dir = String.valueOf(entry.getKey()); String dir = String.valueOf(entry.getKey());
Map<Integer, String> turnColor = null; Map<Integer, String> turnColor = null;
...@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask { ...@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask {
Integer yellowTime = phaseCountDownDTO.getYellowTime(); Integer yellowTime = phaseCountDownDTO.getYellowTime();
Integer redTime = phaseCountDownDTO.getRedTime(); Integer redTime = phaseCountDownDTO.getRedTime();
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) { if (ObjectUtil.isNotEmpty(dirTurnMap)) {
setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS); setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
} else {
log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
} }
} }
} }
......
...@@ -175,6 +175,7 @@ public class LocalDateTimeUtil { ...@@ -175,6 +175,7 @@ public class LocalDateTimeUtil {
LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT); LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT);
String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS)); String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS));
System.out.println(time); System.out.println(time);
System.out.println(new Date().getTime());
} }
/** /**
......
...@@ -32,8 +32,7 @@ public class TempSchemeSendVO { ...@@ -32,8 +32,7 @@ public class TempSchemeSendVO {
@NotBlank(message = "offset不能为空") @NotBlank(message = "offset不能为空")
private String offset; private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=15(瓶颈模式,\n" + @ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=1 时为协调模式,Type=15(瓶颈模式,按比例调整)")
"按比例调整)")
@NotBlank(message = "type不能为空") @NotBlank(message = "type不能为空")
private String 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