From 584c6311dd0622ecd8b4f611bd3886f11e40ee5a Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 18 Oct 2023 14:15:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96IB?= =?UTF-8?q?P=20UID=E9=9B=86=E5=90=88=E9=80=BB=E8=BE=91=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/simulation.go | 2 +- .../simulation/wayside/memory/wayside_memory_ibp.go | 8 ++++---- .../wayside/memory/wayside_memory_map_init.go | 10 +++++----- docs/docs.go | 2 +- docs/swagger.json | 2 +- docs/swagger.yaml | 2 +- dto/simulation.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/simulation.go b/api/simulation.go index e635576..b6a5ee4 100644 --- a/api/simulation.go +++ b/api/simulation.go @@ -328,7 +328,7 @@ func ibpBtnOperation(c *gin.Context) { } simulation := checkDeviceDataAndReturn(req.SimulationId) slog.Info("传入状态参数", req) - memory.ChangeIBPButtonState(simulation, req.MapId, req.StationId, req.Id, req.Down) + memory.ChangeIBPButtonState(simulation, req.MapId, req.Station, req.Id, req.Down) c.JSON(http.StatusOK, "ok") } diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_ibp.go b/ats/verify/simulation/wayside/memory/wayside_memory_ibp.go index b85e884..d749bd6 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_ibp.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_ibp.go @@ -9,8 +9,8 @@ import ( ) // 操作IBP按钮 -func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId string, pressDown bool) { - uid := QueryIBPUidByMidAndComId(mapId, btnId, stationId) +func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, station, btnId string, pressDown bool) { + uid := QueryIBPUidByMidAndComId(mapId, btnId, station) if pressDown { fi.PressDownButton(sim.World, uid) } else { @@ -19,13 +19,13 @@ func ChangeIBPButtonState(sim *VerifySimulation, mapId int32, stationId, btnId s } // 获取仿真车站按钮状态,前端推送 -func GetMapAllIBPState(sim *VerifySimulation, mapId int32, stationId string) *state.AllDevicesStatus { +func GetMapAllIBPState(sim *VerifySimulation, mapId int32, station string) *state.AllDevicesStatus { status := &state.AllDevicesStatus{ ButtonState: []*state.ButtonState{}, LightState: []*state.LightState{}, AlarmState: []*state.AlarmState{}, } - uidMap := QueryIBPUidMapByType(mapId, stationId) + uidMap := QueryIBPUidMapByType(mapId, station) for _, u := range uidMap { entry, ok := entity.GetEntityByUid(sim.World, u.Uid) if !ok { diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_map_init.go b/ats/verify/simulation/wayside/memory/wayside_memory_map_init.go index 920ecaa..3832192 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_map_init.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_map_init.go @@ -215,7 +215,7 @@ func initIBPUid(gus *stationUidStructure, city, lineId string, station *graphicD Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)), } } - gus.IBPIds[station.Common.Id] = uidMap + gus.IBPIds[station.Code] = uidMap } // 初始化继电器柜 UID @@ -367,17 +367,17 @@ func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string { } // 根据地图、车站CODE、设备类型获取UID集合 -func QueryIBPUidMapByType(mapId int32, stationCommonId string) map[string]*elementIdStructure { +func QueryIBPUidMapByType(mapId int32, station string) map[string]*elementIdStructure { uidData, ok := giUidMap.Load(mapId) if !ok { panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)}) } - return (uidData.(*stationUidStructure)).IBPIds[stationCommonId] + return (uidData.(*stationUidStructure)).IBPIds[station] } // 根据地图的comId获取UID -func QueryIBPUidByMidAndComId(mapId int32, comId, stationCommonId string) string { - uidMap := QueryIBPUidMapByType(mapId, stationCommonId) +func QueryIBPUidByMidAndComId(mapId int32, comId, station string) string { + uidMap := QueryIBPUidMapByType(mapId, station) if uidMap[comId] != nil { return uidMap[comId].Uid } diff --git a/docs/docs.go b/docs/docs.go index 5869c15..24f358c 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -4752,7 +4752,7 @@ const docTemplate = `{ "simulationId": { "type": "string" }, - "stationId": { + "stationCode": { "type": "string" } } diff --git a/docs/swagger.json b/docs/swagger.json index 468dd90..17e0645 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -4745,7 +4745,7 @@ "simulationId": { "type": "string" }, - "stationId": { + "stationCode": { "type": "string" } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 64ebec3..d635f2d 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -70,7 +70,7 @@ definitions: type: integer simulationId: type: string - stationId: + stationCode: type: string required: - down diff --git a/dto/simulation.go b/dto/simulation.go index 4239818..152a917 100644 --- a/dto/simulation.go +++ b/dto/simulation.go @@ -80,7 +80,7 @@ type SignalOperationReqDto struct { type ButtonOperationReqDto struct { SimulationId string `form:"simulationId" json:"simulationId" binding:"required"` MapId int32 `json:"mapId" from:"mapId" binding:"required"` - StationId string `form:"stationId" json:"stationId"` + Station string `form:"stationCode" json:"stationCode"` Id string `form:"id" json:"id" binding:"required"` Down bool `form:"down" json:"down" binding:"required"` }