问卷设定

master
xiaochanghai 3 months ago
parent b89d5594c7
commit 086c5c2e19
  1. 11
      Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs
  2. 14
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 2
      Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs
  4. 2
      Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs
  5. 2
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  6. 27
      Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
  7. 14
      Tiobon.Core/Tiobon.Core.xml

@ -56,4 +56,15 @@ public class Ghre_SurveyController : BaseController<IGhre_SurveyServices, Ghre_S
public async Task<ServiceResult<long>> InsertData(long id, [FromBody] InsertGhre_SurveyExtend input) => await _service.InsertData(id, input); public async Task<ServiceResult<long>> InsertData(long id, [FromBody] InsertGhre_SurveyExtend input) => await _service.InsertData(id, input);
#endregion #endregion
#region 插入
/// <summary>
/// 插入
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("QueryData/{id}")]
public async Task<ServiceResult<InsertGhre_SurveyExtend>> QueryData(long id) => await _service.QueryData(id);
#endregion
} }

@ -1254,6 +1254,13 @@
<param name="status">status</param> <param name="status">status</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_RequestController.QueryFormByStatus(Tiobon.Core.Common.QueryForm)">
<summary>
查询菜单表单信息
</summary>
<param name="body">body</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_RequiredCourseController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_RequiredCourseController">
<summary> <summary>
必选修查询(Controller) 必选修查询(Controller)
@ -1388,6 +1395,13 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_SurveyController.QueryData(System.Int64)">
<summary>
插入
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_SurveyOptionController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_SurveyOptionController">
<summary> <summary>
问卷调查选项(Controller) 问卷调查选项(Controller)

@ -13,4 +13,6 @@ public interface IGhre_SurveyServices : IBaseServices<Ghre_Survey, Ghre_SurveyDt
Task<ServiceResult> UpdateStatus(InsertGhre_SurveyInput input, string status); Task<ServiceResult> UpdateStatus(InsertGhre_SurveyInput input, string status);
Task<ServiceResult<long>> InsertData(long id, InsertGhre_SurveyExtend insertModel); Task<ServiceResult<long>> InsertData(long id, InsertGhre_SurveyExtend insertModel);
Task<ServiceResult<InsertGhre_SurveyExtend>> QueryData(long id);
} }

@ -45,7 +45,7 @@ public class InsertGhre_SurveyExtend
/// </summary> /// </summary>
public class InsertGhre_SurveyQuestionExtend public class InsertGhre_SurveyQuestionExtend
{ {
public long Id { get; set; }
/// <summary> /// <summary>
/// 题目类型 /// 题目类型

@ -1420,7 +1420,7 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
if (entity.DateType == DicExamDateType.EXAM_DATE) if (entity.DateType == DicExamDateType.EXAM_DATE)
{ {
courseEndTime = entity.EndTime.Value.Date.AddDays(1); courseEndTime = entity.EndTime.Value.Date.AddDays(1);
courseTime = courseEndTime.AddDays(-(snap?.ValidityPeriod ?? 1)); courseTime = courseEndTime.AddDays(-(snap?.ValidityPeriod ?? 1) * 30);
} }
for (int i = 0; i < staffs.Count; i++) for (int i = 0; i < staffs.Count; i++)

@ -1,6 +1,4 @@
using MongoDB.Driver.Core.Servers; namespace Tiobon.Core.Services;
namespace Tiobon.Core.Services;
/// <summary> /// <summary>
/// 问卷调查 (服务) /// 问卷调查 (服务)
@ -42,6 +40,22 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
var result = await base.QueryForm(body); var result = await base.QueryForm(body);
return result; return result;
} }
public async Task<ServiceResult<InsertGhre_SurveyExtend>> QueryData(long id)
{
var entity = await base.QueryById(id);
var data = Mapper.Map(entity).ToANew<InsertGhre_SurveyExtend>();
var questions = await Db.Queryable<Ghre_SurveyQuestion>().Where(x => x.SurveyId == id).ToListAsync();
var options = await Db.Queryable<Ghre_SurveyOption>().Where(x => x.SurveyId == id).ToListAsync();
data.Questions = Mapper.Map(questions).ToANew<List<InsertGhre_SurveyQuestionExtend>>();
data.Questions.ForEach(x =>
{
x.Options = Mapper.Map(options.Where(o => o.SurveyQuestionId == x.Id)).ToANew<List<InsertGhre_SurveyOptionExtend>>();
});
return ServiceResult<InsertGhre_SurveyExtend>.OprateSuccess("成功", data);
}
public async Task<ServiceResult<long>> InsertByStatus(InsertGhre_SurveyInput insertModel, string status) public async Task<ServiceResult<long>> InsertByStatus(InsertGhre_SurveyInput insertModel, string status)
{ {
@ -92,7 +106,7 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
{ {
var insert = Mapper.Map(insertModel).ToANew<InsertGhre_SurveyInput>(); var insert = Mapper.Map(insertModel).ToANew<InsertGhre_SurveyInput>();
insert.Status = "Temporary";
id = await Add(insert); id = await Add(insert);
for (int i = 0; i < insertModel.Questions.Count; i++) for (int i = 0; i < insertModel.Questions.Count; i++)
@ -118,6 +132,11 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
await Db.Deleteable<Ghre_SurveyQuestion>().Where(x => x.SurveyId == id).ExecuteCommandAsync(); await Db.Deleteable<Ghre_SurveyQuestion>().Where(x => x.SurveyId == id).ExecuteCommandAsync();
await Db.Deleteable<Ghre_SurveyOption>().Where(x => x.SurveyId == id).ExecuteCommandAsync(); await Db.Deleteable<Ghre_SurveyOption>().Where(x => x.SurveyId == id).ExecuteCommandAsync();
var insert = Mapper.Map(insertModel).ToANew<EditGhre_SurveyInput>();
await Update(id, insert, null, ["Status"]);
for (int i = 0; i < insertModel.Questions.Count; i++) for (int i = 0; i < insertModel.Questions.Count; i++)
{ {
var question = Mapper.Map(insertModel.Questions[i]).ToANew<Ghre_SurveyQuestion>(); var question = Mapper.Map(insertModel.Questions[i]).ToANew<Ghre_SurveyQuestion>();

@ -1254,6 +1254,13 @@
<param name="status">status</param> <param name="status">status</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_RequestController.QueryFormByStatus(Tiobon.Core.Common.QueryForm)">
<summary>
查询菜单表单信息
</summary>
<param name="body">body</param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_RequiredCourseController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_RequiredCourseController">
<summary> <summary>
必选修查询(Controller) 必选修查询(Controller)
@ -1388,6 +1395,13 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_SurveyController.QueryData(System.Int64)">
<summary>
插入
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_SurveyOptionController"> <member name="T:Tiobon.Core.Api.Controllers.Ghre_SurveyOptionController">
<summary> <summary>
问卷调查选项(Controller) 问卷调查选项(Controller)

Loading…
Cancel
Save