114 lines
3.5 KiB
C#
114 lines
3.5 KiB
C#
using System.ComponentModel;
|
|
namespace SimpleAdmin.Web.Core;
|
|
|
|
/// <summary>
|
|
/// 提供员工档案及人事维护相关 HTTP 接口。
|
|
/// </summary>
|
|
[ApiDescriptionSettings("Application", Tag = "入职员工档案")]
|
|
[Route("biz/onboarding/employee")]
|
|
[RolePermission]
|
|
public class OnboardingEmployeeController
|
|
{
|
|
private readonly IOnboardingEmployeeService _service;
|
|
private readonly IFileService _fileService;
|
|
|
|
public OnboardingEmployeeController(
|
|
IOnboardingEmployeeService service,
|
|
IFileService fileService)
|
|
{
|
|
_service = service;
|
|
_fileService = fileService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页查询正式员工档案。
|
|
/// </summary>
|
|
[HttpGet("page")]
|
|
[DisplayName("分页查询员工档案")]
|
|
public async Task<dynamic> Page([FromQuery] OnboardingEmployeePageInput input)
|
|
{
|
|
return await _service.Page(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按当前列表筛选条件导出员工基本信息和合同快照。
|
|
/// </summary>
|
|
[HttpPost("export")]
|
|
[DisplayName("导出员工明细")]
|
|
public async Task<FileContentResult> Export([FromBody] OnboardingEmployeePageInput input)
|
|
{
|
|
var file = await _service.Export(input);
|
|
return new FileContentResult(
|
|
file.FileBytes,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
|
{
|
|
FileDownloadName = file.FileName
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询正式员工详情及来源记录。
|
|
/// </summary>
|
|
[HttpGet("detail")]
|
|
[DisplayName("查询员工档案详情")]
|
|
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
|
{
|
|
return await _service.Detail(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑员工用工、社保及合同性质等人事信息。
|
|
/// </summary>
|
|
[HttpPost("hr-info/update")]
|
|
[DisplayName("编辑员工人事信息")]
|
|
public async Task UpdateHrInfo([FromBody] OnboardingEmployeeHrUpdateInput input)
|
|
{
|
|
await _service.UpdateHrInfo(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传转正等员工人事材料。
|
|
/// </summary>
|
|
[HttpPost("attachment/upload")]
|
|
[Consumes("multipart/form-data")]
|
|
[RequestSizeLimit(20 * 1024 * 1024)]
|
|
[DisplayName("上传员工人事材料")]
|
|
public async Task<long> UploadAttachment([FromForm] IFormFile file)
|
|
{
|
|
if (file == null || file.Length == 0)
|
|
throw Oops.Bah("请选择需要上传的材料文件");
|
|
|
|
var allowedExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
".pdf", ".doc", ".docx", ".xls", ".xlsx",
|
|
".jpg", ".jpeg", ".png", ".webp", ".zip"
|
|
};
|
|
var extension = Path.GetExtension(file.FileName);
|
|
if (!allowedExtensions.Contains(extension))
|
|
throw Oops.Bah("仅支持 PDF、Word、Excel、图片或 ZIP 文件");
|
|
|
|
return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_ALIYUN_OSS, file);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 人工办理员工转正。
|
|
/// </summary>
|
|
[HttpPost("regularization/confirm")]
|
|
[DisplayName("办理员工转正")]
|
|
public async Task Regularize([FromBody] OnboardingEmployeeRegularizeInput input)
|
|
{
|
|
await _service.Regularize(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 撤销员工转正。
|
|
/// </summary>
|
|
[HttpPost("regularization/revoke")]
|
|
[DisplayName("撤销员工转正")]
|
|
public async Task RevokeRegularization(
|
|
[FromBody] OnboardingEmployeeRegularizationRevokeInput input)
|
|
{
|
|
await _service.RevokeRegularization(input);
|
|
}
|
|
}
|