|
|
@ -11,6 +11,7 @@ using System.Text.RegularExpressions; |
|
|
|
using System.Net; |
|
|
|
using System.Net; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using Tiobon.Core.Common.Helper; |
|
|
|
using AgileObjects.AgileMapper.Extensions; |
|
|
|
using AgileObjects.AgileMapper.Extensions; |
|
|
|
|
|
|
|
using Tiobon.Core.Common.DB.Dapper.Extensions; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
|
@ -354,36 +355,85 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
body.pageSize = 10000; |
|
|
|
body.pageSize = 10000; |
|
|
|
|
|
|
|
|
|
|
|
long examRecordId = 0; |
|
|
|
long examRecordId = 0; |
|
|
|
if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id)) |
|
|
|
//if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id)) |
|
|
|
|
|
|
|
//{ |
|
|
|
|
|
|
|
// var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.ExamId == id); |
|
|
|
|
|
|
|
// if (examRecord != null) |
|
|
|
|
|
|
|
// examRecordId = examRecord.Id; |
|
|
|
|
|
|
|
// else |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// var insrt = new InsertGhre_ExamRecordInput() |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
// examRecordId = await base.Add(insrt); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.ExamId == id); |
|
|
|
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.StudyRecordId == id); |
|
|
|
|
|
|
|
|
|
|
|
if (examRecord != null) |
|
|
|
if (examRecord != null) |
|
|
|
examRecordId = examRecord.Id; |
|
|
|
examRecordId = examRecord.Id; |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == id); |
|
|
|
|
|
|
|
string sql = @$"SELECT A.StaffId,
|
|
|
|
|
|
|
|
A.Source, |
|
|
|
|
|
|
|
A.ExamId, |
|
|
|
|
|
|
|
B.Id, |
|
|
|
|
|
|
|
B.LinkType, |
|
|
|
|
|
|
|
B.CourseId, |
|
|
|
|
|
|
|
B.CourseSceneId, |
|
|
|
|
|
|
|
B.ExamPaperId, |
|
|
|
|
|
|
|
B.CoverUrl, |
|
|
|
|
|
|
|
B.ExamNo, |
|
|
|
|
|
|
|
B.ExamName, |
|
|
|
|
|
|
|
B.DateType, |
|
|
|
|
|
|
|
B.BeginTime, |
|
|
|
|
|
|
|
B.EndTime, |
|
|
|
|
|
|
|
B.AfterHowLong, |
|
|
|
|
|
|
|
B.ExamMode, |
|
|
|
|
|
|
|
B.ExamPlace, |
|
|
|
|
|
|
|
B.IsLinkOpenClass, |
|
|
|
|
|
|
|
B.OpenClassId, |
|
|
|
|
|
|
|
B.Status |
|
|
|
|
|
|
|
FROM Ghre_ExamStaff A |
|
|
|
|
|
|
|
JOIN Ghre_Exam B |
|
|
|
|
|
|
|
ON A.ExamId = B.Id |
|
|
|
|
|
|
|
AND B.Status = 'Released' |
|
|
|
|
|
|
|
AND A.IsEnable = B.IsEnable |
|
|
|
|
|
|
|
AND B.CourseId = '{studyRecord.CourseId}' |
|
|
|
|
|
|
|
WHERE A.IsEnable = 1 |
|
|
|
|
|
|
|
AND ( B.DateType = 'AfterHowLong' |
|
|
|
|
|
|
|
OR ( B.DateType = 'ExamDate' |
|
|
|
|
|
|
|
AND B.BeginTime >= GETDATE () |
|
|
|
|
|
|
|
AND B.EndTime <= GETDATE ())) |
|
|
|
|
|
|
|
AND A.StaffId = {studyRecord.StaffId}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var exam = await Db.Ado.SqlQuerySingleAsync<Ghre_Exam>(sql); |
|
|
|
|
|
|
|
if (exam is null) |
|
|
|
|
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该门课程勿需考试!"); |
|
|
|
|
|
|
|
|
|
|
|
var insrt = new InsertGhre_ExamRecordInput() |
|
|
|
var insrt = new InsertGhre_ExamRecordInput() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
ExamId = exam.Id, |
|
|
|
|
|
|
|
StudyRecordId = studyRecord.Id, |
|
|
|
|
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
|
|
|
|
CourseSnapId = studyRecord.CourseSnapId, |
|
|
|
|
|
|
|
ExamPaperId = exam.ExamPaperId, |
|
|
|
|
|
|
|
ExamDate = DateTime.Now.Date, |
|
|
|
|
|
|
|
RetakeTimes = 0, |
|
|
|
|
|
|
|
Status = "Wait", |
|
|
|
|
|
|
|
ScoreStatus = "NoScore" |
|
|
|
}; |
|
|
|
}; |
|
|
|
examRecordId = await base.Add(insrt); |
|
|
|
examRecordId = await base.Add(insrt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id)) |
|
|
|
if (examRecordId == 0) examRecordId = id; |
|
|
|
{ |
|
|
|
|
|
|
|
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (examRecord != null) |
|
|
|
|
|
|
|
// examRecordId = examRecord.Id; |
|
|
|
|
|
|
|
//else |
|
|
|
|
|
|
|
//{ |
|
|
|
|
|
|
|
// var insrt = new InsertGhre_ExamRecordInput() |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }; |
|
|
|
|
|
|
|
// examRecordId = await base.Add(insrt); |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var records = await QueryFilterPage(body, $"Id='{examRecordId}'"); |
|
|
|
var records = await QueryFilterPage(body, $"Id='{examRecordId}'"); |
|
|
|