diff --git a/Model/Tiobon.Web.pdm b/Model/Tiobon.Web.pdm index c799a617..80850353 100644 --- a/Model/Tiobon.Web.pdm +++ b/Model/Tiobon.Web.pdm @@ -1,5 +1,5 @@ - + @@ -11249,7 +11249,7 @@ LABL 0 Arial Unicode MS,8,N SystemManager12 1728522772 Administrator -1734490374 +1734507072 Administrator [DisplayPreferences] @@ -39811,11 +39811,10 @@ Ghra_staff_InsureBase GradeId 1730425965 Administrator -1734422692 +1734507068 Administrator 职等ID -nvarchar(2000) -2000 +int E257966A-1186-4977-9600-6BE72E214473 diff --git a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs index 53b6fee0..2e03c99f 100644 --- a/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs +++ b/Tiobon.Core.Api/Controllers/Ghrh/Ghrh_ResumeController.cs @@ -509,4 +509,10 @@ public class Ghrh_ResumeController : BaseController> OfferDownLoad(long id, long templateId, [FromBody] Dictionary extFields) => await _service.OfferDownLoad(id, templateId, extFields); #endregion + + #region 同步数据至人事资料 + [HttpPost, Route("SyncToStaff/{id}")] + public async Task SyncToStaff(long id) => await _service.SyncToStaff(id); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index f40879fc..087b7e39 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -20549,7 +20549,7 @@ 职等ID - + @@ -27682,6 +27682,11 @@ 部门 + + + 职称 + + 岗位 @@ -27702,6 +27707,16 @@ 部门负责人邮箱 + + + 编制内外 + + + + + 性别 + + 人力需求维护明细(Dto.View1) diff --git a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs index f1b04331..c60a80cb 100644 --- a/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs +++ b/Tiobon.Core.IServices/Ghrh/IGhrh_ResumeServices.cs @@ -79,4 +79,7 @@ public interface IGhrh_ResumeServices : IBaseServices>> Log(long id); Task> OfferDownLoad(long id, long templateId, Dictionary extFields); + + + Task SyncToStaff(long id); } \ No newline at end of file diff --git a/Tiobon.Core.Model/Base/Ghrh/Ghrh_HumanRequest.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghrh/Ghrh_HumanRequest.Dto.Base.cs index 8f821f10..e91f6af2 100644 --- a/Tiobon.Core.Model/Base/Ghrh/Ghrh_HumanRequest.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghrh/Ghrh_HumanRequest.Dto.Base.cs @@ -70,8 +70,7 @@ public class Ghrh_HumanRequestBase /// /// 职等ID /// - [Display(Name = "GradeId"), Description("职等ID"), MaxLength(2000, ErrorMessage = "职等ID 不能超过 2000 个字符")] - public string GradeId { get; set; } + public int? GradeId { get; set; } /// /// 需求人数 diff --git a/Tiobon.Core.Model/Models/Ghrh/Ghrh_HumanRequest.cs b/Tiobon.Core.Model/Models/Ghrh/Ghrh_HumanRequest.cs index ba5657ef..ac139921 100644 --- a/Tiobon.Core.Model/Models/Ghrh/Ghrh_HumanRequest.cs +++ b/Tiobon.Core.Model/Models/Ghrh/Ghrh_HumanRequest.cs @@ -70,9 +70,8 @@ public class Ghrh_HumanRequest : BasePoco /// /// 职等ID - /// - [Display(Name = "GradeId"), Description("职等ID"), MaxLength(2000, ErrorMessage = "职等ID 不能超过 2000 个字符")] - public string GradeId { get; set; } + /// + public int? GradeId { get; set; } /// /// 需求人数 diff --git a/Tiobon.Core.Model/View/Ghrh/Ghrh_HumanRequest.Dto.View.cs b/Tiobon.Core.Model/View/Ghrh/Ghrh_HumanRequest.Dto.View.cs index f2cc3d4c..71a53059 100644 --- a/Tiobon.Core.Model/View/Ghrh/Ghrh_HumanRequest.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghrh/Ghrh_HumanRequest.Dto.View.cs @@ -37,14 +37,14 @@ public class Ghrh_HumanRequestDto : Ghrh_HumanRequest /// public string DeptName { get; set; } - ///// - ///// 归属部门 - ///// - //public string BelongDeptName { get; set; } + /// + /// 职称 + /// + public string JobName { get; set; } - /// - /// 岗位 - /// + /// + /// 岗位 + /// public string TitleName { get; set; } /// @@ -62,4 +62,14 @@ public class Ghrh_HumanRequestDto : Ghrh_HumanRequest /// public string DeptManagerEmail { get; set; } + /// + /// 编制内外 + /// + public string InOrOutLabel { get; set; } + + /// + /// 性别 + /// + public string GenderLabel { get; set; } + } diff --git a/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs b/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs index 0a6bb3c2..c79ebdec 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/ResumeTemplateGroupColumn.cs @@ -33,6 +33,8 @@ public class ResumeFormColumn1 public string GroupType { get; set; } public string ColumnType { get; set; } + public string MapTableName { get; set; } + public string MapColumnName { get; set; } } diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index de2f912c..e58372dc 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1791,6 +1791,14 @@ public partial class CommonServices : BaseServices>, ICommon toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault(); if (toolbar != null) toolbar.fnKey = "TBD4YN"; break; + case "F_ManReqMainten": + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD1YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD2YN"; + toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault(); + if (toolbar != null) toolbar.fnKey = "TBD3YN"; + break; case "F_AnnualManpower": var config = await Db.Queryable().Where(x => x.ConfigCode == "ESS_Recruit_Year_Human_Start_Month").FirstAsync(); diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs index f6c226a1..2bcb0af1 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs @@ -1,4 +1,6 @@ -namespace Tiobon.Core.Services; +using System.Collections.Generic; + +namespace Tiobon.Core.Services; /// /// 人力需求维护 (服务) @@ -12,16 +14,30 @@ public class Ghrh_HumanRequestServices : BaseServices + /// 字典映射、全称、单位转换等 + /// + /// + private async Task SetLabel(Ghrh_HumanRequestDto x) + { + if (x != null) + { + x.GenderLabel = await GetParaLabel("Gender", x.Gender); + x.InOrOutLabel = await GetParaLabel("ResumeBudgetTypr", x.InOrOut); + } + } + #endregion public override async Task> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true) { var result = await base.QueryFilterPage(filter, condition, IsEnable); var entitys = result.result.DT_TableDataT1; var deptIds = entitys.Where(x => x.DeptId != null).Select(x => x.DeptId).ToList(); - //var titleIds = entitys.Where(x => x.TitleId != null).Select(x => x.TitleId).ToList(); var gradeIds = entitys.Where(x => x.GradeId != null).Select(x => x.GradeId).ToList(); + var jobIds = entitys.Where(x => x.JobId != null).Select(x => x.JobId).ToList(); var titleIds = entitys.Where(x => x.TitleId != null).Select(x => x.TitleId).ToList(); - //deptIds.AddRange(entitys.Where(x => x.BelongDeptId != null).Select(x => x.BelongDeptId).ToList()); if (deptIds.Any()) { var depts = await Db.Queryable().Where(x => deptIds.Contains(x.DeptID)).ToListAsync(); @@ -29,7 +45,6 @@ public class Ghrh_HumanRequestServices : BaseServices { rule.DeptName = depts.FirstOrDefault(o => rule.DeptId == o.DeptID)?.DeptName; - //rule.BelongDeptName = depts.FirstOrDefault(o => rule.BelongDeptId == o.DeptID)?.DeptName; }); } @@ -43,26 +58,29 @@ public class Ghrh_HumanRequestServices : BaseServices().Where(x => gradeIds.Contains(x.GradeID)).ToListAsync(); - - // entitys.ForEach(rule => - // { - // rule.GradeName = grades.FirstOrDefault(o => rule.GradeId == o.GradeID)?.GradeName; - // }); - //} + if (gradeIds.Any()) + { + var grades = await Db.Queryable().Where(x => gradeIds.Contains(x.GradeID)).ToListAsync(); - //if (jobIds.Any()) - //{ - // var jobs = await Db.Queryable().Where(x => jobIds.Contains(x.JobID)).ToListAsync(); + entitys.ForEach(rule => + { + rule.GradeName = grades.FirstOrDefault(o => rule.GradeId == o.GradeID)?.GradeName; + }); + } - // entitys.ForEach(rule => - // { - // rule.JobName = jobs.FirstOrDefault(o => rule.JobId == o.JobID)?.JobName; - // }); - //} + if (jobIds.Any()) + { + var jobs = await Db.Queryable().Where(x => jobIds.Contains(x.JobID)).ToListAsync(); + entitys.ForEach(rule => + { + rule.JobName = jobs.FirstOrDefault(o => rule.JobId == o.JobID)?.JobName; + }); + } + entitys.ForEach(async x => + { + await SetLabel(x); + }); result.result.DT_TableDataT1 = entitys; return result; } diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index a956e69a..41a034fb 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -2,7 +2,9 @@ using DinkToPdf.Contracts; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; +using System.Collections.Generic; using System.IO.Compression; +using Tiobon.Core.Common.DB.Dapper.Extensions; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -1191,11 +1193,12 @@ END"; } - public async Task> QueryResumeFormColumn(long resumeTemplateID) + public async Task> QueryResumeFormColumn(long resumeTemplateID = 0) { + resumeTemplateID = await Db.Ado.GetLongAsync("select top 1 Id from Ghrh_ResumeTemplate where IsEnable=1 and IsPublish=1"); var sql = @$"DECLARE @ResumeTemplateID BIGINT = {resumeTemplateID} - SELECT A.ColumnName, A.ResumeInfoColumnName ColumnNameDesc, D.GroupType + SELECT A.ColumnName, A.ResumeInfoColumnName ColumnNameDesc, D.GroupType, A.MapTableName, A.MapColumnName FROM Ghrh_ResumeInfoColumn A LEFT JOIN Ghrh_ResumeTemplateInfoGroupColumn B ON B.ResumeInfoColumnID = A.ID @@ -2427,8 +2430,8 @@ END"; if (entity == null) return ServiceResult.OprateFailed("无效的简历ID!"); - if (entity.Status != DIC_INTERVIEW_ORDER_STATUS.HasInterview || entity.Status != DIC_INTERVIEW_ORDER_STATUS.WaitRecommended) - return ServiceResult.OprateFailed("只有在【已面试】、【待推荐】状态下,才能转入待发Offer!"); + //if (entity.Status != DIC_INTERVIEW_ORDER_STATUS.HasInterview || entity.Status != DIC_INTERVIEW_ORDER_STATUS.WaitRecommended) + // return ServiceResult.OprateFailed("只有在【已面试】、【待推荐】状态下,才能转入待发Offer!"); if (await Db.Queryable().AnyAsync(x => x.WorkState == 0 && x.ResumeId == id)) return ServiceResult.OprateFailed("当前简历录用审批处于审批中,不可转入待发Offer!"); @@ -2436,9 +2439,13 @@ END"; await UpdateResumeStatus(entity, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id); - await UpdateInterviewOrderStatus(order, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); - await UpdateInterviewRecordStatus(order, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); - await LogRecord(order.Id, "转入待发Offer!", id, null, "TransferWaitSendOffer"); + if (order != null) + { + + await UpdateInterviewOrderStatus(order, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); + await UpdateInterviewRecordStatus(order, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); + await LogRecord(order.Id, "转入待发Offer!", id, null, "TransferWaitSendOffer"); + } } return ServiceResult.OprateSuccess(); @@ -2784,9 +2791,8 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; var result = new ResumeScheduleInterviewResult(); var entity = await base.QueryById(id); var order = await _ghrh_InterviewOrderServices.QuerySingle(x => x.ResumeId == id); - var records = await _ghrh_InterviewRecordServices.Query(x => x.Round == order.Round && x.OrderId == order.Id); - if (order.RequestId.IsNotEmptyOrNull()) + if (order != null && order.RequestId.IsNotEmptyOrNull()) { var request = await _ghrh_HumanRequestServices.QueryById(order.RequestId); result.RequestId = order.RequestId; @@ -2799,13 +2805,16 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; } else { - result.DeptName = order.HireDeptName; - result.TitleName = order.HireTitleName; + result.DeptName = order?.HireDeptName; + result.TitleName = order?.HireTitleName; } result.ResumeStaffName = entity.StaffName; result.Times = new List(); result.Staffs = new(); + var records = new List(); + if (order != null) records = await _ghrh_InterviewRecordServices.Query(x => x.Round == order.Round && x.OrderId == order.Id); + if (records != null && records.Any()) { var record = records.Where(x => x.PlanInterviewTime1 != null).FirstOrDefault(); @@ -3786,275 +3795,264 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 AND C.Status = A.Status"; /// public async Task SyncToStaff(long id) { - - var entity = await base.QueryById(id); - if (entity.IsSyncToStaff == true || await Db.Queryable().Where(x => x.IdCardNo == entity.IdCardNo).AnyAsync()) + try { - return false; - } - //【简历库-录用-已发offer】配置按钮 - var sendOfferConfig = await Db.Queryable().Where(x => x.ConfigCode == "ESS_Recruit_Custom_Transfer_Staff").FirstAsync(); + var entity = await base.QueryById(id); + if (entity.IsSyncToStaff == true || await Db.Queryable().Where(x => x.IdCardNo == entity.IdCardNo).AnyAsync()) + { + return false; + } + //【简历库-录用-已发offer】配置按钮 + var sendOfferConfig = await Db.Queryable().Where(x => x.ConfigCode == "ESS_Recruit_Custom_Transfer_Staff").FirstAsync(); - var type = sendOfferConfig?.ConfigValue ?? "Fast"; - - #region 人事资料 - var staff = new Ghra_Staff(); - staff.StaffName = entity.StaffName; - var aaa = entity.StaffName.GetTotalPingYin(); - //staff.PinYinName = entity.StaffName.GetTotalPingYin(); - staff.StaffEname = entity.StaffEname; - staff.PhotoUrl = entity.PhotoUrl; - staff.Nation = entity.Nation; - staff.Birthday = entity.Birthday; - staff.NativePlace = entity.NativePlace; - staff.Gender = entity.Gender; - staff.EduDegree = entity.EduDegree; - staff.MaritalStatus = entity.MaritalStatus; - staff.PoliticStatus = entity.PoliticStatus; - staff.Mobile = entity.Mobile; - staff.Email = entity.Email; - staff.Indate = DateTime.Now; - staff.Reverse3 = entity.CertificateType; - staff.IDCardBegin = entity.IDCardBegin; - staff.IDCardEnd = entity.IDCardEnd; - staff.IdCardNo = entity.IdCardNo; - staff.IDCardOrg = entity.IDCardOrg; - staff.RegisteredType = entity.RegisteredType; - staff.UrgentContact = entity.UrgentContact; - staff.UrgentContactTel = entity.UrgentContactTel; - staff.RegisteredPlace = entity.NowAddress; - staff.RegisteredAddress = entity.RegisteredAddress; - staff.NationNo = entity.NationNo; - //staff.FundAccountID = entity.FundAccountID; - staff.FundBase = entity.FundBase; - //staff.InInsureAccountNo = entity.InInsureAccountNo; - //staff.InsureAccountID = entity.InsureAccountID; - staff.InsureBase = entity.InsureBase; - staff.IsInsure = entity.IsInsure == true ? 1 : 0; - staff.IsFund = entity.IsFund == true ? 1 : 0; - //staff.IsStay = entity.IsStay; - //staff.CarNo = entity.CarNo; - //staff.TitleType = entity.TitleType; - //staff.StaffType1 = entity.StaffType1; - staff.IsRelease = 1; - staff.SortNo = 1; - staff.IsDefault = 1; - if (type == "Fast") - { - staff.IsEnable = 2; - staff.ToDoType = "ToDo"; - } - else - staff.IsEnable = 1; - #endregion + var type = sendOfferConfig?.ConfigValue ?? "Fast"; + var formColumns = await QueryResumeFormColumn(); + formColumns = formColumns.Where(x => x.MapTableName.IsNotEmptyOrNull() && x.MapColumnName.IsNotEmptyOrNull()).ToList(); - var applyOrder = await Db.Queryable().Where(x => x.ResumeId == id).FirstAsync(); - if (applyOrder != null) - { - staff.DeptID = applyOrder.DeptId; - staff.TitleID = applyOrder.TitleId; - staff.JobID = applyOrder.JobId; - staff.GradeID = applyOrder.GradeId; - } - var staffId = await Db.Insertable(staff).ExecuteReturnIdentityAsync(); + int staffId = 0; - if (staffId > 0) - { - entity.IsSyncToStaff = true; - entity.StaffId = staffId; - await Update(entity, ["IsSyncToStaff", "StaffId"]); + await Db.Ado.BeginTranAsync(); - #region 家庭关系 - var familys = await _ghrh_ResumeHomeServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); - for (int i = 0; i < familys.Count; i++) - { - var family = familys[i]; - var staffEduBG = new Ghra_StaffSocialRelation() - { - StaffID = staffId, - RelationType = family.RelationType, - RelationName = family.RelationName, - IDCardNo = family.IDCardNo, - Gender = family.Gender, - Birthday = family.Birth, - CompanyName = family.WorkCompany, - //DeptName = family.WorkCompany, - RelationAddress = family.RelationAddress, - RelationTel = family.Telephone, - Reverse1 = family.RelationAge, - RemarkSz = family.RemarkSz - }; - var staffSocialRelation = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); - var attachments = await Db.Queryable().Where(x => x.TableName == family.Id.ObjToString()).ToListAsync(); - if (attachments.Any()) + #region 人事资料 + Dictionary dict = new(); + formColumns.Where(x => x.GroupType == "Base") + .ToList() + .ForEach(x => { - attachments.ForEach(x => - { - x.CreateTime = DateTime.Now; - x.TableName = "Ghra_StaffSocialRelation"; - x.StaffID = staffId; - x.TableKeyID = staffSocialRelation; - }); - await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); - } + dict.Add(x.MapColumnName, entity.GetPropertyValue(x.ColumnName)); + }); + + dict.Add("IsRelease", 1); + dict.Add("SortNo", 1); + dict.Add("IsDefault", 1); + + if (type == "Fast") + { + dict.Add("IsEnable", 2); + dict.Add("ToDoType", "ToDo"); } + else + dict.Add("IsEnable", 1); #endregion - #region 教育背景 - var educations = await _ghrh_ResumeEduBGServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + var applyOrder = await Db.Queryable().Where(x => x.ResumeId == id).FirstAsync(); + if (applyOrder != null) + { + dict.Add("DeptID", applyOrder.DeptId); + dict.Add("TitleID", applyOrder.TitleId); + dict.Add("JobID", applyOrder.JobId); + dict.Add("GradeID", applyOrder.GradeId); + } - for (int i = 0; i < educations.Count; i++) + if (dict.Count > 0) + staffId = await Db.Insertable(dict).AS("Ghra_Staff").ExecuteReturnIdentityAsync(); + if (staffId > 0) { - var education = educations[i]; - var staffEduBG = new Ghra_StaffEduBG() - { - StaffID = staffId, - BeginDate = education.BeginDate.ObjToString(), - EndDate = education.EndDate.ObjToString(), - SchoolName = education.SchoolName, - DeptName = education.DeptName, - DegreeLevel = education.DegreeLevel, - IsGraduate = education.IsGraduate == true ? 1 : 0, - RemarkSz = education.RemarkSz - }; - var staffEduBGId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); - var attachments = await Db.Queryable().Where(x => x.TableName == education.Id.ObjToString()).ToListAsync(); + entity.IsSyncToStaff = true; + entity.StaffId = staffId; + await Update(entity, ["IsSyncToStaff", "StaffId"]); + + #region 家庭关系 + var list = new List>(); - if (attachments.Any()) + var familys = await _ghrh_ResumeHomeServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + for (int i = 0; i < familys.Count; i++) { - attachments.ForEach(x => + var family = familys[i]; + var staffEduBG = new Ghra_StaffSocialRelation() { - x.CreateTime = DateTime.Now; - x.TableName = "Ghra_StaffEduBG"; - x.StaffID = staffId; - x.TableKeyID = staffEduBGId; - }); - await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + StaffID = staffId, + RelationType = family.RelationType, + RelationName = family.RelationName, + IDCardNo = family.IDCardNo, + Gender = family.Gender, + Birthday = family.Birth, + CompanyName = family.WorkCompany, + //DeptName = family.WorkCompany, + RelationAddress = family.RelationAddress, + RelationTel = family.Telephone, + Reverse1 = family.RelationAge, + RemarkSz = family.RemarkSz + }; + var staffSocialRelation = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); + var attachments = await Db.Queryable().Where(x => x.TableName == family.Id.ObjToString()).ToListAsync(); + + if (attachments.Any()) + { + attachments.ForEach(x => + { + x.CreateTime = DateTime.Now; + x.TableName = "Ghra_StaffSocialRelation"; + x.StaffID = staffId; + x.TableKeyID = staffSocialRelation; + }); + await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + } } - } - #endregion + #endregion - #region 工作经历 - var workExps = await _ghrh_ResumeWorkExpServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); - for (int i = 0; i < workExps.Count; i++) - { - var workExp = workExps[i]; - var staffEduBG = new Ghra_StaffWorkExp() - { - StaffID = staffId, - BeginDate = workExp.BeginDate, - EndDate = workExp.EndDate, - CompanyName = workExp.CompanyName, - TitleName = workExp.TitleName, - //IsCompany = workExp.IsCompany, - SalaryAmount = workExp.SalaryAmount, - SeparationReason = workExp.SeparationReason, - RemarkSz = workExp.RemarkSz - }; - var staffworkExpId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); - var attachments = await Db.Queryable().Where(x => x.TableName == workExp.Id.ObjToString()).ToListAsync(); + #region 教育背景 + var educations = await _ghrh_ResumeEduBGServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); - if (attachments.Any()) + for (int i = 0; i < educations.Count; i++) { - attachments.ForEach(x => + var education = educations[i]; + var staffEduBG = new Ghra_StaffEduBG() { - x.CreateTime = DateTime.Now; - x.TableName = "Ghra_StaffWorkExp"; - x.StaffID = staffId; - x.TableKeyID = staffworkExpId; - }); - await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + StaffID = staffId, + BeginDate = education.BeginDate.ObjToString(), + EndDate = education.EndDate.ObjToString(), + SchoolName = education.SchoolName, + DeptName = education.DeptName, + DegreeLevel = education.DegreeLevel, + IsGraduate = education.IsGraduate == true ? 1 : 0, + RemarkSz = education.RemarkSz + }; + var staffEduBGId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); + var attachments = await Db.Queryable().Where(x => x.TableName == education.Id.ObjToString()).ToListAsync(); + + if (attachments.Any()) + { + attachments.ForEach(x => + { + x.CreateTime = DateTime.Now; + x.TableName = "Ghra_StaffEduBG"; + x.StaffID = staffId; + x.TableKeyID = staffEduBGId; + }); + await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + } } - } - #endregion + #endregion - #region 证件 - var Licences = await _ghrh_ResumeLicenceServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); - for (int i = 0; i < Licences.Count; i++) - { - var licence = Licences[i]; - var staffEduBG = new Ghra_StaffLicence() + #region 工作经历 + var workExps = await _ghrh_ResumeWorkExpServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + for (int i = 0; i < workExps.Count; i++) { - StaffID = staffId, - BeginDate = licence.BeginDate, - EndDate = licence.EndDate, - LicenceName = licence.LicenceName, - //LicenceLevel = licence.LicenceLevel, - //IsCompany = workExp.IsCompany, - LicenceNo = licence.LicenceNo, - //SeparationReason = licence.SeparationReason, - RemarkSz = licence.RemarkSz - }; - var staffLicenceId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); - var attachments = await Db.Queryable().Where(x => x.TableName == licence.Id.ObjToString()).ToListAsync(); + var workExp = workExps[i]; + var staffEduBG = new Ghra_StaffWorkExp() + { + StaffID = staffId, + BeginDate = workExp.BeginDate, + EndDate = workExp.EndDate, + CompanyName = workExp.CompanyName, + TitleName = workExp.TitleName, + //IsCompany = workExp.IsCompany, + SalaryAmount = workExp.SalaryAmount, + SeparationReason = workExp.SeparationReason, + RemarkSz = workExp.RemarkSz + }; + var staffworkExpId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); + var attachments = await Db.Queryable().Where(x => x.TableName == workExp.Id.ObjToString()).ToListAsync(); + + if (attachments.Any()) + { + attachments.ForEach(x => + { + x.CreateTime = DateTime.Now; + x.TableName = "Ghra_StaffWorkExp"; + x.StaffID = staffId; + x.TableKeyID = staffworkExpId; + }); + await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + } + } + #endregion - if (attachments.Any()) + #region 证件 + var Licences = await _ghrh_ResumeLicenceServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + for (int i = 0; i < Licences.Count; i++) { - attachments.ForEach(x => + var licence = Licences[i]; + var staffEduBG = new Ghra_StaffLicence() { - x.CreateTime = DateTime.Now; - x.TableName = "Ghra_StaffLicence"; - x.StaffID = staffId; - x.TableKeyID = staffLicenceId; - }); - await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + StaffID = staffId, + BeginDate = licence.BeginDate, + EndDate = licence.EndDate, + LicenceName = licence.LicenceName, + //LicenceLevel = licence.LicenceLevel, + //IsCompany = workExp.IsCompany, + LicenceNo = licence.LicenceNo, + //SeparationReason = licence.SeparationReason, + RemarkSz = licence.RemarkSz + }; + var staffLicenceId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); + var attachments = await Db.Queryable().Where(x => x.TableName == licence.Id.ObjToString()).ToListAsync(); + + if (attachments.Any()) + { + attachments.ForEach(x => + { + x.CreateTime = DateTime.Now; + x.TableName = "Ghra_StaffLicence"; + x.StaffID = staffId; + x.TableKeyID = staffLicenceId; + }); + await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + } } - } - #endregion + #endregion - #region 简历培训记录 - var Trainings = await _ghrh_ResumeTrainingServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); - for (int i = 0; i < Trainings.Count; i++) - { - var training = Trainings[i]; - var staffEduBG = new Ghra_StaffTraining() + #region 简历培训记录 + var Trainings = await _ghrh_ResumeTrainingServices.QueryDto(x => x.ResumeId != null && x.ResumeId == id); + for (int i = 0; i < Trainings.Count; i++) { - StaffID = staffId, - BeginDate = training.BeginDate, - EndDate = training.EndDate, - TrainingOrgName = training.TrainingOrgName, - ClassHour = training.ClassHour, - IsPass = training.IsPass == true ? 1 : 0, - CourseName = training.CourseName, - //ClassCredit = training.ClassCredit, - Reverse1 = training.Reverse1, - RemarkSz = training.RemarkSz - }; - var staffTrainingId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); - var attachments = await Db.Queryable().Where(x => x.TableName == training.Id.ObjToString()).ToListAsync(); + var training = Trainings[i]; + var staffEduBG = new Ghra_StaffTraining() + { + StaffID = staffId, + BeginDate = training.BeginDate, + EndDate = training.EndDate, + TrainingOrgName = training.TrainingOrgName, + ClassHour = training.ClassHour, + IsPass = training.IsPass == true ? 1 : 0, + CourseName = training.CourseName, + //ClassCredit = training.ClassCredit, + Reverse1 = training.Reverse1, + RemarkSz = training.RemarkSz + }; + var staffTrainingId = await Db.Insertable(staffEduBG).ExecuteReturnIdentityAsync(); + var attachments = await Db.Queryable().Where(x => x.TableName == training.Id.ObjToString()).ToListAsync(); + + if (attachments.Any()) + { + attachments.ForEach(x => + { + x.CreateTime = DateTime.Now; + x.TableName = "Ghra_StaffTraining"; + x.StaffID = staffId; + x.TableKeyID = staffTrainingId; + }); + await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + } + } + #endregion - if (attachments.Any()) + #region 附件 + var attachments1 = await Db.Queryable().Where(x => x.TableName == id.ObjToString()).ToListAsync(); + if (attachments1.Any()) { - attachments.ForEach(x => + attachments1.ForEach(x => { x.CreateTime = DateTime.Now; - x.TableName = "Ghra_StaffTraining"; + x.TableName = "Ghra_staff"; x.StaffID = staffId; - x.TableKeyID = staffTrainingId; + x.TableKeyID = staffId; }); - await Db.Insertable(attachments).ExecuteReturnIdentityAsync(); + await Db.Insertable(attachments1).ExecuteReturnIdentityAsync(); } + #endregion } - #endregion + await Db.Ado.CommitTranAsync(); - #region 附件 - var attachments1 = await Db.Queryable().Where(x => x.TableName == id.ObjToString()).ToListAsync(); - if (attachments1.Any()) - { - attachments1.ForEach(x => - { - x.CreateTime = DateTime.Now; - x.TableName = "Ghra_staff"; - x.StaffID = staffId; - x.TableKeyID = staffId; - }); - await Db.Insertable(attachments1).ExecuteReturnIdentityAsync(); - } - #endregion + return true; + } + catch (Exception) + { + await Db.Ado.RollbackTranAsync(); + throw; } - return true; - } #endregion } \ No newline at end of file