diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index b0cc0dde..d06e0326 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -5762,6 +5762,26 @@
培训记录 (Dto.EditInput)
+
+
+ 得分
+
+
+
+
+ 调整得分
+
+
+
+
+ 考试日期
+
+
+
+
+ 是否合格
+
+
必选修规则 (Dto.EditInput)
@@ -5967,6 +5987,26 @@
培训记录 (Dto.InsertInput)
+
+
+ 得分
+
+
+
+
+ 调整得分
+
+
+
+
+ 考试日期
+
+
+
+
+ 是否合格
+
+
必选修规则 (Dto.InsertInput)
@@ -13322,6 +13362,11 @@
考试时长
+
+
+ 是否合格
+
+
必选修规则(Dto.View)
diff --git a/Tiobon.Core.Model/Edit/Ghre/Ghre_StudyRecord.Dto.EditInput.cs b/Tiobon.Core.Model/Edit/Ghre/Ghre_StudyRecord.Dto.EditInput.cs
index ae83f2a3..db661598 100644
--- a/Tiobon.Core.Model/Edit/Ghre/Ghre_StudyRecord.Dto.EditInput.cs
+++ b/Tiobon.Core.Model/Edit/Ghre/Ghre_StudyRecord.Dto.EditInput.cs
@@ -23,5 +23,25 @@ namespace Tiobon.Core.Model.Models
///
public class EditGhre_StudyRecordInput : Ghre_StudyRecordBase
{
+
+ ///
+ /// 得分
+ ///
+ public decimal? Score { get; set; }
+
+ ///
+ /// 调整得分
+ ///
+ public decimal? AdjustScore { get; set; }
+
+ ///
+ /// 考试日期
+ ///
+ public DateTime? ExamDate { get; set; }
+
+ ///
+ /// 是否合格
+ ///
+ public bool? IsPass { get; set; }
}
}
diff --git a/Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRecord.Dto.InsertInput.cs b/Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRecord.Dto.InsertInput.cs
index e15f78af..05efe386 100644
--- a/Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRecord.Dto.InsertInput.cs
+++ b/Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRecord.Dto.InsertInput.cs
@@ -23,5 +23,25 @@ namespace Tiobon.Core.Model.Models
///
public class InsertGhre_StudyRecordInput : Ghre_StudyRecordBase
{
+
+ ///
+ /// 得分
+ ///
+ public decimal? Score { get; set; }
+
+ ///
+ /// 调整得分
+ ///
+ public decimal? AdjustScore { get; set; }
+
+ ///
+ /// 考试日期
+ ///
+ public DateTime? ExamDate { get; set; }
+
+ ///
+ /// 是否合格
+ ///
+ public bool? IsPass { get; set; }
}
}
diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs
index 97e58478..cfa7f6c5 100644
--- a/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs
+++ b/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs
@@ -142,5 +142,9 @@ public class Ghre_StudyRecordDto : Ghre_StudyRecord
public string ExamDuration { get; set; }
public DateTime? ActualEndTime { get; set; }
public DateTime? ActualBeginTime { get; set; }
-
+
+ ///
+ /// 是否合格
+ ///
+ public string IsPass { get; set; }
}
diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs
index bc1218b6..ed09c770 100644
--- a/Tiobon.Core.Services/BASE/BaseServices.cs
+++ b/Tiobon.Core.Services/BASE/BaseServices.cs
@@ -205,6 +205,7 @@ public class BaseServices : IBaseServ
editable,
rowNum,
colNum,
+ dataType,
elementType,
dbo.FS_GetdataSourceBySet
(dataSource, APIDataSourceType, Ghrs_PageSettingEdit.APIDataSourceID)
@@ -228,6 +229,7 @@ public class BaseServices : IBaseServ
new JProperty("editable",!string.IsNullOrWhiteSpace(dt.Rows[i]["editable"].ToString())? Convert.ToBoolean(dt.Rows[i]["editable"]):null),
new JProperty("rowNum",!string.IsNullOrWhiteSpace(dt.Rows[i]["rowNum"].ToString())? Convert.ToInt32(dt.Rows[i]["rowNum"]):null),
new JProperty("colNum",!string.IsNullOrWhiteSpace(dt.Rows[i]["colNum"].ToString())? Convert.ToInt32(dt.Rows[i]["colNum"]):null),
+ new JProperty("dataType", dt.Rows[i]["dataType"].ToString()),
new JProperty("elementType", dt.Rows[i]["elementType"].ToString()),
new JProperty("dataSource", dt.Rows[i]["dataSource"].ToString()),
new JProperty("defaultHidden", dt.Rows[i]["defaultHidden"].ToString()),
diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
index 3a878ceb..85a434e5 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
@@ -11,7 +11,8 @@ using Newtonsoft.Json;
using Tiobon.Core.Common.Helper;
using SqlSugar;
using static Tiobon.Core.Model.Consts;
-using Microsoft.IdentityModel.Tokens;
+using Tiobon.Core.Common.DB.Dapper.Extensions;
+using MongoDB.Driver.Linq;
namespace Tiobon.Core.Services
{
@@ -97,6 +98,110 @@ namespace Tiobon.Core.Services
}
+
+ public override async Task 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)
+ throw new Exception("学习结束时间需大于学习开始时间!");
+
+ if (entity.EndTime > DateTime.Now)
+ throw new Exception("学习结束时间需小于当前时间!");
+ TimeSpan timeDifference = entity.EndTime.Value - entity.BeginTime.Value;
+ entity.StudyDuration = (decimal)timeDifference.TotalMinutes;
+ }
+
+ var snap = await Db.Queryable().FirstAsync(x => x.CourseId == entity.CourseId);
+ entity.CourseSnapId = snap?.Id;
+ entity.CourseType = "ManualInsert";
+ var result = await base.Add(entity);
+
+ var examRecord = new Ghre_ExamRecord()
+ {
+ StudyRecordId = result,
+ StaffId = entity.StaffId,
+ CourseSnapId = snap?.Id,
+ Score = entity.Score,
+ AdjustScore = entity.AdjustScore,
+ ExamDate = entity.ExamDate,
+ IsPass = entity.IsPass,
+ };
+ await Db.Insertable(examRecord).ExecuteCommandAsync();
+
+ return result;
+ }
+
+ public override async Task Update(long Id, EditGhre_StudyRecordInput editModel)
+ {
+ if (await Db.Queryable()
+ .WhereIF(!editModel.CourseId.IsNullOrEmpty(), x => x.CourseId == editModel.CourseId)
+ .WhereIF(!editModel.CourseSceneId.IsNullOrEmpty(), x => x.CourseSceneId == editModel.CourseSceneId)
+ .AnyAsync(x => x.StaffId == editModel.StaffId && x.Id != Id))
+ throw new Exception("该用户存在相同学习记录!");
+
+ if (editModel.BeginTime != null && editModel.EndTime != null)
+ {
+ if (editModel.EndTime < editModel.BeginTime)
+ throw new Exception("学习结束时间需大于学习开始时间!");
+
+ if (editModel.EndTime > DateTime.Now)
+ throw new Exception("学习结束时间需小于当前时间!");
+ TimeSpan timeDifference = editModel.EndTime.Value - editModel.BeginTime.Value;
+ editModel.StudyDuration = (decimal)timeDifference.TotalMinutes;
+ }
+
+ var snap = await Db.Queryable().FirstAsync(x => x.CourseId == editModel.CourseId);
+ editModel.CourseSnapId = snap?.Id;
+ editModel.CourseType = "ManualInsert";
+ var result = await base.Update(Id, editModel);
+ var snapId = snap?.Id;
+ await Db.Updateable()
+ .SetColumns(it => new Ghre_ExamRecord()
+ {
+ StaffId = editModel.StaffId,
+ CourseSnapId = snapId,
+ Score = editModel.Score,
+ AdjustScore = editModel.AdjustScore,
+ ExamDate = editModel.ExamDate,
+ IsPass = editModel.IsPass
+ })
+ .Where(it => it.StudyRecordId == Id)
+ .ExecuteCommandAsync();
+
+ return result;
+ }
+
+ public override async Task> QueryForm(QueryForm body)
+ {
+ var result = await base.QueryForm(body);
+
+ var DT_TableDataT1 = result.result.DT_TableDataT1;
+ for (int i = 0; i < DT_TableDataT1.Count; i++)
+ {
+ var record = await Db.Queryable().FirstAsync(x => x.StudyRecordId == DT_TableDataT1[i].Id);
+
+ if (record != null)
+ {
+ DT_TableDataT1[i].Score = record.Score;
+ DT_TableDataT1[i].AdjustScore = record.AdjustScore;
+ if (record.ExamDate != null)
+ DT_TableDataT1[i].ExamDate = record.ExamDate.Value.ToString();
+ if (record.IsPass != null)
+ DT_TableDataT1[i].IsPass = record.IsPass == true ? "true" : "false";
+ }
+
+ }
+ result.result.DT_TableDataT1 = DT_TableDataT1;
+ return result;
+ }
+
#region 获取ESS查询条件
public async Task> QueryESSSearchFields(QueryBody body)
{
diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs
index c2cff760..2c9651a7 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs
@@ -7,15 +7,10 @@ using Tiobon.Core.Common.Caches;
using Newtonsoft.Json.Linq;
using Tiobon.Core.Common;
using Tiobon.Core.Model;
-using Newtonsoft.Json;
using Tiobon.Core.Common.Helper;
-using Org.BouncyCastle.Crypto;
using SqlSugar;
-using MathNet.Numerics.Distributions;
using MongoDB.Driver.Linq;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using System.Data;
-using System.Collections.Generic;
namespace Tiobon.Core.Services;
diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml
index b0cc0dde..d06e0326 100644
--- a/Tiobon.Core/Tiobon.Core.Model.xml
+++ b/Tiobon.Core/Tiobon.Core.Model.xml
@@ -5762,6 +5762,26 @@
培训记录 (Dto.EditInput)
+
+
+ 得分
+
+
+
+
+ 调整得分
+
+
+
+
+ 考试日期
+
+
+
+
+ 是否合格
+
+
必选修规则 (Dto.EditInput)
@@ -5967,6 +5987,26 @@
培训记录 (Dto.InsertInput)
+
+
+ 得分
+
+
+
+
+ 调整得分
+
+
+
+
+ 考试日期
+
+
+
+
+ 是否合格
+
+
必选修规则 (Dto.InsertInput)
@@ -13322,6 +13362,11 @@
考试时长
+
+
+ 是否合格
+
+
必选修规则(Dto.View)