问卷题库接口开发、页面配置

master
xiaochanghai 2 months ago
parent 1113567888
commit 774f6e0a26
  1. 9
      Tiobon.Core.Api/Controllers/Ghre/Ghre_UshioPlanController.cs
  2. 4
      Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs
  3. 14
      Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs
  4. 12
      Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs

@ -8,8 +8,11 @@
[Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)] [Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)]
public class Ghre_UshioPlanController : BaseController<IGhre_UshioPlanServices, Ghre_UshioPlan, Ghre_UshioPlanDto, InsertGhre_UshioPlanInput, EditGhre_UshioPlanInput> public class Ghre_UshioPlanController : BaseController<IGhre_UshioPlanServices, Ghre_UshioPlan, Ghre_UshioPlanDto, InsertGhre_UshioPlanInput, EditGhre_UshioPlanInput>
{ {
public Ghre_UshioPlanController(IGhre_UshioPlanServices service) : base(service) IGhre_PlanServices _planService;
public Ghre_UshioPlanController(IGhre_UshioPlanServices service,
IGhre_PlanServices planService) : base(service)
{ {
_planService = planService;
} }
#region 查询 #region 查询
@ -33,9 +36,9 @@ public class Ghre_UshioPlanController : BaseController<IGhre_UshioPlanServices,
#region 状态修改 #region 状态修改
[HttpPost("UpdateStatus/{status}")] [HttpPost("UpdateStatus/{status}")]
public async Task<ServiceResult> UpdateStatus(string status, [FromBody] InsertGhre_UshioPlanInput input) public async Task<ServiceResult> UpdateStatus(string status, [FromBody] InsertGhre_PlanInput input)
{ {
return await _service.UpdateStatus(input, status); return await _planService.UpdateStatus(input, status);
} }
#endregion #endregion

@ -693,7 +693,7 @@ FROM Ghre_Request A
CreateProg, CreateProg,
DeptNo, DeptNo,
StaffNo, StaffNo,
LastUpdateDate,TrainStaffId,TrainClass,InOrOut,OutSideOrg) LastUpdateDate,TrainStaffId,TrainClass,InOrOut)
SELECT A.Id, SELECT A.Id,
A.RequestSource, A.RequestSource,
c.DeptName, c.DeptName,
@ -714,7 +714,7 @@ FROM Ghre_Request A
SELECT ',' + S.StaffNo SELECT ',' + S.StaffNo
FROM OPENJSON(A.TrainStaffId) WITH (TrainStaffId INT '$') AS JsonData FROM OPENJSON(A.TrainStaffId) WITH (TrainStaffId INT '$') AS JsonData
INNER JOIN Ghra_Staff S ON JsonData.TrainStaffId = S.StaffID INNER JOIN Ghra_Staff S ON JsonData.TrainStaffId = S.StaffID
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS StaffNames,A.TrainClass,A.InOrOut,SchoolId FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS StaffNames,A.TrainClass,A.InOrOut
FROM Ghre_Request A FROM Ghre_Request A
LEFT JOIN [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Request B LEFT JOIN [120.26.205.42].[GhrUshio].[dbo].Ghre_GHR50Request B
ON B.RequestID = A.Id ON B.RequestID = A.Id

@ -1,6 +1,4 @@
using Mysqlx.Crud; namespace Tiobon.Core.Services;
namespace Tiobon.Core.Services;
/// <summary> /// <summary>
/// 问卷题库 (服务) /// 问卷题库 (服务)
@ -10,10 +8,12 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
private readonly IBaseRepository<Ghre_SurveyQuestionPool> _dal; private readonly IBaseRepository<Ghre_SurveyQuestionPool> _dal;
private IGhre_SurveyQuestionPoolOptionServices _ghre_SurveyQuestionPoolOptionServicesServices; private IGhre_SurveyQuestionPoolOptionServices _ghre_SurveyQuestionPoolOptionServicesServices;
public Ghre_SurveyQuestionPoolServices(IBaseRepository<Ghre_SurveyQuestionPool> dal, public Ghre_SurveyQuestionPoolServices(IBaseRepository<Ghre_SurveyQuestionPool> dal,
ICaching caching,
IGhre_SurveyQuestionPoolOptionServices ghre_SurveyQuestionPoolOptionServices) IGhre_SurveyQuestionPoolOptionServices ghre_SurveyQuestionPoolOptionServices)
{ {
this._dal = dal;
base.BaseDal = dal; base.BaseDal = dal;
base._caching = caching;
_ghre_SurveyQuestionPoolOptionServicesServices = ghre_SurveyQuestionPoolOptionServices; _ghre_SurveyQuestionPoolOptionServicesServices = ghre_SurveyQuestionPoolOptionServices;
} }
@ -37,6 +37,12 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
// x.BuiltInLabel = x.BuiltIn == 1 ? "是" : "否"; // x.BuiltInLabel = x.BuiltIn == 1 ? "是" : "否";
//}); //});
result.result.DT_TableDataT1.ForEach(async x =>
{
x.QuestionType = await GetParaLabel("QuestionType", x.QuestionType);
});
return result; return result;
} }

@ -199,6 +199,8 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
public async Task<ServiceResult<Ghre_SurveyExtend>> QueryESSData(long id, long? openClassId = null) public async Task<ServiceResult<Ghre_SurveyExtend>> QueryESSData(long id, long? openClassId = null)
{ {
var entity = await base.QueryById(id); var entity = await base.QueryById(id);
var data = Mapper.Map(entity).ToANew<Ghre_SurveyExtend>(); var data = Mapper.Map(entity).ToANew<Ghre_SurveyExtend>();
data.BeginEndTime.Add(data.BeginTime); data.BeginEndTime.Add(data.BeginTime);
@ -218,13 +220,19 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
}); });
#region 是否存在已提交问卷数据 #region 是否存在已提交问卷数据
data.IsSubmit = await Db.Queryable<Ghre_SurveyRecord>().Where(x => x.StaffId == App.User.StaffId && x.SurveyId == id).AnyAsync(); data.IsSubmit = await Db.Queryable<Ghre_SurveyRecord>()
.Where(x => x.StaffId == App.User.StaffId && x.SurveyId == id)
.WhereIF(openClassId != null, x => x.OpenClassId == openClassId)
.AnyAsync();
#endregion #endregion
#region 处理已提交信息 #region 处理已提交信息
if (data.IsSubmit) if (data.IsSubmit)
{ {
var recordId = await Db.Queryable<Ghre_SurveyRecord>().Where(x => x.StaffId == App.User.StaffId && x.SurveyId == id).Select(x => x.Id).FirstAsync(); var recordId = await Db.Queryable<Ghre_SurveyRecord>()
.Where(x => x.StaffId == App.User.StaffId && x.SurveyId == id)
.WhereIF(openClassId != null, x => x.OpenClassId == openClassId)
.Select(x => x.Id).FirstAsync();
var recordDetails = await Db.Queryable<Ghre_SurveyRecordDetail>().Where(x => x.SurveyRecordId == recordId).ToListAsync(); var recordDetails = await Db.Queryable<Ghre_SurveyRecordDetail>().Where(x => x.SurveyRecordId == recordId).ToListAsync();
var recordOptions = await Db.Queryable<Ghre_SurveyRecordOption>().Where(x => x.SurveyRecordId == recordId).OrderBy(x => x.OptionContent).ToListAsync(); var recordOptions = await Db.Queryable<Ghre_SurveyRecordOption>().Where(x => x.SurveyRecordId == recordId).OrderBy(x => x.OptionContent).ToListAsync();

Loading…
Cancel
Save