package model import ( "strings" "github.com/gogf/gf/v2/errors/gerror" ) const SimCardAllocateMaxInputRows = 20000 func (in *TSimCardAllocatePrepareParam) ValidateInput() error { count := 0 for _, line := range strings.Split(in.Input, "\n") { if strings.TrimSpace(line) != "" { count++ if count > SimCardAllocateMaxInputRows { return gerror.Newf("单次批量输入最多 %d 条,超出请使用 Excel 导入或分批提交", SimCardAllocateMaxInputRows) } } } if count == 0 { return gerror.New("批量输入内容不能为空") } return nil } type TSimCardAllocateTargetListParam struct { Keyword string `json:"keyword" dc:"目标客户名称、编码或ID"` } type TSimCardAllocateTargetModel struct { DeptId int64 `json:"deptId" dc:"目标客户部门ID"` ParentId int64 `json:"parentId" dc:"上级部门ID"` DeptKey string `json:"deptKey" dc:"客户编码"` DeptName string `json:"deptName" dc:"客户名称"` DeptCategory string `json:"deptCategory" dc:"部门类别"` } type TSimCardAllocatePrepareParam struct { Input string `json:"input" dc:"每行填写ICCID,或ICCID MSISDN IMSI"` TargetDeptId int64 `json:"targetDeptId" v:"required|min:1#请选择划拨目标客户|请选择划拨目标客户" dc:"目标客户部门ID"` } type TSimCardAllocateExcelSubmitParam struct { TargetDeptId int64 `json:"targetDeptId" dc:"目标客户部门ID;兼容旧入口,Excel优先读取文件内目标客户字段"` Remark string `json:"remark" dc:"划拨备注"` } type TSimCardAllocateBatchSubmitParam struct { BatchNo string `json:"batchNo" v:"required#预处理批次号不能为空" dc:"预处理批次号"` TargetDeptId int64 `json:"targetDeptId" dc:"目标客户部门ID"` Remark string `json:"remark" dc:"划拨备注"` } type TSimCardAllocateBatchDetailModel struct { RowNo int `json:"rowNo" dc:"行号"` ItemId string `json:"itemId" dc:"ICCID"` TargetDeptId int64 `json:"targetDeptId" dc:"目标客户部门ID"` TargetDeptKey string `json:"targetDeptKey" dc:"目标客户编码"` TargetDeptName string `json:"targetDeptName" dc:"目标客户名称"` Status string `json:"status" dc:"校验状态"` ErrorReason string `json:"errorReason,omitempty" dc:"失败原因"` } type TSimCardAllocateBatchModel struct { BatchNo string `json:"batchNo" dc:"划拨批次号"` BatchType int `json:"batchType" dc:"批次类型"` BatchAsyncStatus int `json:"batchAsyncStatus" dc:"异步处理状态"` Target *TSimCardAllocateTargetModel `json:"target" dc:"目标客户"` TotalCount int `json:"totalCount" dc:"总数量"` ValidCount int `json:"validCount" dc:"有效数量"` FailCount int `json:"failCount" dc:"失败数量"` FailReason string `json:"failReason,omitempty" dc:"失败原因"` Status string `json:"status" dc:"处理状态"` Details []*TSimCardAllocateBatchDetailModel `json:"details" dc:"逐卡校验结果"` }