From 7486b188969f2c18dd12863608bf121ec8e18687 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 22 May 2025 17:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=85=E9=80=89=E4=BF=AE=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=BC=82=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_StudyRuleController.cs | 13 ++++ Tiobon.Core.Api/Tiobon.Core.xml | 7 ++ .../Ghre/IGhre_StudyRuleServices.cs | 5 +- .../Ghre/Ghre_StudyRuleServices.cs | 68 +++++++++++++++---- 4 files changed, 76 insertions(+), 17 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_StudyRuleController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_StudyRuleController.cs index 11846789..14e89b1b 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_StudyRuleController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_StudyRuleController.cs @@ -11,4 +11,17 @@ public class Ghre_StudyRuleController : BaseController + /// 记录 + /// + /// + /// + [HttpPost("StaffIn")] + public async Task StaffIn(long id) => await _service.StaffIn(); + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 2ad69ed3..8661babf 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1509,6 +1509,13 @@ 必选修规则(Controller) + + + 记录 + + + + 必选修规则结果(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_StudyRuleServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_StudyRuleServices.cs index 9c071b6d..c10ac397 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_StudyRuleServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_StudyRuleServices.cs @@ -1,7 +1,4 @@ -using Tiobon.Core.IServices.BASE; -using Tiobon.Core.Model.Models; - -namespace Tiobon.Core.IServices; +namespace Tiobon.Core.IServices; /// /// 必选修规则(自定义服务接口) diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs index 9687ff4c..37babf05 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs @@ -342,6 +342,10 @@ public class Ghre_StudyRuleServices : BaseServices>(rule.JobId); + await Db.Deleteable().Where(x => x.StudyRuleId == ruleId && x.BeginTime == null).ExecuteCommandAsync(); + await Db.Deleteable().Where(x => x.StudyRuleId == ruleId).ExecuteCommandAsync(); + + #region 处理部门是否含下阶 var deptIds = new List(); if (rule.IsDeptLower == true && DeptIds.Any()) @@ -404,7 +408,7 @@ public class Ghre_StudyRuleServices : BaseServices ruleStaffIds.Contains(x.StaffID)) .ToListAsync(); - if (!staffs.IsNull()) + if (staffs.Any()) { var courseTime = Db.GetDate(); var snap = await Db.Queryable().FirstAsync(x => x.CourseId == rule.CourseId); @@ -414,8 +418,6 @@ public class Ghre_StudyRuleServices : BaseServices(); var insertExamStaffs = new List(); var insertResults = new List(); - await Db.Deleteable().Where(x => x.StudyRuleId == ruleId && x.BeginTime == null).ExecuteCommandAsync(); - await Db.Deleteable().Where(x => x.StudyRuleId == ruleId).ExecuteCommandAsync(); //var exam = await Db.Queryable() // .WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId) @@ -423,8 +425,8 @@ public class Ghre_StudyRuleServices : BaseServices x.Status == Consts.DicExamStatus.RELEASED); var exam = await Db.Queryable() - .Where(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED - && ((x.DateType == Consts.DicExamDateType.EXAM_DATE + .Where(x => x.Status == DIC_EXAM_STATUS.RELEASED + && ((x.DateType == DicExamDateType.EXAM_DATE && x.BeginTime.Value.Date <= DateTime.Now.Date && x.EndTime.Value.Date >= DateTime.Now.Date) || x.DateType == Consts.DicExamDateType.AFTER_HOW_LONG)) .WhereIF(!rule.CourseId.IsNull(), x => x.CourseId == rule.CourseId) .WhereIF(!rule.CourseSceneId.IsNull(), x => x.CourseSceneId == rule.CourseSceneId) @@ -465,7 +467,7 @@ public class Ghre_StudyRuleServices : BaseServices o == staff.StaffID).Any() ? $"生成成功,{month}月内入职员工" : "生成成功" + RemarkSz = inStaffIds.Where(o => o == staff.StaffID).Any() ? $"生成成功,{month}月内入职员工!" : "生成成功!" }); if (exam != null) @@ -478,13 +480,29 @@ public class Ghre_StudyRuleServices : BaseServices x.StaffID).ToList(); + + var recordIds = await Db.Queryable() + .Where(x => x.StudyRuleId == ruleId && !staffIds.Contains(x.StaffId.Value) && + x.StudyStatus != DIC_STUDY_RECORD_STUDY_STATUS.HAS_FINISH && x.Reverse9 != "异动转入选修") + .Select(x => x.Id).ToListAsync(); + if (recordIds.Any()) + await Db.Updateable() + .Where(x => recordIds.Contains(x.Id)) + .SetColumns(it => new Ghre_StudyRecord() { CourseType = "Elective", Reverse9 = "异动转入选修" }) + .ExecuteCommandAsync(); + #endregion + await Db.Ado.CommitTranAsync(); string sql = @"UPDATE A @@ -519,13 +551,23 @@ public class Ghre_StudyRuleServices : BaseServices().Where(x => x.Id == ruleId) - .SetColumns(it => new Ghre_StudyRule() { Result = E.Message })//类只能在表达示里面不能提取 + .SetColumns(it => new Ghre_StudyRule() { Result = E.Message }) .ExecuteCommandAsync(); } return true; } public async Task StaffIn() + { + var rules = await Db.Queryable().Where(x => x.TrainType != DIC_TRAINING_STUDY_RULE_TRAIN_TYPE.Year && x.TrainType != DIC_TRAINING_STUDY_RULE_TRAIN_TYPE.Orientation).ToListAsync(); + + for (int j = 0; j < rules.Count; j++) + { + await GenerateStaffStudyRecord(Db, rules[j].Id); + } + } + + public async Task StaffIn2() { var dt = Db.GetDate(); var depts = new List();