fix: UPF流量总计7,30天累计数据查询

This commit is contained in:
TsMask
2025-03-21 15:52:03 +08:00
parent 7e42dd91e4
commit 72fc915481
4 changed files with 46 additions and 39 deletions

View File

@@ -34,7 +34,7 @@ func (k *KpiCReport) Get(c *gin.Context) {
dbg := dborm.DefaultDB().Table(tableName)
if querys.NeID != "" {
conditions = append(conditions, "rm_uid = (select n.rm_uid from ne_info n where n.ne_type=? and n.ne_id=? and n.status=1)")
conditions = append(conditions, "rm_uid = (select n.rm_uid from ne_info n where n.ne_type=? and n.ne_id=?)")
params = append(params, strings.ToUpper(querys.NeType), querys.NeID)
} else {
c.JSON(http.StatusBadRequest, services.ErrResp("Not found required parameter NE ID"))
@@ -101,7 +101,7 @@ func (k *KpiCReport) GetReport2FE(c *gin.Context) {
dbg := dborm.DefaultDB().Table(tableName)
if querys.NeID != "" {
conditions = append(conditions, "rm_uid = (select n.rm_uid from ne_info n where n.ne_type=? and n.ne_id=? and n.status=1)")
conditions = append(conditions, "rm_uid = (select n.rm_uid from ne_info n where n.ne_type=? and n.ne_id=?)")
params = append(params, querys.NeType, querys.NeID)
} else {
c.JSON(http.StatusBadRequest, services.ErrResp("Not found required parameter NE ID"))

View File

@@ -19,6 +19,8 @@ import (
"be.ems/lib/log"
"be.ems/lib/services"
"be.ems/src/framework/utils/parse"
neDataService "be.ems/src/modules/network_data/service"
neService "be.ems/src/modules/network_element/service"
wsService "be.ems/src/modules/ws/service"
"github.com/go-resty/resty/v2"
@@ -329,6 +331,10 @@ func PostKPIReportFromNF(w http.ResponseWriter, r *http.Request) {
wsService.NewWSSend.ByGroupID(fmt.Sprintf("%s%s_%s", wsService.GROUP_KPI_C, neInfo.NeType, neInfo.NeId), kpiCEvent)
if neInfo.NeType == "UPF" {
wsService.NewWSSend.ByGroupID(wsService.GROUP_KPI_UPF+neInfo.NeId, kpiEvent)
// 更新UPF总流量
upValue := parse.Number(kpiEvent["UPF.03"])
downValue := parse.Number(kpiEvent["UPF.06"])
neDataService.NewPerfKPI.UPFTodayFlowUpdate(neInfo.RmUID, upValue, downValue)
}
}