正在显示
2 个修改的文件
包含
18 行增加
和
2 行删除
| @@ -306,7 +306,7 @@ type BatchAddUserItem struct { | @@ -306,7 +306,7 @@ type BatchAddUserItem struct { | ||
| 306 | // 部门编码 | 306 | // 部门编码 |
| 307 | Department string `json:"department"` | 307 | Department string `json:"department"` |
| 308 | // 状态(1:启用 2:禁用 3:注销) | 308 | // 状态(1:启用 2:禁用 3:注销) |
| 309 | - EnableStatus int `json:"enableStatus,omitempty"` | 309 | + EnableStatus string `json:"enableStatus,omitempty"` |
| 310 | // 共创公司 cooperationCompany | 310 | // 共创公司 cooperationCompany |
| 311 | CooperationCompany string `json:"cooperationCompany"` | 311 | CooperationCompany string `json:"cooperationCompany"` |
| 312 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline | 312 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline |
| @@ -315,3 +315,13 @@ type BatchAddUserItem struct { | @@ -315,3 +315,13 @@ type BatchAddUserItem struct { | ||
| 315 | // 失败理由 | 315 | // 失败理由 |
| 316 | FailReason string `json:"failReason"` | 316 | FailReason string `json:"failReason"` |
| 317 | } | 317 | } |
| 318 | + | ||
| 319 | +func (item *BatchAddUserItem) Status() int { | ||
| 320 | + if item.EnableStatus == "启用" { | ||
| 321 | + return 1 | ||
| 322 | + } | ||
| 323 | + if item.EnableStatus == "禁用" { | ||
| 324 | + return 2 | ||
| 325 | + } | ||
| 326 | + return 1 | ||
| 327 | +} |
| @@ -142,7 +142,7 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | @@ -142,7 +142,7 @@ func (ptr *PgBatchAddUserService) BatchAddUser2(optUser *domain.OperateInfo, use | ||
| 142 | Avatar: "", | 142 | Avatar: "", |
| 143 | Email: user.Email, | 143 | Email: user.Email, |
| 144 | }, | 144 | }, |
| 145 | - EnableStatus: int(domain.UserStatusEnable), | 145 | + EnableStatus: user.Status(), |
| 146 | Ext: &domain.Ext{ | 146 | Ext: &domain.Ext{ |
| 147 | Phone: user.Phone, | 147 | Phone: user.Phone, |
| 148 | UserName: user.UserName, | 148 | UserName: user.UserName, |
| @@ -182,6 +182,12 @@ func (ptr *PgBatchAddUserService) preCheck(user *domain.User) error { | @@ -182,6 +182,12 @@ func (ptr *PgBatchAddUserService) preCheck(user *domain.User) error { | ||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | func (ptr *PgBatchAddUserService) preCheck2(user *domain.BatchAddUserItem) error { | 184 | func (ptr *PgBatchAddUserService) preCheck2(user *domain.BatchAddUserItem) error { |
| 185 | + if len(user.UserCode) == 0 { | ||
| 186 | + return fmt.Errorf("导入的用户编码为空值") | ||
| 187 | + } | ||
| 188 | + if !(user.EnableStatus == "启用" || user.EnableStatus == "禁用") { | ||
| 189 | + return fmt.Errorf("导入的用户状态有误") | ||
| 190 | + } | ||
| 185 | if len(user.UserName) == 0 { | 191 | if len(user.UserName) == 0 { |
| 186 | return fmt.Errorf("导入的用户姓名为空值") | 192 | return fmt.Errorf("导入的用户姓名为空值") |
| 187 | } | 193 | } |
-
请 注册 或 登录 后发表评论