Browse Source

注释掉部分方法的 [ApiLog] 特性,更新权限验证

在 `GroupsController.cs` 文件中,注释掉了多个方法的 `[ApiLog]` 特性。
在 `StatisticsController.cs` 文件中,删除了 `CorporateProfitExcelDownload` 方法中的参数验证代码,并将计算月收入和年收入的字段从 `ReceivedAmount` 改为 `ReceivableAmount`。
在 `EnterExitCostRepository.cs` 文件中,添加了新的权限验证逻辑,并注释掉了旧的权限验证代码。
LEIYI 2 months ago
parent
commit
cdd52c5355

+ 8 - 8
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5475,7 +5475,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCost", OperationEnum.Details)]
+        //[ApiLog("Grp_EnterExitCost", OperationEnum.Details)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GetEnterExitCostInfobyDiId(EnterExitCostInfobyDiIdDto dto)
         {
@@ -7228,7 +7228,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostOneClickClear(EnterExitCostOneClickClearDto dto)
         {
@@ -7260,7 +7260,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
         {
@@ -7287,7 +7287,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCost", OperationEnum.Del)]
         public IActionResult DeleteOtherExpenses(EnterExitCostSubItemDelDto dto)
         {
             var jw = JsonView(false, "删除失败!");
@@ -7688,7 +7688,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Details)]
+        //[ApiLog("Grp_EnterExitCostDraft", OperationEnum.Details)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftInfoById(EnterExitCostDraftInfoByIdDto dto)
         {
@@ -8846,7 +8846,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftOneClickEmpty(EnterExitCostDraftOneClickEmptyDto dto)
         {
@@ -8868,7 +8868,7 @@ FROM
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> EnterExitCostDraftSubItemDel(EnterExitCostDraftSubItemDelDto dto)
         {
@@ -8888,7 +8888,7 @@ FROM
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
-        [ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
+        //[ApiLog("Grp_EnterExitCostDraft", OperationEnum.Del)]
         public IActionResult EnterExitCostDraftOtherExpensesDel(EnterExitCostDraftOtherExpensesDelDto dto)
         {
             var jw = JsonView(false, "删除失败!");

+ 10 - 11
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -8436,7 +8436,6 @@ WHERE
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> CorporateProfitExcelDownload(CorporateProfitExcelDownloadDto dto)
         {
-
             int portType = dto.PortType,
                 userId = dto.UserId,
                 pageId = dto.PageId,
@@ -8620,11 +8619,11 @@ WHERE
                 otherTypeIds.AddRange(inforTypeIds);
                 otherTypeIds.AddRange(competitionTypeIds);
 
-                decimal monthAllIncomes = groupItems.Sum(x => x.ReceivedAmount), //月-收入
-                        monthTzIncomes = groupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        monthHwIncomes = groupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        monthSsIncomes = groupItems.Where(x => competitionTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        monthQtIncomes = groupItems.Where(x => !otherTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
+                decimal monthAllIncomes = groupItems.Sum(x => x.ReceivableAmount), //月-收入
+                        monthTzIncomes = groupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        monthHwIncomes = groupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        monthSsIncomes = groupItems.Where(x => competitionTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        monthQtIncomes = groupItems.Where(x => !otherTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
                         monthAllCost = groupItems.Sum(x => x.CostTotal), //月-成本
                         monthTzCost = groupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.CostTotal),
                         monthHwCost = groupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.CostTotal),
@@ -8635,11 +8634,11 @@ WHERE
                         monthHwGross = monthHwIncomes - monthHwCost,
                         monthSsGross = monthSsIncomes - monthSsCost,
                         monthQtGross = monthQtIncomes - monthQtCost,
-                        yearAllIncomes = yearGroupItems.Sum(x => x.ReceivedAmount), //年-收入
-                        yearTzIncomes = yearGroupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        yearHwIncomes = yearGroupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        yearSsIncomes = yearGroupItems.Where(x => competitionTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
-                        yearQtIncomes = yearGroupItems.Where(x => !otherTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivedAmount),
+                        yearAllIncomes = yearGroupItems.Sum(x => x.ReceivableAmount), //年-收入
+                        yearTzIncomes = yearGroupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        yearHwIncomes = yearGroupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        yearSsIncomes = yearGroupItems.Where(x => competitionTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
+                        yearQtIncomes = yearGroupItems.Where(x => !otherTypeIds.Contains(x.TeamDid)).Sum(x => x.ReceivableAmount),
                         yearAllCost = yearGroupItems.Sum(x => x.CostTotal), //年-成本
                         yearTzCost = yearGroupItems.Where(x => groupTypeIds.Contains(x.TeamDid)).Sum(x => x.CostTotal),
                         yearHwCost = yearGroupItems.Where(x => inforTypeIds.Contains(x.TeamDid)).Sum(x => x.CostTotal),

+ 14 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -164,10 +164,23 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     enterExitCostInfoView = _mapper.Map<EnterExitCostInfoView>(enterExitCostData);
 
+                    var isView = await PermissionValidationAsync(dto.DiId, dto.CurrUserId);
+                    if (isView)
+                    {
+                        enterExitCostInfoView.IsSave = true; //操作权限
+                        enterExitCostInfoView.IsView = true; //查看权限
+                    }
+                    else
+                    {
+                        result.Msg = $"未分配查看或编辑权限,如要查看或编辑,请联系市场部或国交部负责人!";
+                        return result;
+                    }
+
                     //var isView = await PermissionValidationAsync(dto.DiId, dto.CurrUserId);
                     //if (isView) enterExitCostInfoView.IsView = true; //查看权限
 
-                    //if (enterExitCostData.CreateUserId == dto.CurrUserId) {
+                    //if (enterExitCostData.CreateUserId == dto.CurrUserId)
+                    //{
                     //    enterExitCostInfoView.IsSave = true; //操作权限
                     //    enterExitCostInfoView.IsView = true; //查看权限
                     //}