From 0e9f1e361edebeda908a27d0cda7afd70d9d8f63 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 12 Sep 2024 15:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=85=E9=80=89=E4=BF=AE=E8=A7=84=E5=88=99?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=95=B0=E6=8D=AE=E6=96=B0=E5=A2=9E=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=83=A8=E9=97=A8=E6=98=AF=E5=90=A6=E5=90=AB=E4=B8=8B?= =?UTF-8?q?=E9=98=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_StudyRuleServices.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs index fc91c675..8e8866ee 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using System.Data; using MongoDB.Driver.Linq; using Newtonsoft.Json.Linq; @@ -328,6 +329,24 @@ public class Ghre_StudyRuleServices : BaseServices>(rule.JobId); + #region 处理部门是否含下阶 + var deptIds = new List(); + if (rule.IsDeptLower == true && DeptIds.Any()) + { + var depts = new List(); + depts = await GetDeptList(depts); + + foreach (var dept in DeptIds) + { + var items = await GetDeptList(depts, dept); + deptIds.AddRange(items.Select(x => x.DeptID).ToList()); + } + deptIds = deptIds.Distinct().ToList(); + if (deptIds.Any()) + DeptIds.AddRange(deptIds); + } + #endregion + var ruleStaffs = await Db.Queryable().Where(x => x.StudyRuleId == ruleId).ToListAsync(); await Db.Updateable().Where(x => x.StudyRuleId == ruleId && x.IsEnable == 1) @@ -469,6 +488,8 @@ public class Ghre_StudyRuleServices : BaseServices(); + depts = await GetDeptList(depts); var rules = await Db.Queryable().Where(x => x.TrainType != "PreWork" && x.TrainType != "Orientation").ToListAsync(); for (int j = 0; j < rules.Count; j++) @@ -491,6 +512,21 @@ public class Ghre_StudyRuleServices : BaseServices>(rule.JobId); + #region 处理部门是否含下阶 + var deptIds = new List(); + if (rule.IsDeptLower == true && DeptIds.Any()) + { + foreach (var dept in DeptIds) + { + var items = await GetDeptList(depts, dept); + deptIds.AddRange(items.Select(x => x.DeptID).ToList()); + } + deptIds = deptIds.Distinct().ToList(); + if (deptIds.Any()) + DeptIds.AddRange(deptIds); + } + #endregion + var staffs = await Db.Queryable() .Where(x => x.Indate != null && x.Indate.Value.Date == dt.Date) .WhereIF(ZoneIds.Any(), x => ZoneIds.Contains(x.ZoneID))