diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 19b95d82..c1e4420d 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -15382,6 +15382,12 @@
课件 (Dto.InsertInput)
+
+
+
+ 已学习进度百分比
+
+
课件附件 (Dto.InsertInput)
@@ -31967,6 +31973,11 @@
修改信息
+
+
+ 已学习进度百分比
+
+
学分记录(Dto.View)
diff --git a/Tiobon.Core.Common/Helper/UtilHelper.cs b/Tiobon.Core.Common/Helper/UtilHelper.cs
index 61d4b46e..c915efac 100644
--- a/Tiobon.Core.Common/Helper/UtilHelper.cs
+++ b/Tiobon.Core.Common/Helper/UtilHelper.cs
@@ -157,6 +157,57 @@ public static class UtilHelper
return errorValue;
}
+
+
+ #region 去除后面多余的零
+ ///
+ /// 去除后面多余的零
+ ///
+ ///
+ ///
+ public static string RemoveZero(this decimal? dValue)
+ {
+ if (dValue.IsNullOrEmpty())
+ return null;
+ return RemoveZero(dValue.Value);
+ }
+ /////
+ ///// 去除后面多余的零
+ /////
+ /////
+ /////
+ //public static string RemoveZero(decimal? dValue)
+ //{
+ // if (dValue.IsNullOrEmpty())
+ // return null;
+ // return RemoveZero(dValue.Value);
+ //}
+ ///
+ /// 去除后面多余的零
+ ///
+ ///
+ ///
+ public static string RemoveZero(decimal dValue)
+ {
+ string sResult = dValue.ToString();
+ if (sResult.IndexOf(".") < 0)
+ return sResult;
+ int iIndex = sResult.Length - 1;
+ for (int i = sResult.Length - 1; i >= 0; i--)
+ {
+ if (sResult.Substring(i, 1) != "0")
+ {
+ iIndex = i;
+ break;
+ }
+ }
+ sResult = sResult.Substring(0, iIndex + 1);
+ if (sResult.EndsWith("."))
+ sResult = sResult.Substring(0, sResult.Length - 1);
+ return sResult;
+ }
+ #endregion
+
///
///
///
diff --git a/Tiobon.Core.Model/Insert/Ghre/Ghre_CourseWare.Dto.InsertInput.cs b/Tiobon.Core.Model/Insert/Ghre/Ghre_CourseWare.Dto.InsertInput.cs
index 3b2d7d65..f7427b30 100644
--- a/Tiobon.Core.Model/Insert/Ghre/Ghre_CourseWare.Dto.InsertInput.cs
+++ b/Tiobon.Core.Model/Insert/Ghre/Ghre_CourseWare.Dto.InsertInput.cs
@@ -37,8 +37,12 @@ public class Ghre_CourseWareLink
public string LinkAddress { get; set; }
///
- /// 学习时长(分钟)
- ///
- [Display(Name = "LearnDuration"), Description("学习时长(分钟)"), Column(TypeName = "decimal(20,2)")]
+ /// 学习时长(分钟)
public decimal? LearnDuration { get; set; }
+
+ ///
+ /// 已学习进度百分比
+ ///
+ public decimal? HasLearnDuration { get; set; }
+ public decimal? HasLearnPercent { get; set; }
}
\ No newline at end of file
diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_CourseWareAttachment.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_CourseWareAttachment.Dto.View.cs
index 525fd990..938fbe49 100644
--- a/Tiobon.Core.Model/View/Ghre/Ghre_CourseWareAttachment.Dto.View.cs
+++ b/Tiobon.Core.Model/View/Ghre/Ghre_CourseWareAttachment.Dto.View.cs
@@ -31,4 +31,10 @@ public class Ghre_CourseWareAttachmentDto : Ghre_CourseWareAttachment
/// 修改信息
///
public string UpdateDataInfo { get; set; }
+ public decimal? HasLearnDuration { get; set; }
+
+ ///
+ /// 已学习进度百分比
+ ///
+ public decimal? HasLearnPercent { get; set; }
}
diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordCourse.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordCourse.cs
index ec448bbb..a5e44902 100644
--- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordCourse.cs
+++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordCourse.cs
@@ -43,7 +43,7 @@ public class Ghre_StudyRecordCourseWare
public string Source { get; set; }
public string Link { get; set; }
- public List Attachments { get; set; }
+ public List Attachments { get; set; }
public List Links { get; set; }
diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs
index 7a177704..adcba07f 100644
--- a/Tiobon.Core.Services/CommonServices.cs
+++ b/Tiobon.Core.Services/CommonServices.cs
@@ -1051,7 +1051,14 @@ public partial class CommonServices : BaseServices>, ICommon
index = result.JM_PageControlT1.Toolbar.FindIndex(x => x.fnKey == "BatchUpdateYN");
if (index >= 0)
result.JM_PageControlT1.Toolbar.RemoveAt(index);
-
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault();
+ if (toolbar != null) toolbar.fnKey = "TBD1YN";
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault();
+ if (toolbar != null) toolbar.fnKey = "TBD2YN";
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault();
+ if (toolbar != null) toolbar.fnKey = "TBD3YN";
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault();
+ if (toolbar != null) toolbar.fnKey = "TBD4YN";
result.JM_PageControlT1.Toolbar.Insert(0, new Toolbar()
{
display = true,
diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs
index 4a057442..4cfbe89e 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs
@@ -127,6 +127,7 @@ public class Ghre_CourseWareServices : BaseServices()
+ .Where(x => x.StudyRecordId == id)
+ .GroupBy(x => new { x.CourseWareAttachmentId, x.CourseWareId })
+ .Select(x => new
+ {
+ x.CourseWareAttachmentId,
+ x.CourseWareId,
+ StudyDuration = SqlFunc.AggregateSumNoNull(x.StudyDuration)
+ })
+ .ToListAsync();
+
for (int j = 0; j < course.CourseWareList.Count; j++)
{
var attachments = await Db.Queryable().Where(x => x.CourseWareId == course.CourseWareList[j].Id).ToListAsync();
- course.CourseWareList[j].Attachments = attachments.Where(x => x.AttachFileExtension != "http").OrderBy(x => x.SortNo).ToList();
+
+ var attachmentDtos = attachments.Where(x => x.AttachFileExtension != "http").OrderBy(x => x.SortNo).ToList();
+
+ course.CourseWareList[j].Attachments = Mapper.Map(attachmentDtos).ToANew>();
if (course.CourseWareList[j].Attachments != null && course.CourseWareList[j].Attachments.Any())
course.CourseWareList[j].Attachments.ForEach(x => x.RelativePath = "/Advanced" + x.RelativePath);
+ course.CourseWareList[j].Attachments.ForEach(x =>
+ {
+ x.HasLearnDuration = details.FirstOrDefault(o => o.CourseWareAttachmentId == x.Id)?.StudyDuration ?? 0;
+ if (x.HasLearnDuration != 0 && x.LearnDuration != 0)
+ {
+ x.HasLearnPercent = (x.HasLearnDuration / x.LearnDuration) * 100;
+ if (x.HasLearnPercent > 100)
+ x.HasLearnPercent = 100;
+ x.HasLearnPercent = x.HasLearnPercent.RemoveZero().ObjToDecimal();
+ }
+ });
+
course.CourseWareList[j].Links = attachments
.Where(x => x.AttachFileExtension == "http")
.OrderBy(x => x.SortNo)
@@ -1553,7 +1580,20 @@ WHERE A.Id = '{id}'";
Id = x.Id,
LinkName = x.AttachmentName,
LinkAddress = x.RelativePath,
+ LearnDuration = x.LearnDuration
}).ToList();
+
+ course.CourseWareList[j].Links.ForEach(x =>
+ {
+ x.HasLearnDuration = details.FirstOrDefault(o => o.CourseWareAttachmentId == x.Id)?.StudyDuration ?? 0;
+ if (x.HasLearnDuration != 0 && x.LearnDuration != 0)
+ {
+ x.HasLearnPercent = (x.HasLearnDuration / x.LearnDuration) * 100;
+ if (x.HasLearnPercent > 100)
+ x.HasLearnPercent = 100;
+ x.HasLearnPercent = x.HasLearnPercent.RemoveZero().ObjToDecimal();
+ }
+ });
}
if (course.CourseBeginTime != null && course.CourseEndTime != null)
diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml
index e77f05f3..c1e4420d 100644
--- a/Tiobon.Core/Tiobon.Core.Model.xml
+++ b/Tiobon.Core/Tiobon.Core.Model.xml
@@ -3590,6 +3590,11 @@
排序
+
+
+ 学习时长(分钟)
+
+
学分记录 (Dto.Base)
@@ -15377,6 +15382,12 @@
课件 (Dto.InsertInput)
+
+
+
+ 已学习进度百分比
+
+
课件附件 (Dto.InsertInput)
@@ -19541,6 +19552,11 @@
排序
+
+
+ 学习时长(分钟)
+
+
学分记录 (Model)
@@ -31957,6 +31973,11 @@
修改信息
+
+
+ 已学习进度百分比
+
+
学分记录(Dto.View)