From 84f97d1b0b2cbf157dea598363e4cfcf8c15348a Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期四, 03 四月 2025 15:52:22 +0800
Subject: [PATCH] fix:佣金统计

---
 LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs |    6 +++++-
 LifePayment/LifePayment.Application/LifePay/StatisticsService.cs   |   10 +++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
index ad98f37..9c2ae4c 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayOrderService.cs
@@ -495,7 +495,11 @@
 
                     break;
                 case ACOOLYStatusEnum.宸插畬鎴�:
-                    lifePayConsumption.FinishTime = orderFinishTime.Value;
+                    if (orderFinishTime.HasValue)
+                    {
+                        lifePayConsumption.FinishTime = orderFinishTime.Value;
+                    }
+
                     lifePayConsumption.ACOOLYStatus = ACOOLYStatusEnum.宸插畬鎴�;
                     lifePayConsumption.FrozenStatus = ConsumptionFrozenStatusEnum.Thaw;
                     lifePayConsumption.Flow = ConsumptionFlowEnum.Out;
diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
index fb39436..a4e22f2 100644
--- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -186,12 +186,16 @@
 
             ChannlesRakeListOutPut channlesRakeListOutPut = new ChannlesRakeListOutPut();
 
-            foreach (var item in groupedStatistics)
+            var dateList = Enumerable.Range(1, 31)
+                        .Select(i => today.AddDays(-i))
+                        .ToList();
+            foreach (var date in dateList)
             {
+                var stat = groupedStatistics.FirstOrDefault(g => g.FinishTime == date.ToString("yyyy-MM-dd"));
                 ReceiptsDetail receive = new ReceiptsDetail()
                 {
-                    CreationTime = item.FinishTime,
-                    Amount = item.ChannlesRakePrice
+                    CreationTime = date.ToString("yyyy-MM-dd"),
+                    Amount = stat?.ChannlesRakePrice ?? 0
                 };
                 channlesRakeListOutPut.ChannlesRakeList.Add(receive);
             }

--
Gitblit v1.9.1