From d4bb8e7db0ff0c26e0d93ff9d7035de91b551dc0 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 15 Aug 2024 17:12:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=BE=E7=A8=8B=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E8=AF=BE=E4=BB=B6=EF=BC=8C=E5=B0=86=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?id=E5=90=8C=E6=AD=A5=E8=87=B3=E8=AF=BE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_CourseServices.cs | 12 +++++++ .../Ghre/Ghre_ExamServices.cs | 36 +++++++++++++++++++ Tiobon.Core/Tiobon.Core.Model.xml | 13 ++++--- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index e2617b0c..eaa51200 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -321,6 +321,18 @@ public class Ghre_CourseServices : BaseServices().Where(x => x.CourseIds.Contains(id.ToString()) && x.Id != id).ToListAsync(); + for (int j = 0; j < wares.Count; j++) + { + var courseIds2 = new List(); + if (!string.IsNullOrWhiteSpace(wares[j].CourseIds)) + courseIds2 = JsonConvert.DeserializeObject>(wares[j].CourseIds); + courseIds2 = courseIds2.Where(x => x != id).ToList(); + wares[j].CourseIds = JsonConvert.SerializeObject(courseIds2); + } + await Db.Updateable(wares).UpdateColumns(it => new { it.CourseIds }).ExecuteCommandAsync(); + var ware = await Db.Queryable().FirstAsync(x => x.Id == entity.CourseWareId); if (ware != null) { diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 87c8d2b8..1bc10b1c 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -1687,6 +1687,42 @@ public class Ghre_ExamServices : BaseServices new { it.StudyStatus, it.RemarkSz }).ExecuteCommandAsync(); } } + + var Ghre_Courses = await Db.Queryable().ToListAsync(); + for (int i = 0; i < Ghre_Courses.Count; i++) + { + #region 课程ID 同步至课件 + if (!Ghre_Courses[i].CourseWareId.IsNull()) + { + var wares = await Db.Queryable().Where(x => x.CourseIds.Contains(Ghre_Courses[i].Id.ToString()) && x.Id != Ghre_Courses[i].CourseWareId).ToListAsync(); + for (int j = 0; j < wares.Count; j++) + { + var courseIds2 = new List(); + if (!string.IsNullOrWhiteSpace(wares[j].CourseIds)) + courseIds2 = JsonConvert.DeserializeObject>(wares[j].CourseIds); + courseIds2 = courseIds2.Where(x=>x!= Ghre_Courses[i].Id).ToList(); + wares[j].CourseIds = JsonConvert.SerializeObject(courseIds2); + } + await Db.Updateable(wares).UpdateColumns(it => new { it.CourseIds }).ExecuteCommandAsync(); + + var ware = await Db.Queryable().FirstAsync(x => x.Id == Ghre_Courses[i].CourseWareId); + if (ware != null) + { + var courseIds2 = new List(); + if (!string.IsNullOrWhiteSpace(ware.CourseIds)) + courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); + + if (!courseIds2.Any(x => x == Ghre_Courses[i].Id)) + { + courseIds2.Add(Ghre_Courses[i].Id); + + ware.CourseIds = JsonConvert.SerializeObject(courseIds2); + await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); + } + } + } + #endregion + } return ServiceResult.OprateSuccess("执行成功!"); } } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index e6b8d952..0bfa4d28 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -13557,22 +13557,22 @@ 培训记录-课程状态-已结束 - + 培训记录-学习状态 - + 未参与 - + 未完成 - + 已完成 @@ -13597,6 +13597,11 @@ 考试结束 + + + 缺考系统结束 + + 考试记录-评分状态