李昊 hace 4 años
padre
commit
6bafab878c

+ 7 - 7
GxPress/Api/GxPress.Api/AdminControllers/AdminUserController.cs

@@ -186,15 +186,15 @@ namespace GxPress.Api.AdminControllers
                 var user = new User();
                 if (i == 1)
                     continue;
-                var name = sheet.Rows[i][1].ToString().Trim(); //姓名
+                var name = sheet.Rows[i][1].ToString().Trim().Replace(" ", ""); //姓名
                 if (string.IsNullOrEmpty(name))
                     error = "姓名必填";
                 user.Name = name;
-                var phone = sheet.Rows[i][2].ToString().Trim(); //手机号码
+                var phone = sheet.Rows[i][2].ToString().Trim().Replace(" ", ""); //手机号码
                 if (phone.Length != 11)
                     error = "手机号码有误";
                 user.Phone = phone;
-                var email = sheet.Rows[i][3].ToString().Trim(); //邮箱
+                var email = sheet.Rows[i][3].ToString().Trim().Replace(" ", ""); //邮箱
                 if (!string.IsNullOrWhiteSpace(email))
                 {
                     if (email.Contains("@"))
@@ -204,12 +204,12 @@ namespace GxPress.Api.AdminControllers
                 }
                 user.Email = email;
                 user.DepartmentId = request.DepartmentId;
-                var sex = sheet.Rows[i][4].ToString().Trim(); //性别
+                var sex = sheet.Rows[i][4].ToString().Trim().Replace(" ", ""); //性别
                 user.Gender = sex == "男" ? "Male" : "Female";
-                var city = sheet.Rows[i][5].ToString().Trim(); //城市
+                var city = sheet.Rows[i][5].ToString().Trim().Replace(" ", ""); //城市
                 user.City = city;
-                var isLeader = sheet.Rows[i][6].ToString().Trim(); //是否部门负责人
-                var entryDataTime = sheet.Rows[i][7].ToString().Trim(); //入职时间
+                var isLeader = sheet.Rows[i][6].ToString().Trim().Replace(" ", ""); //是否部门负责人
+                var entryDataTime = sheet.Rows[i][7].ToString().Trim().Replace(" ", ""); //入职时间
                 user.IsLeader = isLeader == "是" ? true : false;
                 if (!string.IsNullOrEmpty(entryDataTime))
                     user.EntryDataTime = DateTime.Parse(entryDataTime);