diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index bd52b7ec..08c0f547 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -11,4 +11,20 @@ public class Ghre_ExamRecordController : BaseController + /// 根据条件查询数据 + /// + /// examId + /// 条件 + /// + [HttpPost, Route("QueryList/{examId}")] + public async Task> Query(string examId, [FromBody] QueryBody body) + { + return await _service.Query(examId, body); + } + + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 76f62587..96f4ed83 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -776,6 +776,14 @@ 考试记录(Controller) + + + 根据条件查询数据 + + examId + 条件 + + Ghre_ExamRecordDetail(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index aaaf5cb5..997de2ef 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -1,12 +1,15 @@ -using Tiobon.Core.IServices.BASE; +using Tiobon.Core.Common; +using Tiobon.Core.IServices.BASE; +using Tiobon.Core.Model; using Tiobon.Core.Model.Models; namespace Tiobon.Core.IServices -{ - /// - /// 考试记录(自定义服务接口) - /// +{ + /// + /// 考试记录(自定义服务接口) + /// public interface IGhre_ExamRecordServices :IBaseServices { + Task> Query(string examId, QueryBody body); } } \ No newline at end of file diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs index 241ec5aa..798ffe95 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs @@ -13,7 +13,7 @@ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ *└──────────────────────────────────┘ -*/ +*/ namespace Tiobon.Core.Model.Models; @@ -22,13 +22,28 @@ namespace Tiobon.Core.Model.Models; /// public class Ghre_ExamRecordDto : Ghre_ExamRecord { -/// -/// 创建信息 -/// -public string CreateDataInfo { get; set; } + /// + /// 创建信息 + /// + public string CreateDataInfo { get; set; } + + /// + /// 修改信息 + /// + public string UpdateDataInfo { get; set; } + public string IsPassLabel { get; set; } + + public string StaffNo { get; set; } + public string StaffName { get; set; } + + public string DeptNo { get; set; } + public string DepteName { get; set; } + public string TitleName { get; set; } + public DateTime? Indate { get; set; } + public string InStatus { get; set; } + public string ExamDate { get; set; } + + public decimal? TotalScore { get; set; } = 0; + -/// -/// 修改信息 -/// -public string UpdateDataInfo { get; set; } } diff --git a/Tiobon.Core.Model/ViewModels/Menu.cs b/Tiobon.Core.Model/ViewModels/Menu.cs index f22817e1..15ee9079 100644 --- a/Tiobon.Core.Model/ViewModels/Menu.cs +++ b/Tiobon.Core.Model/ViewModels/Menu.cs @@ -37,7 +37,11 @@ public class ModuleParam public string menuName { get; set; } public string timestamp { get; set; } public string token { get; set; } - public dynamic jsonParam { get; set; } + public ModulejsonParam jsonParam { get; set; } +} +public class ModulejsonParam +{ + public long? MasterId { get; set; } } public class ModuleReturn @@ -167,7 +171,7 @@ public class DT_Procedure public string IUDProcedure { get; set; } public string QueryProcedure { get; set; } public string ImportExcel { get; set; } - + public string DownExcelTemplate { get; set; } public string ExportExcel { get; set; } } diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index ade0732a..e3aa1378 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -12,6 +12,7 @@ using Tiobon.Core.DataAccess; using Tiobon.Core.IServices; using Tiobon.Core.Model; using Tiobon.Core.Services.BASE; +using static StackExchange.Redis.Role; namespace Tiobon.Core.Services; @@ -1048,7 +1049,7 @@ public partial class CommonServices : BaseServices>, ICommon case "F_CourseScene": index = result.JM_PageControlT1.Toolbar.FindIndex(x => x.fnKey == "BatchUpdateYN"); result.JM_PageControlT1.Toolbar.RemoveAt(index); - break; + break; case "F_SchoolManage": case "F_TeacherManage": toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault(); @@ -1058,6 +1059,28 @@ public partial class CommonServices : BaseServices>, ICommon toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault(); if (toolbar != null) { toolbar.fnKey = "TBD3YN"; } break; + case "F_OnlineExamScores": + result.DT_Procedure.QueryProcedure = dt.Rows[0]["QueryProcedure"].ToString(); + result.DT_Procedure.QueryProcedure += "/" + param.jsonParam.MasterId; + + sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName + FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId + WHERE A.UserID = {App.User.ID} + AND A.IsEnable = 1 + AND B.IsEnable = 1 + AND B.RoleNo = 'TrainingExamScore'"; + var toolbarRoles = DbAccess.QueryList(sql); + if (toolbarRoles != null && toolbarRoles.Any()) + result.JM_PageControlT1.Toolbar.Add(new Toolbar() + { + display = true, + fnKey = "TBD4YN", + fnTitle = "评分", + fnType = "row", + icon = "ghr-preview", + position = "left" + }); + break; } #endregion diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index 6d3118d9..61080c9e 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -4,12 +4,17 @@ using Tiobon.Core.Model.Models; using Tiobon.Core.Services.BASE; using Tiobon.Core.IRepository.Base; using Tiobon.Core.Common.Caches; +using Newtonsoft.Json.Linq; +using Tiobon.Core.Common; +using Tiobon.Core.Model; +using Newtonsoft.Json; +using Microsoft.AspNetCore.Mvc; namespace Tiobon.Core.Services { - /// - /// 考试记录 (服务) - /// + /// + /// 考试记录 (服务) + /// public class Ghre_ExamRecordServices : BaseServices, IGhre_ExamRecordServices { private readonly IBaseRepository _dal; @@ -19,5 +24,110 @@ namespace Tiobon.Core.Services base.BaseDal = dal; base._caching = caching; } + + public override async Task> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true) + { + if (string.IsNullOrWhiteSpace(filter.orderBy)) + filter.orderBy = "CreateTime1 DESC"; + + if (filter.pageSize == 0) + filter.pageSize = 10000; + + var countSql = @$" SELECT COUNT(1) FROM Ghre_ExamRecord_V"; + var sql = @$" SELECT * + FROM Ghre_ExamRecord_V"; + + string conditions = " WHERE IsEnable = 1"; + + if (!string.IsNullOrEmpty(condition)) conditions += " AND " + condition; + 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 (name == "DueDate") + { + var jsonParam = JsonConvert.DeserializeObject(value); + conditions += $" AND FORMAT(DueDate, 'yyyy-MM-dd') = '{jsonParam.columnValue}'"; + 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; + } + } + } + + sql += conditions; + countSql += conditions; + int total = await Db.Ado.GetIntAsync(countSql); + + sql = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY " + filter.orderBy + ") NUM FROM (SELECT * FROM (" + sql + " "; + sql += ") A ) B ) C"; + + sql += " WHERE NUM <= " + filter.pageNum * filter.pageSize + " AND NUM >" + (filter.pageNum - 1) * filter.pageSize; + + var entitys = await Db.Ado.SqlQueryAsync(sql); + + entitys.ForEach(async x => + { + x.ScoreStatus = await GetParaLabel("TrainingExamScoreStatus", x.ScoreStatus); + //x.CourseStatusLabel = await GetParaLabel("TrainingCourseStatus", x.CourseStatus); + //x.StudyStatusLabel = await GetParaLabel("TrainingStudyStatus", x.StudyStatus); + x.IsPassLabel = x.IsPass == true ? "合格" : "不合格"; + + //x.InStatusLabel = x.InStatus == "1" ? "在职" : null; + //x.InStatusLabel = x.InStatus == "2" ? "离职" : null; + //x.InStatusLabel = x.InStatus == "0" ? "未入职" : null; + if (x.BeginTime != null) + x.ExamDate = x.BeginTime.Value.ToString("yyyy-MM-dd"); + + + x.TotalScore += x.Score ?? 0; + x.TotalScore += x.AdjustScore ?? 0; + //if (x.DueDate != null) + // x.DueDate1 = x.DueDate.Value.ToString("yyyy-MM-dd"); + //if (x.ExamDate != null) + // x.ExamDate1 = x.ExamDate.Value.ToString("yyyy-MM-dd"); + + }); + + return new ServicePageResult(filter.pageNum, total, filter.pageSize, entitys); + + } + + + + public async Task> Query(string examId, [FromBody] QueryBody body) + { + return await QueryFilterPage(body, $"ExamId='{examId}'"); + } } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index bf0409b3..c777f846 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -1231,7 +1231,7 @@ public class Ghre_ExamServices : BaseServices - + - 用户ID + 员工ID @@ -2325,11 +2325,31 @@ 实际结束时间 + + + 重考次数 + + 状态 + + + 评分状态 + + + + + 评语 + + + + + 是否合格 + + 备注 @@ -6751,9 +6771,9 @@ 试卷ID - + - 用户ID + 员工ID @@ -6786,11 +6806,31 @@ 实际结束时间 + + + 重考次数 + + 状态 + + + 评分状态 + + + + + 评语 + + + + + 是否合格 + + 备注 diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 76f62587..96f4ed83 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -776,6 +776,14 @@ 考试记录(Controller) + + + 根据条件查询数据 + + examId + 条件 + + Ghre_ExamRecordDetail(Controller)