|  | @@ -1,7 +1,4 @@
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -using OASystem.Infrastructure.Repositories.System;
 | 
	
		
			
				|  |  | -using System.Collections;
 | 
	
		
			
				|  |  | +using System.Collections;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |  {
 | 
	
	
		
			
				|  | @@ -24,11 +21,13 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |          private readonly PageFunctionPermissionRepository _PageFunctionPermissionRepository;
 | 
	
		
			
				|  |  |          private readonly SystemMenuAndFunctionRepository _SystemMenuAndFunctionRepository;
 | 
	
		
			
				|  |  |          private readonly JobPostAuthorityRepository _JobPostAuthorityRepository;
 | 
	
		
			
				|  |  | +        private readonly JobPostRepository _jobRep;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public SystemController( CompanyRepository syscom, DepartmentRepository sysDepRep, UsersRepository userRep,
 | 
	
		
			
				|  |  |              IMapper mapper, SetDataRepository setDataRepository, CompanyRepository companyRepository,
 | 
	
		
			
				|  |  |              SystemMenuPermissionRepository systemMenuPermissionRepository, PageFunctionPermissionRepository pageFunctionPermissionRepository,
 | 
	
		
			
				|  |  | -            SystemMenuAndFunctionRepository systemMenuAndFunctionRepository, JobPostAuthorityRepository jobPostAuthorityRepository)
 | 
	
		
			
				|  |  | +            SystemMenuAndFunctionRepository systemMenuAndFunctionRepository, JobPostAuthorityRepository jobPostAuthorityRepository, JobPostRepository jobRep)
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              _syscomRep = syscom;
 | 
	
		
			
				|  |  |              _sysDepRep = sysDepRep;
 | 
	
	
		
			
				|  | @@ -42,35 +41,6 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |              _JobPostAuthorityRepository = jobPostAuthorityRepository;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        #region user 操作
 | 
	
		
			
				|  |  | -        /// <summary>
 | 
	
		
			
				|  |  | -        /// 查询所有员工(web)
 | 
	
		
			
				|  |  | -        /// </summary>
 | 
	
		
			
				|  |  | -        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | -        /// <returns></returns>
 | 
	
		
			
				|  |  | -        [HttpPost]
 | 
	
		
			
				|  |  | -        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | -        public async Task<IActionResult> GetUserList(DtoBase dto)
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            try
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                var result = _userRep.GetUserList(dto.PortType,string.Empty);
 | 
	
		
			
				|  |  | -                if (result.Result.Code != 0)
 | 
	
		
			
				|  |  | -                {
 | 
	
		
			
				|  |  | -                    return Ok(JsonView(false, "暂无数据!"));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                return Ok(JsonView(true,"查询成功!",result.Result.Data));
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            catch (Exception)
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | -                throw;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        #endregion
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          #region 企业操作
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  |          /// 查询企业数据
 | 
	
	
		
			
				|  | @@ -85,7 +55,13 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  |                  if (dto.PortType == 1)
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  | -                    return Ok(JsonView(false, "暂无数据!"));
 | 
	
		
			
				|  |  | +                    var CompanyDataResult = _CompanyRepository.GetCompanyData();
 | 
	
		
			
				|  |  | +                    if (CompanyDataResult.Code != 0)
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        return Ok(JsonView(CompanyDataResult.Msg));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(true, "查询成功!", CompanyDataResult.Data));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else if (dto.PortType == 2)
 | 
	
		
			
				|  |  |                  {
 | 
	
	
		
			
				|  | @@ -229,7 +205,7 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |          /// </summary>
 | 
	
		
			
				|  |  |          /// <param name="dto"></param>
 | 
	
		
			
				|  |  |          /// <returns></returns>
 | 
	
		
			
				|  |  | -        //[Authorize]
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |          [HttpPost]
 | 
	
		
			
				|  |  |          [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  |          public async Task<IActionResult> QueryDepartmentList(DepartmentDto dto)
 | 
	
	
		
			
				|  | @@ -329,7 +305,7 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |                          DepName=dto.DepName,
 | 
	
		
			
				|  |  |                          ParentDepId=dto.ParentDepId,
 | 
	
		
			
				|  |  |                          Remark=dto.Remark,
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | +                     });
 | 
	
		
			
				|  |  |                      if (!res)
 | 
	
		
			
				|  |  |                      {
 | 
	
		
			
				|  |  |                          return Ok(JsonView(false, "修改失败!"));
 | 
	
	
		
			
				|  | @@ -404,7 +380,7 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else if (dto.PortType == 2)
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  | -                    var result = _sysDepRep.QueryDto<Sys_JobPost, JobPostView>(s => s.CompanyId == dto.CompanyId && s.DepId==dto.DepId).ToList();
 | 
	
		
			
				|  |  | +                    var result = _jobRep.QueryDto<Sys_JobPost, JobPostView>(s => s.CompanyId == dto.CompanyId && s.DepId==dto.DepId).ToList();
 | 
	
		
			
				|  |  |                      if (result.Count == 0)
 | 
	
		
			
				|  |  |                      {
 | 
	
		
			
				|  |  |                          return Ok(JsonView(false, "暂无数据!"));
 | 
	
	
		
			
				|  | @@ -426,9 +402,114 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |                  throw;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 添加岗位
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  | +        [HttpPost]
 | 
	
		
			
				|  |  | +        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> AddJobPost(AddJobPostDto dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                Sys_JobPost sys_Job = _mapper.Map<Sys_JobPost>(dto);
 | 
	
		
			
				|  |  | +                int id = await _jobRep.AddAsyncReturnId(sys_Job);
 | 
	
		
			
				|  |  | +                if (id == 0)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "添加失败"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return Ok(JsonView(true, "添加成功", new { Id = id }));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception ex)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 修改岗位
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  | +        [HttpPost]
 | 
	
		
			
				|  |  | +        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> EditJobPost(EditJobPostDto dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                bool res = await _jobRep.UpdateAsync<Sys_JobPost>(a=>a.Id==dto.Id,a =>new Sys_JobPost
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    CompanyId=dto.CompanyId,
 | 
	
		
			
				|  |  | +                    DepId=dto.DepId,
 | 
	
		
			
				|  |  | +                    JobName=dto.JobName,
 | 
	
		
			
				|  |  | +                    Remark=dto.Remark,
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +                if (!res)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "修改失败"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return Ok(JsonView(true, "修改成功"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception ex)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 删除岗位
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  | +        [HttpPost]
 | 
	
		
			
				|  |  | +        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> DelJobPost(DelJobPostDto dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                bool res = await _jobRep.SoftDeleteAsync<Sys_JobPost>(dto.Id.ToString());
 | 
	
		
			
				|  |  | +                if (!res)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "删除失败!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return Ok(JsonView(true, "删除成功"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          #endregion
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          #region 用户操作
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 查询所有员工(web)
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  | +        [HttpPost]
 | 
	
		
			
				|  |  | +        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> GetUserList(DtoBase dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                var result = _userRep.GetUserList(dto.PortType, string.Empty);
 | 
	
		
			
				|  |  | +                if (result.Result.Code != 0)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "暂无数据!"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return Ok(JsonView(true, "查询成功!", result.Result.Data));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  |          /// 查询用户数据
 | 
	
		
			
				|  |  |          /// </summary>
 | 
	
	
		
			
				|  | @@ -470,12 +551,100 @@ namespace OASystem.API.Controllers
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 修改用户信息(上级修改/分配 公司、部门、岗位、工号等信息)
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  | +        [HttpPost]
 | 
	
		
			
				|  |  | +        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> EditUser(EditUserDto dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                bool res = await _userRep.UpdateAsync<Sys_Users>(a => a.Id == dto.Id, a => new Sys_Users
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    Number = dto.Number,
 | 
	
		
			
				|  |  | +                    CompanyId = dto.CompanyId,
 | 
	
		
			
				|  |  | +                    DepId = dto.DepId,
 | 
	
		
			
				|  |  | +                    JobPostId = dto.JobPostId,
 | 
	
		
			
				|  |  | +                    Ext = dto.Ext,
 | 
	
		
			
				|  |  | +                    UsePeriod = dto.UsePeriod,
 | 
	
		
			
				|  |  | +                    HrAudit = dto.HrAudit
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +                if (!res) 
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "修改失败!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return Ok(JsonView(true, "修改成功!"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 修改用户信息(登录用户修改个人信息)
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        /// <param name="dto"></param>
 | 
	
		
			
				|  |  | +        /// <returns></returns>
 | 
	
		
			
				|  |  |          [HttpPost]
 | 
	
		
			
				|  |  |          [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
 | 
	
		
			
				|  |  | -        public async Task<IActionResult> AddUser(AddUserDto dto)
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> EditMyUser(EditMyUserDto dto)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            int id = 0;
 | 
	
		
			
				|  |  | -            return Ok(JsonView(true, "添加成功!", new { Id = id }));
 | 
	
		
			
				|  |  | +            try
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                if (string.IsNullOrWhiteSpace(dto.CnName) || string.IsNullOrWhiteSpace(dto.Address) || string.IsNullOrWhiteSpace(dto.IDCard) || dto.Sex != 0 && dto.Sex != 1 ||
 | 
	
		
			
				|  |  | +                    string.IsNullOrWhiteSpace(dto.MaritalStatus) || string.IsNullOrWhiteSpace(dto.HomeAddress)|| dto.Birthday>=DateTime.Now.AddYears(-1))
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "请完善你的个人信息!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else if (string.IsNullOrWhiteSpace(dto.GraduateInstitutions) || string.IsNullOrWhiteSpace(dto.Professional) || dto.Education == 0 || string.IsNullOrWhiteSpace(dto.GraduateInstitutions))
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "请完善你的学历信息!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else if (string.IsNullOrWhiteSpace(dto.Phone) || string.IsNullOrWhiteSpace(dto.UrgentPhone) || string.IsNullOrWhiteSpace(dto.Email))
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(false, "请检查联系方式、紧急联系人及邮箱输写是否正确!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    bool res = await _userRep.UpdateAsync<Sys_Users>(a => a.Id == dto.Id, a => new Sys_Users
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        CnName = dto.CnName,
 | 
	
		
			
				|  |  | +                        EnName = dto.EnName,
 | 
	
		
			
				|  |  | +                        Sex = dto.Sex,
 | 
	
		
			
				|  |  | +                        Phone = dto.Phone,
 | 
	
		
			
				|  |  | +                        UrgentPhone = dto.UrgentPhone,
 | 
	
		
			
				|  |  | +                        Email = dto.Email,
 | 
	
		
			
				|  |  | +                        Address = dto.Address,
 | 
	
		
			
				|  |  | +                        Edate = dto.Edate,
 | 
	
		
			
				|  |  | +                        Birthday = dto.Birthday,
 | 
	
		
			
				|  |  | +                        IDCard = dto.IDCard,
 | 
	
		
			
				|  |  | +                        GraduateInstitutions = dto.GraduateInstitutions,
 | 
	
		
			
				|  |  | +                        Professional = dto.Professional,
 | 
	
		
			
				|  |  | +                        Education = dto.Education,
 | 
	
		
			
				|  |  | +                        TheOrAdultEducation = dto.TheOrAdultEducation,
 | 
	
		
			
				|  |  | +                        MaritalStatus = dto.MaritalStatus,
 | 
	
		
			
				|  |  | +                        HomeAddress = dto.HomeAddress,
 | 
	
		
			
				|  |  | +                        WorkExperience = dto.WorkExperience,
 | 
	
		
			
				|  |  | +                        Certificate = dto.Certificate
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    if (!res)
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        return Ok(JsonView(false, "修改失败!"));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    return Ok(JsonView(true, "修改成功!"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            catch (Exception)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "程序错误!"));
 | 
	
		
			
				|  |  | +                throw;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          #endregion
 | 
	
		
			
				|  |  |  
 |