作者 yangfu

导入修改

... ... @@ -196,7 +196,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
}
users := make([]allied_creation_user.BatchAddUserItem, 0)
for _, v := range excelData {
if len(v) == 0 {
if srv.fieldValueAllEmpty(v) {
continue
}
item := allied_creation_user.BatchAddUserItem{
... ... @@ -237,7 +237,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
}
items := make([]allied_creation_user.BatchAddOrgItem, 0)
for _, v := range excelData {
if len(v) == 0 {
if srv.fieldValueAllEmpty(v) {
continue
}
item := allied_creation_user.BatchAddOrgItem{
... ... @@ -282,6 +282,17 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa
return result
}
func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool {
isAllEmpty := true
for _, v := range param {
value := strings.TrimSpace(v)
if len(value) > 0 {
isAllEmpty = false
}
}
return isAllEmpty
}
// ImportCompanyUser 导入公司用户信息
func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) {
var mapTemplate = map[string]string{
... ...