feat: 添加moc/cct统计
This commit is contained in:
@@ -170,9 +170,11 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
||||
"G1": "Duration",
|
||||
"H1": "Result Code",
|
||||
"I1": "Result Cause",
|
||||
"J1": "Call Start Time",
|
||||
"K1": "Hangup Time",
|
||||
"L1": "Tenant Name", // for multi-tenancy
|
||||
"J1": "MOS Average",
|
||||
"K1": "Call Connection Time",
|
||||
"L1": "Call Start Time",
|
||||
"M1": "Hangup Time",
|
||||
"N1": "Tenant Name", // for multi-tenancy
|
||||
}
|
||||
// 读取字典数据 CDR SIP响应代码类别类型
|
||||
dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code")
|
||||
@@ -265,6 +267,16 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
||||
}
|
||||
// for multi-tenant, get tenant name
|
||||
tenantName := row.TenantName
|
||||
// 通话质量
|
||||
var mosAverage int64 = 0
|
||||
if v, ok := cdrJSON["mosAverage"]; ok && v != nil && callType != "sms" {
|
||||
mosAverage = parse.Number(v)
|
||||
}
|
||||
// 通话连接时间
|
||||
callConnectionTime := "-"
|
||||
if v, ok := cdrJSON["callConnectionTime"]; ok && v != nil && callType != "sms" {
|
||||
callConnectionTime = fmt.Sprintf("%ds", parse.Number(v))
|
||||
}
|
||||
|
||||
dataCells = append(dataCells, map[string]any{
|
||||
"A" + idx: row.ID,
|
||||
@@ -275,10 +287,12 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
||||
"F" + idx: called,
|
||||
"G" + idx: duration,
|
||||
"H" + idx: callResult,
|
||||
"I" + idx: callCause,
|
||||
"J" + idx: seizureTimeStr,
|
||||
"K" + idx: releaseTimeStr,
|
||||
"L" + idx: tenantName,
|
||||
"I" + idx: mosAverage,
|
||||
"J" + idx: callConnectionTime,
|
||||
"K" + idx: callCause,
|
||||
"L" + idx: seizureTimeStr,
|
||||
"M" + idx: releaseTimeStr,
|
||||
"N" + idx: tenantName,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -476,3 +490,85 @@ func (s IMSController) KPIBusyWeek(c *gin.Context) {
|
||||
data := s.kpiReportService.IMSBusyWeek(neInfo.RmUID, query.WeekStart, query.WeekEnd)
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
|
||||
// CDR MOS
|
||||
//
|
||||
// GET /cdr/mos-hour
|
||||
//
|
||||
// @Tags network_data/ims
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param neId query string true "NE ID" default(001)
|
||||
// @Param timestamp query int64 false "timestamp"
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary MOS hour statistics
|
||||
// @Description MOS hour statistics
|
||||
// @Router /neData/ims/cdr/mos-hour [get]
|
||||
func (s IMSController) CDRMOSHour(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
var query struct {
|
||||
NeID string `form:"neId" binding:"required"`
|
||||
Timestamp int64 `form:"timestamp" binding:"required"` // 时间戳毫秒 年月日返回每小时的总和 年月日时返回该小时的总和
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if query.Timestamp < 1e12 || query.Timestamp > 1e13 {
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "timestamp format is ms"))
|
||||
return
|
||||
}
|
||||
|
||||
// 查询网元获取IP
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID("IMS", query.NeID)
|
||||
if neInfo.NeId != query.NeID || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
data := s.cdrEventService.CDRMOSHour(neInfo.RmUID, query.Timestamp)
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
|
||||
// CDR Call Connection Time
|
||||
//
|
||||
// GET /cdr/cct-hour
|
||||
//
|
||||
// @Tags network_data/ims
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param neId query string true "NE ID" default(001)
|
||||
// @Param timestamp query int64 false "timestamp"
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary MOS hour statistics
|
||||
// @Description MOS hour statistics
|
||||
// @Router /neData/ims/cdr/cct-hour [get]
|
||||
func (s IMSController) CDRCCTHour(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
var query struct {
|
||||
NeID string `form:"neId" binding:"required"`
|
||||
Timestamp int64 `form:"timestamp" binding:"required"` // 时间戳毫秒 年月日返回每小时的总和 年月日时返回该小时的总和
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if query.Timestamp < 1e12 || query.Timestamp > 1e13 {
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "timestamp format is ms"))
|
||||
return
|
||||
}
|
||||
|
||||
// 查询网元获取IP
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID("IMS", query.NeID)
|
||||
if neInfo.NeId != query.NeID || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
data := s.cdrEventService.CDRCCTHour(neInfo.RmUID, query.Timestamp)
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user