【修改UID初始化逻辑】
This commit is contained in:
parent
f3f1f07fd0
commit
f7c9c2ab36
|
@ -78,9 +78,12 @@ func createByProjectId(c *gin.Context) {
|
|||
if len(mapInfos) == 0 {
|
||||
panic(sys_error.New("测试启动失败,项目未关联发布图"))
|
||||
}
|
||||
mapIds := make([]int32, len(mapInfos))
|
||||
for i, mapInfo := range mapInfos {
|
||||
mapIds[i] = mapInfo.ID
|
||||
var mapIds []int32
|
||||
for _, mapInfo := range mapInfos {
|
||||
if mapInfo.Type == graphicData.PictureType_value[graphicData.PictureType_TrainData.String()] {
|
||||
continue
|
||||
}
|
||||
mapIds = append(mapIds, mapInfo.ID)
|
||||
}
|
||||
// 运行环境配置
|
||||
runConfig := service.QueryRunConfig(req.ProjectRunConfigId)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: request.proto
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: ibpGraphics.proto
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: picture.proto
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: pslGraphics.proto
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: relayCabinetLayoutGraphics.proto
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v4.23.1
|
||||
// source: device_state.proto
|
||||
|
||||
|
|
|
@ -83,39 +83,109 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
|||
SpksSwitchIds: make(map[string]*elementIdStructure, len(data.SpksSwitchs)),
|
||||
}
|
||||
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
|
||||
// 处理车站信息
|
||||
stationMap := make(map[string]*graphicData.Station)
|
||||
for _, s := range data.Stations {
|
||||
stationMap[s.Common.Id] = s
|
||||
gus.StationIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Code: s.StationName,
|
||||
Uid: GenerateElementUid(city, lineId, nil, s.StationName),
|
||||
}
|
||||
}
|
||||
// 初始化计轴信息
|
||||
for _, a := range data.AxleCountings {
|
||||
stationNames := make([]string, len(a.CentralizedStations))
|
||||
for i, id := range a.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
if stationMap[id] == nil {
|
||||
stationNames[i] = id
|
||||
} else {
|
||||
stationNames[i] = stationMap[id].StationName
|
||||
}
|
||||
}
|
||||
gus.AxlePointIds[a.Common.Id] = &elementIdStructure{
|
||||
CommonId: a.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, a.CentralizedStations, a.Code),
|
||||
Code: a.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, a.Code),
|
||||
}
|
||||
}
|
||||
// 初始化道岔信息
|
||||
for _, t := range data.Turnouts {
|
||||
stationNames := make([]string, len(t.CentralizedStations))
|
||||
for i, id := range t.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
if stationMap[id] == nil {
|
||||
stationNames[i] = id
|
||||
} else {
|
||||
stationNames[i] = stationMap[id].StationName
|
||||
}
|
||||
}
|
||||
gus.TurnoutIds[t.Common.Id] = &elementIdStructure{
|
||||
CommonId: t.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, t.CentralizedStations, t.Code),
|
||||
Code: t.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, t.Code),
|
||||
}
|
||||
}
|
||||
// 初始化物理区段信息
|
||||
for _, s := range data.Section {
|
||||
stationNames := make([]string, len(s.CentralizedStations))
|
||||
for i, id := range s.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
if stationMap[id] == nil {
|
||||
stationNames[i] = id
|
||||
} else {
|
||||
stationNames[i] = stationMap[id].StationName
|
||||
}
|
||||
}
|
||||
gus.PhysicalSectionIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, s.CentralizedStations, s.Code),
|
||||
Code: s.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, s.Code),
|
||||
}
|
||||
}
|
||||
// 初始化信号机信息
|
||||
for _, s := range data.Signals {
|
||||
stationNames := make([]string, len(s.CentralizedStations))
|
||||
for i, id := range s.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
if stationMap[id] == nil {
|
||||
stationNames[i] = id
|
||||
} else {
|
||||
stationNames[i] = stationMap[id].StationName
|
||||
}
|
||||
}
|
||||
gus.SignalIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, s.CentralizedStations, s.Code),
|
||||
Code: s.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, s.Code),
|
||||
}
|
||||
}
|
||||
// 初始化应答器
|
||||
for _, t := range data.Transponders {
|
||||
stationNames := make([]string, len(t.CentralizedStations))
|
||||
for i, id := range t.CentralizedStations {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
if stationMap[id] == nil {
|
||||
stationNames[i] = id
|
||||
} else {
|
||||
stationNames[i] = stationMap[id].StationName
|
||||
}
|
||||
}
|
||||
gus.TransponderIds[t.Common.Id] = &elementIdStructure{
|
||||
CommonId: t.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, t.CentralizedStations, t.Code),
|
||||
Code: t.Code,
|
||||
Uid: GenerateElementUid(city, lineId, stationNames, t.Code),
|
||||
}
|
||||
}
|
||||
// 初始化坡度
|
||||
|
@ -155,15 +225,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *StationUidStructure {
|
|||
Uid: GenerateElementUid(city, lineId, nil, code),
|
||||
}
|
||||
}
|
||||
// 处理车站信息
|
||||
stationMap := make(map[string]*graphicData.Station)
|
||||
for _, s := range data.Stations {
|
||||
stationMap[s.Common.Id] = s
|
||||
gus.StationIds[s.Common.Id] = &elementIdStructure{
|
||||
CommonId: s.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, nil, s.StationName),
|
||||
}
|
||||
}
|
||||
|
||||
// 站台
|
||||
platformMap := make(map[string]*graphicData.Platform)
|
||||
for _, platform := range data.Platforms {
|
||||
|
|
|
@ -974,7 +974,12 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
|||
}
|
||||
centralizedStation := ""
|
||||
if len(data.CentralizedStations) > 0 {
|
||||
centralizedStation = data.CentralizedStations[0]
|
||||
s := uidsMap.StationIds[data.CentralizedStations[0]]
|
||||
if s != nil {
|
||||
centralizedStation = s.Code
|
||||
} else {
|
||||
centralizedStation = data.CentralizedStations[0]
|
||||
}
|
||||
}
|
||||
physicalSection := &proto.PhysicalSection{
|
||||
Id: data.Common.Id,
|
||||
|
@ -1047,7 +1052,14 @@ func fillProtoRepository(repo *proto.Repository, storage *graphicData.RtssGraphi
|
|||
Type: convertToProtoBaliseType(data.Type),
|
||||
}
|
||||
repo.Transponders = append(repo.Transponders, converTransponderUid(responder, uidsMap))
|
||||
for _, stationName := range data.CentralizedStations {
|
||||
for _, stationId := range data.CentralizedStations {
|
||||
var stationName string
|
||||
if uidsMap.StationIds[stationId] == nil {
|
||||
stationName = stationId
|
||||
} else {
|
||||
stationName = uidsMap.StationIds[stationId].Code
|
||||
}
|
||||
|
||||
if stm[stationName] == nil {
|
||||
stm[stationName] = []string{responder.Id}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue