diff --git a/src/modules/network_data/controller/smf.go b/src/modules/network_data/controller/smf.go index 48bdee05..094b4843 100644 --- a/src/modules/network_data/controller/smf.go +++ b/src/modules/network_data/controller/smf.go @@ -123,26 +123,30 @@ func (s *SMFController) CDRExport(c *gin.Context) { headerCells := map[string]string{ "A1": "ID", "B1": "Charging ID", - "C1": "Subscriber ID Data", - "D1": "Subscriber ID Type", - "E1": "Data Volume Uplink", - "F1": "Data Volume Downlink", - "G1": "Data Total Volume", - "H1": "Duration", - "I1": "Invocation Time", - "J1": "User Identifier", - "K1": "SSC Mode", - "L1": "DNN ID", - "M1": "PDU Type", - "N1": "RAT Type", - "O1": "PDU IPv4 Address", - "P1": "PDU IPv6 Address Swith Prefix", - "Q1": "Record Network Function ID", - "R1": "Record Type", - "S1": "Record Opening Time", + "C1": "NE Name", + "D1": "Resource Unique ID", + "E1": "Subscriber ID Data", + "F1": "Subscriber ID Type", + "G1": "Data Volume Uplink", + "H1": "Data Volume Downlink", + "I1": "Data Total Volume", + "J1": "Duration", + "K1": "Invocation Time", + "L1": "User Identifier", + "M1": "SSC Mode", + "N1": "DNN ID", + "O1": "PDU Type", + "P1": "RAT Type", + "Q1": "PDU IPv4 Address", + "R1": "Network Function IPv4", + "S1": "PDU IPv6 Address Swith Prefix", + "T1": "Record Network Function ID", + "U1": "Record Type", + "V1": "Record Opening Time", } // 从第二行开始的数据 dataCells := make([]map[string]any, 0) + for i, row := range rows { idx := strconv.Itoa(i + 2) // 解析 JSON 字符串为 map @@ -167,6 +171,15 @@ func (s *SMFController) CDRExport(c *gin.Context) { subscriptionIDData = sub["subscriptionIDData"].(string) } } + + // 网络功能 IPv4 地址 + networkFunctionIPv4Address := "" + if v, ok := cdrJSON["nFunctionConsumerInformation"]; ok && v != nil { + if conInfo, conInfoOk := v.(map[string]any); conInfoOk && conInfo != nil { + networkFunctionIPv4Address = conInfo["networkFunctionIPv4Address"].(string) + } + } + // 数据量上行链路 dataVolumeUplink := []string{} // 数据量下行链路 @@ -271,23 +284,26 @@ func (s *SMFController) CDRExport(c *gin.Context) { dataCells = append(dataCells, map[string]any{ "A" + idx: row.ID, "B" + idx: chargingID, - "C" + idx: subscriptionIDData, - "D" + idx: subscriptionIDType, - "E" + idx: strings.Join(dataVolumeUplink, ","), - "F" + idx: strings.Join(dataVolumeDownlink, ","), - "G" + idx: strings.Join(dataTotalVolume, ","), - "H" + idx: duration, - "I" + idx: invocationTimestamp, - "J" + idx: User_Identifier, - "K" + idx: SSC_Mode, - "L" + idx: DNN_ID, - "M" + idx: PDU_Type, - "N" + idx: RAT_Type, - "O" + idx: PDU_IPv4, - "P" + idx: PDU_IPv6, - "Q" + idx: recordNFID, - "R" + idx: recordType, - "S" + idx: recordOpeningTime, + "C" + idx: row.NeName, + "D" + idx: row.RmUID, + "E" + idx: subscriptionIDData, + "F" + idx: subscriptionIDType, + "G" + idx: strings.Join(dataVolumeUplink, ","), + "H" + idx: strings.Join(dataVolumeDownlink, ","), + "I" + idx: strings.Join(dataTotalVolume, ","), + "J" + idx: duration, + "K" + idx: invocationTimestamp, + "L" + idx: User_Identifier, + "M" + idx: SSC_Mode, + "N" + idx: DNN_ID, + "O" + idx: PDU_Type, + "P" + idx: RAT_Type, + "Q" + idx: PDU_IPv4, + "R" + idx: networkFunctionIPv4Address, + "S" + idx: PDU_IPv6, + "T" + idx: recordNFID, + "U" + idx: recordType, + "V" + idx: recordOpeningTime, }) }