faultRecordDTO.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package dto
  2. import (
  3. "time"
  4. faultRecordFile "fwh-toolbox-server/function/FaultRecordFile"
  5. proto "fwh-toolbox-server/function/FaultRecordProtocol"
  6. )
  7. // FaultRecordCreateOpReq 创建故障录波操作
  8. type FaultRecordCreateOpReq struct {
  9. Env string `json:"env"` // prod / test
  10. GatewaySn string `json:"gatewaySn"` // aGate SN
  11. DeviceType string `json:"deviceType"` // aGate / pe
  12. DeviceSn string `json:"deviceSn"` // aGate 时可为空,默认网关 SN
  13. Kind string `json:"kind"` // device_info / record_fetch / param_read / param_write
  14. CodeList []int `json:"codeList,omitempty"`
  15. RecordIndex int `json:"recordIndex,omitempty"` // 单条(兼容)
  16. RecordIndexes []int `json:"recordIndexes,omitempty"` // 多条,设备打成一个包
  17. IdList []int `json:"idList,omitempty"`
  18. ParaList []proto.ParaItem `json:"paraList,omitempty"`
  19. }
  20. // FaultRecordDevice 可操作的设备
  21. type FaultRecordDevice struct {
  22. Type string `json:"type"` // aGate / pe
  23. Sn string `json:"sn"`
  24. }
  25. // FaultRecordSiteDevices 网关及其设备
  26. type FaultRecordSiteDevices struct {
  27. Env string `json:"env"`
  28. GatewaySn string `json:"gatewaySn"`
  29. SiteName string `json:"siteName"`
  30. Online bool `json:"online"`
  31. OnlineTime string `json:"onlineTime,omitempty"`
  32. Devices []FaultRecordDevice `json:"devices"`
  33. }
  34. // FaultRecordOpSummary 操作历史列表项
  35. type FaultRecordOpSummary struct {
  36. ID string `json:"id"`
  37. Env string `json:"env"`
  38. GatewaySn string `json:"gatewaySn"`
  39. DeviceType string `json:"deviceType"`
  40. DeviceSn string `json:"deviceSn"`
  41. Kind string `json:"kind"`
  42. Summary string `json:"summary"` // 请求参数摘要
  43. Operator string `json:"operator"`
  44. Status string `json:"status"`
  45. TimeoutStage string `json:"timeoutStage,omitempty"`
  46. Error string `json:"error,omitempty"`
  47. StageTimes map[string]time.Time `json:"stageTimes"`
  48. FileName string `json:"fileName,omitempty"`
  49. FaultRecordID int64 `json:"faultRecordId,omitempty"`
  50. CanCancel bool `json:"canCancel"`
  51. CanRetryDownload bool `json:"canRetryDownload"` // 上传已完成但下载失败,可手动重试下载
  52. HasFile bool `json:"hasFile"`
  53. CreatedAt time.Time `json:"createdAt"`
  54. UpdatedAt time.Time `json:"updatedAt"`
  55. }
  56. // FaultRecordOpMessageView 原始报文
  57. type FaultRecordOpMessageView struct {
  58. Direction string `json:"direction"`
  59. Topic string `json:"topic"`
  60. CmdType uint `json:"cmdType"`
  61. At time.Time `json:"at"`
  62. Raw string `json:"raw"`
  63. }
  64. // FaultRecordResultItem 解析后的逐项结果
  65. type FaultRecordResultItem struct {
  66. Code int `json:"code,omitempty"` // device_info:数据类别;record_fetch:数据类型码 4/5
  67. Id int `json:"id,omitempty"` // param_read / param_write:功能码
  68. Name string `json:"name"` // 名称
  69. SetVal string `json:"setVal,omitempty"` // param_write:设置值
  70. Raw string `json:"raw,omitempty"` // hexData / idData 原文
  71. Decoded any `json:"decoded,omitempty"`
  72. DecodeErr string `json:"decodeError,omitempty"`
  73. ResultOne string `json:"resultOne"`
  74. ResultDesc string `json:"resultDesc"`
  75. Ok bool `json:"ok"`
  76. }
  77. // FaultRecordOpDetail 操作详情
  78. type FaultRecordOpDetail struct {
  79. FaultRecordOpSummary
  80. Request any `json:"request"`
  81. ReplyResult string `json:"replyResult,omitempty"`
  82. ReplyDesc string `json:"replyDesc,omitempty"`
  83. Items []FaultRecordResultItem `json:"items"`
  84. Messages []FaultRecordOpMessageView `json:"messages"`
  85. }
  86. // FaultRecordRecordView 录波详情(record_fetch 完成后)
  87. type FaultRecordRecordView struct {
  88. OperationID string `json:"operationId"`
  89. Records []faultRecordFile.Record `json:"records"`
  90. }