diff --git a/src/bean/entity/alert_overview.go b/src/bean/entity/alert_overview.go index b29b092a7b1a10532b0feaddb3372ea53729e366..44320cd789bb216da27865d124b8792b47095fb6 100644 --- a/src/bean/entity/alert_overview.go +++ b/src/bean/entity/alert_overview.go @@ -22,26 +22,31 @@ type AlertArray struct { } type RiskLevelDistribution struct { - Name string `json:"name"` // 名称 - RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险 - Percentage string `json:"percentage"` // 百分比 + Name string `json:"name"` // 名称 + //RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险 + //Percentage string `json:"percentage"` // 百分比 + Value int `json:"value"` } type AlertStatusDistribution struct { - Name string `json:"name"` // 名称 - Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭 - Percentage string `json:"percentage"` // 百分比 + Name string `json:"name"` // 名称 + //Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭 + //Percentage string `json:"percentage"` // 百分比 + Value int `json:"value"` } type AlertClassDistribution struct { - Name string `json:"name"` // 名称 - ClassId int `json:"class_id"` // 预警分类id - Percentage string `json:"percentage"` // 百分比 + Name string `json:"name"` // 名称 + //ClassId int `json:"class_id"` // 预警分类id + //Percentage string `json:"percentage"` // 百分比 + Value int `json:"value"` } type AlertFrequencyDistribution struct { - Name string `json:"name"` // 名称 - Count int `json:"count"` // 数量 + //Name string `json:"name"` // 名称 + //Value int `json:"count"` // 数量 + XAxis []string `json:"xAxis"` + Data []int `json:"data"` } func (a *AlertOverview) TableName() string { diff --git a/src/bean/vo/response/alert_overview.go b/src/bean/vo/response/alert_overview.go index 3885be2cd60085b3a1251c4926364d2cfcc04bce..ec2615e3106d669e23e388ff514e976b4ed57db4 100644 --- a/src/bean/vo/response/alert_overview.go +++ b/src/bean/vo/response/alert_overview.go @@ -5,11 +5,11 @@ import ( ) type AlertOverviewItem struct { - AlertOverview []entity.AlertOverview `json:"alert_overview"` - RiskLevelDistribution []entity.RiskLevelDistribution `json:"risk_level_distribution"` - AlertStatusDistribution []entity.AlertStatusDistribution `json:"alert_status_distribution"` - AlertClassDistribution []entity.AlertClassDistribution `json:"alert_class_distribution"` - AlertFrequencyDistribution []entity.AlertFrequencyDistribution `json:"alert_frequency_distribution"` + AlertOverview []entity.AlertOverview `json:"alert_overview"` + RiskLevelDistribution []entity.RiskLevelDistribution `json:"risk_level_distribution"` + AlertStatusDistribution []entity.AlertStatusDistribution `json:"alert_status_distribution"` + AlertClassDistribution []entity.AlertClassDistribution `json:"alert_class_distribution"` + AlertFrequencyDistribution entity.AlertFrequencyDistribution `json:"alert_frequency_distribution"` } type AlertOverviewList struct { diff --git a/src/service/alert_overview.go b/src/service/alert_overview.go index 1d8cc722581daf6a22759222df0d38aac396afdc..4a70ec18c7c581df1508c48a920e8b90603fc6ac 100644 --- a/src/service/alert_overview.go +++ b/src/service/alert_overview.go @@ -187,93 +187,53 @@ func (a *AlertOverviewSvc) Overview(req request.DetailAlertOverview) (resp respo }, RiskLevelDistribution: []entity.RiskLevelDistribution{ { - Name: "重大风险", - RiskLevel: 4, - Percentage: "10%", + Name: "重大风险", + Value: 1, }, { - Name: "较大风险", - RiskLevel: 3, - Percentage: "20%", + Name: "较大风险", + Value: 2, }, { - Name: "一般风险", - RiskLevel: 2, - Percentage: "30%", + Name: "一般风险", + Value: 3, }, { - Name: "低风险", - RiskLevel: 1, - Percentage: "40%", + Name: "低风险", + Value: 4, }, }, AlertStatusDistribution: []entity.AlertStatusDistribution{ { - Name: "未恢复", - Status: 1, - Percentage: "30%", + Name: "未恢复", + Value: 4, }, { - Name: "已恢复", - Status: 2, - Percentage: "70%", + Name: "已恢复", + Value: 6, }, }, AlertClassDistribution: []entity.AlertClassDistribution{ { - Name: "容器集群", - ClassId: 1, - Percentage: "30%", + Name: "容器集群", + Value: 1, }, { - Name: "容器节点", - ClassId: 2, - Percentage: "20%", + Name: "容器节点", + Value: 2, }, { - Name: "容器组", - ClassId: 3, - Percentage: "30%", + Name: "容器组", + Value: 3, }, { - Name: "网关", - ClassId: 4, - Percentage: "20%", + Name: "网关", + Value: 4, }, }, - AlertFrequencyDistribution: []entity.AlertFrequencyDistribution{ - { - Name: "0-3时", - Count: 12, - }, - { - Name: "3-6时", - Count: 20, - }, - { - Name: "6-9时", - Count: 11, - }, - { - Name: "9-12时", - Count: 50, - }, - { - Name: "12-15时", - Count: 60, - }, - { - Name: "15-18时", - Count: 30, - }, - { - Name: "18-21时", - Count: 16, - }, - { - Name: "21-24时", - Count: 6, - }, + AlertFrequencyDistribution: entity.AlertFrequencyDistribution{ + XAxis: []string{"0-3时", "3-6时", "6-9时", "9-12时", "12-15时", "15-18时", "18-21时", "21-24时"}, + Data: []int{12, 20, 11, 50, 60, 30, 16, 6}, }, }