From f5c04cd377e28aff976d6007535ec8b50935d3be Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 01 四月 2025 17:41:14 +0800
Subject: [PATCH] fix: GetLifePayRefundOrderPage bug

---
 LifePayment/LifePayment.Application/LifePay/StatisticsService.cs |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
index 4998753..b69b5b6 100644
--- a/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/StatisticsService.cs
@@ -125,12 +125,12 @@
             {
                 ReceiptsDetail receive = new ReceiptsDetail()
                 {
-                    CreationTime = item.CreationTime.ToString("yyyy-MM-dd"),
+                    CreationTime = item.CreationTime.AddDays(-1).ToString("yyyy-MM-dd"),
                     Amount = item.TotalReceiptsYesterday
                 };
                 ReceiptsDetail income = new ReceiptsDetail()
                 {
-                    CreationTime = item.CreationTime.ToString("yyyy-MM-dd"),
+                    CreationTime = item.CreationTime.AddDays(-1).ToString("yyyy-MM-dd"),
                     Amount = item.TotalIncomeYesterday
                 };
                 receiptsListOutPut.ReceiveList.Add(receive);
@@ -138,6 +138,38 @@
             }
 
             return receiptsListOutPut;
+        }
+
+        public async Task<ChannlesRakeListOutPut> GetChannlesRakeList(List<string> channleList)
+        {
+            var today = DateTime.Now.Date;
+            var statistics = await _lifePayChannlesRakeRepository.Where(x => x.IsDeleted == false &&
+            x.FinishTime.Date <= today && x.FinishTime.Date >= today.AddDays(-30))
+                            .WhereIf(channleList.Count() > 0, x => channleList.Contains(x.ChannelId))
+                            .ToListAsync();
+            var groupedStatistics = statistics
+               .GroupBy(x => x.FinishTime.ToString("yyyy-MM-dd"))
+               .Select(g => new
+               {
+                   FinishTime = g.Key,
+                   ChannlesRakePrice = g.Sum(x => x.ChannlesRakePrice),
+               })
+               .ToList();
+
+            ChannlesRakeListOutPut channlesRakeListOutPut = new ChannlesRakeListOutPut();
+
+            foreach (var item in groupedStatistics)
+            {
+                ReceiptsDetail receive = new ReceiptsDetail()
+                {
+                    CreationTime = item.FinishTime,
+                    Amount = item.ChannlesRakePrice
+                };
+
+                channlesRakeListOutPut.ChannlesRakeList.Add(receive);
+            }
+
+            return channlesRakeListOutPut;
 
         }
 
@@ -164,7 +196,7 @@
             {
                 ChannelDataReceive receive = new ChannelDataReceive()
                 {
-                    ChannelId = item.ChannelId,
+                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault().ChannlesName,
                     ReceivePrice = item.ReceivePrice,
                     ChannlesRakePrice = item.ChannlesRakePrice,
                 };
@@ -190,7 +222,7 @@
             {
                 ChannelDataUserNumber usernumber = new ChannelDataUserNumber()
                 {
-                    ChannelId = item.ChannelId,
+                    ChannelName = _lifePayChannlesRep.Where(x => x.ChannlesNum == item.ChannelId).FirstOrDefault().ChannlesName,
                     Number = item.Number,
                 };
                 if (channelDataList.UserNumberList.Count() < 5)
@@ -256,7 +288,8 @@
                 YesterdayFail = yesterdayFail,
                 AccumulatedUsers = accumulatedUsers,
                 YesterdayActiveUsers = yesterdayActiveUsers,
-                ChannelId = channleId
+                ChannelId = channleId,
+                Date = today.AddDays(-1)
             };
             await _dallyStatisticsRepository.InsertAsync(entity);
             return entity;

--
Gitblit v1.9.1