Commit a6587680 authored by hanbing's avatar hanbing

方案管理-处理伴随相位

parent 7dcd568f
...@@ -98,11 +98,9 @@ public class SaveSchemeConfigDTO { ...@@ -98,11 +98,9 @@ public class SaveSchemeConfigDTO {
@Data @Data
public static class LaneListElement { public static class LaneListElement {
@ApiModelProperty(value = "车道序号,从左车道开始编号11、12、13...", required = true)
private Integer sort;
@ApiModelProperty(value = "车道转向:1左转;2直行;3右转;4掉头;5左直;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头", required = true) @ApiModelProperty(value = "车道转向:1左转;2直行;3右转;4掉头;5左直;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头", required = true)
private Integer turn; private Integer direction;
@ApiModelProperty(value = "车道类别:1机动车;2非机动车;3公交专用;4可变;5潮汐", required = true) @ApiModelProperty(value = "车道类别:1机动车;2非机动车;3公交专用;4可变;5潮汐", required = true)
private Integer category; private Integer laneType;
} }
} }
\ No newline at end of file
...@@ -20,8 +20,8 @@ public interface CrossPhaseMapper { ...@@ -20,8 +20,8 @@ public interface CrossPhaseMapper {
void deleteByCrossId(@Param("crossId") String crossId); void deleteByCrossId(@Param("crossId") String crossId);
void updateAccompanyPhaseNo(@Param("coordPhaseNo") String coordPhaseNo, void updateAccompanyPhaseNo(@Param("accompaniedPhaseNo") String accompaniedPhaseNo,
@Param("phaseNoReal") String phaseNoReal, @Param("accompanyPhaseNo") String accompanyPhaseNo,
@Param("planId") Integer planId, @Param("planId") Integer planId,
@Param("crossId") String crossId); @Param("crossId") String crossId);
} }
...@@ -117,11 +117,11 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -117,11 +117,11 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
String crossId = saveSchemeConfigDTO.getCrossId(); String crossId = saveSchemeConfigDTO.getCrossId();
crossPhaseMapper.deleteByCrossId(crossId); crossPhaseMapper.deleteByCrossId(crossId);
crossPhaseLightsMapper.deleteByCrossId(crossId); crossPhaseLightsMapper.deleteByCrossId(crossId);
// 用于限制相位号不能重复
Set<String> phaseNoSet = new HashSet<>();
List<SaveSchemeConfigDTO.PhaseScheme> phaseSchemeList = saveSchemeConfigDTO.getPhaseSchemeList(); List<SaveSchemeConfigDTO.PhaseScheme> phaseSchemeList = saveSchemeConfigDTO.getPhaseSchemeList();
for (SaveSchemeConfigDTO.PhaseScheme phaseScheme : phaseSchemeList) { for (SaveSchemeConfigDTO.PhaseScheme phaseScheme : phaseSchemeList) {
// 用于限制相位号不能重复
Set<String> phaseNoSet = new HashSet<>();
String schemeNo = phaseScheme.getSchemeNo(); String schemeNo = phaseScheme.getSchemeNo();
// 获取方案ID // 获取方案ID
Integer schemeId = crossSchemeMapper.selectIdByCrossIdAndSchemeNo(crossId, schemeNo); Integer schemeId = crossSchemeMapper.selectIdByCrossIdAndSchemeNo(crossId, schemeNo);
...@@ -139,7 +139,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -139,7 +139,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
String phaseNo = phase.getPhaseNo(); String phaseNo = phase.getPhaseNo();
testPhaseNo(phaseNoSet, phaseNo); testPhaseNo(phaseNoSet, phaseNo);
Integer phaseType = phase.getPhaseType(); Integer phaseType = phase.getPhaseType();
if (phaseType != 3) { // 非伴随相位 if (phaseType != 3) { // 实相位或虚相位
phaseNoMap.put(phaseNo, phase); phaseNoMap.put(phaseNo, phase);
Integer yellowFlashTime = phase.getYellowFlashTime(); Integer yellowFlashTime = phase.getYellowFlashTime();
Integer redFlashTime = phase.getRedFlashTime(); Integer redFlashTime = phase.getRedFlashTime();
...@@ -199,8 +199,8 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -199,8 +199,8 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
Integer coordMaxGreenTime = 0; Integer coordMaxGreenTime = 0;
List<String> accompanyPhaseNoList = phase.getAccompanyPhaseNoList(); List<String> accompanyPhaseNoList = phase.getAccompanyPhaseNoList();
if (accompanyPhaseNoList != null) { if (accompanyPhaseNoList != null) {
for (String accompanyPhaseNo : accompanyPhaseNoList) { for (String accompaniedPhaseNo : accompanyPhaseNoList) {
SaveSchemeConfigDTO.PhaseListElement phaseListElement = phaseNoMap.get(accompanyPhaseNo); SaveSchemeConfigDTO.PhaseListElement phaseListElement = phaseNoMap.get(accompaniedPhaseNo);
// 时长加总 // 时长加总
coordGreenTime += phaseListElement.getGreenTime(); coordGreenTime += phaseListElement.getGreenTime();
coordGreenFlashTime += phaseListElement.getGreenFlashTime(); coordGreenFlashTime += phaseListElement.getGreenFlashTime();
...@@ -210,11 +210,11 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -210,11 +210,11 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
coordRedTime += phaseListElement.getRedTime(); coordRedTime += phaseListElement.getRedTime();
coordMinGreenTime += phaseListElement.getMinGreenTime(); coordMinGreenTime += phaseListElement.getMinGreenTime();
coordMaxGreenTime += phaseListElement.getMaxGreenTime(); coordMaxGreenTime += phaseListElement.getMaxGreenTime();
// 相位号 // 伴随相位号
String phaseNoReal = phaseListElement.getPhaseNo(); String accompanyPhaseNo = phase.getPhaseNo();
// 更新伴随相位号 // 更新伴随相位号
Integer planId = crossSchemeMapper.selectIdByCrossIdAndSchemeNo(crossId, schemeNo); Integer planId = crossSchemeMapper.selectIdByCrossIdAndSchemeNo(crossId, schemeNo);
crossPhaseMapper.updateAccompanyPhaseNo(accompanyPhaseNo, phaseNoReal, planId, crossId); crossPhaseMapper.updateAccompanyPhaseNo(accompaniedPhaseNo, accompanyPhaseNo, planId, crossId);
} }
} }
crossPhasePO.setGreenTime(coordGreenTime); crossPhasePO.setGreenTime(coordGreenTime);
...@@ -300,8 +300,8 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -300,8 +300,8 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
List<SaveSchemeConfigDTO.LaneListElement> laneList = dirListElement.getLaneList(); List<SaveSchemeConfigDTO.LaneListElement> laneList = dirListElement.getLaneList();
for (SaveSchemeConfigDTO.LaneListElement laneListElement : laneList) { for (SaveSchemeConfigDTO.LaneListElement laneListElement : laneList) {
CrossPhaseLightsPO crossPhaseLightsPO = new CrossPhaseLightsPO(); CrossPhaseLightsPO crossPhaseLightsPO = new CrossPhaseLightsPO();
Integer category = laneListElement.getCategory(); Integer category = laneListElement.getLaneType();
Integer turn = laneListElement.getTurn(); Integer turn = laneListElement.getDirection();
// 根据车道获得灯组ID // 根据车道获得灯组ID
String laneId = laneInfoMapper.selectIdByCrossIdDirTurn(crossId, dir, turn, category); String laneId = laneInfoMapper.selectIdByCrossIdDirTurn(crossId, dir, turn, category);
Integer lightsId = crossLaneLightsMapper.selectLightsIdByLaneId(crossId, laneId); Integer lightsId = crossLaneLightsMapper.selectLightsIdByLaneId(crossId, laneId);
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<update id="updateAccompanyPhaseNo"> <update id="updateAccompanyPhaseNo">
update t_base_cross_phase update t_base_cross_phase
set coord_phase_no = #{coordPhaseNo} set accompany_phase_no = #{accompanyPhaseNo}
where cross_id = #{crossId} and plan_id = #{planId} and phase_no = #{phaseNoReal} where cross_id = #{crossId} and plan_id = #{planId} and phase_no = #{accompaniedPhaseNo}
</update> </update>
<delete id="deleteByCrossId"> <delete id="deleteByCrossId">
......
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