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:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/break/junhong_cmp_fiber/internal/domain/cardflow"
|
||||
"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/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/middleware"
|
||||
@@ -72,10 +73,24 @@ func (s *Service) ListAssetPostProcessAttempts(ctx context.Context, req *dto.Ref
|
||||
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, "查询退款资产后处理尝试记录失败")
|
||||
}
|
||||
displayReq := recorddisplay.Request{}
|
||||
for _, row := range rows {
|
||||
if row.AssetType == constants.AssetTypeDevice {
|
||||
displayReq.DeviceIDs = append(displayReq.DeviceIDs, row.AssetID)
|
||||
}
|
||||
}
|
||||
display, err := recorddisplay.Load(ctx, s.db, displayReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, row := range rows {
|
||||
var device recorddisplay.Device
|
||||
if row.AssetType == constants.AssetTypeDevice {
|
||||
device = display.Device(row.AssetID)
|
||||
}
|
||||
resp.Items = append(resp.Items, dto.RefundPostProcessAttemptItem{
|
||||
ID: row.ID, RefundID: row.RefundID, RefundNo: row.RefundNo, Step: row.Step, AssetType: row.AssetType,
|
||||
AssetID: row.AssetID, ICCID: row.ICCID, Attempt: row.Attempt, Trigger: row.Trigger, Result: row.Result,
|
||||
AssetID: row.AssetID, ICCID: row.ICCID, DeviceVirtualNo: device.VirtualNo, DeviceIMEI: device.IMEI, Attempt: row.Attempt, Trigger: row.Trigger, Result: row.Result,
|
||||
ErrorCode: row.ErrorCode, ErrorMessage: row.ErrorMessage, DurationMS: row.DurationMS, CreatedAt: row.CreatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user