batchDownloadDomain.go 6.3 KB

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