feat: 更新IMS导出功能,增加呼叫结果和原因字段
This commit is contained in:
@@ -166,14 +166,16 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
|||||||
"C1": "Type",
|
"C1": "Type",
|
||||||
"D1": "Caller",
|
"D1": "Caller",
|
||||||
"E1": "Called",
|
"E1": "Called",
|
||||||
"F1": "Result",
|
"F1": "Duration",
|
||||||
"G1": "Duration",
|
"G1": "Result Code",
|
||||||
"H1": "Call Start Time",
|
"H1": "Result Cause",
|
||||||
"I1": "Hangup Time",
|
"I1": "Call Start Time",
|
||||||
"J1": "Tenant Name", // for multi-tenancy
|
"J1": "Hangup Time",
|
||||||
|
"K1": "Tenant Name", // for multi-tenancy
|
||||||
}
|
}
|
||||||
// 读取字典数据 CDR SIP响应代码类别类型
|
// 读取字典数据 CDR SIP响应代码类别类型
|
||||||
dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code")
|
dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code")
|
||||||
|
dictCDRSipCodeCause := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code_cause")
|
||||||
// 读取字典数据 CDR 呼叫类型
|
// 读取字典数据 CDR 呼叫类型
|
||||||
dictCDRCallType := sysService.NewSysDictData.SelectDictDataByType("cdr_call_type")
|
dictCDRCallType := sysService.NewSysDictData.SelectDictDataByType("cdr_call_type")
|
||||||
// 从第二行开始的数据
|
// 从第二行开始的数据
|
||||||
@@ -220,13 +222,25 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
|||||||
duration = fmt.Sprintf("%ds", parse.Number(v))
|
duration = fmt.Sprintf("%ds", parse.Number(v))
|
||||||
}
|
}
|
||||||
// 呼叫结果 非短信都有code作为结果 sms短信都ok
|
// 呼叫结果 非短信都有code作为结果 sms短信都ok
|
||||||
callResult := "Success"
|
callResult := "Other"
|
||||||
if v, ok := cdrJSON["cause"]; ok && v != nil && callType != "sms" {
|
callCause := "Call failure for other reason"
|
||||||
cause := fmt.Sprint(v)
|
if callType == "sms" {
|
||||||
for _, v := range dictCDRSipCode {
|
callResult = "Success"
|
||||||
if cause == v.DictValue {
|
callCause = "Normal Send"
|
||||||
callResult = i18n.TKey(language, v.DictLabel)
|
} else {
|
||||||
break
|
if v, ok := cdrJSON["cause"]; ok && v != nil {
|
||||||
|
cause := fmt.Sprint(v)
|
||||||
|
for _, v := range dictCDRSipCode {
|
||||||
|
if cause == v.DictValue {
|
||||||
|
callResult = i18n.TKey(language, v.DictLabel)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range dictCDRSipCodeCause {
|
||||||
|
if cause == v.DictValue {
|
||||||
|
callCause = i18n.TKey(language, v.DictLabel)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,11 +271,12 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
|||||||
"C" + idx: callTypeLable,
|
"C" + idx: callTypeLable,
|
||||||
"D" + idx: caller,
|
"D" + idx: caller,
|
||||||
"E" + idx: called,
|
"E" + idx: called,
|
||||||
"F" + idx: callResult,
|
"F" + idx: duration,
|
||||||
"G" + idx: duration,
|
"G" + idx: callResult,
|
||||||
"H" + idx: seizureTimeStr,
|
"H" + idx: callCause,
|
||||||
"I" + idx: releaseTimeStr,
|
"I" + idx: seizureTimeStr,
|
||||||
"J" + idx: tenantName,
|
"J" + idx: releaseTimeStr,
|
||||||
|
"K" + idx: tenantName,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,13 +60,15 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str
|
|||||||
"C1": "Type",
|
"C1": "Type",
|
||||||
"D1": "Caller",
|
"D1": "Caller",
|
||||||
"E1": "Called",
|
"E1": "Called",
|
||||||
"F1": "Result",
|
"F1": "Duration",
|
||||||
"G1": "Duration",
|
"G1": "Result Code",
|
||||||
"H1": "Call Start Time",
|
"H1": "Result Cause",
|
||||||
"I1": "Hangup Time",
|
"I1": "Call Start Time",
|
||||||
|
"J1": "Hangup Time",
|
||||||
}
|
}
|
||||||
// 读取字典数据 CDR SIP响应代码类别类型
|
// 读取字典数据 CDR SIP响应代码类别类型
|
||||||
dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code")
|
dictCDRSipCode := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code")
|
||||||
|
dictCDRSipCodeCause := sysService.NewSysDictData.SelectDictDataByType("cdr_sip_code_cause")
|
||||||
// 读取字典数据 CDR 呼叫类型
|
// 读取字典数据 CDR 呼叫类型
|
||||||
dictCDRCallType := sysService.NewSysDictData.SelectDictDataByType("cdr_call_type")
|
dictCDRCallType := sysService.NewSysDictData.SelectDictDataByType("cdr_call_type")
|
||||||
// 从第二行开始的数据
|
// 从第二行开始的数据
|
||||||
@@ -113,13 +115,26 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str
|
|||||||
duration = fmt.Sprintf("%ds", parse.Number(v))
|
duration = fmt.Sprintf("%ds", parse.Number(v))
|
||||||
}
|
}
|
||||||
// 呼叫结果 非短信都有code作为结果 sms短信都ok
|
// 呼叫结果 非短信都有code作为结果 sms短信都ok
|
||||||
callResult := "Success"
|
// 呼叫结果 非短信都有code作为结果 sms短信都ok
|
||||||
if v, ok := cdrJSON["cause"]; ok && v != nil && callType != "sms" {
|
callResult := "Other"
|
||||||
cause := fmt.Sprint(v)
|
callCause := "Call failure for other reason"
|
||||||
for _, v := range dictCDRSipCode {
|
if callType == "sms" {
|
||||||
if cause == v.DictValue {
|
callResult = "Success"
|
||||||
callResult = i18n.TKey(language, v.DictLabel)
|
callCause = "Normal Send"
|
||||||
break
|
} else {
|
||||||
|
if v, ok := cdrJSON["cause"]; ok && v != nil {
|
||||||
|
cause := fmt.Sprint(v)
|
||||||
|
for _, v := range dictCDRSipCode {
|
||||||
|
if cause == v.DictValue {
|
||||||
|
callResult = i18n.TKey(language, v.DictLabel)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range dictCDRSipCodeCause {
|
||||||
|
if cause == v.DictValue {
|
||||||
|
callCause = i18n.TKey(language, v.DictLabel)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,10 +163,11 @@ func (r CDREventIMS) ExportXlsx(rows []model.CDREventIMS, fileName, language str
|
|||||||
"C" + idx: callTypeLable,
|
"C" + idx: callTypeLable,
|
||||||
"D" + idx: caller,
|
"D" + idx: caller,
|
||||||
"E" + idx: called,
|
"E" + idx: called,
|
||||||
"F" + idx: callResult,
|
"F" + idx: duration,
|
||||||
"G" + idx: duration,
|
"G" + idx: callResult,
|
||||||
"H" + idx: seizureTimeStr,
|
"H" + idx: callCause,
|
||||||
"I" + idx: releaseTimeStr,
|
"I" + idx: seizureTimeStr,
|
||||||
|
"J" + idx: releaseTimeStr,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user