diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_CourseWare.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_CourseWare.Dto.View.cs index 2033d927..bda4e806 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_CourseWare.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_CourseWare.Dto.View.cs @@ -36,4 +36,6 @@ public class Ghre_CourseWareDto : Ghre_CourseWare public List Attachments { get; set; } + public string StudyDuration { get; set; } + public string SourceLabel { get; set; } } diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index f0e54582..d8566f24 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -135,7 +135,7 @@ public class Ghre_CourseServices : BaseServices> QueryFilterPage(QueryBody body) { var result = await base.QueryFilterPage(body); - result.result.DT_TableDataT1.ForEach(x => + result.result.DT_TableDataT1.ForEach(async x => { if (!string.IsNullOrWhiteSpace(x.CourseIds)) x.CourseIds2 = JsonConvert.DeserializeObject>(x.CourseIds); + + x.StudyDuration = $"{x.Hours}小时{x.Minutes}分钟"; + x.SourceLabel = await GetParaLabel("CourseWareSource", x.Source); }); return result; diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs index e46ac491..92a28fa0 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamPaperServices.cs @@ -64,41 +64,41 @@ namespace Tiobon.Core.Services return entity; } - public override async Task> QueryFilterPage(QueryBody body) - { - var data = await BaseDal.QueryFilterPage(body); - var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew>(); - - var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); - var courses = await _ghre_CourseServices.Query(x => linkIds.Contains(x.Id)); - var courseScenes = await _ghre_CourseSceneServices.Query(x => linkIds.Contains(x.Id)); - - data1.ForEach(async x => - { - try - { - x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod); - x.TotalScore1 = Regex.Replace(x.PassScore.ToString(), @"\.(0+)$", "") + "/" + Regex.Replace(x.TotalScore.ToString(), @"\.(0+)$", ""); - x.SetMethodLabel = await GetParaLabel("SetMethod", x.SetMethod); - - if (x.LinkType == "CourseId") - x.CourseName = courses.FirstOrDefault(o => o.Id == x.LinkId)?.CourseName; - else if (x.LinkType == "CourseSceneId") - x.CourseName = courseScenes.FirstOrDefault(o => o.Id == x.LinkId)?.SceneName; - } - catch (Exception) - { - - } - - }); - - return new ServicePageResult(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); - } + //public override async Task> QueryFilterPage(QueryBody body) + //{ + // var data = await BaseDal.QueryFilterPage(body); + // var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew>(); + + // var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); + // var courses = await _ghre_CourseServices.Query(x => linkIds.Contains(x.Id)); + // var courseScenes = await _ghre_CourseSceneServices.Query(x => linkIds.Contains(x.Id)); + + // data1.ForEach(async x => + // { + // try + // { + // x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod); + // x.TotalScore1 = Regex.Replace(x.PassScore.ToString(), @"\.(0+)$", "") + "/" + Regex.Replace(x.TotalScore.ToString(), @"\.(0+)$", ""); + // x.SetMethodLabel = await GetParaLabel("SetMethod", x.SetMethod); + + // if (x.LinkType == "CourseId") + // x.CourseName = courses.FirstOrDefault(o => o.Id == x.LinkId)?.CourseName; + // else if (x.LinkType == "CourseSceneId") + // x.CourseName = courseScenes.FirstOrDefault(o => o.Id == x.LinkId)?.SceneName; + // } + // catch (Exception) + // { + + // } + + // }); + + // return new ServicePageResult(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); + //} public async Task> QueryList(QueryBody body, string status) { - var data = await QueryFilterPage1(body, status); + var data = await base.QueryFilterPage(body, $"Status='{status}'"); var data1 = Mapper.Map(data.result.DT_TableDataT1).ToANew>(); var linkIds = data1.Where(x => x.LinkId != null).Select(x => x.LinkId.Value).Distinct().ToList(); @@ -128,60 +128,60 @@ namespace Tiobon.Core.Services return new ServicePageResult(body.pageNum, data.result.DT_TablePageInfoT1.TotalCount, body.pageSize, data1); } - public async Task> QueryFilterPage1(QueryBody filter, string status = null) - { - if (string.IsNullOrWhiteSpace(filter.orderBy)) - filter.orderBy = "CreateTime DESC"; - RefAsync totalCount = 0; - var query = Db.Queryable(); - if (!string.IsNullOrWhiteSpace(status)) - query = query.Where(x => x.Status == status); - string conditions = "1=1"; - if (filter.jsonParam != null) - foreach (JProperty jProperty in filter.jsonParam.Properties()) - { - var name = jProperty.Name; - var value = jProperty.Value.ToString(); - if (name == "page" || name == "pageSize") - continue; - if (!string.IsNullOrWhiteSpace(value)) - { - var jsonParam = JsonConvert.DeserializeObject(value); - - switch (jsonParam.operationKey) - { - case "Include": - conditions += $" AND {name} LIKE '%{jsonParam.columnValue}%'"; - break; - case "NotInclude": - conditions += $" AND {name} NOT LIKE '%{jsonParam.columnValue}%'"; - break; - case "IsNull": - conditions += $" AND {name} IS NULL"; - break; - case "NotNull": - conditions += $" AND {name} IS NOT NULL"; - break; - case "Equal": - conditions += $" AND {name} ='{jsonParam.columnValue}'"; - break; - case "NotEqual": - conditions += $" AND {name} !='{jsonParam.columnValue}'"; - break; - default: - break; - } - } - } - if (filter.pageSize == 0) - filter.pageSize = 10000; - query = query.Where(conditions); - var list = await query - .OrderByIF(!string.IsNullOrEmpty(filter.orderBy), filter.orderBy) - .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); - - return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, list); - } + //public async Task> QueryFilterPage1(QueryBody filter, string status = null) + //{ + // if (string.IsNullOrWhiteSpace(filter.orderBy)) + // filter.orderBy = "CreateTime DESC"; + // RefAsync totalCount = 0; + // var query = Db.Queryable(); + // if (!string.IsNullOrWhiteSpace(status)) + // query = query.Where(x => x.Status == status); + // string conditions = "1=1"; + // if (filter.jsonParam != null) + // foreach (JProperty jProperty in filter.jsonParam.Properties()) + // { + // var name = jProperty.Name; + // var value = jProperty.Value.ToString(); + // if (name == "page" || name == "pageSize") + // continue; + // if (!string.IsNullOrWhiteSpace(value)) + // { + // var jsonParam = JsonConvert.DeserializeObject(value); + + // switch (jsonParam.operationKey) + // { + // case "Include": + // conditions += $" AND {name} LIKE '%{jsonParam.columnValue}%'"; + // break; + // case "NotInclude": + // conditions += $" AND {name} NOT LIKE '%{jsonParam.columnValue}%'"; + // break; + // case "IsNull": + // conditions += $" AND {name} IS NULL"; + // break; + // case "NotNull": + // conditions += $" AND {name} IS NOT NULL"; + // break; + // case "Equal": + // conditions += $" AND {name} ='{jsonParam.columnValue}'"; + // break; + // case "NotEqual": + // conditions += $" AND {name} !='{jsonParam.columnValue}'"; + // break; + // default: + // break; + // } + // } + // } + // if (filter.pageSize == 0) + // filter.pageSize = 10000; + // query = query.Where(conditions); + // var list = await query + // .OrderByIF(!string.IsNullOrEmpty(filter.orderBy), filter.orderBy) + // .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); + + // return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, list); + //} public async Task> QueryDefault(long Id) { diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index 9f0bcc40..84217f9c 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -162,10 +162,14 @@ public class Ghre_QuestionServices : BaseServices