Browse Source

优化企业利润相关功能和数据模型

在 `StatisticsController.cs` 中更新 SQL 查询的 `ORDER BY` 子句,添加 `CorporateProfitInfos` 异步方法以计算企业利润信息,并调整 Excel 导出逻辑。
在 `_baseMappingProfile.cs` 中新增 `CorporateProfitInfo` 到 `CorporateProfitItem` 的映射关系。
在 `CorporateProfitDtos.cs` 中添加 `ExcelType` 属性以支持不同类型的 Excel 报表导出。
在 `CorporateProfitViews.cs` 中新增多个视图模型类以支持企业利润数据展示。
在 `DailypaymentView.cs` 中添加 `IsChecked` 属性以表示项的选中状态。
LEIYI 1 week ago
parent
commit
bb33064057

File diff suppressed because it is too large
+ 317 - 26
OASystem/OASystem.Api/Controllers/StatisticsController.cs


+ 1 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -325,6 +325,7 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<StatisticsBRCostView, StatisticsBRCostBriefView>();
             CreateMap<GroupRoyaltyFeeInfo, GroupRoyaltyFeeView>();
             CreateMap<GroupRoyaltyFeeInfo, GroupRoyaltyFeeExcelView>();
+            CreateMap<CorporateProfitInfo, CorporateProfitItem>();
             #endregion
 
             #region 人事 模块

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

@@ -46,6 +46,12 @@ namespace OASystem.Domain.Dtos.Statistics
 
     public class CorporateProfitExcelDownloadDto : CorporateProfitDtos
     {
+        /// <summary>
+        /// excel类型
+        /// 1 月报表 2 季度报表 3 年报表 4 导出 5 生成
+        /// </summary>
+        public int ExcelType { get; set; }
+
         public string BeginDt { get; set; }
         public string EndDt { get; set; }
     }
@@ -54,6 +60,7 @@ namespace OASystem.Domain.Dtos.Statistics
         public CorporateProfitExcelDownloadDtoFoalidator()
         {
             Include(new CorporateProfitDtosDtoBaseFoalidator());
+            RuleFor(it => it.ExcelType).InclusiveBetween(1, 5).WithMessage("请输入有效的Excel类型");
             RuleFor(it => it.BeginDt)
                 .Must(dateString => DateTime.TryParse(dateString, out _))
                 .WithMessage("请输入有效开始的日期");

+ 120 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/CorporateProfitViews.cs

@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Statistics
+{
+    public class CorporateProfitViews
+    {
+    }
+
+
+    public class CorporateProfitInfosView
+    {
+        public CorporateProfitInfo[] GroupItems { get; set; }
+        public DailyInfo[] DailyItems { get; set; }
+    }
+
+    public class DailyInfo
+    {
+        public string CompanyName { get; set; }
+
+        public decimal CNYTotal { get; set; }
+    }
+
+    public class CorporateProfitInfo
+    {
+        public int RowIndex { get; set; }
+        public int Id { get; set; }
+        public string ClientName { get; set; }
+        public string TeamName { get; set; }
+        public int TeamDid { get; set; }
+        public string GroupTypeName { get; set; }
+        public DateTime VisitDate { get; set; }
+        public int VisitPNumber { get; set; }
+        /// <summary>
+        /// 应收金额
+        /// </summary>
+        public decimal ReceivableAmount { get; set; }
+        /// <summary>
+        /// 已收金额
+        /// </summary>
+        public decimal ReceivedAmount { get; set; }
+        /// <summary>
+        /// 收款退还金额
+        /// </summary>
+        public decimal RefundedAmount { get; set; }
+        /// <summary>
+        /// 酒店金额
+        /// </summary>
+        public decimal HotelAmount { get; set; }
+        /// <summary>
+        /// 地接金额
+        /// </summary>
+        public decimal LocalGuideAmount { get; set; }
+        /// <summary>
+        /// 机票金额
+        /// </summary>
+        public decimal AirTicketAmount { get; set; }
+        /// <summary>
+        /// 签证金额
+        /// </summary>
+        public decimal VisaAmount { get; set; }
+        /// <summary>
+        /// 商邀金额
+        /// </summary>
+        public decimal OAAmount { get; set; }
+        /// <summary>
+        /// 保险金额
+        /// </summary>
+        public decimal InsureAmount { get; set; }
+        /// <summary>
+        /// 其他金额
+        /// </summary>
+        public decimal OtherAmount { get; set; }
+        /// <summary>
+        /// 收款合计
+        /// </summary>
+        public decimal CollectionTotal { get { return ReceivedAmount - RefundedAmount; } }
+        /// <summary>
+        /// 成本合计
+        /// </summary>
+        public decimal CostTotal { get { return HotelAmount + LocalGuideAmount + AirTicketAmount + VisaAmount + OAAmount + InsureAmount + OtherAmount; } }
+        /// <summary>
+        /// 利润合计
+        /// </summary>
+        public decimal ProfitTotal { get { return CollectionTotal - CostTotal; } }
+    }
+
+    public class CorporateProfitItem
+    {
+        public int RowIndex { get; set; }
+        public int Id { get; set; }
+        public string ClientName { get; set; }
+        public string TeamName { get; set; }
+        public DateTime VisitDate { get; set; }
+      
+        /// <summary>
+        /// 收款合计
+        /// </summary>
+        public decimal CollectionTotal { get; set; }
+        /// <summary>
+        /// 成本合计
+        /// </summary>
+        public decimal CostTotal { get; set; }
+        /// <summary>
+        /// 利润合计
+        /// </summary>
+        public decimal ProfitTotal { get; set; }
+    }
+
+    public class CorporateProfitItemView
+    {
+        public CorporateProfitItem[] Items { get; set; }
+
+        public string Label { get; set; }
+
+    }
+}

+ 3 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/DailypaymentView.cs

@@ -35,4 +35,7 @@ namespace OASystem.Domain.ViewModels.Statistics
         public bool IsChecked { get; set; } = false;
     }
 
+
+    
+
 }