优化后台手动新增学习记录,新增时间段校验

修改讲师费用申请,调整为根据讲师所属部门签核
考试结果查看考试记录新增显示当前次分数
master
xiaochanghai 2 months ago
parent 103a47fda0
commit 14b599e18d
  1. 3
      Tiobon.Core.Common/Helper/DateTimeHelper.cs
  2. 3
      Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs
  3. 5
      Tiobon.Core.Services/CommonServices.cs
  4. 2
      Tiobon.Core.Services/Ghra/Ghra_StaffServices.cs
  5. 2
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
  6. 33
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  7. 21
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -222,6 +222,9 @@ public class DateTimeHelper
/// <returns></returns>
public static string ConvertToSecondString(object dateTime)
{
if (dateTime == null)
return "";
if (string.IsNullOrEmpty(Convert.ToString(dateTime)))
{
return "";

@ -121,7 +121,8 @@ public class ExamGroup
{
public long? GroupId { get; set; }
public long? ExamRecordId { get; set; }
public DateTime? ExamTime { get; set; }
public string ExamTime { get; set; }
public decimal Score { get; set; }
}
public class CommentData

@ -4356,6 +4356,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
case "Apply":
case "BatchApply":
#region 写入数据,并判断是否有错误
string json = param.jsonParam.ToString();
var dict = JsonHelper.JsonToObj<Ghre_TrainFeeApplyOrder_Boltone>(json);
@ -4363,6 +4364,10 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
//dict.RequestNo = await GenerateContinuousSequence("Ghrh_HumanRequest", "RequestNo", "R");
id = await Db.Insertable(dict).ExecuteReturnSnowflakeIdAsync();
var StaffUserId = await Db.Queryable<Ghrs_User>().Where(x => x.UserStaffID == dict.TeacherId).Select(x => x.UserId).FirstAsync();
if (StaffUserId > 0)
param.userId = StaffUserId;
sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_TrainFeeApplyOrder_Boltone WHERE Id !='{id}' and len(Id) !=19";
var id1 = await Db.Ado.GetLongAsync(sql);
sql = $"UPDATE Ghre_TrainFeeApplyOrder_Boltone SET Id={id1} WHERE Id ='{id}'";

@ -61,7 +61,7 @@ public class Ghra_StaffServices : BaseServices<Ghra_Staff, Ghra_StaffDto, Insert
if (dept != null)
entity.DeptName = dept.DeptName;
dept = await Db.Queryable<Ghro_Dept>().Where(x => x.ParentDeptID == entity.DeptId).FirstAsync();
dept = await Db.Queryable<Ghro_Dept>().Where(x => x.DeptID == dept.ParentDeptID).FirstAsync();
if (dept != null)
entity.ParentDeptName = dept.DeptName;
}

@ -689,7 +689,7 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins
sql += $"AND ( CourseNo like '%{keyWords}%' or CourseName like '%{keyWords}%')";
if (linkId.HasValue)
sql += $" AND CourseSceneId='{linkId}'";
sql += $" AND (CourseSceneId='{linkId}' or CourseSceneIds like '%{linkId}%')";
sql += $" ORDER BY UpdateTime DESC, CreateTime DESC";
dt = await Db.Ado.GetDataTableAsync(sql);

@ -463,6 +463,15 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
await Db.Updateable(record).ExecuteCommandAsync();
await Db.Updateable(details).ExecuteCommandAsync();
var groupId = details.First()?.GroupId;
var group = await Db.Queryable<Ghre_ExamRecordGroup>().Where(x => x.Id == groupId).FirstAsync();
if (group != null)
{
group.Score = record.Score;
await Db.Updateable(group).UpdateColumns(it => new { it.Score }, true)
.ExecuteCommandAsync();
}
return ServiceResult.OprateSuccess("提交成功!");
}
@ -882,15 +891,23 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
}
#endregion
extend.Groups = await Db.Queryable<Ghre_ExamRecordGroup>()
.OrderByDescending(x => x.ExamTime)
.Where(x => x.ExamRecordId == record.Id)
var Groups = await Db.Queryable<Ghre_ExamRecordGroup>()
.OrderByDescending(x => x.ExamTime)
.Where(x => x.ExamRecordId == record.Id)
.Select(x => new
{
GroupId = x.Id,
x.ExamRecordId,
ExamTime = x.ExamTime,
Score = x.Score
}).ToListAsync();
extend.Groups = Groups
.Select(x => new ExamGroup()
{
GroupId = x.Id,
GroupId = x.GroupId,
ExamRecordId = x.ExamRecordId,
ExamTime = x.ExamTime,
}).ToListAsync();
ExamTime = x.ExamTime.ObjToString() + (x.Score != null ? $"({x.Score})" : ""),
}).ToList();
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend);
}
@ -1158,6 +1175,10 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
}
#endregion
group.Score = record.Score;
await Db.Updateable(group).UpdateColumns(it => new { it.Score }, true)
.ExecuteCommandAsync();
#region 多次考试成绩认定
if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && (ScoreRecognition == "Highest" || ScoreRecognition == "Lowest"))
{

@ -1,12 +1,9 @@
using Microsoft.Extensions.Logging;
using MongoDB.Driver.Linq;
using NPOI.HSSF.UserModel;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using Tiobon.Core.Model.Models;
using static System.Runtime.InteropServices.JavaScript.JSType;
using static Tiobon.Core.DataAccess.ReportHelper;
using static Tiobon.Core.Model.Consts;
@ -268,12 +265,6 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
public override async Task<long> Add(InsertGhre_StudyRecordInput entity)
{
if (await Db.Queryable<Ghre_StudyRecord>()
.WhereIF(!entity.CourseId.IsNullOrEmpty(), x => x.CourseId == entity.CourseId)
.WhereIF(!entity.CourseSceneId.IsNullOrEmpty(), x => x.CourseSceneId == entity.CourseSceneId)
.AnyAsync(x => x.StaffId == entity.StaffId))
throw new Exception("该用户存在相同学习记录!");
if (entity.BeginTime != null && entity.EndTime != null)
{
if (entity.EndTime < entity.BeginTime)
@ -287,6 +278,14 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
entity.CourseBeginTime = entity.BeginTime;
entity.CourseEndTime = entity.EndTime;
}
if (await Db.Queryable<Ghre_StudyRecord>()
.WhereIF(!entity.CourseId.IsNullOrEmpty(), x => x.CourseId == entity.CourseId)
.WhereIF(!entity.CourseSceneId.IsNullOrEmpty(), x => x.CourseSceneId == entity.CourseSceneId)
.Where(x => (x.CourseBeginTime <= entity.CourseBeginTime && x.CourseEndTime >= entity.CourseBeginTime) || (x.CourseBeginTime <= entity.CourseEndTime && x.CourseEndTime >= entity.CourseEndTime))
.AnyAsync(x => x.StaffId == entity.StaffId))
throw new Exception("该用户存在相同学习记录!");
entity.StudyStatus = "HasFinish";
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == entity.CourseId);
@ -719,8 +718,8 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
AdjustScore = AdjustScore ?? 0,
IsPass = isPass == "是" ? true : false,
ExamDate = dtExamDate,
BeginTime = dtCourseBeginTime,
EndTime = dtCourseEndTime,
CourseBeginTime = dtCourseBeginTime,
CourseEndTime = dtCourseEndTime,
RemarkSz = remarkSz,
CourseType = "ExcelImport"
};

Loading…
Cancel
Save