线上考试成绩页面开发

master
xiaochanghai 12 months ago
parent d1d1b0a14b
commit 9a2ec1ac05
  1. 16
      Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs
  2. 8
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 5
      Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs
  4. 15
      Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs
  5. 6
      Tiobon.Core.Model/ViewModels/Menu.cs
  6. 23
      Tiobon.Core.Services/CommonServices.cs
  7. 110
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  8. 2
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  9. 48
      Tiobon.Core/Tiobon.Core.Model.xml
  10. 8
      Tiobon.Core/Tiobon.Core.xml

@ -11,4 +11,20 @@ public class Ghre_ExamRecordController : BaseController<IGhre_ExamRecordServices
public Ghre_ExamRecordController(IGhre_ExamRecordServices service) : base(service) public Ghre_ExamRecordController(IGhre_ExamRecordServices service) : base(service)
{ {
} }
#region 根据条件查询数据
/// <summary>
/// 根据条件查询数据
/// </summary>
/// <param name="examId">examId</param>
/// <param name="body">条件</param>
/// <returns></returns>
[HttpPost, Route("QueryList/{examId}")]
public async Task<ServicePageResult<Ghre_ExamRecordDto>> Query(string examId, [FromBody] QueryBody body)
{
return await _service.Query(examId, body);
}
#endregion
} }

@ -776,6 +776,14 @@
考试记录(Controller) 考试记录(Controller)
</summary> </summary>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.Query(System.String,Tiobon.Core.Common.QueryBody)">
<summary>
根据条件查询数据
</summary>
<param name="examId">examId</param>
<param name="body">条件</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary> <summary>
Ghre_ExamRecordDetail(Controller) Ghre_ExamRecordDetail(Controller)

@ -1,4 +1,6 @@
using Tiobon.Core.IServices.BASE; using Tiobon.Core.Common;
using Tiobon.Core.IServices.BASE;
using Tiobon.Core.Model;
using Tiobon.Core.Model.Models; using Tiobon.Core.Model.Models;
namespace Tiobon.Core.IServices namespace Tiobon.Core.IServices
@ -8,5 +10,6 @@ namespace Tiobon.Core.IServices
/// </summary> /// </summary>
public interface IGhre_ExamRecordServices :IBaseServices<Ghre_ExamRecord, Ghre_ExamRecordDto, InsertGhre_ExamRecordInput, EditGhre_ExamRecordInput> public interface IGhre_ExamRecordServices :IBaseServices<Ghre_ExamRecord, Ghre_ExamRecordDto, InsertGhre_ExamRecordInput, EditGhre_ExamRecordInput>
{ {
Task<ServicePageResult<Ghre_ExamRecordDto>> Query(string examId, QueryBody body);
} }
} }

@ -31,4 +31,19 @@ public string CreateDataInfo { get; set; }
/// 修改信息 /// 修改信息
/// </summary> /// </summary>
public string UpdateDataInfo { 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;
} }

@ -37,7 +37,11 @@ public class ModuleParam
public string menuName { get; set; } public string menuName { get; set; }
public string timestamp { get; set; } public string timestamp { get; set; }
public string token { 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 public class ModuleReturn

@ -12,6 +12,7 @@ using Tiobon.Core.DataAccess;
using Tiobon.Core.IServices; using Tiobon.Core.IServices;
using Tiobon.Core.Model; using Tiobon.Core.Model;
using Tiobon.Core.Services.BASE; using Tiobon.Core.Services.BASE;
using static StackExchange.Redis.Role;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -1058,6 +1059,28 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault(); toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault();
if (toolbar != null) { toolbar.fnKey = "TBD3YN"; } if (toolbar != null) { toolbar.fnKey = "TBD3YN"; }
break; 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<ToolbarRole>(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 #endregion

@ -4,6 +4,11 @@ using Tiobon.Core.Model.Models;
using Tiobon.Core.Services.BASE; using Tiobon.Core.Services.BASE;
using Tiobon.Core.IRepository.Base; using Tiobon.Core.IRepository.Base;
using Tiobon.Core.Common.Caches; 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 namespace Tiobon.Core.Services
{ {
@ -19,5 +24,110 @@ namespace Tiobon.Core.Services
base.BaseDal = dal; base.BaseDal = dal;
base._caching = caching; base._caching = caching;
} }
public override async Task<ServicePageResult<Ghre_ExamRecordDto>> 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<JsonParam>(value);
conditions += $" AND FORMAT(DueDate, 'yyyy-MM-dd') = '{jsonParam.columnValue}'";
continue;
}
if (!string.IsNullOrWhiteSpace(value))
{
var jsonParam = JsonConvert.DeserializeObject<JsonParam>(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<Ghre_ExamRecordDto>(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<Ghre_ExamRecordDto>(filter.pageNum, total, filter.pageSize, entitys);
}
public async Task<ServicePageResult<Ghre_ExamRecordDto>> Query(string examId, [FromBody] QueryBody body)
{
return await QueryFilterPage(body, $"ExamId='{examId}'");
}
} }
} }

@ -1231,7 +1231,7 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
var insrt = new InsertGhre_ExamRecordInput() var insrt = new InsertGhre_ExamRecordInput()
{ {
ExamId = id, ExamId = id,
UserId = UserContext.Current.User_Id, //UserId = UserContext.Current.User_Id,
//ActualBeginTime = dt, //ActualBeginTime = dt,
ExamPaperId = exam.ExamPaperId ExamPaperId = exam.ExamPaperId
}; };

@ -2290,9 +2290,9 @@
试卷ID 试卷ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.UserId"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.StaffId">
<summary> <summary>
用户ID 员工ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.ExamPaperId"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.ExamPaperId">
@ -2325,11 +2325,31 @@
实际结束时间 实际结束时间
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.RetakeTimes">
<summary>
重考次数
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.Status"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.Status">
<summary> <summary>
状态 状态
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.ScoreStatus">
<summary>
评分状态
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.Comment">
<summary>
评语
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.IsPass">
<summary>
是否合格
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.RemarkSz"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecordBase.RemarkSz">
<summary> <summary>
备注 备注
@ -6751,9 +6771,9 @@
试卷ID 试卷ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.UserId"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.StaffId">
<summary> <summary>
用户ID 员工ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.ExamPaperId"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.ExamPaperId">
@ -6786,11 +6806,31 @@
实际结束时间 实际结束时间
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.RetakeTimes">
<summary>
重考次数
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.Status"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.Status">
<summary> <summary>
状态 状态
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.ScoreStatus">
<summary>
评分状态
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.Comment">
<summary>
评语
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.IsPass">
<summary>
是否合格
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.RemarkSz"> <member name="P:Tiobon.Core.Model.Models.Ghre_ExamRecord.RemarkSz">
<summary> <summary>
备注 备注

@ -776,6 +776,14 @@
考试记录(Controller) 考试记录(Controller)
</summary> </summary>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.Query(System.String,Tiobon.Core.Common.QueryBody)">
<summary>
根据条件查询数据
</summary>
<param name="examId">examId</param>
<param name="body">条件</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary> <summary>
Ghre_ExamRecordDetail(Controller) Ghre_ExamRecordDetail(Controller)

Loading…
Cancel
Save