shutdownStatisticsDomain.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package domain
  2. import (
  3. "go.mongodb.org/mongo-driver/bson/primitive"
  4. )
  5. type ShutdownStatisticsStatus string // 'error' | 'complete'
  6. // ShutdownStatisticsStatus枚举
  7. const (
  8. ShutdownStatisticsError ShutdownStatisticsStatus = "error"
  9. ShutdownStatisticsComplete ShutdownStatisticsStatus = "complete"
  10. )
  11. type TaskShutdownStatistics struct {
  12. Id primitive.ObjectID `bson:"_id" json:"id"`
  13. Date string `bson:"date" json:"date"`
  14. }
  15. type ShutdownStatisticsItem struct {
  16. Id *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
  17. Date string `bson:"date" json:"date"`
  18. Status ShutdownStatisticsStatus `bson:"status" json:"status"`
  19. Count ShutdownStatisticsArea[uint] `bson:"count" json:"count"`
  20. Country string `json:"country"` // 国家
  21. SiteMap map[string]ShutdownStatisticsInfo `bson:"siteMap" json:"siteMap"` // SN: Info
  22. }
  23. type ShutdownStatisticsInfo struct {
  24. SiteAnalysisId *primitive.ObjectID `bson:"siteAnalysisId" json:"siteAnalysisId"`
  25. ShutdownTimeList []ShutdownTimePointInfo `bson:"shutdownTimeList" json:"shutdownTimeList"`
  26. }
  27. type ShutdownTimePointInfo struct {
  28. Time string `bson:"time" json:"time"`
  29. Type int `bson:"type" json:"type"` // 1-系统停机 2-aPower停机
  30. }
  31. type ShutdownStatisticsDashboard struct {
  32. Date string `bson:"date" json:"date"`
  33. Weekly ShutdownStatisticsArea[[7]uint] `bson:"weekly" json:"weekly"`
  34. Yearly ShutdownStatisticsArea[[12]uint] `bson:"yearly" json:"yearly"`
  35. }
  36. type ShutdownStatisticsArea[T any] struct {
  37. ALL T `bson:"all" json:"all"`
  38. US T `bson:"us" json:"us"`
  39. AU T `bson:"au" json:"au"`
  40. }