正在显示
1 个修改的文件
包含
13 行增加
和
2 行删除
@@ -196,7 +196,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -196,7 +196,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
196 | } | 196 | } |
197 | users := make([]allied_creation_user.BatchAddUserItem, 0) | 197 | users := make([]allied_creation_user.BatchAddUserItem, 0) |
198 | for _, v := range excelData { | 198 | for _, v := range excelData { |
199 | - if len(v) == 0 { | 199 | + if srv.fieldValueAllEmpty(v) { |
200 | continue | 200 | continue |
201 | } | 201 | } |
202 | item := allied_creation_user.BatchAddUserItem{ | 202 | item := allied_creation_user.BatchAddUserItem{ |
@@ -237,7 +237,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -237,7 +237,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
237 | } | 237 | } |
238 | items := make([]allied_creation_user.BatchAddOrgItem, 0) | 238 | items := make([]allied_creation_user.BatchAddOrgItem, 0) |
239 | for _, v := range excelData { | 239 | for _, v := range excelData { |
240 | - if len(v) == 0 { | 240 | + if srv.fieldValueAllEmpty(v) { |
241 | continue | 241 | continue |
242 | } | 242 | } |
243 | item := allied_creation_user.BatchAddOrgItem{ | 243 | item := allied_creation_user.BatchAddOrgItem{ |
@@ -282,6 +282,17 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | @@ -282,6 +282,17 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | ||
282 | return result | 282 | return result |
283 | } | 283 | } |
284 | 284 | ||
285 | +func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool { | ||
286 | + isAllEmpty := true | ||
287 | + for _, v := range param { | ||
288 | + value := strings.TrimSpace(v) | ||
289 | + if len(value) > 0 { | ||
290 | + isAllEmpty = false | ||
291 | + } | ||
292 | + } | ||
293 | + return isAllEmpty | ||
294 | +} | ||
295 | + | ||
285 | // ImportCompanyUser 导入公司用户信息 | 296 | // ImportCompanyUser 导入公司用户信息 |
286 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 297 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
287 | var mapTemplate = map[string]string{ | 298 | var mapTemplate = map[string]string{ |
-
请 注册 或 登录 后发表评论