Commit 97fb9c21 authored by hanbing's avatar hanbing

方案管理-获取方案列表,返回特殊控制信息

parent c5fc8780
......@@ -7,5 +7,7 @@ package net.wanji.web.common.constant;
public class ControlModeConst {
public static final Integer FIXED_CYCLE = 1; // 定周期
public static final Integer YELLOW_FLASH = 7; // 黄闪
public static final Integer RED_FLASH = 8; // 红闪
public static final Integer GREEN_FLASH = 6; // 绿闪
public static final Integer IS_RED = 4; // 红灯
public static final Integer IS_GREEN = 2; // 绿灯
}
......@@ -32,6 +32,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
......@@ -164,12 +165,46 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
* @return java.util.List<net.wanji.web.dto.SaveSchemeConfigDTO.PhaseListElement>
*/
private List<SaveSchemeConfigDTO.PhaseListElement> buildSpecialControlList(String crossId, Integer schemeId) {
// List<CrossPhasePO> crossPhasePOList = crossPhaseMapper.selectByCrossIdAndSchemeId(crossId, schemeId);
// for (CrossPhasePO crossPhasePO : crossPhasePOList) {
// Integer controlMode = crossPhasePO.getControlMode();
// if (controlMode == )
// }
return null;
List<SaveSchemeConfigDTO.PhaseListElement> phaseListElementList = new ArrayList<>();
List<CrossPhasePO> crossPhasePOList = crossPhaseMapper.selectByCrossIdAndSchemeId(crossId, schemeId);
for (CrossPhasePO crossPhasePO : crossPhasePOList) {
SaveSchemeConfigDTO.PhaseListElement phaseListElement = new SaveSchemeConfigDTO.PhaseListElement();
Integer controlMode = crossPhasePO.getControlMode();
if (Objects.equals(controlMode, ControlModeConst.IS_GREEN)
|| Objects.equals(controlMode, ControlModeConst.IS_RED)
|| Objects.equals(controlMode, ControlModeConst.GREEN_FLASH)
|| Objects.equals(controlMode, ControlModeConst.YELLOW_FLASH)) {
String phaseNo = crossPhasePO.getPhaseNo();
phaseListElement.setPhaseNo(phaseNo);
phaseListElement.setPhaseType(crossPhasePO.getPhaseType());
phaseListElement.setMinGreenTime(crossPhasePO.getMinGreenTime());
phaseListElement.setMaxGreenTime(crossPhasePO.getMaxGreenTime());
phaseListElement.setGreenTime(crossPhasePO.getGreenTime());
phaseListElement.setGreenFlashTime(crossPhasePO.getGreenFlashTime());
phaseListElement.setYellowFlashTime(crossPhasePO.getYellowFlashTime());
phaseListElement.setRedFlashTime(crossPhasePO.getRedFlashTime());
phaseListElement.setYellowTime(crossPhasePO.getYellowTime());
phaseListElement.setRedTime(crossPhasePO.getRedTime());
phaseListElement.setYellowFlash(crossPhasePO.getYellowFlashTime());
if (controlMode.equals(ControlModeConst.IS_RED)){
phaseListElement.setIsRed(1);
} else if (controlMode.equals(ControlModeConst.IS_GREEN)) {
phaseListElement.setIsGreen(1);
} else if (controlMode.equals(ControlModeConst.GREEN_FLASH)) {
phaseListElement.setGreenFlash(1);
} else if (controlMode.equals(ControlModeConst.YELLOW_FLASH)) {
phaseListElement.setYellowFlash(1);
}
phaseListElement.setAccompanyPhaseNoList(new ArrayList<>());
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(crossId, schemeId, phaseNo);
List<SaveSchemeConfigDTO.DirListElement> dirList = buildDirList(crossId, phaseId);
phaseListElement.setDirList(dirList);
phaseListElementList.add(phaseListElement);
}
}
return phaseListElementList;
}
/**
......@@ -267,13 +302,13 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
// 伴随相位的母相位列表
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(crossId, schemeId, phaseNo);
if (phaseType == 3) {
List<String> accompanyPhaseNoList = new ArrayList<>();
List<String> superPhaseNoList = new ArrayList<>();
List<Integer> superIdList = crossAccompanyPhaseMapper.selectByPhaseId(phaseId);
List<CrossPhasePO> superList = crossPhaseMapper.selectByIds(superIdList);
for (CrossPhasePO phasePO : superList) {
accompanyPhaseNoList.add(phasePO.getPhaseNo());
superPhaseNoList.add(phasePO.getPhaseNo());
}
phaseListElement.setAccompanyPhaseNoList(accompanyPhaseNoList);
phaseListElement.setAccompanyPhaseNoList(superPhaseNoList);
}
// 构造方向列表
List<SaveSchemeConfigDTO.DirListElement> dirList = buildDirList(crossId, phaseId);
......
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