Browse Source

项目接口-推广码每日统计 接口 功能实现

lifa 1 year ago
parent
commit
2afc50d63e

+ 36 - 0
src/platform/ZhonTai.Admin/Services/DiTuiAPI/Dto/StatOutput.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.DiTuiAPI.Dto
+{
+    public class StatOutput
+    {
+        /// <summary>
+        /// 编号
+        /// </summary>
+        public string Num { get; set; }
+        /// <summary>
+        /// 日期
+        /// </summary>
+        public string Date { get; set; }
+        /// <summary>
+        /// 项目结算标准
+        /// </summary>
+        public string ProjectPriceId { get; set; }
+        /// <summary>
+        /// 项目结算标准名
+        /// </summary>
+        public string ProjectPriceName { get; set; }
+        /// <summary>
+        /// 有效数
+        /// </summary>
+        public long ValidCount { get; set; }
+        /// <summary>
+        /// 奖金
+        /// </summary>
+        public decimal CommissionPrice { get; set; }
+    }
+}

+ 55 - 21
src/platform/ZhonTai.Admin/Services/DiTuiAPI/ProjectsService.cs

@@ -13,6 +13,7 @@ using ZhonTai.Admin.Core.Consts;
 using ZhonTai.Admin.Core.Dto;
 using ZhonTai.Admin.Domain.KuaKe;
 using ZhonTai.Admin.Domain.Project;
+using ZhonTai.Admin.Domain.ProjectLink;
 using ZhonTai.Admin.Domain.User;
 using ZhonTai.Admin.Repositories.KuaKe;
 using ZhonTai.Admin.Repositories.Project;
@@ -21,6 +22,7 @@ using ZhonTai.Admin.Services.DiTuiAPI.Dto;
 using ZhonTai.Admin.Services.Notice.Dto;
 using ZhonTai.Admin.Services.Project;
 using ZhonTai.Admin.Services.ProjectLink.Dto;
+using ZhonTai.Admin.Services.ProjectStat.Dto;
 using ZhonTai.DynamicApi;
 using ZhonTai.DynamicApi.Attributes;
 
