Commit cdbaae0c authored by duanruiming's avatar duanruiming

[add] 方案同步优化:同步相位灯组、车道灯组

parent 565d938a
...@@ -449,8 +449,8 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -449,8 +449,8 @@ public class PlanSendServiceImpl implements PlanSendService {
List<CrossBaseLaneInfoPO> crossBaseLaneInfoPOS = crossBaseLaneInfoMapper.selectList(queryWrapper); List<CrossBaseLaneInfoPO> crossBaseLaneInfoPOS = crossBaseLaneInfoMapper.selectList(queryWrapper);
// 车道灯组关系列表 // 车道灯组关系列表
List<CrossLaneLightsPO> crossLaneLightsPOS = new ArrayList<>(); List<CrossLaneLightsPO> crossLaneLightsPOS = new ArrayList<>();
List<BaseCrossLightsPO> insertedList = baseCrossLightsMapper.selectByCrossId(crossId); List<BaseCrossLightsPO> crossLightsPOS = baseCrossLightsMapper.selectByCrossId(crossId);
for (BaseCrossLightsPO baseCrossLightsPO : insertedList) { for (BaseCrossLightsPO baseCrossLightsPO : crossLightsPOS) {
Integer dir = baseCrossLightsPO.getDir(); Integer dir = baseCrossLightsPO.getDir();
Integer turn = baseCrossLightsPO.getTurn(); Integer turn = baseCrossLightsPO.getTurn();
Integer type = baseCrossLightsPO.getType(); Integer type = baseCrossLightsPO.getType();
...@@ -486,24 +486,35 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -486,24 +486,35 @@ public class PlanSendServiceImpl implements PlanSendService {
baseCrossLaneLightsMapper.deleteByCrossId(crossId); baseCrossLaneLightsMapper.deleteByCrossId(crossId);
baseCrossLaneLightsMapper.insertBatch(crossLaneLightsPOS); baseCrossLaneLightsMapper.insertBatch(crossLaneLightsPOS);
List<CrossPhaseLightsPO> crossPhaseLightsPOS = new ArrayList<>(); List<CrossPhaseLightsPO> crossPhaseLightsPOS = new ArrayList<>();
CrossPhasePO crossPhasePO = new CrossPhasePO(); CrossPhasePO crossPhasePO = new CrossPhasePO();
crossPhasePO.setCrossId(crossId); crossPhasePO.setCrossId(crossId);
List<CrossPhasePO> crossPhasePOS = baseCrossPhaseMapper.listCrossPhasePO(crossPhasePO); List<CrossPhasePO> crossPhasePOS = baseCrossPhaseMapper.listCrossPhasePO(crossPhasePO);
// 灯组 //// 灯组
//insertedList.stream() //// 相位
// 相位 List<CrossPhaseLightsPO> insertPhaseLightList = new ArrayList<>();
List<CrossPhaseLightsPO> crossPhaseLightsPOList = schemePhaseLightsVO.getCrossPhaseLightsPOList(); List<CrossPhaseLightsPO> crossPhaseLightsPOList = schemePhaseLightsVO.getCrossPhaseLightsPOList();
if (!CollectionUtils.isEmpty(crossPhaseLightsPOList) && !CollectionUtils.isEmpty(crossPhasePOS)) {
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) { for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
Integer phaseId = crossPhaseLightsPO.getPhaseId(); Integer phaseId = crossPhaseLightsPO.getPhaseId();
Integer lightsId = crossPhaseLightsPO.getLightsId();
CrossPhaseLightsPO entity = new CrossPhaseLightsPO();
entity.setCrossId(crossId);
for (CrossPhasePO phasePO : crossPhasePOS) {
Integer phaseCurr = Integer.valueOf(phasePO.getPhaseNo());
if (Objects.equals(phaseId, phaseCurr)) {
entity.setPhaseId(phasePO.getId());
}
}
for (BaseCrossLightsPO crossLightsPO : crossLightsPOS) {
Integer lightCurr = Integer.valueOf(crossLightsPO.getLightsNo());
if (Objects.equals(lightsId, lightCurr)) {
entity.setLightsId(crossLightsPO.getId());
} }
} }
baseCrossPhaseLightsMapper.insertBatch(crossPhaseLightsPOS); insertPhaseLightList.add(entity);
}
List<CrossPhaseLightsPO> distinctPhaseLights = insertPhaseLightList.stream().distinct().collect(Collectors.toList());
baseCrossPhaseLightsMapper.insertBatch(distinctPhaseLights);
syncSchedules(crossId, schemePhaseLightsVO); syncSchedules(crossId, schemePhaseLightsVO);
} }
...@@ -537,8 +548,7 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -537,8 +548,7 @@ public class PlanSendServiceImpl implements PlanSendService {
if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) { if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) {
throw new Exception("信号机静态信息获取-调度信息-UTC服务调用异常"); throw new Exception("信号机静态信息获取-调度信息-UTC服务调用异常");
} }
List<CrossSchedulesPO> crossSchedulesPOList = mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<CrossSchedulesPO>>() { List<CrossSchedulesPO> crossSchedulesPOList = mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<CrossSchedulesPO>>() {});
});
insertSchedulesInfo(crossId, crossSchedulesPOList, crossPlanPOList); insertSchedulesInfo(crossId, crossSchedulesPOList, crossPlanPOList);
} }
......
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