diff --git a/ats/verify/simulation/simulation_manage.go b/ats/verify/simulation/simulation_manage.go index dfc1ad0..7de18f5 100644 --- a/ats/verify/simulation/simulation_manage.go +++ b/ats/verify/simulation/simulation_manage.go @@ -100,6 +100,7 @@ func CreateSimulation(mapId int32) string { // 删除仿真对象 func DestroySimulation(simulationId string) { + simulationMap.Delete(simulationId) //移除道岔状态发送 dynamics.Stop() //通知动力学 @@ -107,7 +108,6 @@ func DestroySimulation(simulationId string) { if httpCode != http.StatusOK || err != nil { panic(dto.ErrorDto{Code: dto.LogicError, Message: fmt.Sprintf("动力学接口调用失败:[%d][%s]", httpCode, err)}) } - simulationMap.Delete(simulationId) } // 创建时生成仿真Id @@ -215,20 +215,24 @@ func buildLineBaseInfo(vs *memory.VerifyStructure) *dynamics.LineBaseInfo { for _, link := range vs.LinkModelMap { id, _ := strconv.Atoi(link.Index) var aTurnoutId int - if link.ARelatedSwitchRef.SwitchDevice != nil { + var aPort string + if link.ARelatedSwitchRef != nil && link.ARelatedSwitchRef.SwitchDevice != nil { aTurnoutId, _ = strconv.Atoi(link.ARelatedSwitchRef.SwitchDevice.GetIndex()) + aPort = link.ARelatedSwitchRef.Port.Name() } var bTurnoutId int - if link.BRelatedSwitchRef.SwitchDevice != nil { + var bPort string + if link.BRelatedSwitchRef != nil && link.BRelatedSwitchRef.SwitchDevice != nil { bTurnoutId, _ = strconv.Atoi(link.BRelatedSwitchRef.SwitchDevice.GetIndex()) + bPort = link.BRelatedSwitchRef.Port.Name() } links = append(links, &dynamics.Link{ ID: int32(id), Len: link.Length, ARelTurnoutId: int32(aTurnoutId), - ARelTurnoutPoint: link.ARelatedSwitchRef.Port.Name(), + ARelTurnoutPoint: aPort, BRelTurnoutId: int32(bTurnoutId), - BRelTurnoutPoint: link.BRelatedSwitchRef.Port.Name(), + BRelTurnoutPoint: bPort, }) } return &dynamics.LineBaseInfo{ diff --git a/docs/docs.go b/docs/docs.go index 8103327..30eb9c7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -782,6 +782,19 @@ const docTemplate = `{ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -911,6 +924,19 @@ const docTemplate = `{ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -1037,6 +1063,19 @@ const docTemplate = `{ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -1313,14 +1352,14 @@ const docTemplate = `{ } } }, - "/api/v1/projectLink/trainSize/:id": { + "/api/v1/projectLink/mapInfo/trainSize/:id": { "get": { "security": [ { "JwtAuth": [] } ], - "description": "查询项目的关联列车尺寸信息", + "description": "通过地图ID查询项目的关联列车尺寸信息", "consumes": [ "application/json" ], @@ -1330,11 +1369,11 @@ const docTemplate = `{ "tags": [ "项目关联信息Api" ], - "summary": "查询项目的关联列车尺寸信息", + "summary": "通过地图ID查询项目的关联列车尺寸信息", "parameters": [ { "type": "integer", - "description": "项目ID", + "description": "地图ID", "name": "id", "in": "path", "required": true @@ -2384,7 +2423,7 @@ const docTemplate = `{ "parameters": [ { "type": "integer", - "name": "carriageLength", + "name": "carriage_length", "in": "query" }, { @@ -2404,7 +2443,7 @@ const docTemplate = `{ }, { "type": "integer", - "name": "totalLength", + "name": "total_length", "in": "query" } ], @@ -2514,7 +2553,7 @@ const docTemplate = `{ }, { "type": "integer", - "name": "carriageLength", + "name": "carriage_length", "in": "query" }, { @@ -2534,7 +2573,7 @@ const docTemplate = `{ }, { "type": "integer", - "name": "totalLength", + "name": "total_length", "in": "query" } ], @@ -2703,7 +2742,7 @@ const docTemplate = `{ "parameters": [ { "type": "integer", - "name": "AxialPosition", + "name": "axial_position", "in": "query" }, { @@ -2718,17 +2757,17 @@ const docTemplate = `{ }, { "type": "string", - "name": "installDirection", + "name": "install_direction", "in": "query" }, { "type": "integer", - "name": "maxDiameter", + "name": "max_diameter", "in": "query" }, { "type": "integer", - "name": "minDiameter", + "name": "min_diameter", "in": "query" }, { @@ -2843,7 +2882,7 @@ const docTemplate = `{ }, { "type": "integer", - "name": "AxialPosition", + "name": "axial_position", "in": "query" }, { @@ -2858,17 +2897,17 @@ const docTemplate = `{ }, { "type": "string", - "name": "installDirection", + "name": "install_direction", "in": "query" }, { "type": "integer", - "name": "maxDiameter", + "name": "max_diameter", "in": "query" }, { "type": "integer", - "name": "minDiameter", + "name": "min_diameter", "in": "query" }, { @@ -3514,7 +3553,7 @@ const docTemplate = `{ "dto.TrainSizeDto": { "type": "object", "properties": { - "carriageLength": { + "carriage_length": { "type": "integer" }, "description": { @@ -3526,11 +3565,22 @@ const docTemplate = `{ "name": { "type": "string" }, - "totalLength": { + "total_length": { "type": "integer" } } }, + "graphicData.PictureType": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ] + }, "model.Category": { "type": "object", "properties": { @@ -3590,6 +3640,10 @@ const docTemplate = `{ "type": "integer" } }, + "type": { + "description": "数据类型", + "type": "integer" + }, "update_at": { "description": "修改时间", "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index 00e6b7f..2963b2a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -775,6 +775,19 @@ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -904,6 +917,19 @@ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -1030,6 +1056,19 @@ "collectionFormat": "csv", "name": "proto", "in": "query" + }, + { + "enum": [ + 0, + 1 + ], + "type": "integer", + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ], + "name": "type", + "in": "query" } ], "responses": { @@ -1306,14 +1345,14 @@ } } }, - "/api/v1/projectLink/trainSize/:id": { + "/api/v1/projectLink/mapInfo/trainSize/:id": { "get": { "security": [ { "JwtAuth": [] } ], - "description": "查询项目的关联列车尺寸信息", + "description": "通过地图ID查询项目的关联列车尺寸信息", "consumes": [ "application/json" ], @@ -1323,11 +1362,11 @@ "tags": [ "项目关联信息Api" ], - "summary": "查询项目的关联列车尺寸信息", + "summary": "通过地图ID查询项目的关联列车尺寸信息", "parameters": [ { "type": "integer", - "description": "项目ID", + "description": "地图ID", "name": "id", "in": "path", "required": true @@ -2377,7 +2416,7 @@ "parameters": [ { "type": "integer", - "name": "carriageLength", + "name": "carriage_length", "in": "query" }, { @@ -2397,7 +2436,7 @@ }, { "type": "integer", - "name": "totalLength", + "name": "total_length", "in": "query" } ], @@ -2507,7 +2546,7 @@ }, { "type": "integer", - "name": "carriageLength", + "name": "carriage_length", "in": "query" }, { @@ -2527,7 +2566,7 @@ }, { "type": "integer", - "name": "totalLength", + "name": "total_length", "in": "query" } ], @@ -2696,7 +2735,7 @@ "parameters": [ { "type": "integer", - "name": "AxialPosition", + "name": "axial_position", "in": "query" }, { @@ -2711,17 +2750,17 @@ }, { "type": "string", - "name": "installDirection", + "name": "install_direction", "in": "query" }, { "type": "integer", - "name": "maxDiameter", + "name": "max_diameter", "in": "query" }, { "type": "integer", - "name": "minDiameter", + "name": "min_diameter", "in": "query" }, { @@ -2836,7 +2875,7 @@ }, { "type": "integer", - "name": "AxialPosition", + "name": "axial_position", "in": "query" }, { @@ -2851,17 +2890,17 @@ }, { "type": "string", - "name": "installDirection", + "name": "install_direction", "in": "query" }, { "type": "integer", - "name": "maxDiameter", + "name": "max_diameter", "in": "query" }, { "type": "integer", - "name": "minDiameter", + "name": "min_diameter", "in": "query" }, { @@ -3507,7 +3546,7 @@ "dto.TrainSizeDto": { "type": "object", "properties": { - "carriageLength": { + "carriage_length": { "type": "integer" }, "description": { @@ -3519,11 +3558,22 @@ "name": { "type": "string" }, - "totalLength": { + "total_length": { "type": "integer" } } }, + "graphicData.PictureType": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "x-enum-varnames": [ + "PictureType_StationLayout", + "PictureType_Psl" + ] + }, "model.Category": { "type": "object", "properties": { @@ -3583,6 +3633,10 @@ "type": "integer" } }, + "type": { + "description": "数据类型", + "type": "integer" + }, "update_at": { "description": "修改时间", "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 200ac43..1137d90 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -203,7 +203,7 @@ definitions: type: object dto.TrainSizeDto: properties: - carriageLength: + carriage_length: type: integer description: type: string @@ -211,9 +211,17 @@ definitions: type: integer name: type: string - totalLength: + total_length: type: integer type: object + graphicData.PictureType: + enum: + - 0 + - 1 + type: integer + x-enum-varnames: + - PictureType_StationLayout + - PictureType_Psl model.Category: properties: code: @@ -257,6 +265,9 @@ definitions: items: type: integer type: array + type: + description: 数据类型 + type: integer update_at: description: 修改时间 type: string @@ -849,6 +860,15 @@ paths: type: integer name: proto type: array + - enum: + - 0 + - 1 + in: query + name: type + type: integer + x-enum-varnames: + - PictureType_StationLayout + - PictureType_Psl produces: - application/json responses: @@ -963,6 +983,15 @@ paths: type: integer name: proto type: array + - enum: + - 0 + - 1 + in: query + name: type + type: integer + x-enum-varnames: + - PictureType_StationLayout + - PictureType_Psl produces: - application/json responses: @@ -1011,6 +1040,15 @@ paths: type: integer name: proto type: array + - enum: + - 0 + - 1 + in: query + name: type + type: integer + x-enum-varnames: + - PictureType_StationLayout + - PictureType_Psl produces: - application/json responses: @@ -1192,13 +1230,13 @@ paths: summary: 查询项目的所有关联信息 tags: - 项目关联信息Api - /api/v1/projectLink/trainSize/:id: + /api/v1/projectLink/mapInfo/trainSize/:id: get: consumes: - application/json - description: 查询项目的关联列车尺寸信息 + description: 通过地图ID查询项目的关联列车尺寸信息 parameters: - - description: 项目ID + - description: 地图ID in: path name: id required: true @@ -1224,7 +1262,7 @@ paths: $ref: '#/definitions/dto.ErrorDto' security: - JwtAuth: [] - summary: 查询项目的关联列车尺寸信息 + summary: 通过地图ID查询项目的关联列车尺寸信息 tags: - 项目关联信息Api /api/v1/publishedGi/{id}: @@ -1867,7 +1905,7 @@ paths: description: 创建列车尺寸数据 parameters: - in: query - name: carriageLength + name: carriage_length type: integer - in: query name: description @@ -1879,7 +1917,7 @@ paths: name: name type: string - in: query - name: totalLength + name: total_length type: integer produces: - application/json @@ -1981,7 +2019,7 @@ paths: required: true type: integer - in: query - name: carriageLength + name: carriage_length type: integer - in: query name: description @@ -1993,7 +2031,7 @@ paths: name: name type: string - in: query - name: totalLength + name: total_length type: integer produces: - application/json @@ -2069,7 +2107,7 @@ paths: description: 创建列车轮径数据 parameters: - in: query - name: AxialPosition + name: axial_position type: integer - in: query name: diameter @@ -2078,13 +2116,13 @@ paths: name: id type: integer - in: query - name: installDirection + name: install_direction type: string - in: query - name: maxDiameter + name: max_diameter type: integer - in: query - name: minDiameter + name: min_diameter type: integer - in: query name: name @@ -2189,7 +2227,7 @@ paths: required: true type: integer - in: query - name: AxialPosition + name: axial_position type: integer - in: query name: diameter @@ -2198,13 +2236,13 @@ paths: name: id type: integer - in: query - name: installDirection + name: install_direction type: string - in: query - name: maxDiameter + name: max_diameter type: integer - in: query - name: minDiameter + name: min_diameter type: integer - in: query name: name diff --git a/service/category.go b/service/category.go index 1ec45a8..f7c6d68 100644 --- a/service/category.go +++ b/service/category.go @@ -98,7 +98,7 @@ func checkCategoryInfo(name string, code string, id int32) error { findNameQuery := dbquery.Category w := findNameQuery.Where() if id != 0 { - w = w.Where(findNameQuery.ID.Eq(id)) + w = w.Where(findNameQuery.ID.NotIn(id)) } if name != "" { count, err := w.Where(findNameQuery.Name.Eq(name)).Debug().Count() diff --git a/service/project.go b/service/project.go index fae9202..0d7f3a8 100644 --- a/service/project.go +++ b/service/project.go @@ -101,7 +101,7 @@ func checkProjectInfo(code string, id int32) error { findNameQuery := dbquery.Project w := findNameQuery.Where() if id != 0 { - w = w.Where(findNameQuery.ID.Eq(id)) + w = w.Where(findNameQuery.ID.NotIn(id)) } if code != "" { count, err := w.Where(findNameQuery.Code.Eq(code)).Debug().Count() diff --git a/service/publishedGi.go b/service/publishedGi.go index 6c60424..3acaf57 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -14,11 +14,12 @@ import ( ) func PageQueryPublishedGi(req *publishedGi.PublishedGiReqDto) *dto.PageDto { - where := dbquery.PublishedGi.Where(dbquery.PublishedGi.Status.Eq(1)) + dp := dbquery.PublishedGi + where := dp.Where(dp.Status.Eq(1)) if req.Name != "" { - where = where.Where(dbquery.PublishedGi.Name.Like(fmt.Sprintf("%%%s%%", req.Name))) + where = where.Where(dp.Name.Like(fmt.Sprintf("%%%s%%", req.Name))) } - result, count, err := where.Debug().FindByPage(req.Offset(), req.Size) + result, count, err := where.Select(dp.ID, dp.Name, dp.Note, dp.PublishAt).Debug().FindByPage(req.Offset(), req.Size) if err != nil { panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()}) } diff --git a/service/trainManage.go b/service/trainManage.go index 7150c7d..3420e66 100644 --- a/service/trainManage.go +++ b/service/trainManage.go @@ -270,7 +270,7 @@ func checkTrainModel(name string, id int32) error { findNameQuery := dbquery.TrainModel w := findNameQuery.Where() if id != 0 { - w = w.Where(findNameQuery.ID.Eq(id)) + w = w.Where(findNameQuery.ID.NotIn(id)) } if name != "" { count, err := w.Where(findNameQuery.Name.Eq(name)).Debug().Count()