proto文件增加设备状态;实现应答器的相关接口

This commit is contained in:
joylink_zhangsai 2024-01-10 14:06:01 +08:00
parent 32b4b9ba02
commit 0818438098
20 changed files with 2112 additions and 625 deletions

View File

@ -140,7 +140,7 @@ func publishFromDraft(c *gin.Context) {
// @Tags 发布的图形数据Api // @Tags 发布的图形数据Api
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path int true "id" // @Param id path int true "id"
// @Success 200 {object} nil // @Success 200 {object} nil
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
@ -270,7 +270,7 @@ func renamePublishedGiById(c *gin.Context) {
// @Tags 发布的图形数据Api // @Tags 发布的图形数据Api
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param PublishFallBackDto path int true "id" // @Param PublishFallBackDto path int true "id"
// @Success 200 {object} dto.PublishHistoryDto // @Success 200 {object} dto.PublishHistoryDto
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
@ -296,7 +296,7 @@ func historyPublishedGiById(c *gin.Context) {
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param id path query dto.PublishFallBackDto true "查询参数" // @Param id path query dto.PublishFallBackDto true "查询参数"
// @Success 200 {object} true // @Success 200 {object} bool
// @Failure 401 {object} dto.ErrorDto // @Failure 401 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/publishedGi/fallbackVersion [post] // @Router /api/v1/publishedGi/fallbackVersion [post]

View File

@ -40,6 +40,11 @@ func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
authed.GET("/:id/getMapKilometerRange", getMapKilometerRange) authed.GET("/:id/getMapKilometerRange", getMapKilometerRange)
authed.POST("/psl/operation", pslBtnOperation) authed.POST("/psl/operation", pslBtnOperation)
authed.POST("/psd/operation", psdOperation) authed.POST("/psd/operation", psdOperation)
authed.PUT("/balise/position/modify", balisePositionModify)
authed.PUT("/balise/position/reset", transponderPositionReset)
authed.PUT("/balise/telegram/modify", baliseTelegramModify)
authed.PUT("/balise/telegram/reset", baliseTelegramReset)
authed.PUT("/balise/reset", baliseReset)
// 初始化地图信息 // 初始化地图信息
initPublishMapInfo() initPublishMapInfo()
@ -552,36 +557,151 @@ func relayOperation(c *gin.Context) {
c.JSON(http.StatusOK, "ok") c.JSON(http.StatusOK, "ok")
} }
// 获取ATS测试-操作继电器 // 应答器移位
// //
// @Summary 获取ATS测试-操作继电器 // @Summary 应答器移位
// //
// @Security JwtAuth // @Security JwtAuth
// //
// @Description ATS测试-操作继电器 // @Description 应答器移位
// @Tags ATS测试仿真Api // @Tags ATS测试仿真Api
// @Accept json // @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token" // @Param Authorization header string true "JWT Token"
// @Param RelayOperationReqDto body dto.RelayOperationReqDto true "ATS测试仿真-操作继电器" // @Param BaliseMoveReqDto body dto.BaliseMoveReqDto true "应答器移位"
// //
// @Success 200 {object} string // @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto // @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/transponder/move [post] // @Router /api/v1/simulation/balise/position/modify [put]
func transponderMove(c *gin.Context) { func balisePositionModify(c *gin.Context) {
req := &dto.TransponderMoveReqDto{} req := &dto.BaliseMoveReqDto{}
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器移位操作失败,请求参数异常", err)) panic(sys_error.New("应答器移位操作失败,请求参数异常", err))
} }
simulation := checkDeviceDataAndReturn(req.SimulationId) simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req) slog.Info("传入状态参数", req)
err := memory.TransponderMove(simulation, req) err := memory.BalisePositionModify(simulation, req)
if err != nil { if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器移位操作失败,%s", err.Error()), err)) panic(sys_error.New(fmt.Sprintf("应答器移位操作失败,%s", err.Error()), err))
} }
c.JSON(http.StatusOK, "ok") c.JSON(http.StatusOK, "ok")
} }
// 应答器复位
//
// @Summary 应答器复位
//
// @Security JwtAuth
//
// @Description 应答器复位
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "应答器复位"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/position/reset [put]
func transponderPositionReset(c *gin.Context) {
req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器复位操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
err := memory.BalisePositionReset(simulation, req)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器复位操作失败,%s", err.Error()), err))
}
c.JSON(http.StatusOK, "ok")
}
// 修改应答器报文
//
// @Summary 修改应答器报文
//
// @Security JwtAuth
//
// @Description 修改应答器报文
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseModifyTelegramReqDto body dto.BaliseModifyTelegramReqDto true "修改应答器报文"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/telegram/modify [put]
func baliseTelegramModify(c *gin.Context) {
req := &dto.BaliseModifyTelegramReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器修改报文操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
err := memory.BaliseTelegramModify(simulation, req)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器修改报文操作失败,%s", err.Error()), err))
}
c.JSON(http.StatusOK, "ok")
}
// 重置应答器报文
//
// @Summary 重置应答器报文
//
// @Security JwtAuth
//
// @Description 重置应答器报文
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "重置应答器报文"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/telegram/reset [put]
func baliseTelegramReset(c *gin.Context) {
req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器重置报文操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
err := memory.BaliseTelegramReset(simulation, req)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器重置报文操作失败,%s", err.Error()), err))
}
c.JSON(http.StatusOK, "ok")
}
// 重置应答器状态
//
// @Summary 重置应答器状态
//
// @Security JwtAuth
//
// @Description 重置应答器状态
// @Tags ATS测试仿真Api
// @Accept json
// @Param Authorization header string true "JWT Token"
// @Param BaliseReqDto body dto.BaliseReqDto true "重置应答器状态"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/balise/reset [put]
func baliseReset(c *gin.Context) {
req := &dto.BaliseReqDto{}
if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器状态重置操作失败,请求参数异常", err))
}
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req)
err := memory.BaliseReset(simulation, req)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器状态重置操作失败,%s", err.Error()), err))
}
c.JSON(http.StatusOK, "ok")
}
// 获取仿真设备数据并返回 // 获取仿真设备数据并返回
func checkDeviceDataAndReturn(simId string) *memory.VerifySimulation { func checkDeviceDataAndReturn(simId string) *memory.VerifySimulation {
deviceMemory := ts.FindSimulation(simId) deviceMemory := ts.FindSimulation(simId)

@ -1 +1 @@
Subproject commit 999608fa88a430cba9bef8915f76993a0e4c6d8e Subproject commit 00828fb909e5797c3ef269c37551d48e507f08bf

View File

@ -2192,7 +2192,7 @@ const docTemplate = `{
{ {
"type": "integer", "type": "integer",
"description": "id", "description": "id",
"name": "id", "name": "PublishFallBackDto",
"in": "path", "in": "path",
"required": true "required": true
} }
@ -2219,6 +2219,60 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/publishedGi/fallbackVersion": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "发布地图回退到历史版本",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"发布的图形数据Api"
],
"summary": "发布地图回退到历史版本",
"parameters": [
{
"type": "integer",
"name": "mapId",
"in": "query",
"required": true
},
{
"type": "integer",
"name": "versionId",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/publishedGi/list": { "/api/v1/publishedGi/list": {
"get": { "get": {
"security": [ "security": [
@ -2363,6 +2417,12 @@ const docTemplate = `{
"in": "query", "in": "query",
"required": true "required": true
}, },
{
"type": "boolean",
"description": "是否只要上架数据",
"name": "release",
"in": "query"
},
{ {
"type": "integer", "type": "integer",
"example": 10, "example": 10,
@ -3215,6 +3275,251 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/simulation/balise/position/modify": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器移位",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器移位",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器移位",
"name": "BaliseMoveReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseMoveReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/position/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器复位",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器复位",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器复位",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "重置应答器状态",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "重置应答器状态",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "重置应答器状态",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/modify": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改应答器报文",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "修改应答器报文",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "修改应答器报文",
"name": "BaliseModifyTelegramReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseModifyTelegramReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "重置应答器报文",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "重置应答器报文",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "重置应答器报文",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/check/data": { "/api/v1/simulation/check/data": {
"post": { "post": {
"security": [ "security": [
@ -4100,6 +4405,11 @@ const docTemplate = `{
"type": "string", "type": "string",
"name": "name", "name": "name",
"in": "query" "in": "query"
},
{
"type": "integer",
"name": "pid",
"in": "query"
} }
], ],
"responses": { "responses": {
@ -4616,7 +4926,7 @@ const docTemplate = `{
}, },
"id": { "id": {
"description": "物理区段、道岔ID", "description": "物理区段、道岔ID",
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"description": "场景ID", "description": "场景ID",
@ -4694,7 +5004,7 @@ const docTemplate = `{
], ],
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4713,6 +5023,71 @@ const docTemplate = `{
} }
} }
}, },
"dto.BaliseModifyTelegramReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
},
"telegram": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dto.BaliseMoveReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"km": {
"description": "公里标",
"allOf": [
{
"$ref": "#/definitions/graphicData.KilometerSystem"
}
]
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
}
}
},
"dto.BaliseReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
}
}
},
"dto.CheckMapDataReqDto": { "dto.CheckMapDataReqDto": {
"type": "object", "type": "object",
"required": [ "required": [
@ -4767,7 +5142,7 @@ const docTemplate = `{
"type": "boolean" "type": "boolean"
}, },
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4780,14 +5155,14 @@ const docTemplate = `{
"dto.IBPButtonOperationReqDto": { "dto.IBPButtonOperationReqDto": {
"type": "object", "type": "object",
"required": [ "required": [
"buttonCode", "buttonId",
"mapId", "mapId",
"simulationId", "simulationId",
"stationId" "stationId"
], ],
"properties": { "properties": {
"buttonCode": { "buttonId": {
"type": "string" "type": "integer"
}, },
"down": { "down": {
"type": "boolean" "type": "boolean"
@ -4799,7 +5174,7 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"stationId": { "stationId": {
"type": "string" "type": "integer"
} }
} }
}, },
@ -4814,8 +5189,8 @@ const docTemplate = `{
"gear": { "gear": {
"type": "integer" "type": "integer"
}, },
"keyCode": { "keyId": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4824,7 +5199,7 @@ const docTemplate = `{
"type": "string" "type": "string"
}, },
"stationId": { "stationId": {
"type": "string" "type": "integer"
} }
} }
}, },
@ -4946,7 +5321,7 @@ const docTemplate = `{
"type": "boolean" "type": "boolean"
}, },
"gateBoxId": { "gateBoxId": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4959,6 +5334,9 @@ const docTemplate = `{
"dto.PublishHistoryDto": { "dto.PublishHistoryDto": {
"type": "object", "type": "object",
"properties": { "properties": {
"current": {
"type": "boolean"
},
"id": { "id": {
"type": "integer" "type": "integer"
}, },
@ -5000,11 +5378,20 @@ const docTemplate = `{
"publishAt": { "publishAt": {
"type": "string" "type": "string"
}, },
"publisher": {
"type": "string"
},
"status": {
"type": "integer"
},
"type": { "type": {
"type": "integer" "type": "integer"
}, },
"userID": { "userID": {
"type": "integer" "type": "integer"
},
"version": {
"type": "integer"
} }
} }
}, },
@ -5058,7 +5445,7 @@ const docTemplate = `{
], ],
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -5107,7 +5494,7 @@ const docTemplate = `{
] ]
}, },
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -5295,6 +5682,38 @@ const docTemplate = `{
} }
} }
}, },
"graphicData.KilometerSystem": {
"type": "object",
"properties": {
"coordinateSystem": {
"description": "坐标系",
"type": "string"
},
"direction": {
"description": "左右行",
"allOf": [
{
"$ref": "#/definitions/graphicData.KilometerSystem_Direction"
}
]
},
"kilometer": {
"description": "公里标mm",
"type": "integer"
}
}
},
"graphicData.KilometerSystem_Direction": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-varnames": [
"KilometerSystem_LEFT",
"KilometerSystem_RIGHT"
]
},
"graphicData.PictureType": { "graphicData.PictureType": {
"type": "integer", "type": "integer",
"enum": [ "enum": [
@ -5468,7 +5887,11 @@ const docTemplate = `{
}, },
"deviceId": { "deviceId": {
"description": "设备id", "description": "设备id",
"type": "string" "type": "integer"
},
"group": {
"description": "开门操作的编组",
"type": "integer"
}, },
"mapId": { "mapId": {
"description": "图id", "description": "图id",
@ -5498,9 +5921,6 @@ const docTemplate = `{
4, 4,
5, 5,
6, 6,
7,
8,
9,
10, 10,
11, 11,
12, 12,
@ -5518,29 +5938,23 @@ const docTemplate = `{
"Psd_CancelAsdCannotOpen": "取消滑动门无法开门", "Psd_CancelAsdCannotOpen": "取消滑动门无法开门",
"Psd_CancelForce": "取消强制", "Psd_CancelForce": "取消强制",
"Psd_CancelGm": "取消关门", "Psd_CancelGm": "取消关门",
"Psd_CancelKm4": "取消四编组开门", "Psd_CancelKm": "取消开门",
"Psd_CancelKm8": "取消八编组开门",
"Psd_CancelQDTC": "取消启动探测", "Psd_CancelQDTC": "取消启动探测",
"Psd_CancelTZTC": "取消停止探测", "Psd_CancelTZTC": "取消停止探测",
"Psd_ForceGm": "强制关门", "Psd_ForceGm": "强制关门",
"Psd_ForceKm4": "强制四编组开门", "Psd_ForceKm": "强制开门",
"Psd_ForceKm8": "强制八编组开门",
"Psd_Gm": "关门", "Psd_Gm": "关门",
"Psd_Km4": "四编组开门", "Psd_Km": "开门",
"Psd_Km8": "八编组开门",
"Psd_QDTC": "启动探测", "Psd_QDTC": "启动探测",
"Psd_TZTC": "停止探测" "Psd_TZTC": "停止探测"
}, },
"x-enum-varnames": [ "x-enum-varnames": [
"Psd_Undefined", "Psd_Undefined",
"Psd_Km4", "Psd_Km",
"Psd_CancelKm4", "Psd_CancelKm",
"Psd_Km8",
"Psd_CancelKm8",
"Psd_Gm", "Psd_Gm",
"Psd_CancelGm", "Psd_CancelGm",
"Psd_ForceKm4", "Psd_ForceKm",
"Psd_ForceKm8",
"Psd_ForceGm", "Psd_ForceGm",
"Psd_CancelForce", "Psd_CancelForce",
"Psd_AsdCannotOpen", "Psd_AsdCannotOpen",
@ -5630,7 +6044,7 @@ const docTemplate = `{
"properties": { "properties": {
"deviceId": { "deviceId": {
"description": "设备id", "description": "设备id",
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"description": "图id", "description": "图id",

View File

@ -2185,7 +2185,7 @@
{ {
"type": "integer", "type": "integer",
"description": "id", "description": "id",
"name": "id", "name": "PublishFallBackDto",
"in": "path", "in": "path",
"required": true "required": true
} }
@ -2212,6 +2212,60 @@
} }
} }
}, },
"/api/v1/publishedGi/fallbackVersion": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "发布地图回退到历史版本",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"发布的图形数据Api"
],
"summary": "发布地图回退到历史版本",
"parameters": [
{
"type": "integer",
"name": "mapId",
"in": "query",
"required": true
},
{
"type": "integer",
"name": "versionId",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/publishedGi/list": { "/api/v1/publishedGi/list": {
"get": { "get": {
"security": [ "security": [
@ -2356,6 +2410,12 @@
"in": "query", "in": "query",
"required": true "required": true
}, },
{
"type": "boolean",
"description": "是否只要上架数据",
"name": "release",
"in": "query"
},
{ {
"type": "integer", "type": "integer",
"example": 10, "example": 10,
@ -3208,6 +3268,251 @@
} }
} }
}, },
"/api/v1/simulation/balise/position/modify": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器移位",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器移位",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器移位",
"name": "BaliseMoveReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseMoveReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/position/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "应答器复位",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "应答器复位",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "应答器复位",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "重置应答器状态",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "重置应答器状态",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "重置应答器状态",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/modify": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "修改应答器报文",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "修改应答器报文",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "修改应答器报文",
"name": "BaliseModifyTelegramReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseModifyTelegramReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/balise/telegram/reset": {
"put": {
"security": [
{
"JwtAuth": []
}
],
"description": "重置应答器报文",
"consumes": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "重置应答器报文",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "重置应答器报文",
"name": "BaliseReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.BaliseReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/check/data": { "/api/v1/simulation/check/data": {
"post": { "post": {
"security": [ "security": [
@ -4093,6 +4398,11 @@
"type": "string", "type": "string",
"name": "name", "name": "name",
"in": "query" "in": "query"
},
{
"type": "integer",
"name": "pid",
"in": "query"
} }
], ],
"responses": { "responses": {
@ -4609,7 +4919,7 @@
}, },
"id": { "id": {
"description": "物理区段、道岔ID", "description": "物理区段、道岔ID",
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"description": "场景ID", "description": "场景ID",
@ -4687,7 +4997,7 @@
], ],
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4706,6 +5016,71 @@
} }
} }
}, },
"dto.BaliseModifyTelegramReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
},
"telegram": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dto.BaliseMoveReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"km": {
"description": "公里标",
"allOf": [
{
"$ref": "#/definitions/graphicData.KilometerSystem"
}
]
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
}
}
},
"dto.BaliseReqDto": {
"type": "object",
"properties": {
"baliseId": {
"description": "应答器ID",
"type": "integer"
},
"mapId": {
"description": "地图ID",
"type": "integer"
},
"simulationId": {
"description": "仿真ID",
"type": "string"
}
}
},
"dto.CheckMapDataReqDto": { "dto.CheckMapDataReqDto": {
"type": "object", "type": "object",
"required": [ "required": [
@ -4760,7 +5135,7 @@
"type": "boolean" "type": "boolean"
}, },
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4773,14 +5148,14 @@
"dto.IBPButtonOperationReqDto": { "dto.IBPButtonOperationReqDto": {
"type": "object", "type": "object",
"required": [ "required": [
"buttonCode", "buttonId",
"mapId", "mapId",
"simulationId", "simulationId",
"stationId" "stationId"
], ],
"properties": { "properties": {
"buttonCode": { "buttonId": {
"type": "string" "type": "integer"
}, },
"down": { "down": {
"type": "boolean" "type": "boolean"
@ -4792,7 +5167,7 @@
"type": "string" "type": "string"
}, },
"stationId": { "stationId": {
"type": "string" "type": "integer"
} }
} }
}, },
@ -4807,8 +5182,8 @@
"gear": { "gear": {
"type": "integer" "type": "integer"
}, },
"keyCode": { "keyId": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4817,7 +5192,7 @@
"type": "string" "type": "string"
}, },
"stationId": { "stationId": {
"type": "string" "type": "integer"
} }
} }
}, },
@ -4939,7 +5314,7 @@
"type": "boolean" "type": "boolean"
}, },
"gateBoxId": { "gateBoxId": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -4952,6 +5327,9 @@
"dto.PublishHistoryDto": { "dto.PublishHistoryDto": {
"type": "object", "type": "object",
"properties": { "properties": {
"current": {
"type": "boolean"
},
"id": { "id": {
"type": "integer" "type": "integer"
}, },
@ -4993,11 +5371,20 @@
"publishAt": { "publishAt": {
"type": "string" "type": "string"
}, },
"publisher": {
"type": "string"
},
"status": {
"type": "integer"
},
"type": { "type": {
"type": "integer" "type": "integer"
}, },
"userID": { "userID": {
"type": "integer" "type": "integer"
},
"version": {
"type": "integer"
} }
} }
}, },
@ -5051,7 +5438,7 @@
], ],
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -5100,7 +5487,7 @@
] ]
}, },
"id": { "id": {
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"type": "integer" "type": "integer"
@ -5288,6 +5675,38 @@
} }
} }
}, },
"graphicData.KilometerSystem": {
"type": "object",
"properties": {
"coordinateSystem": {
"description": "坐标系",
"type": "string"
},
"direction": {
"description": "左右行",
"allOf": [
{
"$ref": "#/definitions/graphicData.KilometerSystem_Direction"
}
]
},
"kilometer": {
"description": "公里标mm",
"type": "integer"
}
}
},
"graphicData.KilometerSystem_Direction": {
"type": "integer",
"enum": [
0,
1
],
"x-enum-varnames": [
"KilometerSystem_LEFT",
"KilometerSystem_RIGHT"
]
},
"graphicData.PictureType": { "graphicData.PictureType": {
"type": "integer", "type": "integer",
"enum": [ "enum": [
@ -5461,7 +5880,11 @@
}, },
"deviceId": { "deviceId": {
"description": "设备id", "description": "设备id",
"type": "string" "type": "integer"
},
"group": {
"description": "开门操作的编组",
"type": "integer"
}, },
"mapId": { "mapId": {
"description": "图id", "description": "图id",
@ -5491,9 +5914,6 @@
4, 4,
5, 5,
6, 6,
7,
8,
9,
10, 10,
11, 11,
12, 12,
@ -5511,29 +5931,23 @@
"Psd_CancelAsdCannotOpen": "取消滑动门无法开门", "Psd_CancelAsdCannotOpen": "取消滑动门无法开门",
"Psd_CancelForce": "取消强制", "Psd_CancelForce": "取消强制",
"Psd_CancelGm": "取消关门", "Psd_CancelGm": "取消关门",
"Psd_CancelKm4": "取消四编组开门", "Psd_CancelKm": "取消开门",
"Psd_CancelKm8": "取消八编组开门",
"Psd_CancelQDTC": "取消启动探测", "Psd_CancelQDTC": "取消启动探测",
"Psd_CancelTZTC": "取消停止探测", "Psd_CancelTZTC": "取消停止探测",
"Psd_ForceGm": "强制关门", "Psd_ForceGm": "强制关门",
"Psd_ForceKm4": "强制四编组开门", "Psd_ForceKm": "强制开门",
"Psd_ForceKm8": "强制八编组开门",
"Psd_Gm": "关门", "Psd_Gm": "关门",
"Psd_Km4": "四编组开门", "Psd_Km": "开门",
"Psd_Km8": "八编组开门",
"Psd_QDTC": "启动探测", "Psd_QDTC": "启动探测",
"Psd_TZTC": "停止探测" "Psd_TZTC": "停止探测"
}, },
"x-enum-varnames": [ "x-enum-varnames": [
"Psd_Undefined", "Psd_Undefined",
"Psd_Km4", "Psd_Km",
"Psd_CancelKm4", "Psd_CancelKm",
"Psd_Km8",
"Psd_CancelKm8",
"Psd_Gm", "Psd_Gm",
"Psd_CancelGm", "Psd_CancelGm",
"Psd_ForceKm4", "Psd_ForceKm",
"Psd_ForceKm8",
"Psd_ForceGm", "Psd_ForceGm",
"Psd_CancelForce", "Psd_CancelForce",
"Psd_AsdCannotOpen", "Psd_AsdCannotOpen",
@ -5623,7 +6037,7 @@
"properties": { "properties": {
"deviceId": { "deviceId": {
"description": "设备id", "description": "设备id",
"type": "string" "type": "integer"
}, },
"mapId": { "mapId": {
"description": "图id", "description": "图id",

View File

@ -16,7 +16,7 @@ definitions:
type: integer type: integer
id: id:
description: 物理区段、道岔ID description: 物理区段、道岔ID
type: string type: integer
mapId: mapId:
description: 场景ID description: 场景ID
type: integer type: integer
@ -66,7 +66,7 @@ definitions:
dto.AxleSectionOperationReqDto: dto.AxleSectionOperationReqDto:
properties: properties:
id: id:
type: string type: integer
mapId: mapId:
type: integer type: integer
operation: operation:
@ -82,6 +82,50 @@ definitions:
- mapId - mapId
- simulationId - simulationId
type: object type: object
dto.BaliseModifyTelegramReqDto:
properties:
baliseId:
description: 应答器ID
type: integer
mapId:
description: 地图ID
type: integer
simulationId:
description: 仿真ID
type: string
telegram:
items:
type: integer
type: array
type: object
dto.BaliseMoveReqDto:
properties:
baliseId:
description: 应答器ID
type: integer
km:
allOf:
- $ref: '#/definitions/graphicData.KilometerSystem'
description: 公里标
mapId:
description: 地图ID
type: integer
simulationId:
description: 仿真ID
type: string
type: object
dto.BaliseReqDto:
properties:
baliseId:
description: 应答器ID
type: integer
mapId:
description: 地图ID
type: integer
simulationId:
description: 仿真ID
type: string
type: object
dto.CheckMapDataReqDto: dto.CheckMapDataReqDto:
properties: properties:
data: data:
@ -114,7 +158,7 @@ definitions:
down: down:
type: boolean type: boolean
id: id:
type: string type: integer
mapId: mapId:
type: integer type: integer
simulationId: simulationId:
@ -126,8 +170,8 @@ definitions:
type: object type: object
dto.IBPButtonOperationReqDto: dto.IBPButtonOperationReqDto:
properties: properties:
buttonCode: buttonId:
type: string type: integer
down: down:
type: boolean type: boolean
mapId: mapId:
@ -135,9 +179,9 @@ definitions:
simulationId: simulationId:
type: string type: string
stationId: stationId:
type: string type: integer
required: required:
- buttonCode - buttonId
- mapId - mapId
- simulationId - simulationId
- stationId - stationId
@ -146,14 +190,14 @@ definitions:
properties: properties:
gear: gear:
type: integer type: integer
keyCode: keyId:
type: string type: integer
mapId: mapId:
type: integer type: integer
simulationId: simulationId:
type: string type: string
stationId: stationId:
type: string type: integer
required: required:
- mapId - mapId
- simulationId - simulationId
@ -237,7 +281,7 @@ definitions:
down: down:
type: boolean type: boolean
gateBoxId: gateBoxId:
type: string type: integer
mapId: mapId:
type: integer type: integer
simulationId: simulationId:
@ -249,6 +293,8 @@ definitions:
type: object type: object
dto.PublishHistoryDto: dto.PublishHistoryDto:
properties: properties:
current:
type: boolean
id: id:
type: integer type: integer
note: note:
@ -276,10 +322,16 @@ definitions:
type: array type: array
publishAt: publishAt:
type: string type: string
publisher:
type: string
status:
type: integer
type: type:
type: integer type: integer
userID: userID:
type: integer type: integer
version:
type: integer
type: object type: object
dto.PublishedGiLinkDto: dto.PublishedGiLinkDto:
properties: properties:
@ -312,7 +364,7 @@ definitions:
dto.RelayOperationReqDto: dto.RelayOperationReqDto:
properties: properties:
id: id:
type: string type: integer
mapId: mapId:
type: integer type: integer
simulationId: simulationId:
@ -343,7 +395,7 @@ definitions:
- $ref: '#/definitions/state.Signal_Aspect' - $ref: '#/definitions/state.Signal_Aspect'
description: 当操作为Operation.Display时有效表示显示的信号 description: 当操作为Operation.Display时有效表示显示的信号
id: id:
type: string type: integer
mapId: mapId:
type: integer type: integer
operation: operation:
@ -476,6 +528,27 @@ definitions:
$ref: '#/definitions/dto.AuthRoleRspDto' $ref: '#/definitions/dto.AuthRoleRspDto'
type: array type: array
type: object type: object
graphicData.KilometerSystem:
properties:
coordinateSystem:
description: 坐标系
type: string
direction:
allOf:
- $ref: '#/definitions/graphicData.KilometerSystem_Direction'
description: 左右行
kilometer:
description: 公里标mm
type: integer
type: object
graphicData.KilometerSystem_Direction:
enum:
- 0
- 1
type: integer
x-enum-varnames:
- KilometerSystem_LEFT
- KilometerSystem_RIGHT
graphicData.PictureType: graphicData.PictureType:
enum: enum:
- 0 - 0
@ -603,9 +676,6 @@ definitions:
- 4 - 4
- 5 - 5
- 6 - 6
- 7
- 8
- 9
- 10 - 10
- 11 - 11
- 12 - 12
@ -623,28 +693,22 @@ definitions:
Psd_CancelAsdCannotOpen: 取消滑动门无法开门 Psd_CancelAsdCannotOpen: 取消滑动门无法开门
Psd_CancelForce: 取消强制 Psd_CancelForce: 取消强制
Psd_CancelGm: 取消关门 Psd_CancelGm: 取消关门
Psd_CancelKm4: 取消四编组开门 Psd_CancelKm: 取消开门
Psd_CancelKm8: 取消八编组开门
Psd_CancelQDTC: 取消启动探测 Psd_CancelQDTC: 取消启动探测
Psd_CancelTZTC: 取消停止探测 Psd_CancelTZTC: 取消停止探测
Psd_ForceGm: 强制关门 Psd_ForceGm: 强制关门
Psd_ForceKm4: 强制四编组开门 Psd_ForceKm: 强制开门
Psd_ForceKm8: 强制八编组开门
Psd_Gm: 关门 Psd_Gm: 关门
Psd_Km4: 四编组开门 Psd_Km: 开门
Psd_Km8: 八编组开门
Psd_QDTC: 启动探测 Psd_QDTC: 启动探测
Psd_TZTC: 停止探测 Psd_TZTC: 停止探测
x-enum-varnames: x-enum-varnames:
- Psd_Undefined - Psd_Undefined
- Psd_Km4 - Psd_Km
- Psd_CancelKm4 - Psd_CancelKm
- Psd_Km8
- Psd_CancelKm8
- Psd_Gm - Psd_Gm
- Psd_CancelGm - Psd_CancelGm
- Psd_ForceKm4 - Psd_ForceKm
- Psd_ForceKm8
- Psd_ForceGm - Psd_ForceGm
- Psd_CancelForce - Psd_CancelForce
- Psd_AsdCannotOpen - Psd_AsdCannotOpen
@ -664,7 +728,10 @@ definitions:
type: array type: array
deviceId: deviceId:
description: 设备id description: 设备id
type: string type: integer
group:
description: 开门操作的编组
type: integer
mapId: mapId:
description: 图id description: 图id
type: integer type: integer
@ -785,7 +852,7 @@ definitions:
properties: properties:
deviceId: deviceId:
description: 设备id description: 设备id
type: string type: integer
mapId: mapId:
description: 图id description: 图id
type: integer type: integer
@ -2208,7 +2275,7 @@ paths:
parameters: parameters:
- description: id - description: id
in: path in: path
name: id name: PublishFallBackDto
required: true required: true
type: integer type: integer
produces: produces:
@ -2290,6 +2357,40 @@ paths:
summary: id查询发布的图形数据 summary: id查询发布的图形数据
tags: tags:
- 发布的图形数据Api - 发布的图形数据Api
/api/v1/publishedGi/fallbackVersion:
post:
consumes:
- application/json
description: 发布地图回退到历史版本
parameters:
- in: query
name: mapId
required: true
type: integer
- in: query
name: versionId
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: boolean
"401":
description: Unauthorized
schema:
$ref: '#/definitions/dto.ErrorDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 发布地图回退到历史版本
tags:
- 发布的图形数据Api
/api/v1/publishedGi/list: /api/v1/publishedGi/list:
get: get:
consumes: consumes:
@ -2374,6 +2475,10 @@ paths:
name: current name: current
required: true required: true
type: integer type: integer
- description: 是否只要上架数据
in: query
name: release
type: boolean
- description: 页面行数 - description: 页面行数
example: 10 example: 10
in: query in: query
@ -2859,6 +2964,161 @@ paths:
summary: ATS测试-计轴区段操作 summary: ATS测试-计轴区段操作
tags: tags:
- ATS测试仿真Api - ATS测试仿真Api
/api/v1/simulation/balise/position/modify:
put:
consumes:
- application/json
description: 应答器移位
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 应答器移位
in: body
name: BaliseMoveReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseMoveReqDto'
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 应答器移位
tags:
- ATS测试仿真Api
/api/v1/simulation/balise/position/reset:
put:
consumes:
- application/json
description: 应答器复位
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 应答器复位
in: body
name: BaliseReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseReqDto'
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 应答器复位
tags:
- ATS测试仿真Api
/api/v1/simulation/balise/reset:
put:
consumes:
- application/json
description: 重置应答器状态
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 重置应答器状态
in: body
name: BaliseReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseReqDto'
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 重置应答器状态
tags:
- ATS测试仿真Api
/api/v1/simulation/balise/telegram/modify:
put:
consumes:
- application/json
description: 修改应答器报文
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 修改应答器报文
in: body
name: BaliseModifyTelegramReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseModifyTelegramReqDto'
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 修改应答器报文
tags:
- ATS测试仿真Api
/api/v1/simulation/balise/telegram/reset:
put:
consumes:
- application/json
description: 重置应答器报文
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 重置应答器报文
in: body
name: BaliseReqDto
required: true
schema:
$ref: '#/definitions/dto.BaliseReqDto'
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 重置应答器报文
tags:
- ATS测试仿真Api
/api/v1/simulation/check/data: /api/v1/simulation/check/data:
post: post:
consumes: consumes:
@ -3539,6 +3799,9 @@ paths:
- in: query - in: query
name: name name: name
type: string type: string
- in: query
name: pid
type: integer
produces: produces:
- application/json - application/json
responses: responses:

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: request.proto // source: request.proto

View File

@ -2,6 +2,7 @@ package dto
import ( import (
"joylink.club/bj-rtsts-server/dto/request_proto" "joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/bj-rtsts-server/ts/protos/state" "joylink.club/bj-rtsts-server/ts/protos/state"
) )
@ -169,10 +170,25 @@ type RelayOperationReqDto struct {
Td bool `form:"td" json:"td"` Td bool `form:"td" json:"td"`
} }
// TransponderMoveReqDto 应答器移位请求 // BaliseMoveReqDto 应答器移位请求
type TransponderMoveReqDto struct { type BaliseMoveReqDto struct {
SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID
TransponderId string `json:"transponderId" form:"transponderId"` //应答器ID MapId int32 `json:"mapId" form:"mapId"` //地图ID
LinkId string `json:"linkId" form:"linkId"` //要移动到的link BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID
Offset int64 `json:"offset" form:"offset"` //要移动到的Link的偏移量 Km graphicData.KilometerSystem `json:"km" form:"km"` //公里标
}
// BaliseModifyTelegramReqDto 修改应答器报文
type BaliseModifyTelegramReqDto struct {
SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID
MapId int32 `json:"mapId" form:"mapId"` //地图ID
BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID
Telegram []byte
}
// BaliseReqDto 应答器请求
type BaliseReqDto struct {
SimulationId string `json:"simulationId" form:"simulationId"` //仿真ID
MapId int32 `json:"mapId" form:"mapId"` //地图ID
BaliseId uint32 `json:"baliseId" form:"baliseId"` //应答器ID
} }

View File

@ -40,7 +40,7 @@ func collectRelayState(world ecs.World, mapId int32) ([]*state.ReplyState, error
entry, ok := entity.GetEntityByUid(world, u.Uid) entry, ok := entity.GetEntityByUid(world, u.Uid)
if !ok { if !ok {
// 暂时注释,很多继电器都没初始化 // 暂时注释,很多继电器都没初始化
//return nil, fmt.Errorf("继电器实体不存在: World id=%d, uid=%s", r.vs.World.TransponderId(), u.Uid) //return nil, fmt.Errorf("继电器实体不存在: World id=%d, uid=%s", r.vs.World.BaliseId(), u.Uid)
continue continue
} }
if entry.HasComponent(component.RelayTag) { if entry.HasComponent(component.RelayTag) {

View File

@ -2,6 +2,7 @@ package message_server
import ( import (
"fmt" "fmt"
"joylink.club/rtsssimulation/repository/model/proto"
"strings" "strings"
"time" "time"
@ -47,6 +48,10 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
if err != nil { if err != nil {
return err return err
} }
baliseStates, err := collectBaliseStates(vs.World, mapId)
if err != nil {
return err
}
ststes := &state.PushedDevicesStatus{ ststes := &state.PushedDevicesStatus{
All: true, All: true,
AllStatus: &state.AllDevicesStatus{ AllStatus: &state.AllDevicesStatus{
@ -57,6 +62,7 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
PsdState: psdStates, PsdState: psdStates,
SectionState: sectionStates, SectionState: sectionStates,
PlatformState: platformStates, PlatformState: platformStates,
BaliseState: baliseStates,
}, },
} }
mqtt.GetMsgClient().PubSfpState(vs.SimulationId, mapId, ststes) mqtt.GetMsgClient().PubSfpState(vs.SimulationId, mapId, ststes)
@ -64,6 +70,33 @@ func NewSfpMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask {
}, 200*time.Millisecond) }, 200*time.Millisecond)
} }
// 收集应答器状态
func collectBaliseStates(world ecs.World, mapId int32) ([]*state.BaliseState, error) {
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId)
var transponderStates []*state.BaliseState
for id, structure := range uidStructure.TransponderIds {
entry, ok := entity.GetEntityByUid(world, structure.Uid)
if ok {
baliseState := &state.BaliseState{
Id: id,
Telegram: component.BaliseStateType.Get(entry).ValidTelegram,
}
transponderStates = append(transponderStates, baliseState)
km := component.KmType.Get(entry)
baliseState.Km = &graphicData.KilometerSystem{
Kilometer: km.Value,
CoordinateSystem: km.CoordinateSystem,
}
if km.Direction == proto.Direction_LEFT {
baliseState.Km.Direction = graphicData.KilometerSystem_LEFT
} else if km.Direction == proto.Direction_RIGHT {
baliseState.Km.Direction = graphicData.KilometerSystem_RIGHT
}
}
}
return transponderStates, nil
}
// 收集屏蔽门状态 // 收集屏蔽门状态
func collectPsdStates(world ecs.World, mapId int32) ([]*state.PsdState, error) { func collectPsdStates(world ecs.World, mapId int32) ([]*state.PsdState, error) {
uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId) uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId)

@ -1 +1 @@
Subproject commit a4c17218f7e1901fa25c9c90905a1749f5c57068 Subproject commit e8c0d58799b13f7311c06e247fb53d32a28e54ec

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: ibpGraphics.proto // source: ibpGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: picture.proto // source: picture.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: pslGraphics.proto // source: pslGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: relayCabinetLayoutGraphics.proto // source: relayCabinetLayoutGraphics.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.31.0
// protoc v4.23.1 // protoc v4.23.1
// source: stationLayoutGraphics.proto // source: stationLayoutGraphics.proto

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ package memory_test
// return // return
// } // }
// data := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId) // data := memory.QueryGiData[*graphicData.RtssGraphicStorage](mapId)
// deviceId := data.ScreenDoors[0].Common.TransponderId // deviceId := data.ScreenDoors[0].Common.BaliseId
// simulation := ts.FindSimulation(simId) // simulation := ts.FindSimulation(simId)
// wantErr := false // wantErr := false

View File

@ -4,27 +4,152 @@ import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts/protos/graphicData"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/repository"
"joylink.club/rtsssimulation/repository/model/proto"
"joylink.club/rtsssimulation/util/number"
"sort"
) )
func TransponderMove(simulation *VerifySimulation, req *dto.TransponderMoveReqDto) error { // BalisePositionModify 应答器移位
worldData := entity.GetWorldData(simulation.World) func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) error {
link := worldData.Repo.FindLink(simulation.uidMap[req.LinkId].Uid) uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid
if link == nil { transponder := simulation.Repo.FindTransponder(uid)
panic(sys_error.New(fmt.Sprintf("未找到[id:%s]的Link", link.Id()))) if transponder == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
} }
if req.Offset > link.Length() { //将请求参数中的公里标转为rtss仿真所用的公里标
panic(sys_error.New(fmt.Sprintf("偏移量[%d]超出Link长度", req.Offset))) km := &proto.Kilometer{
Value: req.Km.Kilometer,
CoordinateSystem: req.Km.CoordinateSystem,
} }
te, ok := entity.GetEntityByUid(simulation.World, req.TransponderId) if req.Km.Direction == graphicData.KilometerSystem_LEFT {
if !ok { km.Direction = proto.Direction_LEFT
panic(sys_error.New(fmt.Sprintf("没有[id:%s]的应答器", req.TransponderId))) } else if req.Km.Direction == graphicData.KilometerSystem_RIGHT {
km.Direction = proto.Direction_RIGHT
} else {
panic(fmt.Sprintf("未知的公里标方向[%d]", req.Km.Direction))
} }
component.LinkPositionType.SetValue(te, component_proto.LinkPosition{ //将应答器所在Link的两端公里标转为请求参数中公里标的坐标系
LinkId: req.LinkId, link := transponder.LinkPosition().Link()
Offset: req.Offset, akm, err := repository.ConvertKilometer(simulation.Repo, link.AKm(), km.CoordinateSystem)
if err != nil {
panic(sys_error.New("应答器所在Link的起点公里标转换失败"))
}
bkm, err := repository.ConvertKilometer(simulation.Repo, link.BKm(), km.CoordinateSystem)
if err != nil {
panic(sys_error.New("应答器所在Link的终点公里标转换失败"))
}
//筛选出Link上所有的应答器并按公里标大小排序
var transponders []*repository.Transponder
for _, device := range link.Devices() {
t, ok := device.(*repository.Transponder)
if ok {
transponders = append(transponders, t)
}
}
sort.Slice(transponders, func(i, j int) bool {
aT := transponders[i]
bT := transponders[j]
aTKm, err := repository.ConvertKilometer(simulation.Repo, aT.Km(), km.CoordinateSystem)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器[id:%s]公里标转换失败", aT.Id())))
}
bTKm, err := repository.ConvertKilometer(simulation.Repo, bT.Km(), km.CoordinateSystem)
if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器[id:%s]公里标转换失败", bT.Id())))
}
return aTKm.Value < bTKm.Value
})
//确保请求的公里标没有超出Link范围且在相邻的应答器之间
var minKm *proto.Kilometer
var maxKm *proto.Kilometer
if akm.Value < bkm.Value {
minKm = akm
maxKm = bkm
} else {
minKm = bkm
maxKm = akm
}
for i, t := range transponders {
if t == transponder {
if i > 0 {
minKm, err = repository.ConvertKilometer(simulation.Repo, transponders[i-1].Km(), km.CoordinateSystem)
}
if i < len(transponders)-1 {
maxKm, err = repository.ConvertKilometer(simulation.Repo, transponders[i+1].Km(), km.CoordinateSystem)
}
}
}
//更新应答器公里标和Link位置
entry, _ := entity.GetEntityByUid(simulation.World, uid)
if km.Value < minKm.Value {
km.Value = minKm.Value
} else if km.Value > maxKm.Value {
km.Value = maxKm.Value
}
component.KmType.Set(entry, km)
offset := number.Abs(km.Value - akm.Value)
component.LinkPositionType.Set(entry, &component_proto.LinkPosition{
LinkId: link.Id(),
Offset: offset,
}) })
return nil return nil
} }
// BalisePositionReset 应答器复位
func BalisePositionReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid
transponder := simulation.Repo.FindTransponder(uid)
if transponder == nil {
return sys_error.New(fmt.Sprintf("未找到[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
entry, _ := entity.GetEntityByUid(simulation.World, uid)
component.KmType.Set(entry, transponder.Km())
component.LinkPositionType.SetValue(entry, component_proto.LinkPosition{
LinkId: transponder.LinkPosition().Link().Id(),
Offset: transponder.LinkPosition().Offset(),
})
return nil
}
// BaliseTelegramModify 修改应答器报文
func BaliseTelegramModify(simulation *VerifySimulation, req *dto.BaliseModifyTelegramReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid
entry, ok := entity.GetEntityByUid(simulation.World, uid)
if !ok {
return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
component.BaliseStateType.SetValue(entry, component.BaliseState{
ValidTelegram: req.Telegram,
})
return nil
}
// BaliseTelegramReset 重置应答器报文
func BaliseTelegramReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error {
uid := QueryMapUidMapByType(req.MapId, &graphicData.Transponder{})[req.BaliseId].Uid
entry, ok := entity.GetEntityByUid(simulation.World, uid)
if !ok {
return sys_error.New(fmt.Sprintf("没有[mapId:%d id:%d]的应答器", req.MapId, req.BaliseId))
}
worldData := entity.GetWorldData(simulation.World)
transponder := worldData.Repo.FindTransponder(uid)
component.BaliseStateType.SetValue(entry, component.BaliseState{
ValidTelegram: transponder.FixedTelegram(),
})
return nil
}
// BaliseReset 重置应答器所有状态
func BaliseReset(simulation *VerifySimulation, req *dto.BaliseReqDto) error {
err := BaliseTelegramReset(simulation, req)
if err != nil {
return err
}
err = BalisePositionReset(simulation, req)
return err
}

View File

@ -42,7 +42,7 @@ type VerifySimulation struct {
Repo *repository.Repository Repo *repository.Repository
//Rtss仿真世界的 //Rtss仿真世界的
World ecs.World World ecs.World
//设备UID映射 //设备UID映射 key-uid
uidMap map[string]*elementIdStructure uidMap map[string]*elementIdStructure
// 运行环境配置 // 运行环境配置
runConfig *config.ThridPartyConfig runConfig *config.ThridPartyConfig
@ -791,7 +791,7 @@ func buildAndRelateElectronicComponent(repo *proto.Repository, relayGi *graphicD
// continue // continue
// } // }
// d.Components = append(d.Components, &proto.ElectronicComponent{ // d.Components = append(d.Components, &proto.ElectronicComponent{
// TransponderId: relayUidStructure.RelayIds[relayId].Uid, // BaliseId: relayUidStructure.RelayIds[relayId].Uid,
// DeviceType: proto.DeviceType_DeviceType_Relay, // DeviceType: proto.DeviceType_DeviceType_Relay,
// }) // })
// } // }