diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 2ab8fd93..cec28356 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -13272,6 +13272,11 @@ 必/选修人员 + + + 考试时长 + + 必选修规则(Dto.View) diff --git a/Tiobon.Core.Common/Helper/StringHelper.cs b/Tiobon.Core.Common/Helper/StringHelper.cs index 7c4feb22..3aed5e16 100644 --- a/Tiobon.Core.Common/Helper/StringHelper.cs +++ b/Tiobon.Core.Common/Helper/StringHelper.cs @@ -116,4 +116,42 @@ public class StringHelper return sid; } #endregion + + + + /// + /// 格式化数字字符,并保留指定的小数位 + /// + /// 需要处理的值 + /// 保留小数点后位数,-1时只会去除小数点后最后几位的0 + /// + public static string TrimNumber(decimal value, int reservedDigit) + { + try + { + string result = string.Empty; + if (!string.IsNullOrEmpty(Convert.ToString(value))) + { + //此处主要是为MVC页面中数字类型的字段作处理 + if (value != decimal.MinValue) + { + Decimal tmp = Decimal.Parse(Convert.ToString(value)); + if (reservedDigit == -1) + { + result = string.Format("{0:#0.##########}", tmp); + } + else + { + result = String.Format("{0:N" + reservedDigit.ToString() + "}", tmp); + result = result.Replace(",", ""); + } + } + } + return result; + } + catch (Exception E) + { + throw E; + } + } } 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 b6575358..24ea63e6 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_StudyRecord.Dto.View.cs @@ -129,4 +129,12 @@ public class Ghre_StudyRecordDto : Ghre_StudyRecord /// 必/选修人员 /// public string StaffTypeLabel { get; set; } + + /// + /// 考试时长 + /// + public string ExamDuration { get; set; } + public DateTime? ActualEndTime { get; set; } + public DateTime? ActualBeginTime { get; set; } + } diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index a2b9ed9f..fe99006f 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -11,6 +11,7 @@ using Newtonsoft.Json; using Tiobon.Core.Common.Helper; using SqlSugar; using static Tiobon.Core.Model.Consts; +using Microsoft.IdentityModel.Tokens; namespace Tiobon.Core.Services { @@ -83,6 +84,12 @@ namespace Tiobon.Core.Services if (!string.IsNullOrWhiteSpace(entity.Indate)) entity.Indate = DateTimeHelper.ConvertToDayString(entity.Indate); entity.ExamDate = DateTimeHelper.ConvertToDayString(entity.ExamDate); + + if (entity.ActualBeginTime != null && entity.ActualEndTime != null) + { + TimeSpan timeDifference = entity.ActualEndTime.Value - entity.ActualBeginTime.Value; + entity.ExamDuration = StringHelper.TrimNumber(Convert.ToDecimal(timeDifference.TotalMinutes), 2); + } }); return new ServicePageResult(filter.pageNum, total, filter.pageSize, entitys); diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index 2ab8fd93..cec28356 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -13272,6 +13272,11 @@ 必/选修人员 + + + 考试时长 + + 必选修规则(Dto.View)