feat: 记录查询列表补齐 ICCID、设备号、套餐名称、运营商名称与操作人
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 4m7s
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 4m7s
分页后按当前页 ID 批量查主键补齐展示字段,不在分页查询中关联,也不在记录表冗余: - 采集成功记录补 ICCID、运营商名称;采集失败、卡日流量补运营商名称 - 套餐日流量详单、冲正流水补套餐名称、ICCID、设备号与 IMEI - 冲正流水(含资产详情)补操作人用户名;退款后处理尝试记录补设备号与 IMEI
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
stopresumedomain "github.com/break/junhong_cmp_fiber/internal/domain/stopresume"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
"github.com/break/junhong_cmp_fiber/internal/query/recorddisplay"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||||
@@ -190,9 +191,19 @@ func (s *Service) ListPackageTrafficAdjustments(ctx context.Context, assetType s
|
||||
if err := query.Order("created_at DESC, id DESC").Offset((page - 1) * size).Limit(size).Find(&rows).Error; err != nil {
|
||||
return nil, errors.Wrap(errors.CodeDatabaseError, err, "查询冲正流水失败")
|
||||
}
|
||||
operatorIDs := make([]uint, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
operatorIDs = append(operatorIDs, row.OperatorID)
|
||||
}
|
||||
display, err := recorddisplay.Load(ctx, s.db, recorddisplay.Request{OperatorIDs: operatorIDs})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items := make([]dto.PackageTrafficAdjustmentItem, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
items = append(items, toTrafficAdjustmentItem(row))
|
||||
item := toTrafficAdjustmentItem(row)
|
||||
item.OperatorName = display.OperatorName(row.OperatorID)
|
||||
items = append(items, item)
|
||||
}
|
||||
return &dto.PackageTrafficAdjustmentListResponse{Items: items, Total: total}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user