Parcourir la source

添加企业利润相关功能及数据安全性改进

在 `GeneralMethod.cs`  --> 'ReceivablesImportFeeAsync' 中使用 AES 解密处理公司名称,增强数据安全性。

在 `CorporateProfitDtos.cs` 中新增 `CorporateProfitItemDto` 和 `CorporateProfitItemDtoFoalidator` 类,提升数据传输对象的功能和验证能力。
LEIYI il y a 3 mois
Parent
commit
93435dc3e2

+ 64 - 2
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -25,6 +25,7 @@ using OASystem.Domain.ViewModels.JuHeExchangeRate;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.Groups;
+using StackExchange.Redis;
 using System;
 using System.Data;
 using TencentCloud.Ocr.V20181119.Models;
@@ -2295,7 +2296,6 @@ ORDER BY
             return Ok(JsonView(true, "成功", url));
         }
 
-
         /// <summary>
         ///  团组报表
         ///  利润相关数据 
@@ -7754,10 +7754,72 @@ WHERE
 
         #region 企业利润
 
+
+        /// <summary>
+        /// 企业利润 
+        /// Item
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost("CorporateProfitExcelDownload")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> CorporateProfitItem(CorporateProfitItemDto dto)
+        {
+
+            int portType = dto.PortType,
+                userId = dto.UserId,
+                pageId = dto.PageId;
+            #region  参数验证
+
+            var validationRules = new CorporateProfitItemDtoFoalidator();
+            var validResult = await validationRules.ValidateAsync(dto);
+            if (!validResult.IsValid)
+            {
+                var errors = new StringBuilder();
+                foreach (var error in validResult.Errors) errors.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, errors.ToString()));
+            }
+
+            #region 页面操作权限验证
+            var pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(userId, pageId);
+
+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
+            #endregion
+
+            #endregion
+
+            DateTime beginDt = DateTime.Parse($"{dto.BeginDt} 00:00:00"),
+                endDt = DateTime.Parse($"{dto.EndDt} 23:59:59");
+
+
+            var groupFees = await _sqlSugar
+                .Queryable<Grp_DelegationInfo, Sys_SetData>((gdi, ssd) => new JoinQueryInfos(JoinType.Left, gdi.TeamDid == ssd.Id))
+                .OrderBy((gdi, ssd) => gdi.VisitDate)
+                .Where((gdi, ssd) => gdi.IsDel == 0 && beginDt >= gdi.VisitDate && endDt <= gdi.VisitDate)
+                .Select((gdi,ssd) => new { 
+                    Id = gdi.Id,
+                    GroupName = gdi.TeamName,
+                    GroupTypeName = ssd.Name,
+                    Client = gdi.ClientUnit,
+                    VisitDate = gdi.VisitDate,
+                    PeopleNumber = gdi.VisitPNumber,
+                    ReceivableAmount = SqlFunc.Subqueryable<Fin_ForeignReceivables>().Where(x => x.IsDel == 0 && x.Diid == gdi.Id).Sum(x => x.ItemSumPrice * x.Rate), //应收金额
+                    ReceivedAmount = SqlFunc.Subqueryable<Fin_ProceedsReceived>().Where(x => x.IsDel == 0 && x.Diid == gdi.Id).Sum(x => x.Price),   //已收金额
+                    //RefundedAmount = SqlFunc.Subqueryable<Fin_PaymentRefundAndOtherMoney, Grp_CreditCardPayment>((fpraom.gccp) => new JoinQueryInfos(JoinType.Inner,fpraom.id))
+                })
+                .ToListAsync();
+
+
+
+
+            return Ok(JsonView(false));
+        }
+
+
         /// <summary>
         /// 企业利润 Excel导出
         /// </summary>
-        /// <param name="_dto"></param>
+        /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost("CorporateProfitExcelDownload")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]

+ 4 - 1
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -28,6 +28,7 @@ using System.Data;
 using System.IdentityModel.Tokens.Jwt;
 using System.Security.Claims;
 using NodaTime.Extensions;
+using OASystem.Domain.AesEncryption;
 
 namespace OASystem.API.OAMethodLib
 {
@@ -959,7 +960,9 @@ namespace OASystem.API.OAMethodLib
 
             foreach (var item in groupClientListGroup)
             {
-                var companyName = item.FirstOrDefault().CompanyName;
+                var companyName = AesEncryptionHelper.Decrypt(item.FirstOrDefault().CompanyName);
+
+
                 var airTicketGroup = item.GroupBy(x => x.SpaceId);
 
                 foreach (var airTicket in airTicketGroup)

+ 20 - 0
OASystem/OASystem.Domain/Dtos/Statistics/CorporateProfitDtos.cs

@@ -24,6 +24,26 @@ namespace OASystem.Domain.Dtos.Statistics
         }
     }
 
+    /// <summary>
+    /// item Dto
+    /// </summary>
+    public class CorporateProfitItemDto : CorporateProfitExcelDownloadDto
+    {
+    }
+
+    /// <summary>
+    /// item Dto
+    /// 参数验证
+    /// </summary>
+    public class CorporateProfitItemDtoFoalidator : AbstractValidator<CorporateProfitItemDto>
+    {
+        public CorporateProfitItemDtoFoalidator()
+        {
+            Include(new CorporateProfitExcelDownloadDtoFoalidator());
+        }
+    }
+
+
     public class CorporateProfitExcelDownloadDto : CorporateProfitDtos
     {
         public string BeginDt { get; set; }