|
|
@ -422,16 +422,57 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
body.pageNum = 1; |
|
|
|
body.pageNum = 1; |
|
|
|
body.pageSize = 10000; |
|
|
|
body.pageSize = 10000; |
|
|
|
bool isOpenClass = false; |
|
|
|
bool isOpenClass = false; |
|
|
|
|
|
|
|
long? examRecordId = 0; |
|
|
|
|
|
|
|
Ghre_Exam exam = null; |
|
|
|
|
|
|
|
|
|
|
|
var staffId = App.User.StaffId; |
|
|
|
var staffId = App.User.StaffId; |
|
|
|
|
|
|
|
|
|
|
|
if (await Db.Queryable<Ghre_OpenClass>().Where(x => x.Id == id).AnyAsync()) |
|
|
|
var openClass = await Db.Queryable<Ghre_OpenClass>().Where(x => x.Id == id).FirstAsync(); |
|
|
|
|
|
|
|
if (openClass != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
id = await Db.Queryable<Ghre_StudyRecord>().Where(x => x.OpenClassId == id && x.StaffId == staffId).Select(x => x.Id).FirstAsync(); |
|
|
|
var id1 = await Db.Queryable<Ghre_ExamRecord>().Where(x => x.OpenClassId == id && x.StaffId == staffId).Select(x => x.Id).FirstAsync(); |
|
|
|
|
|
|
|
if (id1 > 0) |
|
|
|
|
|
|
|
id = id1; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id1 = await Db.Queryable<Ghre_StudyRecord>().Where(x => x.OpenClassId == id && x.StaffId == staffId).Select(x => x.Id).FirstAsync(); |
|
|
|
|
|
|
|
if (id1 > 0) |
|
|
|
|
|
|
|
id = id1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (id1 == 0 && openClass.IsRequireStudy == false) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
long? courseSnapId = null; |
|
|
|
|
|
|
|
if (openClass.LinkType == "Course") |
|
|
|
|
|
|
|
courseSnapId = await Db.Queryable<Ghre_CourseSnap>().Where(x => x.CourseId == openClass.LinkId).Select(x => x.Id).FirstAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var insrt = new InsertGhre_ExamRecordInput() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ExamId = openClass.ExamId, |
|
|
|
|
|
|
|
StudyRecordId = null, |
|
|
|
|
|
|
|
StaffId = staffId, |
|
|
|
|
|
|
|
CourseSnapId = courseSnapId, |
|
|
|
|
|
|
|
CourseSceneId = openClass.LinkType == "CourseScene" ? openClass.LinkId : null, |
|
|
|
|
|
|
|
CourseId = openClass.LinkType == "Course" ? openClass.LinkId : null, |
|
|
|
|
|
|
|
ExamPaperId = openClass.ExamPaperId, |
|
|
|
|
|
|
|
ExamDate = DateTime.Now.Date, |
|
|
|
|
|
|
|
RetakeTimes = 0, |
|
|
|
|
|
|
|
Status = DIC_EXAM_RECORD_STATUS.WAIT, |
|
|
|
|
|
|
|
ScoreStatus = DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE, |
|
|
|
|
|
|
|
BeginTime = openClass.ExamStartTime, |
|
|
|
|
|
|
|
EndTime = openClass.ExamEndTime, |
|
|
|
|
|
|
|
OpenClassId = openClass?.Id |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
id = await base.Add(insrt); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exam = await Db.Queryable<Ghre_Exam>() |
|
|
|
|
|
|
|
.Where(x => x.Id == openClass.ExamId) |
|
|
|
|
|
|
|
.FirstAsync(x => x.Status == DIC_EXAM_STATUS.RELEASED); |
|
|
|
|
|
|
|
|
|
|
|
isOpenClass = true; |
|
|
|
isOpenClass = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long? examRecordId = null; |
|
|
|
|
|
|
|
Ghre_StudyRecord studyRecord = null; |
|
|
|
Ghre_StudyRecord studyRecord = null; |
|
|
|
if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id)) |
|
|
|
if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -439,7 +480,6 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
if (studyRecord != null) |
|
|
|
if (studyRecord != null) |
|
|
|
id = studyRecord.Id; |
|
|
|
id = studyRecord.Id; |
|
|
|
} |
|
|
|
} |
|
|
|
Ghre_Exam exam = null; |
|
|
|
|
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id && x.StaffId == staffId)) |
|
|
|
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id && x.StaffId == staffId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.StudyRecordId == id && x.StaffId == staffId); |
|
|
|
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.StudyRecordId == id && x.StaffId == staffId); |
|
|
@ -472,13 +512,16 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
StudyRecordId = studyRecord.Id, |
|
|
|
StudyRecordId = studyRecord.Id, |
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
CourseSnapId = studyRecord.CourseSnapId, |
|
|
|
CourseSnapId = studyRecord.CourseSnapId, |
|
|
|
|
|
|
|
CourseSceneId = studyRecord.CourseSceneId, |
|
|
|
|
|
|
|
CourseId = studyRecord.CourseId, |
|
|
|
ExamPaperId = exam.ExamPaperId, |
|
|
|
ExamPaperId = exam.ExamPaperId, |
|
|
|
ExamDate = DateTime.Now.Date, |
|
|
|
ExamDate = DateTime.Now.Date, |
|
|
|
RetakeTimes = 0, |
|
|
|
RetakeTimes = 0, |
|
|
|
Status = Consts.DIC_EXAM_RECORD_STATUS.WAIT, |
|
|
|
Status = DIC_EXAM_RECORD_STATUS.WAIT, |
|
|
|
ScoreStatus = Consts.DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE, |
|
|
|
ScoreStatus = DIC_EXAM_RECORD_SCORE_STATUS.NO_SCORE, |
|
|
|
BeginTime = exam.BeginTime, |
|
|
|
BeginTime = exam.BeginTime, |
|
|
|
EndTime = exam.EndTime |
|
|
|
EndTime = exam.EndTime, |
|
|
|
|
|
|
|
OpenClassId = openClass?.Id, |
|
|
|
}; |
|
|
|
}; |
|
|
|
examRecordId = await base.Add(insrt); |
|
|
|
examRecordId = await base.Add(insrt); |
|
|
|
|
|
|
|
|
|
|
@ -502,14 +545,15 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
if (studyRecord.IsNull()) |
|
|
|
if (studyRecord.IsNull()) |
|
|
|
studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId); |
|
|
|
studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId); |
|
|
|
|
|
|
|
|
|
|
|
if (studyRecord.StudyProgress.IsNull() || (!studyRecord.StudyProgress.IsNull() && studyRecord.StudyProgress < 100)) |
|
|
|
|
|
|
|
return ServiceResult<QueryExam>.OprateFailed("学习尚未结束暂不可考试!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (exam.IsNull()) |
|
|
|
if (exam.IsNull()) |
|
|
|
exam = await Db.Queryable<Ghre_Exam>() |
|
|
|
exam = await Db.Queryable<Ghre_Exam>() |
|
|
|
.Where(x => x.Id == studyRecord.ExamId) |
|
|
|
.Where(x => x.Id == studyRecord.ExamId) |
|
|
|
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED || x.Status == Consts.DIC_EXAM_STATUS.DISABLED); |
|
|
|
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED || x.Status == Consts.DIC_EXAM_STATUS.DISABLED); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((isOpenClass == false && exam.IsRequireStudy == true) || (isOpenClass == true && openClass.IsRequireStudy == true)) |
|
|
|
|
|
|
|
if (studyRecord.StudyProgress.IsNull() || (!studyRecord.StudyProgress.IsNull() && studyRecord.StudyProgress < 100)) |
|
|
|
|
|
|
|
return ServiceResult<QueryExam>.OprateFailed("学习尚未结束暂不可考试!"); |
|
|
|
|
|
|
|
|
|
|
|
if (exam.IsNull() && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) |
|
|
|
if (exam.IsNull() && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !"); |
|
|
|
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !"); |
|
|
|
|
|
|
|
|
|
|
@ -528,9 +572,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
if (isOpenClass) |
|
|
|
if (isOpenClass) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (record.Status == DIC_EXAM_RECORD_STATUS.WAIT && (record.EndTime < dt.Date || record.BeginTime > dt)) |
|
|
|
if (record.Status == DIC_EXAM_RECORD_STATUS.WAIT && (record.EndTime < dt.Date || record.BeginTime > dt)) |
|
|
|
{ |
|
|
|
|
|
|
|
extend.IsAllowExam = false; |
|
|
|
extend.IsAllowExam = false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|