Browse Source

添加和更新 API 日志注解,修改批注渲染逻辑

在 `GroupsController.cs` 中添加了多个 `[ApiLog]` 注解以记录 API 操作日志,并注释掉了部分方法上的 `[ApiLog]` 注解。更新了 `StatisticsController.cs` 中的批注渲染逻辑,仅在 `ThisMonthAmount` 或 `ThisYearAmount` 不为 0 时添加批注。修改了 `RecordAPIOperationMiddleware.cs` 中的注释。注释掉了 `EnterExitCostDraftRepository.cs` 和 `EnterExitCostRepository.cs` 中的权限验证代码。
LEIYI 4 months ago
parent
commit
3a30c439a4

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

@@ -5475,6 +5475,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCost", OperationEnum.Details)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GetEnterExitCostInfobyDiId(EnterExitCostInfobyDiIdDto dto)
         {
@@ -5533,6 +5534,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCost",OperationEnum.Add)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostOperate(EnterExitCostOperateDto dto)
         {
@@ -5650,6 +5652,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        //[ApiLog("Grp_EnterExitCost", OperationEnum.Download)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostDownload(EnterExitCostDownloadDto dto)
         {
@@ -7225,6 +7228,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostOneClickClear(EnterExitCostOneClickClearDto dto)
         {
@@ -7256,6 +7260,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
         {
@@ -7282,6 +7287,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         public IActionResult DeleteOtherExpenses(EnterExitCostSubItemDelDto dto)
         {
             var jw = JsonView(false, "删除失败!");
@@ -7682,6 +7688,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Details)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftInfoById(EnterExitCostDraftInfoByIdDto dto)
         {
@@ -7737,6 +7744,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Add)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftOp(EnterExitCostDraftOpDto dto)
         {
@@ -7760,6 +7768,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        //[ApiLog("Grp_EnterExitCostDraft", OperationEnum.Download)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftDownload(EnterExitCostDraftDownloadDto dto)
         {
@@ -8832,12 +8841,12 @@ FROM
             return _city;
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用-草稿 - 一键清空
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftOneClickEmpty(EnterExitCostDraftOneClickEmptyDto dto)
         {
@@ -8859,6 +8868,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftSubItemDel(EnterExitCostDraftSubItemDelDto dto)
         {
@@ -8878,6 +8888,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
+        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         public IActionResult EnterExitCostDraftOtherExpensesDel(EnterExitCostDraftOtherExpensesDelDto dto)
         {
             var jw = JsonView(false, "删除失败!");

+ 19 - 15
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -8920,24 +8920,28 @@ WHERE
                 {
                     string monthComment = $"C{i + 3}",
                            yearComment = $"D{i + 3}";
+
                     int monthCommentIndex = dailySheet.Comments.Add(monthComment),
                         yearCommentIndex = dailySheet.Comments.Add(yearComment);
+                    if (dailyViewItems[i].ThisMonthAmount != 0.00M)
+                    {
+                        string commentText1 = conmmentTexts[i].MonthComment;
+                        Aspose.Cells.Comment comment = dailySheet.Comments[monthCommentIndex];
+                        comment.Note = commentText1;
+                        comment.Width = 400;
+                        comment.Height = 400;
+                        comment.Font.Color = Color.Red;
+                    }
 
-
-                    string commentText1 = conmmentTexts[i].MonthComment,
-                           commentText2 = conmmentTexts[i].YearComment;
-
-                    Aspose.Cells.Comment comment1 = dailySheet.Comments[monthCommentIndex];
-                    comment1.Note = commentText1;
-                    comment1.Width = 400;
-                    comment1.Height = 400;
-                    comment1.Font.Color = Color.Red;
-
-                    Aspose.Cells.Comment comment2 = dailySheet.Comments[yearCommentIndex];
-                    comment2.Note = commentText2;
-                    comment2.Width = 400;
-                    comment2.Height = 400;
-                    comment2.Font.Color = Color.Red;
+                    if (dailyViewItems[i].ThisYearAmount != 0.00M)
+                    {
+                        string commentText2 = conmmentTexts[i].YearComment;
+                        Aspose.Cells.Comment comment = dailySheet.Comments[yearCommentIndex];
+                        comment.Note = commentText2;
+                        comment.Width = 400;
+                        comment.Height = 400;
+                        comment.Font.Color = Color.Red;
+                    }
                 }
 
                 string fileName = $"利润报表({beginDate.ToString("yyyy年MM月dd日")}~{endDate.ToString("yyyy年MM月dd日")}){Guid.NewGuid().ToString()}.xls";

+ 1 - 1
OASystem/OASystem.Api/Middlewares/RecordAPIOperationMiddleware.cs

@@ -19,7 +19,7 @@ namespace OASystem.API.Middlewares
         private readonly SqlSugarClient _sqlSugar;
 
         /// <summary>
-        /// 初始化
+        /// 初始化DeleteUserId
         /// </summary>
         /// <param name="next"></param>
         /// <param name="config"></param>

+ 8 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs

@@ -261,15 +261,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     var isNull = _sqlSugar.Queryable<Grp_EnterExitCostDraft>().Where(it => it.IsDel == 0 && it.DraftName.Equals(dto.DraftName)).First();
                     if (isNull != null) //修改
                     {
-                        //编辑验证
-                        if (isNull.CreateUserId != dto.UserId)
-                        {
-                            var userName = _sqlSugar.Queryable<Sys_Users>().Where(x => isNull.CreateUserId == isNull.Id).Select(x => x.CnName).First();
-                            _sqlSugar.RollbackTran();
-                            result.Msg = $"该条信息只有操作人“{userName}”可修改!";
-                            return result;
-                        }
-
+                        ////编辑验证
+                        //if (isNull.CreateUserId != dto.UserId)
+                        //{
+                        //    var userName = _sqlSugar.Queryable<Sys_Users>().Where(x => isNull.CreateUserId == isNull.Id).Select(x => x.CnName).First();
+                        //    _sqlSugar.RollbackTran();
+                        //    result.Msg = $"该条信息只有操作人“{userName}”可修改!";
+                        //    return result;
+                        //}
 
                         var updateId = _sqlSugar.Updateable(enterExitCost)
                                                 .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })

+ 11 - 11
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -375,18 +375,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     
                     if (enterExitCost.Id > 0) //修改
                     {
-                        //操作权限验证 只有创建人可修改
-                        var info = await _sqlSugar.Queryable<Grp_EnterExitCost,Sys_Users>((eec,u) => new JoinQueryInfos(JoinType.Left,eec.CreateUserId == u.Id))
-                            .Where((eec, u) => eec.IsDel == 0 && eec.Id == enterExitCost.Id)
-                            .Select((eec, u) => new { eec.CreateUserId,u.CnName })
-                            .FirstAsync();
-                        if (info.CreateUserId != dto.UserId)
-                        {
+                        ////操作权限验证 只有创建人可修改
+                        //var info = await _sqlSugar.Queryable<Grp_EnterExitCost,Sys_Users>((eec,u) => new JoinQueryInfos(JoinType.Left,eec.CreateUserId == u.Id))
+                        //    .Where((eec, u) => eec.IsDel == 0 && eec.Id == enterExitCost.Id)
+                        //    .Select((eec, u) => new { eec.CreateUserId,u.CnName })
+                        //    .FirstAsync();
+                        //if (info.CreateUserId != dto.UserId)
+                        //{
                             
-                            _sqlSugar.RollbackTran();
-                            result.Msg = $"该条信息只有操作人“{info.CnName}”可修改!";
-                            return result;
-                        }
+                        //    _sqlSugar.RollbackTran();
+                        //    result.Msg = $"该条信息只有操作人“{info.CnName}”可修改!";
+                        //    return result;
+                        //}
 
                         //修改验证
                         //IsConfirm == 2 不可修改