Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtsts-server-go
This commit is contained in:
commit
01a979d6ae
@ -30,7 +30,7 @@ type stationUidStructure struct {
|
||||
CurvatureIds map[string]*elementIdStructure
|
||||
ButtonIds map[string]*elementIdStructure
|
||||
StationIds map[string]*elementIdStructure
|
||||
IBPIds map[string]*elementIdStructure
|
||||
IBPIds map[string]map[string]*elementIdStructure
|
||||
}
|
||||
|
||||
type relayUidStructure struct {
|
||||
@ -75,7 +75,7 @@ func initStationUid(data *graphicData.RtssGraphicStorage) *stationUidStructure {
|
||||
CurvatureIds: make(map[string]*elementIdStructure, len(data.Curvatures)),
|
||||
ButtonIds: make(map[string]*elementIdStructure, len(data.EsbButtons)),
|
||||
StationIds: make(map[string]*elementIdStructure, len(data.Stations)),
|
||||
IBPIds: make(map[string]*elementIdStructure, len(data.Stations)),
|
||||
IBPIds: make(map[string]map[string]*elementIdStructure, len(data.Stations)),
|
||||
}
|
||||
city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix)
|
||||
// 初始化计轴信息
|
||||
@ -192,30 +192,32 @@ func initIBPUid(gus *stationUidStructure, city, lineId string, station *graphicD
|
||||
}
|
||||
return p + "_" + code
|
||||
}
|
||||
uidMap := make(map[string]*elementIdStructure, len(data.IbpButtons)+len(data.IbpKeys)+len(data.IbpAlarms)+len(data.IbpLights))
|
||||
for _, d := range data.IbpButtons { // ibp按钮
|
||||
gus.IBPIds[d.Common.Id] = &elementIdStructure{
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpKeys { // ibp钥匙
|
||||
gus.IBPIds[d.Common.Id] = &elementIdStructure{
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpAlarms { // ibp报警器
|
||||
gus.IBPIds[d.Common.Id] = &elementIdStructure{
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
for _, d := range data.IbpLights { // ibp指示灯
|
||||
gus.IBPIds[d.Common.Id] = &elementIdStructure{
|
||||
uidMap[d.Common.Id] = &elementIdStructure{
|
||||
CommonId: d.Common.Id,
|
||||
Uid: GenerateElementUid(city, lineId, []string{station.Code}, getCode(d.Common.Id, d.Code)),
|
||||
}
|
||||
}
|
||||
gus.IBPIds[station.Code] = uidMap
|
||||
}
|
||||
|
||||
// 初始化继电器柜 UID
|
||||
@ -305,7 +307,9 @@ func buildRepositoryAllUidsMap(mapIds []int32, repo *repository.Repository) map[
|
||||
saveToAllUidMap(u.SlopeIds)
|
||||
saveToAllUidMap(u.CurvatureIds)
|
||||
saveToAllUidMap(u.ButtonIds)
|
||||
saveToAllUidMap(u.IBPIds)
|
||||
for _, ids := range u.IBPIds {
|
||||
saveToAllUidMap(ids)
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -344,9 +348,6 @@ func getUidMapByType(uidData any, m interface{}) map[string]*elementIdStructure
|
||||
return (uidData.(*relayUidStructure)).RelayIds
|
||||
case *graphicData.EsbButton:
|
||||
return (uidData.(*stationUidStructure)).ButtonIds
|
||||
// Ibp相关
|
||||
case *graphicData.IBPButton, *graphicData.IbpAlarm, *graphicData.IbpKey, *graphicData.IbpLight:
|
||||
return (uidData.(*stationUidStructure)).IBPIds
|
||||
default:
|
||||
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
||||
}
|
||||
@ -369,3 +370,27 @@ func QueryUidByMidAndComId(mapId int32, comId string, m interface{}) string {
|
||||
}
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
|
||||
}
|
||||
|
||||
// 根据地图、车站CODE、设备类型获取UID集合
|
||||
func QueryIBPUidMapByType(mapId int32, stationCode string, m interface{}) map[string]*elementIdStructure {
|
||||
uidData, ok := giUidMap.Load(mapId)
|
||||
if !ok {
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在uid缓存", mapId)})
|
||||
}
|
||||
switch m.(type) {
|
||||
// Ibp相关
|
||||
case *graphicData.IBPButton, *graphicData.IbpAlarm, *graphicData.IbpKey, *graphicData.IbpLight:
|
||||
return (uidData.(*stationUidStructure)).IBPIds[stationCode]
|
||||
default:
|
||||
panic(&dto.ErrorDto{Code: dto.ArgumentParseError, Message: "类型未映射字段"})
|
||||
}
|
||||
}
|
||||
|
||||
// 根据地图的comId获取UID
|
||||
func QueryIBPUidByMidAndComId(mapId int32, comId, stationCode string, m interface{}) string {
|
||||
uidMap := QueryIBPUidMapByType(mapId, stationCode, m)
|
||||
if uidMap[comId] != nil {
|
||||
return uidMap[comId].Uid
|
||||
}
|
||||
panic(&dto.ErrorDto{Code: dto.DataNotExist, Message: fmt.Sprintf("地图【id:%d】不存在【comId:%s】缓存", mapId, comId)})
|
||||
}
|
||||
|
62
docs/docs.go
62
docs/docs.go
@ -4714,6 +4714,7 @@ const docTemplate = `{
|
||||
"dto.SignalOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"aspect",
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
@ -5109,67 +5110,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.TurnoutOperationReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceId": {
|
||||
"description": "设备id",
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"description": "图id",
|
||||
"type": "integer"
|
||||
},
|
||||
"operation": {
|
||||
"description": "道岔操作",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/request_proto.Turnout_Operation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simulationId": {
|
||||
"description": "仿真id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.Turnout_Operation": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"Turnout_CancelDC": "取消定操",
|
||||
"Turnout_CancelFC": "取消反操",
|
||||
"Turnout_CancelJC": "取消挤岔故障",
|
||||
"Turnout_CancelSB": "取消失表故障",
|
||||
"Turnout_DC": "定操",
|
||||
"Turnout_FC": "反操",
|
||||
"Turnout_SetJC": "设置挤岔故障",
|
||||
"Turnout_SetSB": "设置失表故障",
|
||||
"Turnout_Undefined": "未定义"
|
||||
},
|
||||
"x-enum-varnames": [
|
||||
"Turnout_Undefined",
|
||||
"Turnout_DC",
|
||||
"Turnout_CancelDC",
|
||||
"Turnout_FC",
|
||||
"Turnout_CancelFC",
|
||||
"Turnout_SetSB",
|
||||
"Turnout_CancelSB",
|
||||
"Turnout_SetJC",
|
||||
"Turnout_CancelJC"
|
||||
]
|
||||
},
|
||||
"state.Signal_Aspect": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
|
@ -4707,6 +4707,7 @@
|
||||
"dto.SignalOperationReqDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"aspect",
|
||||
"id",
|
||||
"mapId",
|
||||
"simulationId"
|
||||
@ -5102,67 +5103,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.TurnoutOperationReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceId": {
|
||||
"description": "设备id",
|
||||
"type": "string"
|
||||
},
|
||||
"mapId": {
|
||||
"description": "图id",
|
||||
"type": "integer"
|
||||
},
|
||||
"operation": {
|
||||
"description": "道岔操作",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/request_proto.Turnout_Operation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simulationId": {
|
||||
"description": "仿真id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_proto.Turnout_Operation": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"Turnout_CancelDC": "取消定操",
|
||||
"Turnout_CancelFC": "取消反操",
|
||||
"Turnout_CancelJC": "取消挤岔故障",
|
||||
"Turnout_CancelSB": "取消失表故障",
|
||||
"Turnout_DC": "定操",
|
||||
"Turnout_FC": "反操",
|
||||
"Turnout_SetJC": "设置挤岔故障",
|
||||
"Turnout_SetSB": "设置失表故障",
|
||||
"Turnout_Undefined": "未定义"
|
||||
},
|
||||
"x-enum-varnames": [
|
||||
"Turnout_Undefined",
|
||||
"Turnout_DC",
|
||||
"Turnout_CancelDC",
|
||||
"Turnout_FC",
|
||||
"Turnout_CancelFC",
|
||||
"Turnout_SetSB",
|
||||
"Turnout_CancelSB",
|
||||
"Turnout_SetJC",
|
||||
"Turnout_CancelJC"
|
||||
]
|
||||
},
|
||||
"state.Signal_Aspect": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
|
@ -213,6 +213,7 @@ definitions:
|
||||
simulationId:
|
||||
type: string
|
||||
required:
|
||||
- aspect
|
||||
- id
|
||||
- mapId
|
||||
- simulationId
|
||||
@ -484,54 +485,6 @@ definitions:
|
||||
description: 名称
|
||||
type: string
|
||||
type: object
|
||||
request_proto.Turnout_Operation:
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
type: integer
|
||||
x-enum-comments:
|
||||
Turnout_CancelDC: 取消定操
|
||||
Turnout_CancelFC: 取消反操
|
||||
Turnout_CancelJC: 取消挤岔故障
|
||||
Turnout_CancelSB: 取消失表故障
|
||||
Turnout_DC: 定操
|
||||
Turnout_FC: 反操
|
||||
Turnout_SetJC: 设置挤岔故障
|
||||
Turnout_SetSB: 设置失表故障
|
||||
Turnout_Undefined: 未定义
|
||||
x-enum-varnames:
|
||||
- Turnout_Undefined
|
||||
- Turnout_DC
|
||||
- Turnout_CancelDC
|
||||
- Turnout_FC
|
||||
- Turnout_CancelFC
|
||||
- Turnout_SetSB
|
||||
- Turnout_CancelSB
|
||||
- Turnout_SetJC
|
||||
- Turnout_CancelJC
|
||||
request_proto.TurnoutOperationReq:
|
||||
properties:
|
||||
deviceId:
|
||||
description: 设备id
|
||||
type: string
|
||||
mapId:
|
||||
description: 图id
|
||||
type: integer
|
||||
operation:
|
||||
allOf:
|
||||
- $ref: '#/definitions/request_proto.Turnout_Operation'
|
||||
description: 道岔操作
|
||||
simulationId:
|
||||
description: 仿真id
|
||||
type: string
|
||||
type: object
|
||||
state.Signal_Aspect:
|
||||
enum:
|
||||
- 0
|
||||
|
@ -74,7 +74,7 @@ type SignalOperationReqDto struct {
|
||||
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
|
||||
MapId int32 `json:"mapId" from:"mapId" binding:"required"`
|
||||
DeviceId string `form:"id" json:"id" binding:"required"`
|
||||
Aspect state.Signal_Aspect `form:"aspect" json:"aspect"`
|
||||
Aspect state.Signal_Aspect `form:"aspect" json:"aspect" binding:"required"`
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user