diff --git a/ats/verify/simulation/simulation_manage.go b/ats/verify/simulation/simulation_manage.go index 0bf2b37..ab46e97 100644 --- a/ats/verify/simulation/simulation_manage.go +++ b/ats/verify/simulation/simulation_manage.go @@ -42,7 +42,7 @@ func init() { vobc.RegisterTrainInfoHandler(func(info []byte) { zap.S().Debug("接到列车信息", info) for _, simulation := range GetSimulationArr() { - simulation.Memory.Status.TrainStateMap.Range(func(key, value any) bool { + simulation.Memory.Status.TrainStateMap.Range(func(_, value any) bool { train := value.(*state.TrainState) if train.Show { // 上线列车 // 拼接列车ID @@ -119,7 +119,7 @@ func createSimulationId(mapId int32) string { // 获取仿真列表 func ListAllSimulations() []*dto.SimulationInfoRepDto { simArr := []*dto.SimulationInfoRepDto{} - simulationMap.Range(func(k, v any) bool { + simulationMap.Range(func(_, v any) bool { s := v.(*memory.VerifySimulation) simArr = append(simArr, &dto.SimulationInfoRepDto{ SimulationId: s.SimulationId, @@ -142,7 +142,7 @@ func FindSimulation(simulationId string) *memory.VerifySimulation { // 获取普通仿真数组 func GetSimulationArr() []*memory.VerifySimulation { result := []*memory.VerifySimulation{} - simulationMap.Range(func(k, v any) bool { + simulationMap.Range(func(_, v any) bool { result = append(result, v.(*memory.VerifySimulation)) return true }) @@ -234,28 +234,6 @@ func buildLineBaseInfo(vs *memory.VerifyStructure) *dynamics.LineBaseInfo { BRelTurnoutPoint: link.BRelatedSwitchRef.Port.Name(), }) } - //for _, slope := range vs.SlopeModelMap { - // id, _ := strconv.Atoi(slope.Index) - // slopes = append(slopes, &dynamics.Slope{ - // ID: int32(id), - // StartLinkId: slope.StartLinkIndex, - // StartLinkOffset: slope.StartLinkOffset, - // EndLinkId: slope.EndLinkIndex, - // EndLinkOffset: slope.EndLinkOffset, - // DegreeTrig: slope.DegreeTrig, - // }) - //} - //for _, curve := range vs.CurveModelMap { - // id, _ := strconv.Atoi(curve.Index) - // curves = append(curves, &dynamics.Curve{ - // ID: int32(id), - // StartLinkId: curve.StartLinkIndex, - // StartLinkOffset: curve.StartLinkOffset, - // EndLinkId: curve.EndLinkIndex, - // EndLinkOffset: curve.EndLinkOffset, - // Curvature: curve.Curvature, - // }) - //} return &dynamics.LineBaseInfo{ LinkList: links, SlopeList: slopes, diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_generate.go b/ats/verify/simulation/wayside/memory/wayside_memory_generate.go index e64c201..3198a6d 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_generate.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_generate.go @@ -137,10 +137,10 @@ func calcGraphicLenByTurnout(turnout *buildCalcTurnoutStruct, p graphicData.Rela func getGraphicSectionRefDevices(refVal *graphicData.RelatedRef, deviceMap map[string]*graphicData.CalculateLink_DevicePosition, section *buildCalcSectionStruct, offset int32, prevKm int64) (int32, int64) { dealFunc := func(p *graphicData.AxleCounting, d map[string]*graphicData.CalculateLink_DevicePosition, o int32, pk int64) (int32, int64) { - if p != nil && deviceMap[p.Common.Id] == nil { + if p != nil && d[p.Common.Id] == nil { resultOff := o + int32(math.Abs(float64(p.KilometerSystem.Kilometer-pk))) resultPK := p.KilometerSystem.Kilometer - deviceMap[p.Common.Id] = &graphicData.CalculateLink_DevicePosition{ + d[p.Common.Id] = &graphicData.CalculateLink_DevicePosition{ DeviceId: p.Common.Id, Offset: resultOff, DeviceType: graphicData.RelatedRef_AxleCounting.String(), diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_map.go b/ats/verify/simulation/wayside/memory/wayside_memory_map.go index 07e7c5a..0ead078 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_map.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_map.go @@ -363,7 +363,7 @@ func initGraphicStructure(graphicData *graphicData.RtssGraphicStorage, verifyStr // 初始化信号机信息 initGraphicSignal(graphicData.Signals, verifyStructure, graphicDataMap) // 初始化坡度和曲线端点 - initPoints(graphicData, verifyStructure, graphicDataMap) + initPoints(graphicData, verifyStructure) // 初始化Link信息 initLinks(graphicData.CalculateLink, verifyStructure, graphicDataMap) // 初始化坡度 @@ -422,7 +422,7 @@ func initSlopes(slopes []*graphicData.Slope, vs *VerifyStructure, dataMap *Graph } } -func initPoints(storage *graphicData.RtssGraphicStorage, vs *VerifyStructure, dataMap *GraphicInfoMapStructure) { +func initPoints(storage *graphicData.RtssGraphicStorage, vs *VerifyStructure) { for _, slopeKm := range storage.SlopeKiloMarker { vs.PointMap[slopeKm.Common.Id] = &device.PointModel{ DeviceModel: face.DeviceModel{ diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_section_axle.go b/ats/verify/simulation/wayside/memory/wayside_memory_section_axle.go index d0c917b..a0ced16 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_section_axle.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_section_axle.go @@ -3,7 +3,7 @@ package memory import ( "fmt" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "joylink.club/bj-rtsts-server/ats/verify/protos/state" ) @@ -26,7 +26,7 @@ func ChangeAxleSectionState(simulation *VerifySimulation, status *state.SectionS func GetAllAxleSectionState(simulation *VerifySimulation) []*state.SectionState { allSectionMap := &simulation.Memory.Status.AxleSectionStateMap var sectionArr []*state.SectionState - allSectionMap.Range(func(k, v any) bool { + allSectionMap.Range(func(_, v any) bool { sectionArr = append(sectionArr, v.(*state.SectionState)) return true }) diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_section_physical.go b/ats/verify/simulation/wayside/memory/wayside_memory_section_physical.go index 27770b1..83dc820 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_section_physical.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_section_physical.go @@ -3,7 +3,7 @@ package memory import ( "fmt" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "joylink.club/bj-rtsts-server/ats/verify/protos/state" ) @@ -26,7 +26,7 @@ func ChangePhysicalSectionState(simulation *VerifySimulation, status *state.Sect func GetAllPhysicalSectionState(simulation *VerifySimulation) []*state.SectionState { allSectionMap := &simulation.Memory.Status.PhysicalSectionStateMap var sectionArr []*state.SectionState - allSectionMap.Range(func(k, v any) bool { + allSectionMap.Range(func(_, v any) bool { sectionArr = append(sectionArr, v.(*state.SectionState)) return true }) diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_train.go b/ats/verify/simulation/wayside/memory/wayside_memory_train.go index 7a2ac20..41df5b7 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_train.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_train.go @@ -12,7 +12,7 @@ import ( "joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dynamics" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "joylink.club/bj-rtsts-server/ats/verify/protos/state" ) @@ -99,7 +99,7 @@ func RemoveTrainState(simulation *VerifySimulation, id string) { func GetAllTrainState(simulation *VerifySimulation) []*state.TrainState { allTrainMap := &simulation.Memory.Status.TrainStateMap var trainArr []*state.TrainState - allTrainMap.Range(func(k, v any) bool { + allTrainMap.Range(func(_, v any) bool { trainArr = append(trainArr, v.(*state.TrainState)) return true }) @@ -110,7 +110,7 @@ func GetAllTrainState(simulation *VerifySimulation) []*state.TrainState { func GetUpdatedTrainState(simulation *VerifySimulation) []*state.TrainState { changeTrainMap := &simulation.Memory.ChangeStatus.TrainStateMap var trainArr []*state.TrainState - changeTrainMap.Range(func(k, v any) bool { + changeTrainMap.Range(func(_, v any) bool { d := v.(*state.TrainState) trainArr = append(trainArr, d) return true diff --git a/ats/verify/simulation/wayside/memory/wayside_memory_turnout.go b/ats/verify/simulation/wayside/memory/wayside_memory_turnout.go index 02c8daf..665be1a 100644 --- a/ats/verify/simulation/wayside/memory/wayside_memory_turnout.go +++ b/ats/verify/simulation/wayside/memory/wayside_memory_turnout.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "joylink.club/bj-rtsts-server/ats/verify/protos/state" ) @@ -29,7 +29,7 @@ func ChangeTurnoutState(simulation *VerifySimulation, status *state.SwitchState) func GetAllTurnoutState(simulation *VerifySimulation) []*state.SwitchState { allSwitchMap := &simulation.Memory.Status.SwitchStateMap var switchArr []*state.SwitchState - allSwitchMap.Range(func(k, v any) bool { + allSwitchMap.Range(func(_, v any) bool { switchArr = append(switchArr, v.(*state.SwitchState)) return true }) @@ -40,7 +40,7 @@ func GetAllTurnoutState(simulation *VerifySimulation) []*state.SwitchState { func GetChangeTurnoutState(simulation *VerifySimulation) []*state.SwitchState { changeSwitchMap := &simulation.Memory.ChangeStatus.SwitchStateMap var switchArr []*state.SwitchState - changeSwitchMap.Range(func(k, v any) bool { + changeSwitchMap.Range(func(_, v any) bool { d := v.(*state.SwitchState) switchArr = append(switchArr, &state.SwitchState{ Id: d.Id, diff --git a/db/dbquery/drafting.gen.go b/db/dbquery/drafting.gen.go index 09ba6ab..2b7807e 100644 --- a/db/dbquery/drafting.gen.go +++ b/db/dbquery/drafting.gen.go @@ -30,7 +30,7 @@ func newDrafting(db *gorm.DB, opts ...gen.DOOption) drafting { _drafting.ID = field.NewInt32(tableName, "id") _drafting.Name = field.NewString(tableName, "name") _drafting.Category = field.NewString(tableName, "category") - _drafting.Type = field.NewString(tableName, "type") + _drafting.Type = field.NewInt32(tableName, "type") _drafting.Proto = field.NewBytes(tableName, "proto") _drafting.CreatorID = field.NewInt32(tableName, "creator_id") _drafting.CreatedAt = field.NewTime(tableName, "created_at") @@ -48,7 +48,7 @@ type drafting struct { ID field.Int32 // id Name field.String // 草稿图名称 Category field.String // 厂家编码 - Type field.String // 数据类型 + Type field.Int32 // 数据类型 Proto field.Bytes // 绘图数据 CreatorID field.Int32 // 创建人id CreatedAt field.Time // 创建时间 @@ -72,7 +72,7 @@ func (d *drafting) updateTableName(table string) *drafting { d.ID = field.NewInt32(table, "id") d.Name = field.NewString(table, "name") d.Category = field.NewString(table, "category") - d.Type = field.NewString(table, "type") + d.Type = field.NewInt32(table, "type") d.Proto = field.NewBytes(table, "proto") d.CreatorID = field.NewInt32(table, "creator_id") d.CreatedAt = field.NewTime(table, "created_at") diff --git a/db/model/drafting.gen.go b/db/model/drafting.gen.go index 177b20c..e3196e1 100644 --- a/db/model/drafting.gen.go +++ b/db/model/drafting.gen.go @@ -15,7 +15,7 @@ type Drafting struct { ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:id" json:"id"` // id Name string `gorm:"column:name;not null;comment:草稿图名称" json:"name"` // 草稿图名称 Category string `gorm:"column:category;comment:厂家编码" json:"category"` // 厂家编码 - Type string `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型 + Type int32 `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型 Proto []byte `gorm:"column:proto;comment:绘图数据" json:"proto"` // 绘图数据 CreatorID int32 `gorm:"column:creator_id;not null;comment:创建人id" json:"creator_id"` // 创建人id CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"` // 创建时间