From 14b599e18d6facdfa131a83319d928ea1e3fae26 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 24 Apr 2025 17:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=96=B0=E5=A2=9E=E5=AD=A6=E4=B9=A0=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=97=B6=E9=97=B4=E6=AE=B5=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20=E4=BF=AE=E6=94=B9=E8=AE=B2=E5=B8=88=E8=B4=B9?= =?UTF-8?q?=E7=94=A8=E7=94=B3=E8=AF=B7=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=BA?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AE=B2=E5=B8=88=E6=89=80=E5=B1=9E=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E7=AD=BE=E6=A0=B8=20=E8=80=83=E8=AF=95=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=9F=A5=E7=9C=8B=E8=80=83=E8=AF=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E6=AC=A1?= =?UTF-8?q?=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Common/Helper/DateTimeHelper.cs | 3 ++ .../Extend/Ghre_ExamRecordExtend.cs | 3 +- Tiobon.Core.Services/CommonServices.cs | 5 +++ .../Ghra/Ghra_StaffServices.cs | 2 +- .../Ghre/Ghre_CourseServices.cs | 2 +- .../Ghre/Ghre_ExamRecordServices.cs | 33 +++++++++++++++---- .../Ghre/Ghre_StudyRecordServices.cs | 21 ++++++------ 7 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Tiobon.Core.Common/Helper/DateTimeHelper.cs b/Tiobon.Core.Common/Helper/DateTimeHelper.cs index e0e85a96..d269489a 100644 --- a/Tiobon.Core.Common/Helper/DateTimeHelper.cs +++ b/Tiobon.Core.Common/Helper/DateTimeHelper.cs @@ -222,6 +222,9 @@ public class DateTimeHelper /// public static string ConvertToSecondString(object dateTime) { + if (dateTime == null) + return ""; + if (string.IsNullOrEmpty(Convert.ToString(dateTime))) { return ""; diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs index 9e941b7e..955ad132 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs @@ -121,7 +121,8 @@ public class ExamGroup { public long? GroupId { get; set; } public long? ExamRecordId { get; set; } - public DateTime? ExamTime { get; set; } + public string ExamTime { get; set; } + public decimal Score { get; set; } } public class CommentData diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 9a25182d..b53b1aac 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -4356,6 +4356,7 @@ public partial class CommonServices : BaseServices>, ICommon case "Apply": case "BatchApply": + #region 写入数据,并判断是否有错误 string json = param.jsonParam.ToString(); var dict = JsonHelper.JsonToObj(json); @@ -4363,6 +4364,10 @@ public partial class CommonServices : BaseServices>, ICommon //dict.RequestNo = await GenerateContinuousSequence("Ghrh_HumanRequest", "RequestNo", "R"); id = await Db.Insertable(dict).ExecuteReturnSnowflakeIdAsync(); + var StaffUserId = await Db.Queryable().Where(x => x.UserStaffID == dict.TeacherId).Select(x => x.UserId).FirstAsync(); + if (StaffUserId > 0) + param.userId = StaffUserId; + sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_TrainFeeApplyOrder_Boltone WHERE Id !='{id}' and len(Id) !=19"; var id1 = await Db.Ado.GetLongAsync(sql); sql = $"UPDATE Ghre_TrainFeeApplyOrder_Boltone SET Id={id1} WHERE Id ='{id}'"; diff --git a/Tiobon.Core.Services/Ghra/Ghra_StaffServices.cs b/Tiobon.Core.Services/Ghra/Ghra_StaffServices.cs index f9473a33..1d236bcf 100644 --- a/Tiobon.Core.Services/Ghra/Ghra_StaffServices.cs +++ b/Tiobon.Core.Services/Ghra/Ghra_StaffServices.cs @@ -61,7 +61,7 @@ public class Ghra_StaffServices : BaseServices().Where(x => x.ParentDeptID == entity.DeptId).FirstAsync(); + dept = await Db.Queryable().Where(x => x.DeptID == dept.ParentDeptID).FirstAsync(); if (dept != null) entity.ParentDeptName = dept.DeptName; } diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index edd304fa..7d48f07c 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -689,7 +689,7 @@ public class Ghre_CourseServices : BaseServices().Where(x => x.Id == groupId).FirstAsync(); + if (group != null) + { + group.Score = record.Score; + await Db.Updateable(group).UpdateColumns(it => new { it.Score }, true) + .ExecuteCommandAsync(); + } + return ServiceResult.OprateSuccess("提交成功!"); } @@ -882,15 +891,23 @@ public class Ghre_ExamRecordServices : BaseServices() - .OrderByDescending(x => x.ExamTime) - .Where(x => x.ExamRecordId == record.Id) + var Groups = await Db.Queryable() + .OrderByDescending(x => x.ExamTime) + .Where(x => x.ExamRecordId == record.Id) + .Select(x => new + { + GroupId = x.Id, + x.ExamRecordId, + ExamTime = x.ExamTime, + Score = x.Score + }).ToListAsync(); + extend.Groups = Groups .Select(x => new ExamGroup() { - GroupId = x.Id, + GroupId = x.GroupId, ExamRecordId = x.ExamRecordId, - ExamTime = x.ExamTime, - }).ToListAsync(); + ExamTime = x.ExamTime.ObjToString() + (x.Score != null ? $"({x.Score})" : ""), + }).ToList(); return ServiceResult.OprateSuccess("查询成功!", extend); } @@ -1158,6 +1175,10 @@ public class Ghre_ExamRecordServices : BaseServices new { it.Score }, true) + .ExecuteCommandAsync(); + #region 多次考试成绩认定 if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && (ScoreRecognition == "Highest" || ScoreRecognition == "Lowest")) { diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index b44d5cc6..21d0b76c 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -1,12 +1,9 @@ using Microsoft.Extensions.Logging; using MongoDB.Driver.Linq; using NPOI.HSSF.UserModel; -using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; using NPOI.SS.Util; using NPOI.XSSF.UserModel; -using Tiobon.Core.Model.Models; -using static System.Runtime.InteropServices.JavaScript.JSType; using static Tiobon.Core.DataAccess.ReportHelper; using static Tiobon.Core.Model.Consts; @@ -268,12 +265,6 @@ public class Ghre_StudyRecordServices : BaseServices Add(InsertGhre_StudyRecordInput entity) { - if (await Db.Queryable() - .WhereIF(!entity.CourseId.IsNullOrEmpty(), x => x.CourseId == entity.CourseId) - .WhereIF(!entity.CourseSceneId.IsNullOrEmpty(), x => x.CourseSceneId == entity.CourseSceneId) - .AnyAsync(x => x.StaffId == entity.StaffId)) - throw new Exception("该用户存在相同学习记录!"); - if (entity.BeginTime != null && entity.EndTime != null) { if (entity.EndTime < entity.BeginTime) @@ -287,6 +278,14 @@ public class Ghre_StudyRecordServices : BaseServices() + .WhereIF(!entity.CourseId.IsNullOrEmpty(), x => x.CourseId == entity.CourseId) + .WhereIF(!entity.CourseSceneId.IsNullOrEmpty(), x => x.CourseSceneId == entity.CourseSceneId) + .Where(x => (x.CourseBeginTime <= entity.CourseBeginTime && x.CourseEndTime >= entity.CourseBeginTime) || (x.CourseBeginTime <= entity.CourseEndTime && x.CourseEndTime >= entity.CourseEndTime)) + .AnyAsync(x => x.StaffId == entity.StaffId)) + throw new Exception("该用户存在相同学习记录!"); + + entity.StudyStatus = "HasFinish"; var snap = await Db.Queryable().FirstAsync(x => x.CourseId == entity.CourseId); @@ -719,8 +718,8 @@ public class Ghre_StudyRecordServices : BaseServices