|
|
@ -1114,89 +1114,102 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
|
|
|
|
|
|
|
public async Task DealPass(ISqlSugarClient Db, long studyRecordId) |
|
|
|
public async Task DealPass(ISqlSugarClient Db, long studyRecordId) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var record = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.Id == studyRecordId); |
|
|
|
|
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】1"); |
|
|
|
|
|
|
|
|
|
|
|
var record = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.Id == studyRecordId); |
|
|
|
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId); |
|
|
|
|
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().FirstAsync(x => x.Id == record.ExamPaperId); |
|
|
|
|
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】PassScore:{examPaper.PassScore},Score:{record.Score},PassScore:{record.AdjustScore},"); |
|
|
|
|
|
|
|
|
|
|
|
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId); |
|
|
|
record.IsPass = examPaper.PassScore > ((record.Score ?? 0) + (record.AdjustScore ?? 0)) ? false : true; |
|
|
|
var examPaper = await Db.Queryable<Ghre_ExamPaper>().FirstAsync(x => x.Id == record.ExamPaperId); |
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】IsPass:{record.IsPass}"); |
|
|
|
record.IsPass = examPaper.PassScore > ((record.Score ?? 0) + (record.AdjustScore ?? 0)) ? false : true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
record.FinallyIsPass = record.IsPass; |
|
|
|
record.FinallyIsPass = record.IsPass; |
|
|
|
|
|
|
|
|
|
|
|
await Db.Updateable(record).UpdateColumns(it => new { it.IsPass, it.FinallyIsPass }, true)//true表示追加AOP赋值列 |
|
|
|
await Db.Updateable(record).UpdateColumns(it => new { it.IsPass, it.FinallyIsPass }, true)//true表示追加AOP赋值列 |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
await Db.Deleteable<Ghre_CreditPoint>().Where(x => x.ExamId == studyRecord.ExamId).ExecuteCommandAsync(); |
|
|
|
await Db.Deleteable<Ghre_CreditPoint>().Where(x => x.ExamId == studyRecord.ExamId).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
if (record.IsPass == true) |
|
|
|
if (record.IsPass == true) |
|
|
|
{ |
|
|
|
|
|
|
|
if (studyRecord.CourseSceneId.IsNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
var course = await Db.Queryable<Ghre_Course>().FirstAsync(x => x.Id == studyRecord.CourseId); |
|
|
|
if (studyRecord.CourseSceneId.IsNull()) |
|
|
|
#region 学分发放 |
|
|
|
|
|
|
|
var creditPoint = new Ghre_CreditPoint() |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
CourseId = studyRecord.CourseId, |
|
|
|
var course = await Db.Queryable<Ghre_Course>().FirstAsync(x => x.Id == studyRecord.CourseId); |
|
|
|
CourseSnapId = studyRecord.CourseSnapId, |
|
|
|
|
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
|
|
|
|
ExamId = studyRecord.ExamId, |
|
|
|
|
|
|
|
Date = DateTime.Now.Date, |
|
|
|
|
|
|
|
CreditPoints = course.CreditPoints |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 证书发放 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courses = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneId == studyRecord.CourseSceneId).ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < courses.Count; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == courses[i].Id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 学分发放 |
|
|
|
#region 学分发放 |
|
|
|
var creditPoint = new Ghre_CreditPoint() |
|
|
|
var creditPoint = new Ghre_CreditPoint() |
|
|
|
{ |
|
|
|
{ |
|
|
|
CourseId = courses[i].Id, |
|
|
|
CourseId = studyRecord.CourseId, |
|
|
|
CourseSnapId = snap?.Id, |
|
|
|
CourseSnapId = studyRecord.CourseSnapId, |
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
ExamId = studyRecord.ExamId, |
|
|
|
ExamId = studyRecord.ExamId, |
|
|
|
Date = DateTime.Now.Date, |
|
|
|
Date = DateTime.Now.Date, |
|
|
|
CreditPoints = courses[i].CreditPoints |
|
|
|
CreditPoints = course.CreditPoints |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 证书发放 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var courses = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneId == studyRecord.CourseSceneId).ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
for (int i = 0; i < courses.Count; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == courses[i].Id); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
#region 学分发放 |
|
|
|
|
|
|
|
var creditPoint = new Ghre_CreditPoint() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CourseId = courses[i].Id, |
|
|
|
|
|
|
|
CourseSnapId = snap?.Id, |
|
|
|
|
|
|
|
StaffId = studyRecord.StaffId, |
|
|
|
|
|
|
|
ExamId = studyRecord.ExamId, |
|
|
|
|
|
|
|
Date = DateTime.Now.Date, |
|
|
|
|
|
|
|
CreditPoints = courses[i].CreditPoints |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 处理培训记录有效时间 |
|
|
|
} |
|
|
|
if (studyRecord.StudyRuleId != null) |
|
|
|
|
|
|
|
{ |
|
|
|
} |
|
|
|
var studyRule = await Db.Queryable<Ghre_StudyRule>().FirstAsync(x => x.Id == studyRecord.StudyRuleId); |
|
|
|
|
|
|
|
if (studyRule != null && studyRule.ResultValidPeriod != null) |
|
|
|
#region 处理培训记录有效时间 |
|
|
|
|
|
|
|
if (studyRecord.StudyRuleId != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
studyRecord.ValidBeginTime = DateTime.Now; |
|
|
|
var studyRule = await Db.Queryable<Ghre_StudyRule>().FirstAsync(x => x.Id == studyRecord.StudyRuleId); |
|
|
|
studyRecord.ValidEndTime = studyRecord.ValidBeginTime.Value.AddMonths(studyRule.ResultValidPeriod.Value); |
|
|
|
if (studyRule != null && studyRule.ResultValidPeriod != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
studyRecord.ValidBeginTime = DateTime.Now; |
|
|
|
|
|
|
|
studyRecord.ValidEndTime = studyRecord.ValidBeginTime.Value.AddMonths(studyRule.ResultValidPeriod.Value); |
|
|
|
|
|
|
|
|
|
|
|
await Db.Updateable(studyRecord).UpdateColumns(it => new { it.ValidBeginTime, it.ValidEndTime }, true)//true表示追加AOP赋值列 |
|
|
|
await Db.Updateable(studyRecord).UpdateColumns(it => new { it.ValidBeginTime, it.ValidEndTime }, true)//true表示追加AOP赋值列 |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
record.ValidBeginTime = studyRecord.ValidBeginTime; |
|
|
|
record.ValidBeginTime = studyRecord.ValidBeginTime; |
|
|
|
record.ValidEndTime = studyRecord.ValidEndTime; |
|
|
|
record.ValidEndTime = studyRecord.ValidEndTime; |
|
|
|
await Db.Updateable(record).UpdateColumns(it => new { it.ValidBeginTime, it.ValidEndTime }) |
|
|
|
await Db.Updateable(record).UpdateColumns(it => new { it.ValidBeginTime, it.ValidEndTime }) |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】2"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception E) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】Message:{E.Message}"); |
|
|
|
|
|
|
|
_logger.LogInformation($"【DealPass:{studyRecordId}】StackTrace:{E.StackTrace}"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult> ViewExamPaperCallBackAsync(long examRecordId) |
|
|
|
public async Task<ServiceResult> ViewExamPaperCallBackAsync(long examRecordId) |
|
|
|