入职任务预览,入职任务cope,验证填入的信息
This commit is contained in:
+1
-41
@@ -131,7 +131,7 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
throw Oops.Bah("当前任务不可编辑");
|
||||
}
|
||||
|
||||
ValidateEmployeeInfo(input);
|
||||
OnboardingEmployeeInfoValidator.ValidateAndNormalize(input);
|
||||
await _identityValidationService.EnsureNoDuplicate(
|
||||
task.Id,
|
||||
input.EmployeeName,
|
||||
@@ -170,46 +170,6 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
await _snapshotService.Build(task.Id, entity, invalidateGeneratedPreview: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验候选人核心身份信息,避免非法格式进入合同和正式员工档案。
|
||||
/// </summary>
|
||||
private static void ValidateEmployeeInfo(OnboardingTaskPublicSaveInput input)
|
||||
{
|
||||
input.EmployeeName = input.EmployeeName?.Trim();
|
||||
input.Phone = input.Phone?.Trim();
|
||||
input.IdCardNumber = input.IdCardNumber?.Trim().ToUpperInvariant();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(input.EmployeeName) || input.EmployeeName.Length > 100)
|
||||
throw Oops.Bah("员工姓名不能为空且不能超过 100 个字符");
|
||||
if (!global::System.Text.RegularExpressions.Regex.IsMatch(
|
||||
input.Phone ?? string.Empty,
|
||||
"^1[3-9]\\d{9}$"))
|
||||
{
|
||||
throw Oops.Bah("请输入正确的 11 位手机号码");
|
||||
}
|
||||
|
||||
if (!global::System.Text.RegularExpressions.Regex.IsMatch(
|
||||
input.IdCardNumber ?? string.Empty,
|
||||
"^\\d{17}[0-9X]$"))
|
||||
{
|
||||
throw Oops.Bah("请输入正确的 18 位身份证号码");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(input.CustomVariablesJson))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
using var document = global::System.Text.Json.JsonDocument.Parse(input.CustomVariablesJson);
|
||||
if (document.RootElement.ValueKind != global::System.Text.Json.JsonValueKind.Object)
|
||||
throw new global::System.Text.Json.JsonException();
|
||||
}
|
||||
catch (global::System.Text.Json.JsonException)
|
||||
{
|
||||
throw Oops.Bah("员工补充变量格式不正确,请刷新页面后重新填写");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据员工当前已填写信息校验变量并提前生成合同 DOCX。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user