|
@@ -1,7 +1,8 @@
|
|
|
|
|
|
|
|
|
+using Google.Protobuf.WellKnownTypes;
|
|
|
+using OASystem.Domain.Dtos.UserDto;
|
|
|
using OASystem.Infrastructure.Repositories.System;
|
|
|
-
|
|
|
using System.ComponentModel.Design;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
@@ -444,7 +445,13 @@ namespace OASystem.API.Controllers
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 删除岗位
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> DelJobPost(DelJobPostDto dto)
|
|
|
{
|
|
|
try
|
|
@@ -532,12 +539,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
|
|
|
|