fix: export csv file contain tenant name

This commit is contained in:
2024-10-15 10:10:19 +08:00
parent 25232876b0
commit f592f1c544
11 changed files with 39 additions and 4 deletions

View File

@@ -130,6 +130,7 @@ func (s *IMSController) CDRExport(c *gin.Context) {
"F1": "Duration",
"G1": "Result",
"H1": "Time",
"I1": "Tenant Name", // for multi-tenancy
}
// 读取字典数据 CDR SIP响应代码类别类型
dictCDRSipCode := sysService.NewSysDictDataImpl.SelectDictDataByType("cdr_sip_code")
@@ -195,6 +196,11 @@ func (s *IMSController) CDRExport(c *gin.Context) {
releaseTime := parse.Number(v)
timeStr = date.ParseDateToStr(releaseTime, date.YYYY_MM_DDTHH_MM_SSZ)
}
// tenant name
tenantName := ""
if v, ok := cdrJSON["tenantName"]; ok && v != nil {
tenantName = v.(string)
}
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
@@ -205,6 +211,7 @@ func (s *IMSController) CDRExport(c *gin.Context) {
"F" + idx: duration,
"G" + idx: callResult,
"H" + idx: timeStr,
"I" + idx: tenantName,
})
}

View File

@@ -134,6 +134,7 @@ func (s *SMFController) CDRExport(c *gin.Context) {
"H1": "Duration",
"I1": "Invocation Time",
"J1": "PDU Session Charging Information",
"K1": "Tenant Name", // for multi-tenancy
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
@@ -243,6 +244,11 @@ PDU Type: %s
PDU IPv4 Address: %s
PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
}
// Tenant Name
tenantName := ""
if v, ok := cdrJSON["tenantName"]; ok && v != nil {
tenantName = v.(string)
}
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
@@ -255,6 +261,7 @@ PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID,
"H" + idx: duration,
"I" + idx: invocationTimestamp,
"J" + idx: pduSessionChargingInformation,
"K" + idx: tenantName,
})
}

View File

@@ -128,6 +128,7 @@ func (s *SMSCController) CDRExport(c *gin.Context) {
"E1": "Called",
"F1": "Result",
"G1": "Time",
"H1": "Tenant Name", // for multi-tenancy
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
@@ -174,6 +175,11 @@ func (s *SMSCController) CDRExport(c *gin.Context) {
releaseTime := parse.Number(v)
timeStr = date.ParseDateToStr(releaseTime, date.YYYY_MM_DDTHH_MM_SSZ)
}
// Tenant name
tenantName := ""
if v, ok := cdrJSON["tenantName"]; ok && v != nil {
tenantName = v.(string)
}
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
@@ -183,6 +189,7 @@ func (s *SMSCController) CDRExport(c *gin.Context) {
"E" + idx: called,
"F" + idx: callResult,
"G" + idx: timeStr,
"H" + idx: tenantName,
})
}