Commit f93b5775 authored by duanruiming's avatar duanruiming

[update] 方案管理-方案查询-相位车道方向优化

parent 17181f0b
package net.wanji.web.common.enums;
import java.util.Objects;
/**
* @author duanruiming
* @date 2023/03/29 17:47
*/
public enum CrossLisghtsLaneDirEnum {
ONE(1, 5, "北"),
TWO(2, 6, "东北"),
THREE(3, 7, "东"),
FOUR(4, 8, "东南"),
FIVE(5, 1, "南"),
SIX(6, 2,"西南"),
SEVEN(7, 3, "西"),
EIGHT(8, 4,"西北");
private final int lightDir;
private final int laneDir;
private final String msg;
public static Integer getLaneDirByLightsDir(Integer lightDir) {
CrossLisghtsLaneDirEnum[] values = CrossLisghtsLaneDirEnum.values();
for (CrossLisghtsLaneDirEnum value : values) {
if (Objects.equals(value.getLightDir(), lightDir)) {
return value.getLaneDir();
}
}
return null;
}
public static Integer getBackByFront(Integer frontCode) {
for (CrossTurnEnum value : CrossTurnEnum.values()) {
if (value.getFrontCode() == frontCode) {
return value.getBackCode();
}
}
return null;
}
CrossLisghtsLaneDirEnum(int lightDir, int laneDir, String msg) {
this.lightDir = lightDir;
this.laneDir = laneDir;
this.msg = msg;
}
public int getLightDir() {
return lightDir;
}
public int getLaneDir() {
return laneDir;
}
public String getMsg() {
return msg;
}
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import net.wanji.common.dto.CrossIdDTO;
import net.wanji.web.common.constant.ControlModeConst;
import net.wanji.web.common.enums.CrossLisghtsLaneDirEnum;
import net.wanji.web.common.exception.NoLanesException;
import net.wanji.web.common.exception.PhaseNoNotUniqueException;
import net.wanji.web.dto.LaneIdDTO;
......@@ -350,7 +351,8 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
}
for (Integer dir : dirSet) {
SaveSchemeConfigDTO.DirListElement dirListElement = new SaveSchemeConfigDTO.DirListElement();
dirListElement.setDir(dir);
Integer laneDir = CrossLisghtsLaneDirEnum.getLaneDirByLightsDir(dir);
dirListElement.setDir(laneDir);
// 是否有行人相位
List<CrossLightsPO> crossLightsPOList = crossLightsMapper.selectByCrossIdAndDir(crossId, dir);
for (CrossLightsPO crossLightsPO : crossLightsPOList) {
......
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