feat: 更新多个模块以支持新的数据结构和日志格式
This commit is contained in:
@@ -25,21 +25,21 @@ type CDREventSMSC struct {
|
||||
cdrEventRepository *repository.CDREventSMSC // CDR会话事件数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *CDREventSMSC) SelectPage(querys model.CDREventSMSCQuery) ([]model.CDREventSMSC, int64) {
|
||||
return r.cdrEventRepository.SelectByPage(querys)
|
||||
// FindByPage 根据条件分页查询
|
||||
func (r *CDREventSMSC) FindByPage(query model.CDREventSMSCQuery) ([]model.CDREventSMSC, int64) {
|
||||
return r.cdrEventRepository.SelectByPage(query)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *CDREventSMSC) DeleteByIds(cdrIds []string) (int64, error) {
|
||||
func (r *CDREventSMSC) DeleteByIds(ids []int64) (int64, error) {
|
||||
// 检查是否存在
|
||||
ids := r.cdrEventRepository.SelectByIds(cdrIds)
|
||||
if len(ids) <= 0 {
|
||||
rows := r.cdrEventRepository.SelectByIds(ids)
|
||||
if len(rows) <= 0 {
|
||||
return 0, fmt.Errorf("not data")
|
||||
}
|
||||
|
||||
if len(ids) == len(cdrIds) {
|
||||
rows := r.cdrEventRepository.DeleteByIds(cdrIds)
|
||||
if len(rows) == len(ids) {
|
||||
rows := r.cdrEventRepository.DeleteByIds(ids)
|
||||
return rows, nil
|
||||
}
|
||||
// 删除信息失败!
|
||||
@@ -59,14 +59,14 @@ func (r CDREventSMSC) ExportXlsx(rows []model.CDREventSMSC, fileName, language s
|
||||
"G1": "Time",
|
||||
}
|
||||
// 读取字典数据 CDR 原因码
|
||||
dictCDRCauseCode := sysService.NewSysDictData.SelectDictDataByType("cdr_cause_code")
|
||||
dictCDRCauseCode := sysService.NewSysDictData.FindByType("cdr_cause_code")
|
||||
// 从第二行开始的数据
|
||||
dataCells := make([]map[string]any, 0)
|
||||
for i, row := range rows {
|
||||
idx := strconv.Itoa(i + 2)
|
||||
// 解析 JSON 字符串为 map
|
||||
var cdrJSON map[string]interface{}
|
||||
err := json.Unmarshal([]byte(row.CDRJSONStr), &cdrJSON)
|
||||
err := json.Unmarshal([]byte(row.CdrJson), &cdrJSON)
|
||||
if err != nil {
|
||||
logger.Warnf("CDRExport Error parsing JSON: %s", err.Error())
|
||||
continue
|
||||
@@ -103,8 +103,8 @@ func (r CDREventSMSC) ExportXlsx(rows []model.CDREventSMSC, fileName, language s
|
||||
if v, ok := cdrJSON["cause"]; ok && v != nil && callResult == "Fail" {
|
||||
cause := fmt.Sprint(v)
|
||||
for _, v := range dictCDRCauseCode {
|
||||
if cause == v.DictValue {
|
||||
callResult = fmt.Sprintf("%s, %s", callResult, i18n.TKey(language, v.DictLabel))
|
||||
if cause == v.DataValue {
|
||||
callResult = fmt.Sprintf("%s, %s", callResult, i18n.TKey(language, v.DataLabel))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user