111
This commit is contained in:
@@ -44,14 +44,25 @@ public class OnboardingAuditService : IOnboardingAuditService
|
||||
throw Oops.Bah("该身份证号或手机号已存在正式员工");
|
||||
}
|
||||
|
||||
var extraValues = await _db.Queryable<ObTaskFormValue>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.ToListAsync();
|
||||
var employee = employeeInfo.Adapt<ObEmployee>();
|
||||
employee.Id = global::SimpleAdmin.Core.Utils.CommonUtils.GetSingleId();
|
||||
employee.CompanyId = task.CompanyId;
|
||||
employee.PositionId = task.PositionId;
|
||||
employee.ExtraInfoJson = global::System.Text.Json.JsonSerializer.Serialize(extraValues);
|
||||
employee.DepartmentName = employeeInfo.OnboardingDepartment;
|
||||
employee.College = employeeInfo.GraduatedSchool;
|
||||
employee.BirthDate = ParseDate(employeeInfo.Birthday);
|
||||
employee.ContactAddress = employeeInfo.CurrentAddress;
|
||||
employee.EntryDate = ParseDate(employeeInfo.OnboardingDate);
|
||||
employee.Remark = employeeInfo.OtherRemarks;
|
||||
employee.ExtraInfoJson = global::System.Text.Json.JsonSerializer.Serialize(employeeInfo);
|
||||
employee.Status = CommonStatusConst.ENABLE;
|
||||
employee.CreateTime = DateTime.Now;
|
||||
employee.CreateUserId = UserManager.UserId;
|
||||
employee.CreateUser = UserManager.Name;
|
||||
employee.UpdateTime = null;
|
||||
employee.UpdateUserId = null;
|
||||
employee.UpdateUser = null;
|
||||
employee.IsDelete = false;
|
||||
|
||||
// 员工档案、任务状态和审核记录必须同时成功,避免出现“已通过但没有员工档案”的中间状态。
|
||||
await _db.Ado.BeginTranAsync();
|
||||
@@ -124,6 +135,16 @@ public class OnboardingAuditService : IOnboardingAuditService
|
||||
return task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将登记表中的日期文本转换为正式员工档案日期。
|
||||
/// </summary>
|
||||
private static DateTime? ParseDate(string value)
|
||||
{
|
||||
return DateTime.TryParse(value, out var result)
|
||||
? result.Date
|
||||
: null;
|
||||
}
|
||||
|
||||
private Task WriteAudit(ObOnboardingTask task, string action, string opinion)
|
||||
{
|
||||
return _db.Insertable(new ObTaskAudit
|
||||
|
||||
Reference in New Issue
Block a user