[alerter]fixbug dashboard告警处理率计算和无数据时告警图展示错乱
This commit is contained in:
@@ -75,10 +75,14 @@ public class AlertServiceImpl implements AlertService {
|
|||||||
- alertSummary.getPriorityEmergencyNum() - alertSummary.getPriorityWarningNum();
|
- alertSummary.getPriorityEmergencyNum() - alertSummary.getPriorityWarningNum();
|
||||||
alertSummary.setDealNum(dealNum);
|
alertSummary.setDealNum(dealNum);
|
||||||
try {
|
try {
|
||||||
float rate = BigDecimal.valueOf(100 * (float) dealNum / total)
|
if (total == 0) {
|
||||||
.setScale(2, RoundingMode.HALF_UP)
|
alertSummary.setRate(100);
|
||||||
.floatValue();
|
} else {
|
||||||
alertSummary.setRate(rate);
|
float rate = BigDecimal.valueOf(100 * (float) dealNum / total)
|
||||||
|
.setScale(2, RoundingMode.HALF_UP)
|
||||||
|
.floatValue();
|
||||||
|
alertSummary.setRate(rate);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@
|
|||||||
[autoResize]="true"
|
[autoResize]="true"
|
||||||
[loading]="alertsLoading"
|
[loading]="alertsLoading"
|
||||||
(chartInit)="onAlertNumChartInit($event)"
|
(chartInit)="onAlertNumChartInit($event)"
|
||||||
style="width: 100%; height: 100%"
|
style="width: 100%; min-height: 300px"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div nz-col nzXs="24" nzSm="12" nzMd="5" class="mb-md">
|
<div nz-col nzXs="24" nzSm="12" nzMd="5" class="mb-md">
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
[autoResize]="true"
|
[autoResize]="true"
|
||||||
[loading]="alertsDealLoading"
|
[loading]="alertsDealLoading"
|
||||||
(chartInit)="onAlertRateChartInit($event)"
|
(chartInit)="onAlertRateChartInit($event)"
|
||||||
style="width: 100%; height: 100%"
|
style="width: 100%; min-height: 300px"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 100,
|
||||||
name: '告警处理率'
|
name: '告警处理率'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user