Ver código fonte

团组流程视图模型重构及流程搜索接口增强

新增 ProcessView 视图模型,重构流程相关数据结构,提升类型安全性和可维护性。新增团组/会务流程关键字搜索接口,优化任务名称去重逻辑,完善接口文档注释,提升整体代码规范性。
Lyyyi 2 dias atrás
pai
commit
b5e447e4d0

+ 0 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -32920,7 +32920,6 @@ WHERE
                 .ToListAsync();
 
             return Ok(JsonView(groupNames));
-
         }
 
         /// <summary>

+ 15 - 14
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -3992,19 +3992,19 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             return Ok(await AiPerformanceAnalysis_TaskAllocationAsync(userId, start, end, createUserId, 1486));
         }
 
-        /// <summary>
-        /// 策划部员工分析
-        /// </summary>
-        /// <param name="userId"></param>
-        /// <param name="start"></param>
-        /// <param name="end"></param>
-        /// <param name="createUserId"></param>
-        /// <returns></returns>
-        // [HttpGet]
-        // public async Task<IActionResult> AiPerformanceAnalysis_PlanningDepartmentAsync(int userId, DateTime start, DateTime end, int createUserId)
-        // {
+        ///// <summary>
+        ///// 策划部员工分析
+        ///// </summary>
+        ///// <param name="userId"></param>
+        ///// <param name="start"></param>
+        ///// <param name="end"></param>
+        ///// <param name="createUserId"></param>
+        ///// <returns></returns>
+        //[HttpGet]
+        //public async Task<IActionResult> AiPerformanceAnalysis_PlanningDepartmentAsync(int userId, DateTime start, DateTime end, int createUserId)
+        //{
 
-        // }
+        //}
 
         /// <summary>
         /// 任务分配分析
@@ -4013,6 +4013,7 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
         /// <param name="start"></param>
         /// <param name="end"></param>
         /// <param name="createUserId"></param>
+        /// <param name="setdataId"></param>
         /// <returns></returns>
         private async Task<JsonView> AiPerformanceAnalysis_TaskAllocationAsync(int userId, DateTime start, DateTime end, int createUserId, int setdataId)
         {
@@ -4270,8 +4271,8 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
         /// <summary>
         /// 国交员工分析pdf下载
         /// </summary>
-        /// <param name="year"></param>
-        /// <param name="month"></param>
+        /// <param name="start"></param>
+        /// <param name="end"></param>
         /// <param name="userId"></param>
         /// <returns></returns>
         [HttpPost]

+ 70 - 0
OASystem/OASystem.Api/Controllers/SearchController.cs

@@ -204,5 +204,75 @@ namespace OASystem.API.Controllers
         }
 
 
+        /// <summary>
+        /// 团组、会务流程 关键字输入提示(智能版)
+        /// </summary>
+        /// <param name="keyword">关键字</param>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> ProcessKeywordSearch(string keyword)
+        {
+            try
+            {
+                // 验证请求参数
+                if (string.IsNullOrEmpty(keyword))
+                {
+                    return Ok(JsonView(true, $"暂无数据!"));
+                }
+
+                var searchRequest = new DynamicSearchRequest
+                {
+                    Keyword = keyword,
+                    RequireAllSingleChars = true,
+                    PageIndex = 1,
+                    PageSize = 999999,
+                    FieldWeights = new Dictionary<string, int>
+                    {
+                        { "TeamName", 10 }
+                    },
+                    Filters = new List<SearchFilter>()
+                    {
+                        new(){Field = "IsDel",Operator="eq",Value="0" }
+                    },
+                    OrderBy = "VisitDate",
+                    ReturnFields = new List<string>() { "TeamName" }
+                };
+
+                // 验证字段配置
+                var validation = _groupSearchService.ValidateFieldConfig(
+                    searchRequest.FieldWeights,
+                    searchRequest.ReturnFields);
+
+                if (!validation.IsValid)
+                {
+                    return Ok(JsonView(true, $"暂无数据!{validation.Message}"));
+                }
+
+                var result = await _groupSearchService.SearchAsync(searchRequest);
+
+                if (result.Success)
+                {
+                    var data = new List<dynamic>();
+
+                    foreach (var item in result.Items)
+                    {
+                        data.Add(new
+                        {
+                            item.Data.Id,
+                            item.Data.TeamName,
+                        });
+                    }
+
+                    return Ok(JsonView(true, result.Message, data, data.Count));
+                }
+
+                return Ok(JsonView(true, result.Message));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(true, $"搜索服务暂时不可用!"));
+            }
+        }
     }
 }

+ 72 - 0
OASystem/OASystem.Domain/ViewModels/Groups/ProcessView.cs

