From f4da27596748108f99f45047967ebedd38488071 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Tue, 17 Dec 2024 15:55:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=85=A5=E5=BE=85=E5=8F=91Offer=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E5=AE=A1=E6=89=B9=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Services/CommonServices.cs | 13 +++++++------ .../Ghrh/Ghrh_OfferApplyOrderServices.cs | 4 +--- Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs | 2 +- .../Ghrh/Ghrh_YearHumanSettingsServices.cs | 7 +++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 54bdf24e..0e98ed01 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -3512,15 +3512,16 @@ public partial class CommonServices : BaseServices>, ICommon for (int i = 0; i < dict.Items.Count; i++) { var item = dict.Items[i]; + if (item.DeptId.IsNullOrEmpty()) + return ServiceResult.OprateFailed($"第{i + 1}行,部门不可为空"); if (item.TitleId.IsNullOrEmpty()) return ServiceResult.OprateFailed($"第{i + 1}行,岗位不可为空"); - if (item.JobId.IsNullOrEmpty()) - return ServiceResult.OprateFailed($"第{i + 1}行,职称不可为空"); - if (item.GradeId.IsNullOrEmpty()) - return ServiceResult.OprateFailed($"第{i + 1}行,职等不可为空"); - if (await Db.Queryable().AnyAsync(x => x.Year == item.Year && x.JobId == item.JobId && x.GradeId == item.GradeId && x.JobId == item.GradeId)) - return ServiceResult.OprateFailed($" {item.Year}年度,已存在相同岗位、职等、职称数据!"); + if (await Db.Queryable() + .WhereIF(item.GradeId.IsNotEmptyOrNull(), x => x.GradeId == item.GradeId) + .WhereIF(item.JobId.IsNotEmptyOrNull(), x => x.JobId == item.JobId) + .AnyAsync(x => x.Year == item.Year && x.DeptId == item.DeptId && x.TitleId == item.TitleId)) + return ServiceResult.OprateFailed($" {item.Year}年度,已存在相同数据!"); } #endregion diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs index 8e48a0dc..ed8721e6 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_OfferApplyOrderServices.cs @@ -1,6 +1,4 @@ -using Tiobon.Core.IServices; - -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 4303da49..76b76c5e 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_ResumeServices.cs @@ -2428,7 +2428,7 @@ END"; if (entity.Status != DIC_INTERVIEW_ORDER_STATUS.HasInterview || entity.Status != DIC_INTERVIEW_ORDER_STATUS.WaitRecommended) return ServiceResult.OprateFailed("只有在【已面试】、【待推荐】状态下,才能转入待发Offer!"); - if (await Db.Queryable().Where(x => x.WorkState == 0 && x.ResumeId == id).AnyAsync()) + if (await Db.Queryable().AnyAsync(x => x.WorkState == 0 && x.ResumeId == id)) return ServiceResult.OprateFailed("当前简历录用审批处于审批中,不可转入待发Offer!"); await UpdateResumeStatus(entity, DIC_INTERVIEW_ORDER_STATUS.WaitSendOffer); diff --git a/Tiobon.Core.Services/Ghrh/Ghrh_YearHumanSettingsServices.cs b/Tiobon.Core.Services/Ghrh/Ghrh_YearHumanSettingsServices.cs index 78bc4b76..2f4b4753 100644 --- a/Tiobon.Core.Services/Ghrh/Ghrh_YearHumanSettingsServices.cs +++ b/Tiobon.Core.Services/Ghrh/Ghrh_YearHumanSettingsServices.cs @@ -26,8 +26,11 @@ public class Ghrh_YearHumanSettingsServices : BaseServices().AnyAsync(x => x.Year == entity.Year && x.JobId == entity.JobId && x.GradeId == entity.GradeId && x.JobId == entity.GradeId)) - throw new Exception($" {entity.Year}年度,已存在相同岗位、职等、职称数据!"); + if (await Db.Queryable() + .WhereIF(entity.GradeId.IsNotEmptyOrNull(), x => x.GradeId == entity.GradeId) + .WhereIF(entity.JobId.IsNotEmptyOrNull(), x => x.JobId == entity.JobId) + .AnyAsync(x => x.Year == entity.Year && x.DeptId == entity.DeptId && x.TitleId == entity.TitleId)) + throw new Exception($" {entity.Year}年度,已存在相同数据!"); var result = await base.Add(entity);