拆分字段列以及新增字段列

This commit is contained in:
lai
2024-10-29 15:03:57 +08:00
parent 44536f34d4
commit c6c40e55d9

View File

@@ -130,7 +130,16 @@ func (s *SMFController) CDRExport(c *gin.Context) {
"G1": "Data Total Volume",
"H1": "Duration",
"I1": "Invocation Time",
"J1": "PDU Session Charging Information",
"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",
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
@@ -164,6 +173,7 @@ func (s *SMFController) CDRExport(c *gin.Context) {
dataVolumeDownlink := []string{}
// 数据总量
dataTotalVolume := []string{}
if v, ok := cdrJSON["listOfMultipleUnitUsage"]; ok && v != nil {
usageList := v.([]any)
if len(usageList) > 0 {
@@ -198,32 +208,31 @@ func (s *SMFController) CDRExport(c *gin.Context) {
invocationTimestamp = v.(string)
}
// 记录打开时间
pduSessionChargingInformation := ""
User_Identifier := ""
SSC_Mode := ""
RAT_Type := ""
DNN_ID := ""
PDU_Type := ""
PDU_IPv4 := ""
PDU_IPv6 := ""
if v, ok := cdrJSON["pDUSessionChargingInformation"]; ok && v != nil {
pduInfo := v.(map[string]any)
User_Identifier := ""
if v, ok := pduInfo["userIdentifier"]; ok && v != nil {
User_Identifier = v.(string)
}
SSC_Mode := ""
if v, ok := pduInfo["sSCMode"]; ok && v != nil {
SSC_Mode = v.(string)
}
RAT_Type := ""
if v, ok := pduInfo["rATType"]; ok && v != nil {
RAT_Type = v.(string)
}
DNN_ID := ""
if v, ok := pduInfo["dNNID"]; ok && v != nil {
DNN_ID = v.(string)
}
PDU_Type := ""
if v, ok := pduInfo["pDUType"]; ok && v != nil {
PDU_Type = v.(string)
}
PDU_IPv4 := ""
PDU_IPv6 := ""
if v, ok := pduInfo["pDUAddress"]; ok && v != nil {
pDUAddress := v.(map[string]any)
if addr, ok := pDUAddress["pDUIPv4Address"]; ok && addr != nil {
@@ -234,11 +243,29 @@ func (s *SMFController) CDRExport(c *gin.Context) {
}
}
pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
SSC Mode: %s RAT Type: %s DNN ID: %s
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)
// pduSessionChargingInformation = fmt.Sprintf(`User Identifier: %s
// SSC Mode: %s RAT Type: %s DNN ID: %s
// 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)
}
// 记录网络参数ID
recordNFID := ""
if v, ok := cdrJSON["recordingNetworkFunctionID"]; ok && v != nil {
recordNFID = v.(string)
}
//记录开始时间
recordOpeningTime := ""
if v, ok := cdrJSON["recordOpeningTime"]; ok && v != nil {
recordOpeningTime = v.(string)
}
//记录类型
recordType := ""
if v, ok := cdrJSON["recordType"]; ok && v != nil {
recordType = v.(string)
}
dataCells = append(dataCells, map[string]any{
@@ -251,7 +278,16 @@ PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID,
"G" + idx: strings.Join(dataTotalVolume, ","),
"H" + idx: duration,
"I" + idx: invocationTimestamp,
"J" + idx: pduSessionChargingInformation,
"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,
})
}