From 1f161eba9d90dd9be8e31a0a17e0dc98638d0487 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 1 Aug 2024 14:46:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Tiobon.Core.Model.xml | 35 ++++++++++++ Tiobon.Core.Model/Consts.cs | 53 ++++++++++++++++++- .../Ghre/Ghre_ExamRecordServices.cs | 28 +++++----- .../Ghre/Ghre_StudyRecordServices.cs | 6 +-- .../Ghre/Ghre_StudyRuleServices.cs | 37 +++++++------ Tiobon.Core/Tiobon.Core.Model.xml | 48 +++++++++++++++-- 6 files changed, 166 insertions(+), 41 deletions(-) diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 3ba97531..45be744a 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -12662,6 +12662,41 @@ 培训记录-学习状态-已完成 + + + 考试记录-状态 + + + + + 待考试 + + + + + 考试中 + + + + + 考试结束 + + + + + 考试记录-评分状态 + + + + + 评分 + + + + + 已评分 + + 无任何权限 diff --git a/Tiobon.Core.Model/Consts.cs b/Tiobon.Core.Model/Consts.cs index c6ff9829..aaf25804 100644 --- a/Tiobon.Core.Model/Consts.cs +++ b/Tiobon.Core.Model/Consts.cs @@ -41,8 +41,8 @@ public class Consts /// /// 学完多久 /// - public const string AFTER_HOW_LONG = "AfterHowLong"; - } + public const string AFTER_HOW_LONG = "AfterHowLong"; + } #endregion #region 考试管理-关联类型 @@ -89,4 +89,53 @@ public class Consts #endregion + + #region 考试记录 + + #region 考试记录-状态 + /// + /// 考试记录-状态 + /// + public static class DIC_EXAM_RECORD_STATUS + { + /// + /// 待考试 + /// + public const string WAIT = "Wait"; + + + /// + /// 考试中 + /// + public const string EXAMING = "Examing"; + + /// + /// 考试结束 + /// + public const string EXAM_END = "ExamEnd"; + } + + + #endregion + + #region 考试记录-评分状态 + /// + /// 考试记录-评分状态 + /// + public static class DIC_EXAM_RECORD_SCORE_STATUS + { + /// + /// 评分 + /// + public const string NO_SCORE = "NoScore"; + + /// + /// 已评分 + /// + public const string HAS_SCORE = "HasScore"; + } + + #endregion + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index 3cfa00e9..95fc3335 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -176,7 +176,7 @@ public class Ghre_ExamRecordServices : BaseServices x.TaxisNo) .Where(x => x.ExamRecordDetailId != null && detailIds.Contains(x.ExamRecordDetailId.Value)) .ToListAsync(); - if (record.ScoreStatus == "NoScore") + if (record.ScoreStatus == Consts.DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE) await ExamHelper.SystemMarkAsync(Db, record, details, recordAnswers); var exampaper = await Db.Queryable().FirstAsync(x => x.Id == record.ExamPaperId); @@ -303,7 +303,7 @@ public class Ghre_ExamRecordServices : BaseServices(sql); - if (record.ScoreStatus == "NoScore") + if (record.ScoreStatus == Consts.DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE) extend.CommentData.IsFirstTime = true; extend.CommentData.Comment = record.Comment; @@ -326,7 +326,7 @@ public class Ghre_ExamRecordServices : BaseServices x.Id == examRecordId); record.Score = extend.StaffInfo.StaffScore; - record.ScoreStatus = "HasScore"; + record.ScoreStatus = Consts.DIC_EXAM_RECORD_SCORE_STATUS.HAS_SCORE; record.Comment = extend.CommentData.Comment; var details = await Db.Queryable().Where(x => x.ExamRecordId == record.Id).ToListAsync(); @@ -395,7 +395,7 @@ public class Ghre_ExamRecordServices : BaseServices.OprateFailed("该门课程尚未开启考试,清联系HR !"); + return ServiceResult.OprateFailed("该门课程尚未开启考试,请联系HR !"); var insrt = new InsertGhre_ExamRecordInput() { @@ -406,8 +406,8 @@ public class Ghre_ExamRecordServices : BaseServices(filter.pageNum, total, filter.pageSize, entitys); diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs index 3f136115..8016be21 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs @@ -200,8 +200,7 @@ public class Ghre_StudyRuleServices : BaseServices().FirstAsync(x => x.Id == ruleId); - - + var ruleStaffs = await Db.Queryable().Where(x => x.StudyRuleId == ruleId).ToListAsync(); await Db.Updateable().Where(x => x.StudyRuleId == ruleId && x.IsEnable == 1) @@ -211,22 +210,20 @@ public class Ghre_StudyRuleServices : BaseServices x.StaffId).ToList(); var staffs = await Db.Queryable() - .WhereIF(rule.ZoneId != null, x => x.ZoneID == rule.ZoneId) - .WhereIF(rule.DeptId != null, x => x.DeptID == rule.DeptId) - .WhereIF(rule.TitleId != null, x => x.TitleID == rule.TitleId) - .WhereIF(rule.GradeId != null, x => x.GradeID == rule.GradeId) - .WhereIF(rule.JobId != null, x => x.JobID == rule.JobId) - .WhereIF(ruleStaffIds != null && ruleStaffIds.Any(), x => ruleStaffIds.Contains(x.StaffID)) - .WhereIF(rule.GradeId != null, x => x.GradeID == rule.GradeId) + .WhereIF(!rule.ZoneId.IsNull(), x => x.ZoneID == rule.ZoneId) + .WhereIF(!rule.DeptId.IsNull(), x => x.DeptID == rule.DeptId) + .WhereIF(!rule.TitleId.IsNull(), x => x.TitleID == rule.TitleId) + .WhereIF(!rule.GradeId.IsNull(), x => x.GradeID == rule.GradeId) + .WhereIF(!rule.JobId.IsNull(), x => x.JobID == rule.JobId) + .WhereIF(!ruleStaffIds.IsNull() && ruleStaffIds.Any(), x => ruleStaffIds.Contains(x.StaffID)) + .WhereIF(!rule.GradeId.IsNull(), x => x.GradeID == rule.GradeId) .ToListAsync(); - if (staffs != null) + if (!staffs.IsNull()) { DateTime courseTime = Db.GetDate(); var snap = await Db.Queryable().FirstAsync(x => x.CourseId == rule.CourseId); - - if (staffs.Any()) { var inserts = new List(); @@ -235,10 +232,18 @@ public class Ghre_StudyRuleServices : BaseServices().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) + // .WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId) + // .FirstAsync(x => x.Status == Consts.DicExamStatus.RELEASED); + var exam = await Db.Queryable() - .WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId) - .WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId) - .FirstAsync(x => x.Status == Consts.DicExamStatus.RELEASED); + .Where(x => x.Status == Consts.DicExamStatus.RELEASED + && ((x.DateType == Consts.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) + .FirstAsync(); for (int i = 0; i < staffs.Count; i++) { @@ -307,10 +312,8 @@ public class Ghre_StudyRuleServices : BaseServices().Where(x => x.Id == ruleId) .SetColumns(it => new Ghre_StudyRule() { Result = rule.Result })//类只能在表达示里面不能提取 .ExecuteCommandAsync(); diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index 8953e5b7..45be744a 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -12612,14 +12612,19 @@ 已归档 - + - 考试管理-日期类型-考试区间 + 考试管理-日期类型 - + - 考试管理-日期类型-学完多久 + 时间区间 + + + + + 学完多久 @@ -12657,6 +12662,41 @@ 培训记录-学习状态-已完成 + + + 考试记录-状态 + + + + + 待考试 + + + + + 考试中 + + + + + 考试结束 + + + + + 考试记录-评分状态 + + + + + 评分 + + + + + 已评分 + + 无任何权限