@@ -0,0 +1,72 @@
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Groups
+{
+    public class ProcessView
+    {
+    }
+
+    /// <summary>
+    /// 团组流程View
+    /// </summary>
+    public class ProcessDetailsView
+    {
+        public int Id { get; set; }
+        public int GroupId { get; set; }
+        public GroupProcessType ProcessType { get; set; }
+        public string ProcessName { get; set; }
+        public List<ProcessNodeDetailsView> Nodes { get; set; } = new List<ProcessNodeDetailsView>();
+    }
+
+    public class ProcessNodeDetailsView
+    {
+        public int Id { get; set; }
+        public int ProcessId { get; set; }
+        public int NodeOrder { get; set; }
+        public string NodeName { get; set; }
+        public ProcessStatus OverallStatus { get; set; }
+        public string StatusText { get; set; }
+        public string Operator { get; set; }
+        public string OpeateTime { get; set; }
+        public string ActualDone { get; set; }
+        /// <summary>
+        /// 可操作用户列表
+        /// </summary>
+        public List<int> OpUserList { get; set; } = new List<int>();
+        public string NodeDescTips { get; set; }
+        /// <summary>
+        /// 是否启用财务流程首节点协助按钮
+        /// </summary>
+        public bool IsEnaAssistBtn { get; set; }
+        /// <summary>
+        /// 财务流程首节点 存储值
+        /// </summary>
+        public bool IsAssist { get; set; }
+        /// <summary>
+        /// 是否启用上传文件按钮
+        /// </summary>
+        public bool IsEnaFileUpBtn { get; set; }
+        /// <summary>
+        /// 票据上传节点 存储值
+        /// </summary>
+        public bool IsFileUp { get; set; }
+        /// <summary>
+        /// 是否启用参与按钮
+        /// </summary>
+        public bool IsEnaPartBtn { get; set; }
+        /// <summary>
+        /// 参与按钮 存储值
+        /// </summary>
+        public bool IsPart { get; set; }
+        /// <summary>
+        /// 签证节点类型使用
+        /// </summary>
+        public List<VisaProcessNode> VisaSubNodes { get; set; } = new List<VisaProcessNode>();
+    }
+}

+ 19 - 19
OASystem/OASystem.Infrastructure/Repositories/Groups/ProcessOverviewRepository.cs

@@ -365,11 +365,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var orderedNodes = p.Nodes.OrderBy(n => n.NodeOrder).ToList();
                 var totalNodes = orderedNodes.Count;
 
-                return new
+                return new ProcessDetailsView()
                 {
-                    p.Id,
-                    p.GroupId,
-                    p.ProcessType,
+                    Id = p.Id,
+                    GroupId = p.GroupId,
+                    ProcessType = p.ProcessType,
                     ProcessName = p.ProcessType.GetEnumDescription(),
                     Nodes = orderedNodes.Select((n, index) =>
                     {
@@ -409,7 +409,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 ?? new List<VisaProcessNode>();
                         }
 
-                        // 获取操作人姓名(使用字典提升性能)
+                        // 获取操作人姓名
                         string operatorName = "-";
                         if (n.Operator.HasValue && userDict.TryGetValue(n.Operator.Value, out var name))
                         {
@@ -418,26 +418,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                         string nodeTipsMsg = NodeTipsMsg(groupInfo, p.ProcessType, n.NodeOrder);
 
-                        return new
+                        return new ProcessNodeDetailsView()
                         {
-                            n.Id,
-                            n.ProcessId,
-                            n.NodeOrder,
-                            n.NodeName,
-                            n.OverallStatus,
+                            Id = n.Id,
+                            ProcessId = n.ProcessId,
+                            NodeOrder = n.NodeOrder,
+                            NodeName = n.NodeName,
+                            OverallStatus = n.OverallStatus,
                             StatusText = n.OverallStatus.GetEnumDescription(),
                             Operator = operatorName,
                             OpeateTime = n.OperationTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "-",
                             ActualDone = n.ActualDone?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
-                            n.OpUserList,    //可操作用户列表
+                            OpUserList = n.OpUserList,    //可操作用户列表
                             NodeDescTips = nodeTipsMsg,
-                            isEnaAssistBtn,  // 是否启用财务流程首节点协助按钮
-                            n.IsAssist,      // 财务流程首节点 存储值
-                            isEnaFileUpBtn,  // 是否启用上传文件按钮
-                            n.IsFileUp,      // 票据上传节点 存储值
-                            isEnaPartBtn,    // 是否启用参与按钮
-                            n.IsPart,        // 参与按钮 存储值
-                            visaSubNodes     // 签证节点类型使用
+                            IsEnaAssistBtn = isEnaAssistBtn,  // 是否启用财务流程首节点协助按钮
+                            IsAssist = n.IsAssist,      // 财务流程首节点 存储值
+                            IsEnaFileUpBtn = isEnaFileUpBtn,  // 是否启用上传文件按钮
+                            IsFileUp = n.IsFileUp,      // 票据上传节点 存储值
+                            IsEnaPartBtn = isEnaPartBtn,    // 是否启用参与按钮
+                            IsPart = n.IsPart,        // 参与按钮 存储值
+                            VisaSubNodes = visaSubNodes     // 签证节点类型使用
                         };
                     }).ToList()
                 };

+ 9 - 3
OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/TaskAllocationRepository.cs

@@ -83,12 +83,18 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                     .ToList();
 
                 //任务名称 
-                var taskNameInfos = _sqlSugar.Queryable<Pm_TaskAllocation, Pm_TaskRelevanceUser>((ta, tau) => new JoinQueryInfos(JoinType.Left, ta.Id == tau.TAId))
+                var taskNameInfos = _sqlSugar.Queryable<Pm_TaskAllocation, Pm_TaskRelevanceUser>((ta, taru) => new JoinQueryInfos(JoinType.Left, ta.Id == taru.TAId))
                     .Where((ta, taru) => ta.IsDel == 0 && taru.IsDel == 0)
                     .Where((ta, taru) => ta.CreateUserId == userId || taru.UserId == userId)
                     .OrderByDescending((ta, taru) => ta.CreateTime)
-                    .Select(ta => ta.TaskName)
-                    .Distinct()
+                    .Select((ta, taru) => new
+                    {
+                        ta.TaskName,
+                        ta.CreateTime 
+                    })
+                    .ToList()
+                    .DistinctBy(x => x.TaskName)
+                    .Select(x => x.TaskName) 
                     .ToList();
 
                 //团组名称