faultRecordDTO.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. Kind string `json:"kind"` // aGate / aPowerPE / aPowerMPPT / aHub
  23. Type string `json:"type"` // 377 报文中的 type(aGate / pe);为空表示协议类型待确认
  24. Sn string `json:"sn"` // aPower-MPPT 与 aPower-PE 使用同一 SN
  25. Model string `json:"model,omitempty"` // 型号,如 aPower S
  26. HwVer *int `json:"hwVer,omitempty"` // aPower PE 硬件版本
  27. Supported bool `json:"supported"` // 是否可发起操作
  28. Note string `json:"note,omitempty"` // 不可用原因
  29. }
  30. // FaultRecordSiteDevices 网关及其设备
  31. type FaultRecordSiteDevices struct {
  32. Env string `json:"env"`
  33. GatewaySn string `json:"gatewaySn"`
  34. SiteName string `json:"siteName"`
  35. Online bool `json:"online"`
  36. OnlineTime string `json:"onlineTime,omitempty"`
  37. Devices []FaultRecordDevice `json:"devices"`
  38. Warnings []string `json:"warnings,omitempty"` // 部分设备信息获取失败时的提示
  39. }
  40. // FaultRecordOpSummary 操作历史列表项
  41. type FaultRecordOpSummary struct {
  42. ID string `json:"id"`
  43. Env string `json:"env"`
  44. GatewaySn string `json:"gatewaySn"`
  45. DeviceType string `json:"deviceType"`
  46. DeviceSn string `json:"deviceSn"`
  47. Kind string `json:"kind"`
  48. Summary string `json:"summary"` // 请求参数摘要
  49. Operator string `json:"operator"`
  50. Status string `json:"status"`
  51. TimeoutStage string `json:"timeoutStage,omitempty"`
  52. Error string `json:"error,omitempty"`
  53. StageTimes map[string]time.Time `json:"stageTimes"`
  54. FileName string `json:"fileName,omitempty"`
  55. FaultRecordID int64 `json:"faultRecordId,omitempty"`
  56. CanCancel bool `json:"canCancel"`
  57. CanRetryDownload bool `json:"canRetryDownload"` // 上传已完成但下载失败,可手动重试下载
  58. HasFile bool `json:"hasFile"`
  59. CreatedAt time.Time `json:"createdAt"`
  60. UpdatedAt time.Time `json:"updatedAt"`
  61. }
  62. // FaultRecordOpMessageView 原始报文
  63. type FaultRecordOpMessageView struct {
  64. Direction string `json:"direction"`
  65. Topic string `json:"topic"`
  66. CmdType uint `json:"cmdType"`
  67. At time.Time `json:"at"`
  68. Raw string `json:"raw"`
  69. }
  70. // FaultRecordResultItem 解析后的逐项结果
  71. type FaultRecordResultItem struct {
  72. Code int `json:"code,omitempty"` // device_info:数据类别;record_fetch:数据类型码 4/5
  73. Id int `json:"id,omitempty"` // param_read / param_write:功能码
  74. Name string `json:"name"` // 名称
  75. SetVal string `json:"setVal,omitempty"` // param_write:设置值
  76. Raw string `json:"raw,omitempty"` // hexData / idData 原文
  77. Decoded any `json:"decoded,omitempty"`
  78. DecodeErr string `json:"decodeError,omitempty"`
  79. ResultOne string `json:"resultOne"`
  80. ResultDesc string `json:"resultDesc"`
  81. Ok bool `json:"ok"`
  82. }
  83. // FaultRecordOpDetail 操作详情
  84. type FaultRecordOpDetail struct {
  85. FaultRecordOpSummary
  86. Request any `json:"request"`
  87. ReplyResult string `json:"replyResult,omitempty"`
  88. ReplyDesc string `json:"replyDesc,omitempty"`
  89. Items []FaultRecordResultItem `json:"items"`
  90. Messages []FaultRecordOpMessageView `json:"messages"`
  91. }
  92. // FaultRecordRecordView 录波详情(record_fetch 完成后)
  93. type FaultRecordRecordView struct {
  94. OperationID string `json:"operationId"`
  95. Records []faultRecordFile.Record `json:"records"`
  96. }