|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
using AgileObjects.AgileMapper.Extensions; |
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
using MongoDB.Driver.Linq; |
|
|
|
|
using System.Net; |
|
|
|
|
using System.Text.RegularExpressions; |
|
|
|
@ -13,14 +14,16 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
{ |
|
|
|
|
private readonly IBaseRepository<Ghre_ExamRecord> _dal; |
|
|
|
|
//private readonly IGhre_ExamPaperServices _ghre_ExamPaperServices; |
|
|
|
|
private readonly ILogger<Ghre_ExamRecordServices> _logger; |
|
|
|
|
public Ghre_ExamRecordServices(ICaching caching, |
|
|
|
|
//IGhre_ExamPaperServices ghre_ExamPaperServices, |
|
|
|
|
IBaseRepository<Ghre_ExamRecord> dal) |
|
|
|
|
IBaseRepository<Ghre_ExamRecord> dal, ILogger<Ghre_ExamRecordServices> logger) |
|
|
|
|
{ |
|
|
|
|
this._dal = dal; |
|
|
|
|
base.BaseDal = dal; |
|
|
|
|
base._caching = caching; |
|
|
|
|
//_ghre_ExamPaperServices = ghre_ExamPaperServices; |
|
|
|
|
_logger = logger; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override async Task<ServicePageResult<Ghre_ExamRecordDto>> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true) |
|
|
|
@ -1463,6 +1466,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
x.IsPass == true && |
|
|
|
|
(x.IsIssueCertificate == null || x.IsIssueCertificate == false)) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
_logger.LogInformation($"【发放证书】查询到{records.Count}条考试数据"); |
|
|
|
|
if (!records.Any()) |
|
|
|
|
return ServiceResult.OprateSuccess("发放成功!"); |
|
|
|
|
|
|
|
|
@ -1498,11 +1502,21 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
DateTime? ValidityPeriodTime = null; |
|
|
|
|
|
|
|
|
|
if (rule.ValidityType == "StaticDuration" && rule.StaticNum != null) |
|
|
|
|
{ |
|
|
|
|
ValidityPeriodTime = now.AddDays(rule.StaticNum.Value); |
|
|
|
|
ValidityPeriod = DateTimeHelper.ConvertToOnlySecondString(ValidityPeriodTime); |
|
|
|
|
} |
|
|
|
|
else if (rule.ValidityType == "Option" && rule.ValidityTime != null) |
|
|
|
|
{ |
|
|
|
|
ValidityPeriodTime = rule.ValidityTime; |
|
|
|
|
ValidityPeriod = DateTimeHelper.ConvertToSecondString(ValidityPeriodTime); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if (rule.ValidityType == "Unlimited") |
|
|
|
|
{ |
|
|
|
|
ValidityPeriodTime = DateTime.MaxValue; |
|
|
|
|
ValidityPeriod = "长期"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//发放证书 |
|
|
|
|
certificates.Add(new Ghre_Certificate() |
|
|
|
@ -1511,8 +1525,10 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
StaffId = record.StaffId, |
|
|
|
|
CourseId = record.CourseId, |
|
|
|
|
AwardDate = now, |
|
|
|
|
//ValidityPeriod = ValidityPeriod, |
|
|
|
|
ValidityPeriodTime = ValidityPeriodTime |
|
|
|
|
ValidityPeriod = ValidityPeriod, |
|
|
|
|
ValidityPeriodTime = ValidityPeriodTime, |
|
|
|
|
Reverse1 = "考试通过发放" |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1526,7 +1542,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
record.IsIssueCertificate = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await Db.Insertable(certificates).ExecuteReturnSnowflakeIdAsync(); |
|
|
|
|
await Db.Insertable(certificates).ExecuteReturnSnowflakeIdListAsync(); |
|
|
|
|
await Db.Updateable(records) |
|
|
|
|
.UpdateColumns(it => new { it.IsIssueCertificate }, true) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|