课程场景新增场景说明维护

课程详情接口新增返回 课程场景说明
master
xiaochanghai 1 month ago
parent 7b9399a047
commit 9d1c279b4b
  1. 10
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  2. 8
      Tiobon.Core.Model/Base/Ghre/Ghre_CourseScene.Dto.Base.cs
  3. 8
      Tiobon.Core.Model/Models/Ghre/Ghre_CourseScene.cs
  4. 2
      Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordCourse.cs
  5. 217
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  6. 3
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
  7. 10
      Tiobon.Core/Tiobon.Core.Model.xml

@ -3700,6 +3700,11 @@
学分规则ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseSceneBase.SceneDescription">
<summary>
场景说明
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseSceneBase.Courses">
<summary>
课程列表
@ -23217,6 +23222,11 @@
学分规则ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseScene.SceneDescription">
<summary>
场景说明
</summary>
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_CourseSnap">
<summary>
Ghre_CourseSnap (Model)

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2025/4/8 17:21:17 SimonHsiao
*V0.01 2025/5/21 11:04:51 SimonHsiao
*
* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
*
@ -171,6 +171,12 @@ public class Ghre_CourseSceneBase
/// </summary>
public long? CreditRuleId { get; set; }
/// <summary>
/// 场景说明
/// </summary>
[Display(Name = "SceneDescription"), Description("场景说明"), MaxLength(200, ErrorMessage = "场景说明 不能超过 200 个字符")]
public string SceneDescription { get; set; }
/// <summary>
/// 课程列表
/// </summary>

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2025/4/8 17:21:17 SimonHsiao
*V0.01 2025/5/21 11:04:51 SimonHsiao
*
* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
*
@ -171,4 +171,10 @@ public class Ghre_CourseScene : BasePoco
/// 学分规则ID
/// </summary>
public long? CreditRuleId { get; set; }
/// <summary>
/// 场景说明
/// </summary>
[Display(Name = "SceneDescription"), Description("场景说明"), MaxLength(200, ErrorMessage = "场景说明 不能超过 200 个字符")]
public string SceneDescription { get; set; }
}

@ -27,7 +27,7 @@ public class Ghre_StudyRecordCourse
public decimal? CourseStandardDuration1 { get; set; }
public string StudyDuration { get; set; }
public string CourseStandardDuration { get; set; }
public string SceneDescription { get; set; }
public List<Ghre_StudyRecordCourseWare> CourseWareList { get; set; }
public List<Ghre_StudyRecordCourseCourseRemarkSzs> CourseRemarkSzs { get; set; }

