Commit ef60234e authored by hanbing's avatar hanbing

方案管理-灯组配置,定义行人灯放行方向为安装位置

parent 040fc9da
......@@ -37,16 +37,16 @@ public class CrossConfigServiceImpl implements CrossConfigService {
private final LaneSegmentMapper laneSegmentMapper;
private final CrossLightsMapper crossLightsMapper;
// 灯组位置与放行方向对应关系
private static final Map<String, Integer> ADDRESS_DIR_MAP = new HashMap<>(8);
private static final Map<Integer, Integer> ADDRESS_DIR_MAP = new HashMap<>(8);
static {
ADDRESS_DIR_MAP.put("1", 5);
ADDRESS_DIR_MAP.put("2", 6);
ADDRESS_DIR_MAP.put("3", 7);
ADDRESS_DIR_MAP.put("4", 8);
ADDRESS_DIR_MAP.put("5", 1);
ADDRESS_DIR_MAP.put("6", 2);
ADDRESS_DIR_MAP.put("7", 3);
ADDRESS_DIR_MAP.put("8", 4);
ADDRESS_DIR_MAP.put(1, 5);
ADDRESS_DIR_MAP.put(2, 6);
ADDRESS_DIR_MAP.put(3, 7);
ADDRESS_DIR_MAP.put(4, 8);
ADDRESS_DIR_MAP.put(5, 1);
ADDRESS_DIR_MAP.put(6, 2);
ADDRESS_DIR_MAP.put(7, 3);
ADDRESS_DIR_MAP.put(8, 4);
}
// 放行方向与灯组位置对应关系
......@@ -137,10 +137,13 @@ public class CrossConfigServiceImpl implements CrossConfigService {
setType(ledConfigListElement, crossLightsPO);
// 灯组放行方向
Integer address = ledConfigListElement.getAddress();
String addressStr = address.toString();
String addressFirstLetter = addressStr.substring(0, 1);
Integer dir = ADDRESS_DIR_MAP.get(addressFirstLetter);
if (address < 10) { // 非行人灯
Integer dir = ADDRESS_DIR_MAP.get(address);
crossLightsPO.setDir(dir);
} else { // 行人灯
String firstDigit = address.toString().substring(0, 1);
crossLightsPO.setDir(Integer.parseInt(firstDigit));
}
crossLightsPO.setSort(ledConfigListElement.getOrder());
crossLightsPO.setCrossId(crossId);
crossLightsPOList.add(crossLightsPO);
......@@ -273,15 +276,15 @@ public class CrossConfigServiceImpl implements CrossConfigService {
if (type < 20 || type >= 30) { // 非行人灯
ledConfigListElement.setAddress(address);
} else if (type == 20) { // 一次过街
String s = "" + address + 1;
String s = "" + dir + 1;
int i = Integer.parseInt(s);
ledConfigListElement.setAddress(i);
} else if (type == 22) { // 二次过街-出口
String s = "" + address + 21;
String s = "" + dir + 21;
int i = Integer.parseInt(s);
ledConfigListElement.setAddress(i);
} else if (type == 21) { // 二次过街-进口
String s = "" + address + 22;
String s = "" + dir + 22;
int i = Integer.parseInt(s);
ledConfigListElement.setAddress(i);
}
......
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