89 lines
2.6 KiB
C#
89 lines
2.6 KiB
C#
namespace SimpleAdmin.Web.Core;
|
|
|
|
/// <summary>
|
|
/// 提供员工端资料提交相关 HTTP 接口。
|
|
/// </summary>
|
|
[ApiDescriptionSettings("Application", Tag = "员工入职提交")]
|
|
[Route("open/onboarding")]
|
|
[AllowAnonymous]
|
|
public class OnboardingPublicSubmissionController
|
|
{
|
|
private readonly IOnboardingPublicSubmissionService _service;
|
|
private readonly IFileService _fileService;
|
|
|
|
public OnboardingPublicSubmissionController(IOnboardingPublicSubmissionService service, IFileService fileService)
|
|
{
|
|
_service = service;
|
|
_fileService = fileService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存员工动态字段。
|
|
/// </summary>
|
|
[HttpPost("save-dynamic-values")]
|
|
public async Task SaveDynamicValues([FromBody] OnboardingSaveDynamicValuesInput input)
|
|
{
|
|
await _service.SaveDynamicValues(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存员工已上传材料记录。
|
|
/// </summary>
|
|
[HttpPost("save-material")]
|
|
public async Task SaveMaterial([FromBody] OnboardingSaveMaterialInput input)
|
|
{
|
|
await _service.SaveMaterial(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 确认已阅读指定合同。
|
|
/// </summary>
|
|
[HttpPost("confirm-contract")]
|
|
public async Task ConfirmContract([FromBody] OnboardingConfirmContractInput input)
|
|
{
|
|
await _service.ConfirmContract(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交入职资料进入审核。
|
|
/// </summary>
|
|
[HttpPost("submit")]
|
|
public async Task Submit([FromBody] OnboardingSubmitInput input)
|
|
{
|
|
await _service.Submit(input);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 校验并上传员工入职材料。
|
|
/// </summary>
|
|
[HttpPost("upload-material")]
|
|
[Consumes("multipart/form-data")]
|
|
[RequestSizeLimit(20 * 1024 * 1024)]
|
|
public async Task UploadMaterial(
|
|
[FromQuery] string token,
|
|
[FromQuery] long materialTypeId,
|
|
[FromForm] IFormFile file)
|
|
{
|
|
if (file == null || file.Length == 0)
|
|
{
|
|
throw Oops.Bah("请选择需要上传的文件");
|
|
}
|
|
|
|
await _service.ValidateMaterialUpload(new OnboardingMaterialUploadValidationInput
|
|
{
|
|
Token = token,
|
|
MaterialTypeId = materialTypeId,
|
|
FileName = file.FileName,
|
|
FileLength = file.Length
|
|
});
|
|
|
|
var fileId = await _fileService.UploadFile(SysDictConst.FILE_ENGINE_ALIYUN_OSS, file);
|
|
await _service.SaveMaterial(new OnboardingSaveMaterialInput
|
|
{
|
|
Token = token,
|
|
MaterialTypeId = materialTypeId,
|
|
FileId = fileId
|
|
});
|
|
}
|
|
}
|