@ -1607,85 +1607,182 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
(x.IsIssueCertificate == null || x.IsIssueCertificate == false))
.ToListAsync();
_logger.LogInformation($"【发放证书】查询到{records.Count}条考试数据");
if (!records.Any())
return ServiceResult.OprateSuccess("发放成功!");
var certificates = new List<Ghre_Certificate>();
var rules = await Db.Queryable<Ghre_CertificateRule>().Where(x => x.SendRule == "ExamPass").ToListAsync();
for (int i = 0; i < records.Count; i++)
var rules = new List<Ghre_CertificateRule>();
if (records.Any())
{
var record = records[i];
if (record.CourseId.IsNotEmptyOrNull())
{
var rules1 = rules.Where(x => x.CourseId1 != null && x.CourseId1.Contains(record.CourseId.ObjToString())).ToList();
for (int j = 0; j < rules1.Count; j++)
var certificates = new List<Ghre_Certificate>();
rules = await Db.Queryable<Ghre_CertificateRule>().Where(x => x.SendRule == "ExamPass").ToListAsync();
for (int i = 0; i < records.Count; i++)
{
var record = records[i];
if (record.CourseId.IsNotEmptyOrNull())
{
var rule = rules1[j];
var courseIds = JsonHelper.JsonToObj<List<long>>(rule.CourseId1);
courseIds = courseIds.Distinct().ToList();
if (courseIds.Any())
var rules1 = rules.Where(x => x.CourseId1 != null && x.CourseId1.Contains(record.CourseId.ObjToString())).ToList();
for (int j = 0; j < rules1.Count; j++)
{
if (courseIds.Count() ==
await Db.Queryable<Ghre_ExamRecord>()
.Where(x =>
x.ValidBeginTime != null &&
x.ValidEndTime != null &&
x.ValidBeginTime <= now &&
x.ValidEndTime >= now &&
x.StaffId == record.StaffId &&
x.CourseId != null &&
x.IsPass == true &&
courseIds.Contains(x.CourseId.Value)).CountAsync())
var rule = rules1[j];
var courseIds = JsonHelper.JsonToObj<List<long>>(rule.CourseId1);
courseIds = courseIds.Distinct().ToList();
if (courseIds.Any())
{
string ValidityPeriod = string.Empty;
DateTime? ValidityPeriodTime = null;
if (rule.ValidityType == "StaticDuration" && rule.StaticNum != null)
if (courseIds.Count() ==
await Db.Queryable<Ghre_ExamRecord>()
.Where(x =>
x.ValidBeginTime != null &&
x.ValidEndTime != null &&
x.ValidBeginTime <= now &&
x.ValidEndTime >= now &&
x.StaffId == record.StaffId &&
x.CourseId != null &&
x.IsPass == true &&
courseIds.Contains(x.CourseId.Value)).CountAsync())
{
ValidityPeriodTime = now.AddDays(rule.StaticNum.Value);
ValidityPeriod = DateTimeHelper.ConvertToOnlySecondString(ValidityPeriodTime);
string ValidityPeriod = string.Empty;
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()
{
CertificateRuleId = rule.Id,
StaffId = record.StaffId,
CourseId = record.CourseId,
AwardDate = now,
ValidityPeriod = ValidityPeriod,
ValidityPeriodTime = ValidityPeriodTime,
Reverse1 = "考试通过发放"
});
}
else if (rule.ValidityType == "Option" && rule.ValidityTime != null)
{
ValidityPeriodTime = rule.ValidityTime;
ValidityPeriod = DateTimeHelper.ConvertToSecondString(ValidityPeriodTime);
}
}
}
else if (rule.ValidityType == "Unlimited")
{
ValidityPeriodTime = DateTime.MaxValue;
ValidityPeriod = "长期";
}
}
else if (record.CourseSceneId.IsNotEmptyOrNull())
{
//发放证书
certificates.Add(new Ghre_Certificate()
{
CertificateRuleId = rule.Id,
StaffId = record.StaffId,
CourseId = record.CourseId,
AwardDate = now,
ValidityPeriod = ValidityPeriod,
ValidityPeriodTime = ValidityPeriodTime,
Reverse1 = "考试通过发放"
}
record.IsIssueCertificate = true;
}
});
await Db.Insertable(certificates).ExecuteReturnSnowflakeIdListAsync();
await Db.Updateable(records)
.UpdateColumns(it => new { it.IsIssueCertificate }, true)
.ExecuteCommandAsync();
}
if (await Db.Queryable<Ghre_CertificateRule>().Where(x => x.SendRule == "CourseFinish").AnyAsync()
&& await Db.Queryable<Ghre_StudyRecord>()
.Where(x =>
x.StudyStatus == "HasFinish" &&
(x.IsIssueCertificate == null || x.IsIssueCertificate == false))
.AnyAsync())
{
var studyRecords = await Db.Queryable<Ghre_StudyRecord>()
.Where(x =>
x.StudyStatus == "HasFinish" &&
(x.IsIssueCertificate == null || x.IsIssueCertificate == false))
.ToListAsync();
rules = await Db.Queryable<Ghre_CertificateRule>().Where(x => x.SendRule == "CourseFinish").ToListAsync();
var certificates = new List<Ghre_Certificate>();
for (int i = 0; i < studyRecords.Count; i++)
{
var record = studyRecords[i];
if (record.CourseId.IsNotEmptyOrNull())
{
var rules1 = rules.Where(x => x.CourseId1 != null && x.CourseId1.Contains(record.CourseId.ObjToString())).ToList();
for (int j = 0; j < rules1.Count; j++)
{
var rule = rules1[j];
var courseIds = JsonHelper.JsonToObj<List<long>>(rule.CourseId1);
courseIds = courseIds.Distinct().ToList();
if (courseIds.Any())
{
if (courseIds.Count() ==
await Db.Queryable<Ghre_ExamRecord>()
.Where(x =>
x.ValidBeginTime != null &&
x.ValidEndTime != null &&
x.ValidBeginTime <= now &&
x.ValidEndTime >= now &&
x.StaffId == record.StaffId &&
x.CourseId != null &&
x.IsPass == true &&
courseIds.Contains(x.CourseId.Value)).CountAsync())
{
string ValidityPeriod = string.Empty;
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()
{
CertificateRuleId = rule.Id,
StaffId = record.StaffId,
CourseId = record.CourseId,
AwardDate = now,
ValidityPeriod = ValidityPeriod,
ValidityPeriodTime = ValidityPeriodTime,
Reverse1 = "考试通过发放"
});
}
}
}
}
else if (record.CourseSceneId.IsNotEmptyOrNull())
{
}
record.IsIssueCertificate = true;
}
else if (record.CourseSceneId.IsNotEmptyOrNull())
{
}
record.IsIssueCertificate = true;
await Db.Insertable(certificates).ExecuteReturnSnowflakeIdListAsync();
await Db.Updateable(records)
.UpdateColumns(it => new { it.IsIssueCertificate }, true)
.ExecuteCommandAsync();
}
await Db.Insertable(certificates).ExecuteReturnSnowflakeIdListAsync();
await Db.Updateable(records)
.UpdateColumns(it => new { it.IsIssueCertificate }, true)
.ExecuteCommandAsync();
return ServiceResult.OprateSuccess("发放成功!");
}
#endregion

@ -1514,7 +1514,8 @@ WHERE A.Status !='Temporary' AND A.Status !='Close' AND A.IsEnable=1 AND ( E
A.CourseEndTime,
A.StandardDuration
CourseStandardDuration1,
A.StudyDuration StudyDuration1
A.StudyDuration StudyDuration1,
G.SceneDescription
FROM Ghre_StudyRecord A
LEFT JOIN Ghre_Course B ON A.CourseId = B.Id
LEFT JOIN Ghra_Staff c ON B.TeacherId = c.StaffID

@ -3700,6 +3700,11 @@
学分规则ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseSceneBase.SceneDescription">
<summary>
场景说明
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseSceneBase.Courses">
<summary>
课程列表
@ -23217,6 +23222,11 @@
学分规则ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CourseScene.SceneDescription">
<summary>
场景说明
</summary>
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_CourseSnap">
<summary>
Ghre_CourseSnap (Model)

Loading…
Cancel
Save