Files
junhong_cmp_fiber/internal/model/dto/card_realname_dto.go
邹进 4967f4df43
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
feat: 卡实名时间以上游 archiveTime 为准并记录实名时间历史,新增二次实名批次
2026-11-08 19:12:46 +09:00

115 lines
7.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import "time"
// CardRealnameHistoryListRequest 查询单卡实名时间历史。
type CardRealnameHistoryListRequest struct {
ID uint `json:"-" path:"id" description:"IoT卡ID"`
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"`
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"`
}
// CardRealnameCurrentResponse 是卡当前实名时间。
type CardRealnameCurrentResponse struct {
CardID uint `json:"card_id" description:"IoT卡ID"`
RealnameAt *time.Time `json:"realname_at" description:"当前实名时间:上游返回的实名时间优先,否则为首次读到已实名的时间"`
RealnameAtSource string `json:"realname_at_source" description:"实名时间来源:upstream 上游返回 / first_observed 首次读到 / migrated 迁移沿用"`
RealnameAtSourceName string `json:"realname_at_source_name" description:"实名时间来源中文名"`
UpstreamRealnameAt *time.Time `json:"upstream_realname_at" description:"上游最近一次返回的实名时间"`
FirstObservedAt *time.Time `json:"first_observed_at" description:"首次读到已实名的时间"`
ResetPending bool `json:"reset_pending" description:"是否等待二次实名(仅后台展示)"`
ResetAt *time.Time `json:"reset_at" description:"二次实名清除时间"`
ResetBaselineAt *time.Time `json:"reset_baseline_at" description:"清除前的上游实名时间(新旧判定基准)"`
ResetBatchID *uint `json:"reset_batch_id" description:"所属二次实名批次 ID"`
}
// CardRealnameHistoryItem 是一条实名时间变化历史。
type CardRealnameHistoryItem struct {
ID uint `json:"id" description:"历史 ID"`
CardID uint `json:"card_id" description:"IoT卡ID"`
ICCID string `json:"iccid" description:"ICCID"`
BeforeAt *time.Time `json:"before_at" description:"原实名时间"`
AfterAt *time.Time `json:"after_at" description:"新实名时间"`
AfterSource string `json:"after_source" description:"新实名时间来源"`
AfterSourceName string `json:"after_source_name" description:"新实名时间来源中文名"`
ChangeType string `json:"change_type" description:"变化类型:first 首次实名 / upstream_fix 上游更正 / reset 二次实名清除 / reset_completed 二次实名完成 / reset_reverted 二次实名撤销 / migrated 迁移补录"`
ChangeTypeName string `json:"change_type_name" description:"变化类型中文名"`
ObservationSource string `json:"observation_source" description:"观测来源:polling 轮询 / manual_sync 手动刷新 / carrier_callback 回调 / business_event 业务观测 / manual_override 人工 / migration 迁移 / package_silence 沉默期判定"`
ObservationSourceName string `json:"observation_source_name" description:"观测来源中文名"`
ResetBatchID *uint `json:"reset_batch_id" description:"关联二次实名批次 ID"`
OperatorID uint `json:"operator_id" description:"操作人账号 ID(人工时)"`
OperatorName string `json:"operator_name" description:"操作人名称"`
ObservedAt time.Time `json:"observed_at" description:"发现时间"`
CreatedAt time.Time `json:"created_at" description:"记录时间"`
}
// CardRealnameHistoryResponse 是单卡实名记录:当前实名时间与历史分页。
type CardRealnameHistoryResponse struct {
Current CardRealnameCurrentResponse `json:"current" description:"当前实名时间"`
Items []CardRealnameHistoryItem `json:"items" description:"实名时间历史(按时间倒序)"`
Total int64 `json:"total" description:"历史总数"`
Page int `json:"page" description:"页码"`
PageSize int `json:"page_size" description:"每页数量"`
}
// RealnameResetImportRequest 导入二次实名名单。
type RealnameResetImportRequest struct {
Identifiers []string `json:"identifiers" validate:"required,min=1,max=1000,dive,required,max=64" required:"true" description:"资产号列表:ICCID / 虚拟号 / IMEI,设备展开为其全部绑定卡,最多 1000 个"`
Reason string `json:"reason" validate:"required,min=1,max=500" required:"true" description:"原因"`
ImportFileKey string `json:"import_file_key" validate:"omitempty,max=500" description:"导入文件对象存储 Key(可选,留档)"`
}
// RealnameResetItem 是二次实名批次的一行结果。
type RealnameResetItem struct {
RowNo int `json:"row_no" description:"行号(从 1 开始)"`
Input string `json:"input" description:"导入的资产号"`
CardID uint `json:"card_id,omitempty" description:"卡 ID"`
ICCID string `json:"iccid,omitempty" description:"ICCID"`
Result string `json:"result" description:"结果:pending 等待二次实名 / completed 已完成 / reverted 已撤销 / skipped 跳过 / failed 失败"`
ResultName string `json:"result_name" description:"结果中文名"`
Reason string `json:"reason,omitempty" description:"跳过或失败原因"`
}
// RealnameResetBatchResponse 是二次实名批次。
type RealnameResetBatchResponse struct {
ID uint `json:"id" description:"批次 ID"`
BatchNo string `json:"batch_no" description:"批次号"`
Reason string `json:"reason" description:"原因"`
ImportFileKey string `json:"import_file_key" description:"导入文件 Key"`
TotalCount int `json:"total_count" description:"处理卡数(含跳过)"`
SucceededCount int `json:"succeeded_count" description:"已清除卡数"`
SkippedCount int `json:"skipped_count" description:"跳过或失败数"`
CompletedCount int `json:"completed_count" description:"已完成二次实名卡数"`
RevertedCount int `json:"reverted_count" description:"已撤销卡数"`
PendingCount int `json:"pending_count" description:"仍在等待二次实名卡数"`
OperatorID uint `json:"operator_id" description:"操作人账号 ID"`
OperatorName string `json:"operator_name" description:"操作人"`
CreatedAt time.Time `json:"created_at" description:"导入时间"`
Items []RealnameResetItem `json:"items,omitempty" description:"逐行结果(详情返回)"`
}
// RealnameResetBatchListRequest 查询二次实名批次。
type RealnameResetBatchListRequest struct {
BatchNo string `json:"batch_no" query:"batch_no" validate:"omitempty,max=40" description:"批次号"`
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"`
PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"`
}
// RealnameResetBatchIDRequest 是批次路径参数。
type RealnameResetBatchIDRequest struct {
ID uint `json:"-" path:"id" description:"批次 ID"`
}
// RealnameResetRevertRequest 撤销二次实名。
type RealnameResetRevertRequest struct {
ID uint `json:"-" path:"id" description:"批次 ID"`
CardIDs []uint `json:"card_ids" validate:"omitempty,max=1000" description:"只撤销这些卡;为空撤销整批仍在等待的卡"`
}
// RealnameResetRevertResponse 撤销结果。
type RealnameResetRevertResponse struct {
RevertedCount int `json:"reverted_count" description:"撤销成功卡数"`
FailedCount int `json:"failed_count" description:"撤销失败卡数"`
Failures []string `json:"failures,omitempty" description:"失败说明"`
}