All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 13m40s
统一时间筛选:新增共享严格解析器 pkg/utils/time_range.go,只接受带显式时区的 RFC3339 秒级时间(拒绝小数秒、无时区、date-only、空格分隔、±hhmm、未补零、非法日期与越界偏移),闭区间含两端、归一为 UTC 瞬时,创建期与执行期共用同一份实现。 端点改造(13 个入口):IoT 卡导入任务、设备导入任务、导出任务列表、订单列表参数名不变仅收紧解析;换货、分配记录、代理充值、临期列表改名 start_time/end_time(旧参数名显式拒绝);提现记录两处删除解析失败静默跳过,非法参数一律 1001;授权记录由起始闭结束开改为闭区间含两端;临期列表改按当前生效主套餐最终到期时刻比较,保留剩余天数上下限与既有粗放窗口。 临期导出新建:新场景 expiring_asset 与受控入口 POST /api/admin/expiring-assets/export,复用列表候选预筛与最终到期推算,一行一资产、加油包不单独成行,列序与 111 §18.1 逐列一致,店铺/业务员/用户组按执行时当前归属补充且不超出创建时冻结范围。 佣金明细导出新增按创建时间闭区间筛选(原佣金与回溯两条分支各自创建时间列),记录粒度、列定义与余额口径不变。 冻结与遗留任务:创建期把筛选与时间边界规范化为 UTC RFC3339 秒级串写入既有 query_json,无新列无迁移;执行期只按冻结值严格解析,非法冻结值在任何分片与文件动作前落任务失败并写安全摘要,不放行全量;重试沿用原快照。达量预警导出执行期同样纳入严格解析(其入口契约、列定义与触发快照口径不变)。 归档 add-export-time-filter-standards 并新建主 Spec openspec/specs/export-time-filter/spec.md,同步 requirement-evidence.json 与入口能力矩阵,README 导出场景清单更新为 11 个场景。 验证:junhong_cmp_test + 本地隔离 Redis(DB7,测试部署共享队列 DB6 未被占用)实跑 85 PASS / 0 FAIL(接受/拒绝集合、区间与顺序语义、列表与导出同筛选行集一致、代理 HTTP 全链路与范围冻结、遗留旧格式任务安全失败、列与余额口径回归、表头逐字),门禁 gofmt/go build/gendocs 两次一致/openspec validate/doctor/context-health 全绿;无 Schema 变更、无迁移、无运行时开关。
126 lines
10 KiB
Go
126 lines
10 KiB
Go
package dto
|
||
|
||
import "time"
|
||
|
||
// CreateExchangeRequest 创建换货单请求。
|
||
type CreateExchangeRequest struct {
|
||
OldAssetType string `json:"old_asset_type" validate:"required,oneof=iot_card device" required:"true" description:"旧资产类型 (iot_card:物联网卡, device:设备)"`
|
||
OldIdentifier string `json:"old_identifier" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"旧资产输入标识,卡支持 ICCID、接入号、虚拟号,设备支持虚拟号、IMEI、SN;响应快照使用权威标识"`
|
||
FlowType string `json:"flow_type" validate:"omitempty,oneof=shipping direct" enum:"shipping,direct" description:"换货流程类型 (shipping:物流换货, direct:直接换货)"`
|
||
NewIdentifier string `json:"new_identifier" validate:"omitempty,min=1,max=100" minLength:"1" maxLength:"100" description:"新资产输入标识,direct 流程必填;卡支持 ICCID、接入号、虚拟号,设备支持虚拟号、IMEI、SN"`
|
||
MigrateData *bool `json:"migrate_data" description:"是否执行全量迁移,direct 流程未传按 false 处理"`
|
||
ExchangeReason string `json:"exchange_reason" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"换货原因"`
|
||
Remark *string `json:"remark" validate:"omitempty,max=500" maxLength:"500" description:"备注"`
|
||
}
|
||
|
||
// ExchangeListRequest 换货单列表请求。
|
||
type ExchangeListRequest struct {
|
||
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:"每页数量"`
|
||
Status *int `json:"status" query:"status" validate:"omitempty,min=1,max=5" minimum:"1" maximum:"5" description:"换货状态 (1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)"`
|
||
FlowType string `json:"flow_type" query:"flow_type" validate:"omitempty,oneof=shipping direct" enum:"shipping,direct" description:"换货流程类型 (shipping:物流换货, direct:直接换货)"`
|
||
OldAssetKeyword string `json:"old_asset_keyword" query:"old_asset_keyword" validate:"omitempty,max=100" maxLength:"100" description:"旧资产关键词,支持卡 ICCID、接入号、虚拟号或设备虚拟号、IMEI、SN;与新资产关键词按 AND 组合"`
|
||
NewAssetKeyword string `json:"new_asset_keyword" query:"new_asset_keyword" validate:"omitempty,max=100" maxLength:"100" description:"新资产关键词,支持卡 ICCID、接入号、虚拟号或设备虚拟号、IMEI、SN;与旧资产关键词按 AND 组合"`
|
||
StartTime string `json:"start_time" query:"start_time" description:"创建时间起始(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-01T00:00:00+08:00)"`
|
||
EndTime string `json:"end_time" query:"end_time" description:"创建时间结束(带时区的 RFC3339 秒级时间,闭区间含该时刻,如 2026-09-30T23:59:59+08:00)"`
|
||
}
|
||
|
||
// ExchangeShipRequest 换货发货请求。
|
||
type ExchangeShipRequest struct {
|
||
ExpressCompany string `json:"express_company" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"快递公司"`
|
||
ExpressNo string `json:"express_no" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"快递单号"`
|
||
NewIdentifier string `json:"new_identifier" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"新资产输入标识,卡支持 ICCID、接入号、虚拟号,设备支持虚拟号、IMEI、SN;保存快照使用权威标识"`
|
||
MigrateData bool `json:"migrate_data" required:"true" description:"是否执行全量迁移 (true:执行,迁移状态置为 pending;false:不执行,迁移状态保持 not_migrated)"`
|
||
}
|
||
|
||
type ExchangeCancelRequest struct {
|
||
Remark *string `json:"remark" validate:"omitempty,max=500" maxLength:"500" description:"取消备注"`
|
||
}
|
||
|
||
type ClientShippingInfoRequest struct {
|
||
RecipientName string `json:"recipient_name" validate:"required,min=1,max=50" required:"true" minLength:"1" maxLength:"50" description:"收件人姓名"`
|
||
RecipientPhone string `json:"recipient_phone" validate:"required,min=1,max=20" required:"true" minLength:"1" maxLength:"20" description:"收件人电话"`
|
||
RecipientAddress string `json:"recipient_address" validate:"required,min=1,max=500" required:"true" minLength:"1" maxLength:"500" description:"收货地址"`
|
||
}
|
||
|
||
type ClientExchangePendingRequest struct {
|
||
Identifier string `json:"identifier" query:"identifier" validate:"required,min=1,max=100" required:"true" minLength:"1" maxLength:"100" description:"资产标识符(ICCID/虚拟号/IMEI/SN)"`
|
||
}
|
||
|
||
type ExchangeIDRequest struct {
|
||
ID uint `path:"id" required:"true" description:"换货单ID"`
|
||
}
|
||
|
||
type ExchangeShipParams struct {
|
||
ID uint `path:"id" required:"true" description:"换货单ID"`
|
||
ExchangeShipRequest
|
||
}
|
||
|
||
type ExchangeCancelParams struct {
|
||
ID uint `path:"id" required:"true" description:"换货单ID"`
|
||
ExchangeCancelRequest
|
||
}
|
||
|
||
type ClientShippingInfoParams struct {
|
||
ID uint `path:"id" required:"true" description:"换货单ID"`
|
||
ClientShippingInfoRequest
|
||
}
|
||
|
||
// ExchangeOrderResponse 换货单响应。
|
||
type ExchangeOrderResponse struct {
|
||
ID uint `json:"id" description:"换货单ID"`
|
||
ExchangeNo string `json:"exchange_no" description:"换货单号"`
|
||
FlowType string `json:"flow_type" description:"换货流程类型 (shipping:物流换货, direct:直接换货)"`
|
||
FlowTypeName string `json:"flow_type_name" description:"换货流程类型名称"`
|
||
OldAssetType string `json:"old_asset_type" description:"旧资产类型 (iot_card:物联网卡, device:设备)"`
|
||
OldAssetID uint `json:"old_asset_id" description:"旧资产ID"`
|
||
OldAssetIdentifier string `json:"old_asset_identifier" description:"旧资产权威快照,卡为完整 ICCID,设备按虚拟号、IMEI、SN 优先级取值;历史记录保持原值"`
|
||
NewAssetType string `json:"new_asset_type" description:"新资产类型 (iot_card:物联网卡, device:设备)"`
|
||
NewAssetID *uint `json:"new_asset_id,omitempty" description:"新资产ID"`
|
||
NewAssetIdentifier string `json:"new_asset_identifier" description:"新资产权威快照,卡为完整 ICCID,设备按虚拟号、IMEI、SN 优先级取值;历史记录保持原值"`
|
||
RecipientName string `json:"recipient_name" description:"收件人姓名"`
|
||
RecipientPhone string `json:"recipient_phone" description:"收件人电话"`
|
||
RecipientAddress string `json:"recipient_address" description:"收货地址"`
|
||
ExpressCompany string `json:"express_company" description:"快递公司"`
|
||
ExpressNo string `json:"express_no" description:"快递单号"`
|
||
MigrateData bool `json:"migrate_data" description:"是否执行全量迁移"`
|
||
MigrationCompleted bool `json:"migration_completed" description:"迁移是否已完成"`
|
||
MigrationBalance int64 `json:"migration_balance" description:"迁移转移金额(分)"`
|
||
MigrationStatus string `json:"migration_status" enum:"not_migrated,pending,migrated,failed" description:"业务数据迁移状态 (not_migrated:不迁移, pending:待迁移, migrated:已迁移, failed:迁移失败);迁移结果以本字段为准,勿再用布尔字段推断"`
|
||
MigrationStatusName string `json:"migration_status_name" description:"业务数据迁移状态名称(中文)"`
|
||
MigrationFailureReason string `json:"migration_failure_reason,omitempty" description:"最近一次业务数据迁移失败原因,仅迁移状态为 failed 时返回"`
|
||
ShippedAt *time.Time `json:"shipped_at,omitempty" description:"发货时间"`
|
||
CompletedAt *time.Time `json:"completed_at,omitempty" description:"换货完成时间"`
|
||
ExchangeReason string `json:"exchange_reason" description:"换货原因"`
|
||
Remark *string `json:"remark,omitempty" description:"备注"`
|
||
Status int `json:"status" description:"换货状态 (1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)"`
|
||
StatusName string `json:"status_name" description:"换货状态名称(中文)"`
|
||
StatusText string `json:"status_text" description:"换货状态文本"`
|
||
ShopID *uint `json:"shop_id,omitempty" description:"所属店铺ID"`
|
||
CreatedAt time.Time `json:"created_at" description:"创建时间"`
|
||
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
|
||
DeletedAt *time.Time `json:"deleted_at,omitempty" description:"删除时间"`
|
||
SubmitterID uint `json:"submitter_id" description:"提交人账号ID"`
|
||
SubmitterName string `json:"submitter_name" description:"提交人账号名称"`
|
||
Creator uint `json:"creator" description:"创建人ID"`
|
||
Updater uint `json:"updater" description:"更新人ID"`
|
||
}
|
||
|
||
type ExchangeListResponse struct {
|
||
List []*ExchangeOrderResponse `json:"items" description:"换货单列表"`
|
||
Total int64 `json:"total" description:"总数"`
|
||
Page int `json:"page" description:"当前页码"`
|
||
PageSize int `json:"size" description:"每页数量"`
|
||
}
|
||
|
||
type ClientExchangePendingResponse struct {
|
||
ID uint `json:"id" description:"换货单ID"`
|
||
ExchangeNo string `json:"exchange_no" description:"换货单号"`
|
||
FlowType string `json:"flow_type" description:"换货流程类型 (shipping:物流换货, direct:直接换货)"`
|
||
Status int `json:"status" description:"换货状态 (1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)"`
|
||
StatusName string `json:"status_name" description:"换货状态名称(中文)"`
|
||
StatusText string `json:"status_text" description:"换货状态文本"`
|
||
ExchangeReason string `json:"exchange_reason" description:"换货原因"`
|
||
CreatedAt time.Time `json:"created_at" description:"创建时间"`
|
||
}
|