Przeglądaj źródła

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

LEIYI 3 miesięcy temu
rodzic
commit
a503bdf2de

+ 72 - 4
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -2052,12 +2052,19 @@ namespace OASystem.API.Controllers
         /// 员工绩效组成结构获取
         /// </summary>
         /// <param name="userid"></param>
+        /// <param name="date"></param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetPerformanceList(int userid)
+        public IActionResult GetPerformanceList(int userid,string date)
         {
             var jw = JsonView(false);
 
+            if (!DateTime.TryParse(date,out DateTime date_Dt))
+            {
+                jw.Msg = "日期格式有误!";
+                return Ok(jw);
+            }
+
             string sql_CTE = $@"-- 定义递归查询的CTE
 WITH PerAssessmentSettingsCTE AS (
     -- 选择指定ID的记录作为起点
@@ -2107,12 +2114,13 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             var ids = result_CTE.Select(x => x.Id);
 
             var List = _sqlSugar.Queryable<Per_AssessmentSetting>()
-                        .LeftJoin<Per_AssessmentContentSetting>((a, b) => a.Id == b.AssessmentSettingId && b.IsDel == 0)
-                        .LeftJoin<Per_AssessmentScore>((a, b,c) => b.Id == c.AssessmentContentSettingId && c.IsDel == 0)
+                        .LeftJoin<Per_AssessmentContentSetting>((a, b) => a.Id == b.AssessmentSettingId && b.IsDel == 0 && b.UserId == userid)
+                        .LeftJoin<Per_AssessmentScore>((a, b,c) => b.Id == c.AssessmentContentSettingId && c.IsDel == 0 && c.YearMonth.Year == date_Dt.Year && c.YearMonth.Month == date_Dt.Month)
                         .Where((a, b) => a.IsDel == 0 && ids.Contains(a.Id))
                         .Select((a, b, c) => new TreeNode
                         {
                             Id = a.Id,
+                            ContentId = b.Id,
                             Name = a.Name,
                             ParentId = a.ParentId,
                             AssessmentProportion = a.AssessmentProportion, //占比
@@ -2345,7 +2353,7 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
                                                        b.AssessmentStandard,
                                                        MergeStr = $"【项名称:{b.Name}/目标值:{a.TargetValue}/评估标准:{b.AssessmentStandard}】",
                                                        a.AssessmentProportionChi,
-                                                        b.Name
+                                                       b.Name
                                                    })
                                                    .ToList()
                                                    .ToDictionary(x => x.ContentSettingId);
@@ -2407,6 +2415,66 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
             return Ok(jw);
         }
 
+        /// <summary>
+        /// 绩效项删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult DeleteAssessmentSetting(DeleteAssessmentSettingDto dto)
+        {
+            var jw = JsonView(false, "删除失败!");
+            if (!dto.IdArr.Any())
+            {
+                jw.Msg = "id不能为空!";
+                return Ok(jw);
+            }
+
+            var rowCount = _sqlSugar.Updateable<Per_AssessmentSetting>()
+                .Where(x => dto.IdArr.Contains(x.Id) && x.IsDel == 0)
+                .SetColumns(x => new Per_AssessmentSetting
+                {
+                    IsDel = 1,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
+                    DeleteUserId = dto.UserId,
+                })
+                .ExecuteCommand();
+
+            jw.Code = 200;
+            jw.Msg = $"修改成功!,修改数量{rowCount}";
+            return Ok(jw);
+        }
+
+        /// <summary>
+        /// 绩效内容删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult DeleteAssessmentContentSetting(DeleteAssessmentSettingDto dto)
+        {
+            var jw = JsonView(false, "删除失败!");
+            if (!dto.IdArr.Any())
+            {
+                jw.Msg = "id不能为空!";
+                return Ok(jw);
+            }
+
+            var rowCount = _sqlSugar.Updateable<Per_AssessmentContentSetting>()
+                .Where(x => dto.IdArr.Contains(x.Id) && x.IsDel == 0)
+                .SetColumns(x => new Per_AssessmentContentSetting
+                {
+                    IsDel = 1,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
+                    DeleteUserId = dto.UserId,
+                })
+                .ExecuteCommand();
+
+            jw.Code = 200;
+            jw.Msg = $"修改成功!,修改数量{rowCount}";
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 企微Api测试

+ 9 - 0
OASystem/OASystem.Domain/Dtos/PersonnelModule/TreeNode.cs

@@ -10,6 +10,8 @@ namespace OASystem.Domain.Dtos.PersonnelModule
     public class TreeNode
     {
         public int Id { get; set; }
+
+        public int ContentId { get; set; }
         public string Name { get; set; }
         /// <summary>
         /// 考核占比
@@ -230,4 +232,11 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         public string Status { get; set; }
 
     }
+
+    public class DeleteAssessmentSettingDto
+    {
+        public List<int> IdArr { get; set;}
+
+        public int UserId { get; set;}
+    }
 }