fix: CDR数据导出添加网元名称列

This commit is contained in:
TsMask
2025-05-09 11:51:21 +08:00
parent 774c865e97
commit 8c663f1e18
10 changed files with 52 additions and 101 deletions

View File

@@ -26,10 +26,10 @@ func (r CDREventIMS) SelectByPage(query model.CDREventIMSQuery) ([]model.CDREven
tx = tx.Where("rm_uid = ?", query.RmUID)
}
if query.BeginTime != 0 {
tx = tx.Where("timestamp >= ?", query.BeginTime)
tx = tx.Where("created_at >= ?", query.BeginTime)
}
if query.EndTime != 0 {
tx = tx.Where("timestamp <= ?", query.EndTime)
tx = tx.Where("created_at <= ?", query.EndTime)
}
if query.CallerParty != "" {
tx = tx.Where("JSON_EXTRACT(cdr_json, '$.callerParty') = ?", query.CallerParty)

View File

@@ -51,15 +51,16 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str
// 第一行表头标题
headerCells := map[string]string{
"A1": "ID",
"B1": "Record Behavior",
"C1": "Type",
"D1": "Caller",
"E1": "Called",
"F1": "Duration",
"G1": "Result Code",
"H1": "Result Cause",
"I1": "Call Start Time",
"J1": "Hangup Time",
"B1": "NE Name",
"C1": "Record Behavior",
"D1": "Type",
"E1": "Caller",
"F1": "Called",
"G1": "Duration",
"H1": "Result Code",
"I1": "Result Cause",
"J1": "Call Start Time",
"K1": "Hangup Time",
}
// 读取字典数据 CDR SIP响应代码类别类型
dictCDRSipCode := sysService.NewSysDictData.FindByType("cdr_sip_code")
@@ -154,15 +155,16 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
"B" + idx: recordType,
"C" + idx: callTypeLable,
"D" + idx: caller,
"E" + idx: called,
"F" + idx: duration,
"G" + idx: callResult,
"H" + idx: callCause,
"I" + idx: seizureTimeStr,
"J" + idx: releaseTimeStr,
"B" + idx: row.NeName,
"C" + idx: recordType,
"D" + idx: callTypeLable,
"E" + idx: caller,
"F" + idx: called,
"G" + idx: duration,
"H" + idx: callResult,
"I" + idx: callCause,
"J" + idx: seizureTimeStr,
"K" + idx: releaseTimeStr,
})
}

View File

@@ -72,7 +72,6 @@ func (r CDREventSMF) ExportXlsx(rows []model.CDREventSMF, fileName string) (stri
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
for i, row := range rows {
idx := strconv.Itoa(i + 2)
// 解析 JSON 字符串为 map

View File

@@ -51,12 +51,13 @@ func (r CDREventSMSC) ExportXlsx(rows []model.CDREventSMSC, fileName, language s
// 第一行表头标题
headerCells := map[string]string{
"A1": "ID",
"B1": "Record Behavior",
"C1": "Service Type",
"D1": "Caller",
"E1": "Called",
"F1": "Result",
"G1": "Time",
"B1": "NE Name",
"C1": "Record Behavior",
"D1": "Service Type",
"E1": "Caller",
"F1": "Called",
"G1": "Result",
"H1": "Time",
}
// 读取字典数据 CDR 原因码
dictCDRCauseCode := sysService.NewSysDictData.FindByType("cdr_cause_code")
@@ -121,12 +122,13 @@ func (r CDREventSMSC) ExportXlsx(rows []model.CDREventSMSC, fileName, language s
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
"B" + idx: recordType,
"C" + idx: serviceType,
"D" + idx: caller,
"E" + idx: called,
"F" + idx: callResult,
"G" + idx: timeStr,
"B" + idx: row.NeName,
"C" + idx: recordType,
"D" + idx: serviceType,
"E" + idx: caller,
"F" + idx: called,
"G" + idx: callResult,
"H" + idx: timeStr,
})
}

View File

@@ -397,13 +397,16 @@ func (s NeInfoController) Add(c *gin.Context) {
if v, ok := body.ServerState["version"]; ok && v != nil {
neVersion.Name = "-"
neVersion.Path = "-"
neVersion.Version = v.(string)
neVersion.Version = fmt.Sprint(v)
}
if v, ok := body.ServerState["capability"]; ok && v != nil {
neLicense.Capability = parse.Number(v)
}
if v, ok := body.ServerState["sn"]; ok && v != nil {
neLicense.SerialNum = v.(string)
neLicense.SerialNum = fmt.Sprint(v)
}
if v, ok := body.ServerState["expire"]; ok && v != nil {
neLicense.ExpiryDate = v.(string)
neLicense.ExpiryDate = fmt.Sprint(v)
neLicense.Status = "1"
}
}
@@ -495,14 +498,17 @@ func (s NeInfoController) Edit(c *gin.Context) {
if v, ok := body.ServerState["version"]; ok && v != nil {
neVersion.Name = "-"
neVersion.Path = "-"
neVersion.Version = v.(string)
neVersion.Version = fmt.Sprint(v)
neVersion.UpdateBy = loginUserName
}
if v, ok := body.ServerState["capability"]; ok && v != nil {
neLicense.Capability = parse.Number(v)
}
if v, ok := body.ServerState["sn"]; ok && v != nil {
neLicense.SerialNum = v.(string)
neLicense.SerialNum = fmt.Sprint(v)
}
if v, ok := body.ServerState["expire"]; ok && v != nil {
neLicense.ExpiryDate = v.(string)
neLicense.ExpiryDate = fmt.Sprint(v)
neLicense.Status = "1"
neLicense.UpdateBy = loginUserName
}