新增公开课 加入学习接口

master
xiaochanghai 11 months ago
parent ac01263e0f
commit ceab9d19da
  1. 15
      Tiobon.Core.Api/Controllers/Ghre/Ghre_StudyRecordController.cs
  2. 7
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 3
      Tiobon.Core.IServices/Ghre/IGhre_StudyRecordServices.cs
  4. 11
      Tiobon.Core.Services/BASE/BaseServices.cs
  5. 5
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  6. 35
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
  7. 14
      Tiobon.Core/Tiobon.Core.xml

@ -39,8 +39,6 @@ public class Ghre_StudyRecordController : BaseController<IGhre_StudyRecordServic
}
#endregion
#region 获取课程
/// <summary>
/// 获取课程
@ -54,4 +52,17 @@ public class Ghre_StudyRecordController : BaseController<IGhre_StudyRecordServic
return await _service.QueryCourse(body, id);
}
#endregion
#region 加入学习
/// <summary>
/// 加入学习
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost, Route("Join/{id}")]
public async Task<ServiceResult> Join(long id)
{
return await _service.Join(id);
}
#endregion
}

@ -962,6 +962,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_StudyRecordController.Join(System.Int64)">
<summary>
加入学习
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_StudyRuleController">
<summary>
必选修规则(Controller)

@ -16,5 +16,8 @@ namespace Tiobon.Core.IServices
Task<ServicePageResult<Ghre_StudyRecordESS>> QueryESS(QueryBody filter, string condition, bool? IsEnable = true);
Task<ServiceResult<Ghre_StudyRecordCourse>> QueryCourse(QueryBody body, long id);
Task<ServiceResult> Join(long courseId);
}
}

@ -21,6 +21,7 @@ using Tiobon.Core.Model.Models;
using System.Reflection;
using System.Collections;
using Microsoft.IdentityModel.Tokens;
using System.Collections.Generic;
namespace Tiobon.Core.Services.BASE;
@ -1383,6 +1384,16 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ
return queryString;
}
public int? GetStaffId()
{
int? StaffId = null;
string sql = $"SELECT UserStaffID FROM Ghrs_User WHERE UserId='{App.User.ID}'";
string StaffId1 = Convert.ToString(DbAccess.ExecuteScalar(sql));
if (!StaffId1.IsNull())
StaffId = Convert.ToInt32(StaffId1);
return StaffId;
}
//public int GetTotalCount(string sqlSelect)
//{
// string sql = string.Empty;

@ -1522,12 +1522,9 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
public async Task<ServiceResult<List<StaffTableData>>> QueryRuleStaff(long examId)
{
var exam = await base.QuerySingle(examId);
var Ids = await Db.Queryable<Ghre_StudyRecord>()
.Where(x => x.ExamId == null)
.WhereIF(exam.CourseId != null, x => x.CourseId == exam.CourseId)
.WhereIF(exam.CourseSceneId != null, x => x.CourseSceneId == exam.CourseSceneId)
.Where(x => x.ExamId == null && (x.CourseId == examId || x.CourseSceneId == examId))
.Select(x => x.StaffId).Distinct().ToListAsync();
string sql = @"SELECT A.StaffID,
A.StaffName,

@ -299,8 +299,7 @@ namespace Tiobon.Core.Services
}
#endregion
#endregion
#region 获取课程
/// <summary>
@ -388,7 +387,7 @@ namespace Tiobon.Core.Services
course.CourseWareList = new List<Ghre_StudyRecordCourseWare>();
course.CourseTeacherList = new List<Ghre_StudyRecordCourseTeacher>();
var courses = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneId == course.CourseSceneId && x.Status == Consts.DIC_COURSE_STATUS.RELEASED).ToListAsync();
for (int i = 0; i < courses.Count; i++)
{
var course1 = courses[i];
@ -450,5 +449,35 @@ namespace Tiobon.Core.Services
}
#endregion
#region 获取ESS查询条件
public async Task<ServiceResult> Join(long courseId)
{
var staffId = GetStaffId();
if (!await base.AnyAsync(x => x.CourseId == courseId && x.StaffId == staffId))
{
var course = await Db.Queryable<Ghre_Course>().Where(x => x.Id == courseId && x.Status == Consts.DIC_COURSE_STATUS.RELEASED).FirstAsync();
if (course.IsNull())
return ServiceResult.OprateFailed("无效的课程!");
DateTime courseTime = Db.GetDate();
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == courseId);
await base.Add(new InsertGhre_StudyRecordInput
{
StaffId = staffId,
CourseSnapId = snap?.Id,
CourseId = courseId,
JoinTime = courseTime,
CourseBeginTime = courseTime.Date,
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
});
}
return ServiceResult.OprateSuccess("加入成功!");
}
#endregion
}
}

@ -745,6 +745,13 @@
<param name="insert">insert</param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamController.QueryRuleStaff(System.Int64)">
<summary>
获取考试关联人员
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamMessageLogController">
<summary>
考试通知记录(Controller)
@ -955,6 +962,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_StudyRecordController.Join(System.Int64)">
<summary>
加入学习
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_StudyRuleController">
<summary>
必选修规则(Controller)

Loading…
Cancel
Save