public List <PersonnelOfDeptData> GetPersonnelOfDeptData() { HrSystem hrSystem = new HrSystem(); //未知查询条件,查询所有转换再处理 var personList = hrSystem.GetPersonnelDataByCompanyId(new List <string>()); return(personList); }
/// <summary> /// 获取人事系统所有人员信息进行转换 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2019-01-14</para> /// </summary> /// <returns>人员信息列表</returns> private static List <EmployeeInfo> GetAllConvertEmployee() { HrSystem hrSystem = new HrSystem(); try { //未知查询条件,查询所有转换再处理 var personList = hrSystem.GetPersonnelDataByCompanyId(new List <string>()); //当人员记录数为0时记录日记,以便跟踪 if (personList == null || personList.Count <= 0) { RequestLog("EmployeeService->GetAllConvertEmployee", $"YMM.HRS.SDK.HrSystem 人员信息获为0条", "", null); } var result = personList.Select(x => new EmployeeInfo { BirthDate = x.BirthDate, CheckStatus = x.CheckStatus, CityId = x.DepartmentInfo.CityId, Company = x.DepartmentInfo.Company, CompanyId = x.DepartmentInfo.CompanyId, DeptId = x.DepartmentInfo.DeptId, DeptName = x.DepartmentInfo.DeptName, Email = x.Email, EmployeeId = x.UserId, EmployeeName = x.UserName, HeadPic = x.HeadPic, IdentityCardNo = x.IdentityCardNo, Mobile = x.Mobile, Number = x.Number, OrgId = x.DepartmentInfo.OrgId, OrgName = x.DepartmentInfo.OrgName, PositionId = x.DepartmentInfo.PositionId, PositionName = x.DepartmentInfo.PositionName, SchoolSno = x.DepartmentInfo.SchoolSno, Sex = x.Sex, Status = x.Status, UserSno = x.UserSno, Watermark = x.Watermark, LeaveDate = x.LeaveDate }).ToList(); return(result); } catch (Exception ex) { RequestLog("EmployeeService->GetAllConvertEmployee", "YMM.HRS.SDK.HrSystem 人员信息获取失败", ex.Message, ex); throw new ApplicationException("人员信息获取失败"); } }
/// <summary> /// 根据组织架构获取用户信息 /// by:Huang GaoLiang 2018年11月1日 /// </summary> /// <param name="userId">当前操作人编号</param> /// <returns></returns> public List <EmployeeInfo> GetSchoolEmployeeByCompanyId(string userId = null) { List <EmployeeInfo> employeeList = new List <EmployeeInfo>(); if (string.IsNullOrWhiteSpace(_schoolId)) { return(employeeList); } try { List <string> schoolIds = new List <string> { _schoolId }; HrSystem rr = new HrSystem(); List <string> s = new List <string>(); List <PersonnelOfDeptData> res = rr.GetPersonnelDataByCompanyId(s); foreach (PersonnelOfDeptData item in res) { if (!schoolIds.Contains(item.DepartmentInfo.OrgId)) { continue; } EmployeeInfo info = new EmployeeInfo(); info.CompanyId = item.DepartmentInfo.CompanyId; info.Company = item.DepartmentInfo.Company; info.EmployeeId = item.UserId; info.EmployeeName = item.UserName; info.Status = item.Status; employeeList.Add(info); } } catch (Exception e) { base.AntWriteLog("GetPersonnelDataByCompanyId", "根据组织架构获取用户信息", "", e.Message, e); } employeeList = employeeList.Where((x, i) => employeeList.FindIndex(z => z.EmployeeId == x.EmployeeId) == i).ToList(); return(employeeList); }