【处理获取地图类型不存在的问题】【处理屏蔽门双车站问题】
This commit is contained in:
parent
1e2b0bd729
commit
68c51bab51
|
@ -28,7 +28,7 @@ func Start(vs *memory.VerifySimulation) {
|
|||
mss: []ms_api.IMsgServer{},
|
||||
}
|
||||
for _, mapId := range vs.MapIds {
|
||||
t := memory.QueryOnlyGiType(mapId)
|
||||
t := memory.QueryGiType(mapId)
|
||||
switch t {
|
||||
case graphicData.PictureType_StationLayout: // 平面布置图
|
||||
// 添加车站关联的平面布置图、IBP、PSL信息
|
||||
|
|
|
@ -78,7 +78,7 @@ func QueryGiType(mapId int32) graphicData.PictureType {
|
|||
if !ok {
|
||||
graphic, err := dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.ID.Eq(mapId)).First() // 当缓存缺失新地图时,查询一次
|
||||
if err != nil {
|
||||
panic(&dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("[mapId:%d]类型映射错误 :%v", mapId, value)})
|
||||
panic(sys_error.New(fmt.Sprintf("[mapId:%d]类型映射错误 :%v", mapId, value), err))
|
||||
}
|
||||
PublishMapVerifyStructure(graphic)
|
||||
return graphicData.PictureType(graphic.Type)
|
||||
|
@ -86,14 +86,6 @@ func QueryGiType(mapId int32) graphicData.PictureType {
|
|||
return value.(graphicData.PictureType)
|
||||
}
|
||||
|
||||
func QueryOnlyGiType(mapId int32) graphicData.PictureType {
|
||||
value, ok := giTypeMap.Load(mapId)
|
||||
if !ok {
|
||||
panic(sys_error.New(fmt.Sprintf("[mapId:%d]不存在", mapId)))
|
||||
}
|
||||
return value.(graphicData.PictureType)
|
||||
}
|
||||
|
||||
func QueryGiData[T proto.Message](mapId int32) T {
|
||||
value, _ := giDataMap.Load(mapId)
|
||||
return value.(T)
|
||||
|
|
|
@ -45,6 +45,7 @@ type deviceRelateUidPriex struct {
|
|||
deviceCode string
|
||||
typeCode string
|
||||
isStation bool
|
||||
isPSD bool
|
||||
}
|
||||
|
||||
// 获取UID的前缀信息
|
||||
|
@ -234,8 +235,9 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
refMap := make(map[string]*deviceRelateUidPriex, len(data.Relays))
|
||||
for _, r := range data.DeviceRelateRelayList {
|
||||
isStation := r.DeviceType == graphicData.RelatedRef_station
|
||||
isPsd := r.DeviceType == graphicData.RelatedRef_ScreenDoor
|
||||
for _, c := range r.Combinationtypes {
|
||||
p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation}
|
||||
p := &deviceRelateUidPriex{deviceCode: r.Code, typeCode: c.Code, isStation: isStation, isPSD: isPsd}
|
||||
for _, i := range c.RefRelays {
|
||||
refMap[i] = p
|
||||
}
|
||||
|
@ -258,7 +260,7 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
}
|
||||
stationArr := []string{station}
|
||||
if p != nil && p.isStation {
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
|
@ -274,7 +276,7 @@ func initRelayCabinetUid(data *graphicData.RelayCabinetGraphicStorage) *RelayUid
|
|||
code = p.deviceCode + "_" + p.typeCode + "_" + r.Code
|
||||
}
|
||||
stationArr := []string{station}
|
||||
if p != nil && p.isStation {
|
||||
if p != nil && (p.isStation || p.isPSD) {
|
||||
stationArr = nil
|
||||
}
|
||||
rus.RelayIds[r.Common.Id] = &elementIdStructure{
|
||||
|
|
|
@ -96,7 +96,7 @@ func NewWaysideMemory() *WaysideMemory {
|
|||
func CreateSimulation(projectId int32, mapIds []int32, runConfig *dto.ProjectRunConfigDto) (*VerifySimulation, error) {
|
||||
// 地图信息
|
||||
sort.Slice(mapIds, func(i, j int) bool {
|
||||
return QueryOnlyGiType(mapIds[i]) < QueryOnlyGiType(mapIds[j])
|
||||
return QueryGiType(mapIds[i]) < QueryGiType(mapIds[j])
|
||||
})
|
||||
verifySimulation := &VerifySimulation{
|
||||
ProjectId: projectId,
|
||||
|
|
Loading…
Reference in New Issue