@@ -598,9 +600,9 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
         public async Task<PageOutput<ProjectCountPageOutput>> QrcodeCountPageAsync(PageInput<QrcodeCountPageInput> input)
         {
             var Id = input.Filter?.Id;
-            if (Id == null)
+            if (Id == null || Id == 0)
             {
-                Id = 0;
+                throw ResultOutput.Exception($"无效参数");
             }
 
 
@@ -618,35 +620,67 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
             //    QrcodeUrl = m.QrcodeUrl,
             //    QueryUrl = m.QueryUrl
             //});
+            List<StatOutput> result = await _projectStatRepository.Select.DisableGlobalFilter(FilterNames.Tenant).From<ProjectLinkEntity>((s, l) => s
+                .InnerJoin(a => a.Num == l.Num && a.ProjectId == l.ProjectId))
+                .Where((a, b) => b.Id == Id && a.IsSettle == 1)
+                .ToListAsync((a, b) => new StatOutput
+                {
+                    Num = a.Num,
+                    Date = a.EffectDate.ToString("yyyy-MM-dd"),
+                    ProjectPriceId = a.ProjectPriceId.ToString(),
+                    ProjectPriceName = a.Name,
+                    ValidCount = a.ValidCount,
+                    CommissionPrice = a.CommissionPrice
+                });
 
-            List<ProjectCountPageOutput> list = new List<ProjectCountPageOutput>();
-            List<SettleCount> settleCounts = new List<SettleCount>();
-            settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            settleCounts.Add(new SettleCount("电商首购B级", "201/300单", "201元"));
-            settleCounts.Add(new SettleCount("电商首购C级", "202/300单", "202元"));
-            settleCounts.Add(new SettleCount("今日汇总", "603/900单", "603元"));
+            List<ProjectCountPageOutput> list2 = new List<ProjectCountPageOutput>();
+            var groupR = result.GroupBy(a => a.Date);
+            foreach (var item in groupR)
+            {
+                List<SettleCount> settleCountsTemp = new List<SettleCount>();
+                long totalValidCount = 0;
+                long totalCount = 0;
+                decimal totalCommission = 0;
+                foreach (var settleItem in item)
+                {
+                    settleCountsTemp.Add(new SettleCount(settleItem.ProjectPriceName, settleItem.ValidCount + "/" + settleItem.ValidCount + "单", settleItem.CommissionPrice.ToString()));
+                    totalValidCount += settleItem.ValidCount;
+                    totalCount += settleItem.ValidCount;
+                    totalCommission += settleItem.CommissionPrice;
+                }
+                settleCountsTemp.Add(new SettleCount("当日汇总", totalValidCount + "/" + totalCount + "单", totalCommission.ToString()));
+                list2.Add(new ProjectCountPageOutput((long)Id, item.Key, "", settleCountsTemp));
+            }
 
+            #region moke数据
+            //List<ProjectCountPageOutput> list = new List<ProjectCountPageOutput>();
+            //List<SettleCount> settleCounts = new List<SettleCount>();
             //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-02", "", settleCounts));
+            //settleCounts.Add(new SettleCount("电商首购B级", "201/300单", "201元"));
+            //settleCounts.Add(new SettleCount("电商首购C级", "202/300单", "202元"));
+            //settleCounts.Add(new SettleCount("今日汇总", "603/900单", "603元"));
 
-            List<SettleCount> settleCounts1 = new List<SettleCount>();
-            settleCounts1.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            settleCounts1.Add(new SettleCount("电商首购B级", "199/300单", "199元"));
-            settleCounts1.Add(new SettleCount("电商首购C级", "198/300单", "198元"));
-            settleCounts1.Add(new SettleCount("今日汇总", "597/900单", "597元"));
+            ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
+            ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
+            //list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-02", "", settleCounts));
 
-            //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            //settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
-            list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-01", "", settleCounts1));
+            //List<SettleCount> settleCounts1 = new List<SettleCount>();
+            //settleCounts1.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
+            //settleCounts1.Add(new SettleCount("电商首购B级", "199/300单", "199元"));
+            //settleCounts1.Add(new SettleCount("电商首购C级", "198/300单", "198元"));
+            //settleCounts1.Add(new SettleCount("今日汇总", "597/900单", "597元"));
 
-            var total = list.Count;
+            ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
+            ////settleCounts.Add(new SettleCount("电商首购A级", "200/300单", "200元"));
+            //list.Add(new ProjectCountPageOutput((long)(Id != 0 ? Id : 416237348180038), "2023-05-01", "", settleCounts1));
 
+            //var total = list.Count;
+#endregion
 
             var data = new PageOutput<ProjectCountPageOutput>()
             {
-                List = list,
-                Total = total
+                List = list2,
+                Total = list2.Count
             };
 
             return data;

+ 60 - 2
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -6398,6 +6398,36 @@
             版本号
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.Num">
+            <summary>
+            编号
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.Date">
+            <summary>
+            日期
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.ProjectPriceId">
+            <summary>
+            项目结算标准
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.ProjectPriceName">
+            <summary>
+            项目结算标准名
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.ValidCount">
+            <summary>
+            有效数
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.StatOutput.CommissionPrice">
+            <summary>
+            奖金
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Services.DiTuiAPI.Dto.UserInfoOutput.Avatar">
             <summary>
             头像
@@ -8738,11 +8768,21 @@
             项目名称
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.GetProjectPricePageOutput.Status">
+            <summary>
+            项目名称
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Services.Project.Dto.GetProjectPricePageOutput.Prices">
             <summary>
             项目价格列表
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Project.Dto.GetProjectPricePageOutput.PrePrices">
+            <summary>
+            预价格列表
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Services.Project.Dto.PriceGetPageOutput_Price.Id">
             <summary>
             价格Id
@@ -8953,13 +8993,31 @@
             <param name="input"></param>
             <returns></returns>
         </member>
-        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.CheckDrawRatio(System.Decimal)">
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.ExecuteTaskCompanyDraw">
+            <summary>
+            执行公司抽成任务
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.ExecuteTaskProjectDraw">
+            <summary>
+            执行抽成项目任务
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.ExecuteTasDrawTenant">
+            <summary>
+            执行抽成平台任务
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.CheckDrawRatio(System.Nullable{System.Decimal})">
             <summary>
             校验抽成比例
             </summary>
             <param name="drawRatio"></param>
         </member>
-        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.CheckDrawRatioEffect(System.DateTime)">
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectPriceService.CheckDrawRatioEffect(System.Nullable{System.DateTime})">
             <summary>
             校验抽成比例生效时间
             </summary>