From 8d0b86380765c1a67051aec2aae0e809efd891c6 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 2 Apr 2025 17:22:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=97=AE=E5=8D=B7=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Ghre/Ghre_SurveyController.cs | 12 +++++++ Tiobon.Core.Api/Tiobon.Core.xml | 8 +++++ .../Ghre/IGhre_SurveyServices.cs | 2 ++ Tiobon.Core.Services/CommonServices.cs | 4 +-- .../Ghre/Ghre_ExamServices.cs | 2 +- .../Ghre/Ghre_SurveyServices.cs | 36 ++++++++++++++++--- Tiobon.Core/Tiobon.Core.xml | 8 +++++ 7 files changed, 64 insertions(+), 8 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs index b47e206a..5d338f33 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyController.cs @@ -90,4 +90,16 @@ public class Ghre_SurveyController : BaseController SubmitESSData(long id, [FromBody] Ghre_SurveyExtend input) => await _service.SubmitESSData(id, input); #endregion + + #region 发布 + /// + /// 发布 + /// + /// + /// + /// + [HttpPost("Publish/{id}")] + public async Task Publish(long id) => await _service.Publish(id); + + #endregion } diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 81e5dae7..7ed65935 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1417,6 +1417,14 @@ + + + 发布 + + + + + 问卷调查选项(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs index 2aeea2fb..77622954 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_SurveyServices.cs @@ -19,4 +19,6 @@ public interface IGhre_SurveyServices : IBaseServices> QueryESSData(long id); Task SubmitESSData(long id, Ghre_SurveyExtend input); + + Task Publish(long id); } \ No newline at end of file diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 9750c527..b16f2019 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -2401,11 +2401,11 @@ public partial class CommonServices : BaseServices>, ICommon case "TitleId": switch (jsonParam.operationKey) { - case "Include": + case "Equal": if (jsonParam.columnValue != null) titles = titles.Where(x => x.TitleID == jsonParam.columnValue.ObjToInt()).ToList(); break; - case "NotInclude": + case "NotEqual": if (jsonParam.columnValue != null) titles = titles.Where(x => x.TitleID != jsonParam.columnValue.ObjToInt()).ToList(); break; diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index dc785309..861bd730 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -291,7 +291,7 @@ public class Ghre_ExamServices : BaseServices /// 问卷调查 (服务) @@ -391,4 +387,34 @@ public class Ghre_SurveyServices : BaseServices Publish(long id) + { + var entity = await base.QueryById(id); + + await Db.Updateable() + .SetColumns(it => new Ghre_Survey() { Status = "Publish" }) + .Where(x => x.Id == id) + .ExecuteCommandAsync(); + + var deptIds = new List(); + var staffIds = new List(); + + if (entity.DeptId.IsNotEmptyOrNull()) + deptIds = JsonHelper.JsonToObj>(entity.DeptId); + + + if (entity.StaffId.IsNotEmptyOrNull()) + staffIds = JsonHelper.JsonToObj>(entity.StaffId); + + + var staffIds1 = await Db.Queryable().Where(x => x.DeptID != null && deptIds.Contains(x.DeptID.Value)).Select(x => x.StaffID).ToListAsync(); + staffIds.AddRange(staffIds1); + staffIds = staffIds.Distinct().ToList(); + + var userId = await Db.Queryable().Where(x => x.UserStaffID != null && staffIds.Contains(x.UserStaffID.Value)).Select(x => x.UserId).ToListAsync(); + + return ServiceResult.OprateSuccess("发布成功!"); + } } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 81e5dae7..7ed65935 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1417,6 +1417,14 @@ + + + 发布 + + + + + 问卷调查选项(Controller)