diff --git a/Tiobon.Core.Common/DB/Aop/SqlsugarAop.cs b/Tiobon.Core.Common/DB/Aop/SqlsugarAop.cs index 707db21d..3995b5c4 100644 --- a/Tiobon.Core.Common/DB/Aop/SqlsugarAop.cs +++ b/Tiobon.Core.Common/DB/Aop/SqlsugarAop.cs @@ -93,7 +93,7 @@ public static class SqlSugarAop var dyCreateBy = getType.GetProperty("CreateBy"); var dyCreateTime = getType.GetProperty("CreateTime"); BasePoco ent = entityInfo.EntityValue as BasePoco; - if (ent.Id == 0) + if (ent != null && ent.Id == 0) ent.Id = SnowFlakeSingle.Instance.NextId(); if (App.User?.ID > 0 && dyCreateBy != null && dyCreateBy.GetValue(entityInfo.EntityValue) == null) { diff --git a/Tiobon.Core.Common/Helper/DateTimeHelper.cs b/Tiobon.Core.Common/Helper/DateTimeHelper.cs index 65e59b10..e0e85a96 100644 --- a/Tiobon.Core.Common/Helper/DateTimeHelper.cs +++ b/Tiobon.Core.Common/Helper/DateTimeHelper.cs @@ -62,7 +62,7 @@ public class DateTimeHelper return ConvertToYearString((DateTime)dateTime); } /// - /// 格式化DateTime类型为字符串类型,精确到月,如:2008/01 + /// 格式化DateTime类型为字符串类型,精确到月,如:2008-01 /// /// /// @@ -72,10 +72,10 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM"); + return dateTime.ToString(@"yyyy\-MM"); } /// - /// 格式化object类型为字符串类型,精确到月,如:2008/01 + /// 格式化object类型为字符串类型,精确到月,如:2008-01 /// /// /// @@ -88,7 +88,7 @@ public class DateTimeHelper return ConvertToMonthString((DateTime)dateTime); } /// - /// 格式化DateTime类型为字符串类型,精确到天,如:2008/01/01 + /// 格式化DateTime类型为字符串类型,精确到天,如:2008-01-01 /// /// /// @@ -98,10 +98,10 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM\/dd"); + return dateTime.ToString(@"yyyy\-MM\-dd"); } /// - /// 格式化DateTime类型为字符串类型,精确到天,如:2008/01/01 + /// 格式化DateTime类型为字符串类型,精确到天,如:2008-01-01 /// /// /// @@ -119,7 +119,7 @@ public class DateTimeHelper } /// - /// 格式化DateTime类型为字符串类型,精确到小时,如:2008/01/01 18 + /// 格式化DateTime类型为字符串类型,精确到小时,如:2008-01-01 18 /// /// /// @@ -129,10 +129,10 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM\/dd HH"); + return dateTime.ToString(@"yyyy\-MM\-dd HH"); } /// - /// 格式化object类型为字符串类型,精确到小时,如:2008/01/01 18 + /// 格式化object类型为字符串类型,精确到小时,如:2008-01-01 18 /// /// /// @@ -146,7 +146,7 @@ public class DateTimeHelper } /// - /// 格式化object类型为字符串类型,精确到天,如:2008/01/01 + /// 格式化object类型为字符串类型,精确到天,如:2008-01-01 /// /// /// @@ -162,7 +162,7 @@ public class DateTimeHelper } /// - /// 格式化DateTime类型为字符串类型,精确到分钟,如:2008/01/01 18:09 + /// 格式化DateTime类型为字符串类型,精确到分钟,如:2008-01-01 18:09 /// /// /// @@ -172,11 +172,11 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM\/dd HH:mm"); + return dateTime.ToString(@"yyyy\-MM\-dd HH:mm"); } /// - /// 格式化object类型为字符串类型,精确到分钟,如:2008/01/01 18:09 + /// 格式化object类型为字符串类型,精确到分钟,如:2008-01-01 18:09 /// /// /// @@ -190,7 +190,7 @@ public class DateTimeHelper } /// - /// 格式化DateTime类型为字符串类型,精确到秒,如:2008/01/01 18:09:20 + /// 格式化DateTime类型为字符串类型,精确到秒,如:2008-01-01 18:09:20 /// /// /// @@ -200,7 +200,7 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM\/dd HH:mm:ss"); + return dateTime.ToString(@"yyyy\-MM\-dd HH:mm:ss"); } /// /// 格式化DateTime类型为字符串类型,精确到秒,如:20080101180920 @@ -216,7 +216,7 @@ public class DateTimeHelper return dateTime.ToString(@"yyyyMMddHHmmss"); } /// - /// 格式化object类型为字符串类型,精确到秒,如:2008/01/01 18:09:20 + /// 格式化object类型为字符串类型,精确到秒,如:2008-01-01 18:09:20 /// /// /// @@ -310,7 +310,7 @@ public class DateTimeHelper } /// - /// 格式化DateTime类型为字符串类型,如:2020/05 + /// 格式化DateTime类型为字符串类型,如:2020-05 /// /// /// @@ -320,10 +320,10 @@ public class DateTimeHelper { return ""; } - return dateTime.ToString(@"yyyy\/MM"); + return dateTime.ToString(@"yyyy\-MM"); } /// - /// 格式化object类型为字符串类型,如:2020/05 + /// 格式化object类型为字符串类型,如:2020-05 /// /// /// diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs index 01c1d8c3..a5389a09 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_HumanRequestServices.cs @@ -191,22 +191,25 @@ WHERE A.IsEnable = 1 AND A.Id = {entitys[i].YearHumanId}"); public override async Task QueryById(object objId) { var result = await base.QueryById(objId); - result.DeptName = (await Db.Queryable().FirstAsync(o => result.DeptId == o.DeptID))?.DeptName; - if (result.TitleId.IsNotEmptyOrNull()) - result.TitleName = (await Db.Queryable().FirstAsync(o => result.TitleId == o.TitleID))?.TitleName; - - #region 返回部门负责人信息 - var dept = await Db.Queryable().Where(x => x.DeptID == result.DeptId).FirstAsync(); - if (dept != null) + if (result != null) { - var staff = await Db.Queryable().Where(x => x.StaffID == dept.DeptManagerID).FirstAsync(); - if (staff != null) + result.DeptName = (await Db.Queryable().FirstAsync(o => result.DeptId == o.DeptID))?.DeptName; + if (result.TitleId.IsNotEmptyOrNull()) + result.TitleName = (await Db.Queryable().FirstAsync(o => result.TitleId == o.TitleID))?.TitleName; + + #region 返回部门负责人信息 + var dept = await Db.Queryable().Where(x => x.DeptID == result.DeptId).FirstAsync(); + if (dept != null) { - result.DeptManagerID = staff.StaffID; - result.DeptManagerEmail = staff.Email; + var staff = await Db.Queryable().Where(x => x.StaffID == dept.DeptManagerID).FirstAsync(); + if (staff != null) + { + result.DeptManagerID = staff.StaffID; + result.DeptManagerEmail = staff.Email; + } } + #endregion } - #endregion return result; } diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_InterviewRecordServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_InterviewRecordServices.cs index fb5407ad..161699fb 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_InterviewRecordServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_InterviewRecordServices.cs @@ -1,6 +1,4 @@ -using MySqlX.XDevAPI.Common; - -namespace Tiobon.Core.Services; +namespace Tiobon.Core.Services; /// /// 面试记录 (服务) diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs index 1531ff49..2ce41958 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -1316,6 +1316,24 @@ A.DataType, A.ColumnType, A.IsRequired, A.DataSourceType, A.DataSource, A.DataSo } #endregion resume.Base.Education = resume.Base.EduDegree; + + #region 计算工作年限 + var days = 0; + if (resume.WorkExp != null && resume.WorkExp.Any()) + { + resume.WorkExp.ForEach(x => + { + if (x.BeginDate != null && x.EndDate != null && x.EndDate > x.BeginDate) + { + var difference = x.EndDate.Value - x.BeginDate.Value; + days += difference.TotalDays.ObjToInt(); + } + }); + } + + resume.Base.WorkYears = days / 365; + #endregion + await base.Update(id, resume.Base); await _ghrh_ResumeHomeServices.Delete(x => x.ResumeId != null && x.ResumeId == id);//家庭关系 @@ -3050,12 +3068,12 @@ WHERE A.IsEnable = 1 AND C.IsEnable = 1 { var request = await _ghrh_HumanRequestServices.QueryById(order.RequestId); result.RequestId = order.RequestId; - result.DeptName = request.DeptName; - result.TitleName = request.TitleName; - result.ResumeCount = request.RequestCount; - result.RecommendCount = request.RecommendCount; - result.InterviewCount = request.InterviewCount; - result.OfferCount = request.OfferCount; + result.DeptName = request?.DeptName; + result.TitleName = request?.TitleName; + result.ResumeCount = request?.RequestCount; + result.RecommendCount = request?.RecommendCount; + result.InterviewCount = request?.InterviewCount; + result.OfferCount = request?.OfferCount; } else {