|
|
|
@ -12,6 +12,7 @@ using Tiobon.Core.Common.Helper; |
|
|
|
|
using MySqlX.XDevAPI.Common; |
|
|
|
|
using SqlSugar; |
|
|
|
|
using Google.Protobuf.WellKnownTypes; |
|
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services |
|
|
|
|
{ |
|
|
|
@ -83,6 +84,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
{ |
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.Indate)) |
|
|
|
|
entity.Indate = DateTimeHelper.ConvertToDayString(entity.Indate); |
|
|
|
|
entity.ExamDate = DateTimeHelper.ConvertToDayString(entity.ExamDate); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return new ServicePageResult<Ghre_StudyRecordDto>(filter.pageNum, total, filter.pageSize, entitys); |
|
|
|
@ -485,7 +487,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
CourseEndTime = courseTime.Date.AddMonths(snap?.ValidityPeriod ?? 1), |
|
|
|
|
CourseType = "Elective", |
|
|
|
|
CourseStatus = Consts.DIC_STUDY_RECORD_COURSE_STATUS_IN, |
|
|
|
|
StudyStatus = Consts.DIC_STUDY_RECORD_STUDY_STATUS_NO_JOIN |
|
|
|
|
StudyStatus = Consts.DicStudyRecordStudyStatus.NO_JOIN |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return ServiceResult.OprateSuccess("加入成功!"); |
|
|
|
@ -508,6 +510,8 @@ namespace Tiobon.Core.Services |
|
|
|
|
public async Task<bool> GenerateStaffStudyRecord(ISqlSugarClient Db, long studyRecordId) |
|
|
|
|
{ |
|
|
|
|
var record = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == studyRecordId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
decimal studyProgress = 0; |
|
|
|
|
var sql = $@"SELECT ISNULL (A.Hours, 0) * 60 + A.Minutes Minutes
|
|
|
|
|
FROM Ghre_CourseWare A |
|
|
|
@ -526,8 +530,13 @@ namespace Tiobon.Core.Services |
|
|
|
|
studyProgress = 100; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sql = $"UPDATE Ghre_StudyRecord SET StudyProgress = ISNULL(StudyProgress, 0)+{studyProgress} WHERE Id='{studyRecordId}'"; |
|
|
|
|
var studyStatus = DicStudyRecordStudyStatus.NO_FINISH; |
|
|
|
|
if (studyProgress == 100) |
|
|
|
|
studyStatus = DicStudyRecordStudyStatus.HAS_FINISH; |
|
|
|
|
sql = $"UPDATE Ghre_StudyRecord SET StudyProgress = ISNULL(StudyProgress, 0)+{studyProgress},StudyStatus='{studyStatus}' WHERE Id='{studyRecordId}'"; |
|
|
|
|
if (studyProgress > 0) await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
sql = $"UPDATE Ghre_StudyRecord SET BeginTime=GETDATE(),StudyStatus='{studyStatus}' WHERE BeginTime IS NULL AND Id='{studyRecordId}'"; |
|
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|