From e281e248acb320f8e0ff591670710be936414a53 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 21 Apr 2025 14:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=8A=80=E8=83=BD=5F?= =?UTF-8?q?=E5=AE=9D=E8=BF=9E=E9=80=9A=20(=E6=9C=8D=E5=8A=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_TitleSkill_BoltoneServices.cs | 86 +++++++++++++------ 1 file changed, 62 insertions(+), 24 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_TitleSkill_BoltoneServices.cs b/Tiobon.Core.Services/Ghre/Ghre_TitleSkill_BoltoneServices.cs index d03f2e5a..5de8e889 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_TitleSkill_BoltoneServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_TitleSkill_BoltoneServices.cs @@ -1,4 +1,5 @@ using MySqlX.XDevAPI.Common; +using NPOI.OpenXmlFormats; using NPOI.SS.Formula.Functions; using OfficeOpenXml.FormulaParsing; using Org.BouncyCastle.Utilities; @@ -120,7 +121,40 @@ public class Ghre_TitleSkill_BoltoneServices : BaseServices new + { + x.DeptId, + x.TitleId + }).Distinct().ToList(); + + string condition = "1=1"; + + if (group1.Any()) + { + condition += "AND ("; + var i = 0; + group1.ForEach(x => + { + if (i == 0) + condition += $"(DeptId={x.DeptId} AND TitleId={x.TitleId})"; + else + condition += $"OR (DeptId={x.DeptId} AND TitleId={x.TitleId})"; + + i++; + }); + condition += ")"; + } + + var result2 = await _staffServices.QueryFilterPage(filter, condition); var DT_TableDataT1 = result2.result.DT_TableDataT1; @@ -131,16 +165,9 @@ public class Ghre_TitleSkill_BoltoneServices : BaseServices(); for (int i = 0; i < result2.result.DT_TableDataT1.Count; i++) { var column = result2.result.DT_TableDataT1[i]; @@ -155,25 +182,36 @@ public class Ghre_TitleSkill_BoltoneServices : BaseServices + for (int j = 0; j < titleSkills.result.DT_TableDataT1.Count; j++) { + var item = titleSkills.result.DT_TableDataT1[j]; + if (column.DeptID != item.DeptId || column.TitleID != item.TitleId) + continue; var key = item.CourseId + "_" + item.DeptId + "_" + item.TitleId + "_" + item.RequiredElective; - //if (dict.ContainsKey(column.Id.ObjToString())) - //{ - // var ids = dict[column.Id.ObjToString()]; - // if (ids.Where(id => id == x.TitleID).Any()) - // item.Add(new JProperty("Title_" + x.TitleNo, "✔")); - // else - // item.Add(new JProperty("Title_" + x.TitleNo, "")); - //} - //else - item1.Add(new JProperty(key, "★")); - }); + + var value = "×"; + + if (await src.Where(x => + x.CourseId == item.CourseId && + x.StaffId == column.StaffID && + x.StudyStatus == "NoFinish" && + ((x.CourseBeginTime >= item.EffectiveDate && x.CourseBeginTime <= item.ExpiryDate) || (x.CourseEndTime >= item.EffectiveDate && x.CourseEndTime <= item.ExpiryDate)) + ).AnyAsync()) + value = "◑"; + if (await src.Where(x => + x.CourseId == item.CourseId && + x.StaffId == column.StaffID && + x.StudyStatus == "HasFinish" && + ((x.CourseBeginTime >= item.EffectiveDate && x.CourseBeginTime <= item.ExpiryDate) || (x.CourseEndTime >= item.EffectiveDate && x.CourseEndTime <= item.ExpiryDate)) + ).AnyAsync()) + value = "☆"; + item1.Add(new JProperty(key, value)); + } columns.Add(item1); }