Commit b8f0fc81 authored by hanbing's avatar hanbing

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

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