Browse Source

优化统计控制器和企业利润视图

在 `StatisticsController.cs` 中添加了对 `System.Runtime.Intrinsics.Arm` 的引用,并修改了 `dailyItems` 的查询逻辑,使用联接查询替代原有简单查询。注释掉了旧的赋值行,更新了 `view.DailyItems` 的赋值。

在 `CorporateProfitViews.cs` 中移除了不必要的引用,并添加了对 `OASystem.Domain.Entities.Financial` 的引用。更新了 `DailyInfo` 类,添加了多个新属性,并移除了原有的 `Instructions` 属性。同时新增了 `DailyPriceInfo` 类以描述每日价格信息。
LEIYI 4 days ago
parent
commit
ac375a42c2

+ 20 - 3
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -28,6 +28,7 @@ using OASystem.Infrastructure.Repositories.Groups;
 using StackExchange.Redis;
 using System;
 using System.Data;
+using System.Runtime.Intrinsics.Arm;
 using TencentCloud.Ocr.V20181119.Models;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 using TypeInfo = OASystem.Domain.ViewModels.Statistics.TypeInfo;
@@ -7931,9 +7932,26 @@ GROUP BY
 ORDER BY
   CNYTotal ASC", beginDt, endDt);
 
-            var dailyItems = await _sqlSugar.SqlQueryable<DailyInfo>(dailySql).ToArrayAsync();
+            var dailyItems = await _sqlSugar.Queryable<Fin_DailyFeePayment, Sys_SetData, Sys_SetDataType, Sys_Company>((dfp, sd, sdt, c) =>
+                new JoinQueryInfos(
+                    JoinType.Left, dfp.PriceTypeId == sd.Id,
+                    JoinType.Left, sd.STid == sdt.Id,
+                    JoinType.Left, dfp.CompanyId == c.Id
+                 )).Select((dfp, sd, sdt, c) => new DailyInfo()
+                {
+                    Id = dfp.Id,
+                    PriceParentTypeId = sdt.Id,
+                    PriceParentTypeName = sdt.Name,
+                    PriceTypeId = sd.Id,
+                    PriceTypeName = sd.Name,
+                    CompanyName = c.CompanyName,
+                    Instructions = dfp.Instructions,
+                    CNYTotal = dfp.SumPrice,
+                    //PriceInfos = SqlFunc.Subqueryable<Fin_DailyFeePaymentContent>().Where(dfpc => dfp.IsDel == 0 && dfp.Id == dfpc.DFPId).ToList()
+                })
+                .ToListAsync();
             view.GroupItems = groupItems;
-            view.DailyItems = dailyItems;
+            //view.DailyItems = dailyItems;
             return view;
         }
 
@@ -8078,7 +8096,6 @@ ORDER BY
             //51    其他费用
             var feeTypeDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && new int[] { 48, 49, 90, 50, 51 }.Contains(x.Id)).ToListAsync();
 
-
             if (excelType == 1)
             {
                 //团组收款、成本、利润 合计

+ 20 - 2
OASystem/OASystem.Domain/ViewModels/Statistics/CorporateProfitViews.cs

@@ -1,4 +1,5 @@
-using System;
+using OASystem.Domain.Entities.Financial;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -19,9 +20,26 @@ namespace OASystem.Domain.ViewModels.Statistics
 
     public class DailyInfo
     {
+        public int Id { get; set; }
+        public int PriceParentTypeId { get; set; }
+        public string PriceParentTypeName { get; set; }
+        public int PriceTypeId { get; set; }
+        public string PriceTypeName { get; set; }
         public string CompanyName { get; set; }
-
+        public string Instructions { get; set; }
         public decimal CNYTotal { get; set; }
+        public List<Fin_DailyFeePaymentContent> PriceInfos { get; set; }
+    }
+
+    public class DailyPriceInfo
+    {
+        public int Id { get; set; }
+        public int DFPId { get; set; }
+        public string PriceName { get; set; }
+        public decimal Quantity { get; set; }
+        public decimal Price { get; set; }
+        public decimal ItemTotal { get; set; }
+        public string Remark { get; set; }
     }
 
     public class CorporateProfitInfo