Commit cdbaae0c authored by duanruiming's avatar duanruiming

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

parent 565d938a
......@@ -449,8 +449,8 @@ public class PlanSendServiceImpl implements PlanSendService {
List<CrossBaseLaneInfoPO> crossBaseLaneInfoPOS = crossBaseLaneInfoMapper.selectList(queryWrapper);
// 车道灯组关系列表
List<CrossLaneLightsPO> crossLaneLightsPOS = new ArrayList<>();
List<BaseCrossLightsPO> insertedList = baseCrossLightsMapper.selectByCrossId(crossId);
for (BaseCrossLightsPO baseCrossLightsPO : insertedList) {
List<BaseCrossLightsPO> crossLightsPOS = baseCrossLightsMapper.selectByCrossId(crossId);
for (BaseCrossLightsPO baseCrossLightsPO : crossLightsPOS) {
Integer dir = baseCrossLightsPO.getDir();
Integer turn = baseCrossLightsPO.getTurn();
Integer type = baseCrossLightsPO.getType();
......@@ -486,24 +486,35 @@ public class PlanSendServiceImpl implements PlanSendService {
baseCrossLaneLightsMapper.deleteByCrossId(crossId);
baseCrossLaneLightsMapper.insertBatch(crossLaneLightsPOS);
List<CrossPhaseLightsPO> crossPhaseLightsPOS = new ArrayList<>();
CrossPhasePO crossPhasePO = new CrossPhasePO();
crossPhasePO.setCrossId(crossId);
List<CrossPhasePO> crossPhasePOS = baseCrossPhaseMapper.listCrossPhasePO(crossPhasePO);
// 灯组
//insertedList.stream()
// 相位
//// 灯组
//// 相位
List<CrossPhaseLightsPO> insertPhaseLightList = new ArrayList<>();
List<CrossPhaseLightsPO> crossPhaseLightsPOList = schemePhaseLightsVO.getCrossPhaseLightsPOList();
if (!CollectionUtils.isEmpty(crossPhaseLightsPOList) && !CollectionUtils.isEmpty(crossPhasePOS)) {
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
Integer phaseId = crossPhaseLightsPO.getPhaseId();
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
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());
}
}
insertPhaseLightList.add(entity);
}
baseCrossPhaseLightsMapper.insertBatch(crossPhaseLightsPOS);
List<CrossPhaseLightsPO> distinctPhaseLights = insertPhaseLightList.stream().distinct().collect(Collectors.toList());
baseCrossPhaseLightsMapper.insertBatch(distinctPhaseLights);
syncSchedules(crossId, schemePhaseLightsVO);
}
......@@ -537,8 +548,7 @@ public class PlanSendServiceImpl implements PlanSendService {
if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) {
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);
}
......
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