111
This commit is contained in:
@@ -25,6 +25,11 @@ public class OnboardingTaskCreateInput
|
||||
[IdNotNull(ErrorMessage = "岗位Id不能为空")]
|
||||
public long PositionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用工类型:full_time 正式用工,part_time 兼职用工。
|
||||
/// </summary>
|
||||
public string EmploymentType { get; set; } = EmployeeEmploymentType.FullTime;
|
||||
|
||||
/// <summary>
|
||||
/// 本次任务使用的入职模板 Id。
|
||||
/// </summary>
|
||||
|
||||
@@ -26,6 +26,8 @@ public class OnboardingTaskService : IOnboardingTaskService
|
||||
if (string.IsNullOrWhiteSpace(input.Remark))
|
||||
throw Oops.Bah("请填写人事备注");
|
||||
|
||||
ValidateEmploymentType(input.EmploymentType);
|
||||
|
||||
var companyEnabled = await _db.Queryable<ObCompany>()
|
||||
.AnyAsync(item => item.Id == input.CompanyId && item.Status == "enable");
|
||||
if (!companyEnabled)
|
||||
@@ -123,6 +125,7 @@ public class OnboardingTaskService : IOnboardingTaskService
|
||||
CompanyId = input.CompanyId,
|
||||
DepartmentId = input.DepartmentId,
|
||||
PositionId = input.PositionId,
|
||||
EmploymentType = input.EmploymentType,
|
||||
OnboardingTemplateId = onboardingTemplate.Id,
|
||||
AssignedReviewerUserId = input.AssignedReviewerUserId,
|
||||
LinkExpireAt = expiresAt,
|
||||
@@ -366,6 +369,9 @@ public class OnboardingTaskService : IOnboardingTaskService
|
||||
CompanyId = sourceTask.CompanyId,
|
||||
DepartmentId = sourceTask.DepartmentId,
|
||||
PositionId = sourceTask.PositionId,
|
||||
EmploymentType = string.IsNullOrWhiteSpace(sourceTask.EmploymentType)
|
||||
? EmployeeEmploymentType.FullTime
|
||||
: sourceTask.EmploymentType,
|
||||
OnboardingTemplateId = sourceTask.OnboardingTemplateId,
|
||||
AssignedReviewerUserId = sourceTask.AssignedReviewerUserId,
|
||||
LinkExpireAt = expiresAt,
|
||||
@@ -553,4 +559,13 @@ public class OnboardingTaskService : IOnboardingTaskService
|
||||
if (endDate.Date < startDate.Date)
|
||||
throw Oops.Bah($"{rangeName}结束日期不能早于开始日期");
|
||||
}
|
||||
|
||||
private static void ValidateEmploymentType(string employmentType)
|
||||
{
|
||||
if (employmentType != EmployeeEmploymentType.FullTime
|
||||
&& employmentType != EmployeeEmploymentType.PartTime)
|
||||
{
|
||||
throw Oops.Bah("用工类型不正确,请选择正式员工或兼职员工");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user