batchDownloadDomain.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package domain
  2. import (
  3. "go.mongodb.org/mongo-driver/bson/primitive"
  4. )
  5. type BatchDownloadInfo struct {
  6. Id primitive.ObjectID `bson:"_id" json:"id"`
  7. Sn []string `bson:"sn" json:"sn"`
  8. Description string `bson:"description" json:"description"`
  9. TimePeriod [2]string `bson:"timePeriod" json:"timePeriod"`
  10. Options BatchDownloadOptions `bson:"options" json:"options"`
  11. Progress Progress `bson:"progress" json:"progress"`
  12. FailReasons []string `bson:"failReasons" json:"failReasons"`
  13. Owner *[]string `bson:"owner,omitempty" json:"owner,omitempty"`
  14. }
  15. type BatchDownloadOptions struct {
  16. PowerFlow bool `bson:"powerFlow" json:"powerFlow"` // 功率流图
  17. MqttLogs []string `bson:"mqttLogs" json:"mqttLogs"` // MQTT日志
  18. EventAlarm bool `bson:"eventAlarm" json:"eventAlarm"` // 事件和告警日志
  19. AlarmSnapshot bool `bson:"alarmSnapshot" json:"alarmSnapshot"` // 告警快照
  20. EmsLogs []string `bson:"emsLogs" json:"emsLogs"` // EMS日志
  21. FaultRecord bool `bson:"faultRecord" json:"faultRecord"` // 故障录波
  22. UpdateLog bool `bson:"updateLog" json:"updateLog"` // 升级记录
  23. Settings bool `bson:"settings" json:"settings"` // 站点设置
  24. }
  25. type BatchDownloadConfigWrite struct {
  26. Sn []string `bson:"sn" json:"sn"`
  27. Description string `bson:"description" json:"description"`
  28. TimePeriod [2]string `bson:"timePeriod" json:"timePeriod"`
  29. Options BatchDownloadOptions `bson:"options"`
  30. Owner *[]string `bson:"owner,omitempty" json:"owner,omitempty"`
  31. }
  32. type BatchDownloadConfig struct {
  33. Id primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
  34. Sn []string `bson:"sn" json:"sn"`
  35. Description string `bson:"description" json:"description"`
  36. TimePeriod [2]string `bson:"timePeriod" json:"timePeriod"`
  37. Options BatchDownloadOptions `bson:"options"`
  38. Progress Progress `bson:"progress" json:"progress"`
  39. Data map[string]BatchDownloadData `bson:"data" json:"data"` // map-key为SN
  40. FailReasons []string `bson:"failReasons" json:"failReasons"`
  41. Owner *[]string `bson:"owner,omitempty" json:"owner,omitempty"`
  42. }
  43. type TaskBatchDownload struct {
  44. Id primitive.ObjectID `bson:"_id" json:"id"`
  45. Sn []string `bson:"sn" json:"sn"`
  46. TimePeriod [2]string `bson:"timePeriod" json:"timePeriod"`
  47. Options BatchDownloadOptions `bson:"options"`
  48. }
  49. // 数据说明
  50. // map的key为日期,格式为 YYYY-MM-DD
  51. // MqttLogs和EmsLogs的二级map为日志类型名称
  52. // 存储的最终数据是文件服务器(minio)的存储路径
  53. type BatchDownloadData struct {
  54. PowerFlow *map[string]string `bson:"powerFlow,omitempty" json:"powerFlow,omitempty"` // 功率流图
  55. MqttLogs *map[string]map[string]string `bson:"mqttLogs,omitempty" json:"mqttLogs,omitempty"` // MQTT日志
  56. EventAlarm *map[string]string `bson:"eventAlarm,omitempty" json:"eventAlarm,omitempty"` // 事件和告警日志
  57. AlarmSnapshot *map[string]string `bson:"alarmSnapshot,omitempty" json:"alarmSnapshot,omitempty"` // 告警快照
  58. EmsLogs *map[string]map[string]string `bson:"emsLogs,omitempty" json:"emsLogs,omitempty"` // EMS日志
  59. FaultRecord *map[string]string `bson:"faultRecord,omitempty" json:"faultRecord,omitempty"` // 故障录波 map的key为文件名
  60. UpdateLog *string `bson:"updateLog,omitempty" json:"updateLog,omitempty"` // 升级记录
  61. Settings *string `bson:"settings,omitempty" json:"settings,omitempty"` // 站点设置
  62. }
  63. // 下载任务数据 (保存于redis数据库)
  64. type BatchDownloadFileTaskInfo struct {
  65. DevType int `bson:"devType" json:"devType"` // 设备类型:-1-忽略 0-aPower 1-aGate 2-MPPT 3-aHub
  66. Sn string `bson:"sn" json:"sn"`
  67. Date string `bson:"date" json:"date"`
  68. FileType string `bson:"fileType" json:"fileType"`
  69. FileSupType string `bson:"fileSubType" json:"fileSubType"`
  70. Result int `bson:"result" json:"result"` // -1-失败 0-进行中 1-成功
  71. Reason string `bson:"reason" json:"reason"` // 失败原因
  72. }
  73. type BatchDownloadUpdateLogVersionInfo struct {
  74. Name string `json:"name"` // 名称
  75. OldVer string `json:"oldVer"`
  76. NewVer string `json:"newVer"`
  77. }
  78. type BatchDownloadUpdateLogSubDevInfo struct {
  79. DevSn string `json:"devSn"`
  80. DevVerList []BatchDownloadUpdateLogVersionInfo `json:"devVerList"`
  81. }
  82. type BatchDownloadUpdateLogAHubVersionInfo struct {
  83. FileName string `json:"fileName"` // 文件名称
  84. FileOrder string `json:"fileOrder"` // 文件单号
  85. Result string `json:"result"` // 升级结果 "0"-成功
  86. ResultDesc string `json:"resultDesc"` // 升级结果说明
  87. OldVer string `json:"oldVer"`
  88. NewVer string `json:"newVer"`
  89. }
  90. // 系统升级日志信息数据
  91. type BatchDownloadSystemUpdateLogInfo struct {
  92. OrderNo string `json:"orderNo"` // 升级工单号
  93. TriggerType string `json:"triggerType"` // 触发类型 自动 or 手动
  94. GateSn string `json:"gateSn"`
  95. FileName string `json:"fileName"` // 升级包名
  96. UpdateTime string `json:"updateTime"` // 触发升级时间 - 北京时间
  97. Result string `json:"result"` // 升级结果
  98. GateVerList []BatchDownloadUpdateLogVersionInfo `json:"gateVerList"`
  99. SubDevList []BatchDownloadUpdateLogSubDevInfo `json:"subVerList"`
  100. }
  101. // aHub升级日志信息数据
  102. type BatchDownloadAHubUpdateLogInfo struct {
  103. OrderNo string `json:"orderNo"` // 升级工单号
  104. TriggerType string `json:"triggerType"` // 触发类型 自动 or 手动
  105. AHubSn string `json:"aHubSn"` // aHubSn
  106. GateSn string `json:"gateSn"`
  107. EndTime string `json:"endTime"` // 升级时间 - 北京时间
  108. Result string `json:"result"` // 升级结果
  109. DetailList []BatchDownloadUpdateLogAHubVersionInfo `json:"detailList"`
  110. }