Commit b8f0fc81 authored by hanbing's avatar hanbing

渠化配置-修改车道ID生成规则

parent 94eeaaf8
...@@ -31,4 +31,6 @@ public interface LaneInfoMapper { ...@@ -31,4 +31,6 @@ public interface LaneInfoMapper {
@Param("category") Integer category); @Param("category") Integer category);
List<LaneInfoPO> selectByLaneIds(@Param("laneIds") List<String> laneIds); List<LaneInfoPO> selectByLaneIds(@Param("laneIds") List<String> laneIds);
String selectPreId(String crossId, Integer dir);
} }
...@@ -210,7 +210,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -210,7 +210,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
&& Objects.equals(oldPO.getType(), newPO.getType())); && Objects.equals(oldPO.getType(), newPO.getType()));
} }
private static void setType(LedConfigListElement ledConfigListElement, CrossLightsPO crossLightsPO) { private void setType(LedConfigListElement ledConfigListElement, CrossLightsPO crossLightsPO) {
Integer type = ledConfigListElement.getType(); Integer type = ledConfigListElement.getType();
Integer signalType = ledConfigListElement.getSignalType(); Integer signalType = ledConfigListElement.getSignalType();
String address = ledConfigListElement.getAddress(); String address = ledConfigListElement.getAddress();
...@@ -271,7 +271,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -271,7 +271,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
List<Integer> dirListFromDb= crossDirInfoPOList.stream() List<Integer> dirListFromDb= crossDirInfoPOList.stream()
.map(CrossDirInfoPO::getDirType) .map(CrossDirInfoPO::getDirType)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 删除数据库中有,前端对象中没有的数据 // 删除数据库中有,前端对象中没有的方向
for (Integer dirFromDb : dirListFromDb) { for (Integer dirFromDb : dirListFromDb) {
if (!dirList.contains(dirFromDb)) { if (!dirList.contains(dirFromDb)) {
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByCrossIdAndDir(crossId, dirFromDb); List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByCrossIdAndDir(crossId, dirFromDb);
...@@ -291,7 +291,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -291,7 +291,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
cleanDataBase(crossId, dir, laneInfoPOList); cleanDataBase(crossId, dir, laneInfoPOList);
// 插入进口信息 // 插入进口信息
List<LaneInfoPO> laneInfoPOListForInsert = getLaneInfoPOListForInsert( List<LaneInfoPO> laneInfoPOListForInsert = getLaneInfoPOListForInsert(
crossId, dirListElement, dir, laneListFromClient); crossId, dir, laneListFromClient);
if (laneInfoPOListForInsert.size() > 0) { if (laneInfoPOListForInsert.size() > 0) {
laneInfoMapper.insertBatch(laneInfoPOListForInsert); laneInfoMapper.insertBatch(laneInfoPOListForInsert);
} }
...@@ -300,8 +300,8 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -300,8 +300,8 @@ public class CrossConfigServiceImpl implements CrossConfigService {
crossDirInfoMapper.insertOne(crossDirInfoPO); crossDirInfoMapper.insertOne(crossDirInfoPO);
} }
// 更新是否有行人道 // 更新是否有行人道
String id = getId(crossId, dirListElement); String crossDirInfoId = getId(crossId, dirListElement);
crossDirInfoMapper.updateIsPedestrian(dirListElement.getIsPersonCross(), id); crossDirInfoMapper.updateIsPedestrian(dirListElement.getIsPersonCross(), crossDirInfoId);
} }
} }
...@@ -382,7 +382,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -382,7 +382,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
ledConfigList.sort(Comparator.comparing(LedConfigListElement::getOrder)); ledConfigList.sort(Comparator.comparing(LedConfigListElement::getOrder));
} }
private static void setLightAddress(LedConfigListElement ledConfigListElement, String s) { private void setLightAddress(LedConfigListElement ledConfigListElement, String s) {
int i = Integer.parseInt(s); int i = Integer.parseInt(s);
String address = LightsAddressEnum.getMsgByCode(i); String address = LightsAddressEnum.getMsgByCode(i);
ledConfigListElement.setAddress(address); ledConfigListElement.setAddress(address);
...@@ -454,13 +454,13 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -454,13 +454,13 @@ public class CrossConfigServiceImpl implements CrossConfigService {
} }
} }
private static String getId(String crossId, DirListElement dirListElement) { private String getId(String crossId, DirListElement dirListElement) {
Integer dir = dirListElement.getDir(); Integer dir = dirListElement.getDir();
String id = crossId + "_" + dir + "_" + 1 + "_" + 0;// todo 暂无主辅路序号,赋值0 String id = crossId + "_" + dir + "_" + 1 + "_" + 0;// todo 暂无主辅路序号,赋值0
return id; return id;
} }
private static CrossDirInfoPO getCrossDirInfoPO(String crossId, DirListElement dirListElement) { private CrossDirInfoPO getCrossDirInfoPO(String crossId, DirListElement dirListElement) {
CrossDirInfoPO crossDirInfoPO = new CrossDirInfoPO(); CrossDirInfoPO crossDirInfoPO = new CrossDirInfoPO();
Integer dir = dirListElement.getDir(); Integer dir = dirListElement.getDir();
crossDirInfoPO.setId(crossId + "_" + dir + "_" + 1 + "_" + 0); // todo 暂无主辅路序号,赋值0 crossDirInfoPO.setId(crossId + "_" + dir + "_" + 1 + "_" + 0); // todo 暂无主辅路序号,赋值0
...@@ -472,8 +472,8 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -472,8 +472,8 @@ public class CrossConfigServiceImpl implements CrossConfigService {
return crossDirInfoPO; return crossDirInfoPO;
} }
private static List<LaneInfoPO> getLaneInfoPOListForInsert(String crossId, DirListElement dirListElement, private List<LaneInfoPO> getLaneInfoPOListForInsert(
Integer dir, List<LaneListElement> laneListFromClient) { String crossId, Integer dir, List<LaneListElement> laneListFromClient) {
List<LaneInfoPO> laneInfoPOListForInsert = new ArrayList<>(); List<LaneInfoPO> laneInfoPOListForInsert = new ArrayList<>();
for (LaneListElement laneListElement : laneListFromClient) { for (LaneListElement laneListElement : laneListFromClient) {
LaneInfoPO laneInfoPO = new LaneInfoPO(); LaneInfoPO laneInfoPO = new LaneInfoPO();
...@@ -482,7 +482,10 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -482,7 +482,10 @@ public class CrossConfigServiceImpl implements CrossConfigService {
String substring = name.substring(name.length() - 1);// 1 String substring = name.substring(name.length() - 1);// 1
String s = 1 + substring; String s = 1 + substring;
int sort = Integer.parseInt(s); int sort = Integer.parseInt(s);
laneInfoPO.setId(crossId + "_" + dirListElement.getDir() + "_" + 2 + "_" + sort); // 信控车道类型都是进口车道 // 上一个路口ID
String preId = laneInfoMapper.selectPreId(crossId, dir);
// 0 主路;900 进口道渠化序号。信控车道类型都是进口车道
laneInfoPO.setId(preId + crossId + 0 + 900 + sort);
laneInfoPO.setCode(name); laneInfoPO.setCode(name);
laneInfoPO.setSort(sort); laneInfoPO.setSort(sort);
laneInfoPO.setDir(dir); laneInfoPO.setDir(dir);
......
...@@ -70,4 +70,9 @@ ...@@ -70,4 +70,9 @@
order by sort order by sort
</select> </select>
<select id="selectPreId" resultType="java.lang.String">
SELECT start_cross_id FROM t_base_rid_info
WHERE end_cross_id = #{crossId} and in_dir = #{dir}
</select>
</mapper> </mapper>
...@@ -53,8 +53,10 @@ public class TrendServiceImpl implements TrendService { ...@@ -53,8 +53,10 @@ public class TrendServiceImpl implements TrendService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public TrendServiceImpl(GreenwaveInfoMapper greenwaveInfoMapper, CrossInfoMapper crossInfoMapper,
public TrendServiceImpl(GreenwaveInfoMapper greenwaveInfoMapper, CrossInfoMapper crossInfoMapper, CrossDataRealtimeMapper crossDataRealtimeMapper, CrossTurnDataRealtimeMapper crossTurnDataRealtimeMapper, CrossDirDataHistMapper crossDirDataHistMapper, EventAlarmMapper eventAlarmMapper) { CrossDataRealtimeMapper crossDataRealtimeMapper,
CrossTurnDataRealtimeMapper crossTurnDataRealtimeMapper,
CrossDirDataHistMapper crossDirDataHistMapper, EventAlarmMapper eventAlarmMapper) {
this.greenwaveInfoMapper = greenwaveInfoMapper; this.greenwaveInfoMapper = greenwaveInfoMapper;
this.crossInfoMapper = crossInfoMapper; this.crossInfoMapper = crossInfoMapper;
this.crossDataRealtimeMapper = crossDataRealtimeMapper; this.crossDataRealtimeMapper = crossDataRealtimeMapper;
...@@ -69,7 +71,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -69,7 +71,7 @@ public class TrendServiceImpl implements TrendService {
String name = greenwaveListDTO.getName(); String name = greenwaveListDTO.getName();
Integer type = greenwaveListDTO.getType(); Integer type = greenwaveListDTO.getType();
List<GreenwaveListVO> greenwaveListVOList = greenwaveInfoMapper.listGreenwave(status, name, type); List<GreenwaveListVO> greenwaveListVOList = greenwaveInfoMapper.listGreenwave(status, name, type);
// 3以上都算拥堵 // 3、4都算拥堵
if (status != null && status == 3) { if (status != null && status == 3) {
List<GreenwaveListVO> extraList = greenwaveInfoMapper.listGreenwave(4, name, type); List<GreenwaveListVO> extraList = greenwaveInfoMapper.listGreenwave(4, name, type);
greenwaveListVOList.addAll(extraList); greenwaveListVOList.addAll(extraList);
......
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