From 06fd481d0f6f6bb84b09608edc82ccc0c73605f8 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期五, 21 三月 2025 16:30:11 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentApi
---
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 80 +++------------------------------------
1 files changed, 7 insertions(+), 73 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 577dd86..65a57b4 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -61,7 +61,6 @@
IRepository<LifePayUser, Guid> lifePayUserRepository,
IRepository<LifePayPremium, Guid> lifePayPremiumRepository,
IRepository<LifePayIntroInfo, Guid> lifePayIntroInfoRepository,
- IRepository<DallyStatistics, Guid> dallyStatisticsRepository,
IRepository<OperateHistory, Guid> operateHistory,
IAliPayApi aliPayApi,
IAlipayInterfaceManager aliPayInterfaceManager,
@@ -79,7 +78,6 @@
_lifePayUserRepository = lifePayUserRepository;
_lifePayPremiumRepository = lifePayPremiumRepository;
_lifePayIntroInfoRepository = lifePayIntroInfoRepository;
- _dallyStatisticsRepository = dallyStatisticsRepository;
_aliPayApi = aliPayApi;
_alipayInterfaceManager = aliPayInterfaceManager;
_wxPayApi = wxPayApi;
@@ -94,65 +92,6 @@
#region 鏌ヨ
- public async Task<TopStatisticsOutput> GetTopStatistics()
- {
- var today = DateTime.Now.Date;
- var statistics = await _dallyStatisticsRepository.Where(x => x.CreationTime.Date == today).FirstOrDefaultAsync();
- if (statistics == null)
- {
- var accumulatedReceipts = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.PayAmount);
- var receiptsYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).SumAsync(x => x.PayAmount);
- var accumulatedOrders = await _lifePayOrderRepository.Where(x => x.CreationTime < today).CountAsync();
- var accumulatedIncome = await _lifePayOrderRepository.Where(x => x.CreationTime < today).SumAsync(x => x.ActualRechargeAmount);
- var ordersNumYesterday = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today).CountAsync();
- var yesterdaySuccess = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插畬鎴�).CountAsync();
- var yesterdayFail = await _lifePayOrderRepository.Where(x => x.CreationTime >= today.AddDays(-1) && x.CreationTime < today && x.LifePayOrderStatus == LifePayOrderStatusEnum.宸插け璐�).CountAsync();
- var accumulatedUsers = await _lifePayUserRepository.CountAsync();
-
- var entity = new DallyStatistics()
- {
- Id = GuidGenerator.Create(),
- CreationTime = DateTime.Now,
- Amount = 0,
- AccumulatedReceipts = accumulatedReceipts,
- ReceiptsYesterday = receiptsYesterday,
- AccumulatedOrders = accumulatedOrders,
- OrdersNumYesterday = ordersNumYesterday,
- YesterdaySuccess = yesterdaySuccess,
- YesterdayFail = yesterdayFail,
- AccumulatedUsers = accumulatedUsers,
- };
- await _dallyStatisticsRepository.InsertAsync(entity);
-
- TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
- {
- Amount = entity.Amount,
- AccumulatedReceipts = entity.AccumulatedReceipts,
- ReceiptsYesterday = entity.ReceiptsYesterday,
- AccumulatedOrders = entity.AccumulatedOrders,
- OrdersNumYesterday = entity.OrdersNumYesterday,
- YesterdaySuccess = entity.YesterdaySuccess,
- YesterdayFail = entity.YesterdayFail,
- AccumulatedUsers = entity.AccumulatedUsers,
- };
- return topStatisticsOutput;
- }
- else
- {
- TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
- {
- Amount = statistics.Amount,
- AccumulatedReceipts = statistics.AccumulatedReceipts,
- ReceiptsYesterday = statistics.ReceiptsYesterday,
- AccumulatedOrders = statistics.AccumulatedOrders,
- OrdersNumYesterday = statistics.OrdersNumYesterday,
- YesterdaySuccess = statistics.YesterdaySuccess,
- YesterdayFail = statistics.YesterdayFail,
- AccumulatedUsers = statistics.AccumulatedUsers,
- };
- return topStatisticsOutput;
- }
- }
/// <summary>
/// 鑾峰彇鐢佃垂闈㈠��
@@ -443,8 +382,8 @@
ChannlesRakeRate = channle.ChannlesRakeRate,
ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2),
PremiumRate = order.PremiumRate,
- PremiumPrice = Math.Round(order.PayAmount * order.PremiumRate, 2),
- Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channle.ChannlesRakeRate / 100) - Math.Round(order.PayAmount * order.PremiumRate, 2)
+ PremiumPrice = Math.Round(order.PayAmount * (order.PremiumRate.HasValue ? order.PremiumRate.Value:0), 2),
+ Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channle.ChannlesRakeRate / 100) - Math.Round(order.PayAmount * (order.PremiumRate.HasValue ? order.PremiumRate.Value : 0), 2)
};
return result;
@@ -1291,9 +1230,9 @@
order.FinishTime = DateTime.Now;
}
- if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插け璐� && order.PayStatus != LifePayStatusEnum.宸查��娆�)
+ if (order.LifePayOrderStatus == LifePayOrderStatusEnum.宸插け璐� && order.LifePayRefundStatus != LifePayRefundStatusEnum.宸查��娆�)
{
- order.PayStatus = LifePayStatusEnum.寰呴��娆�;
+ order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
}
order.LifePayOrderStatus = status;
@@ -1313,7 +1252,7 @@
var order = await _lifePayOrderRepository.FirstOrDefaultAsync(x => x.Id == input.Id);
CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
- if (order.PayStatus == LifePayStatusEnum.宸查��娆�)
+ if (order.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
{
return;
}
@@ -1341,19 +1280,16 @@
var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo,order.RefundApplyRemark, Convert.ToInt32(input.RefundPrice * 100), Convert.ToInt32(order.PayAmount * 100));
if (wxRefundResult.Status == "SUCCESS")
{
- order.PayStatus = LifePayStatusEnum.宸查��娆�;
order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
order.LifePayRefundStatus = LifePayRefundStatusEnum.宸查��娆�;
}
else if (wxRefundResult.Status == "PROCESSING")
{
- order.PayStatus = LifePayStatusEnum.閫�娆句腑;
order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆句腑;
order.LifePayRefundStatus = LifePayRefundStatusEnum.閫�娆句腑;
}
else
{
- order.PayStatus = LifePayStatusEnum.寰呴��娆�;
order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆惧け璐�;
order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
}
@@ -1365,8 +1301,6 @@
{
throw new UserFriendlyException("閫�娆惧け璐�");
}
-
- order.PayStatus = LifePayStatusEnum.宸查��娆�;
order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
break;
default: throw new UserFriendlyException("閫�娆惧け璐�");
@@ -1403,7 +1337,7 @@
throw new UserFriendlyException("闈炵敤鎴锋湰浜洪��娆�");
}
- if (order.PayStatus == LifePayStatusEnum.宸查��娆�)
+ if (order.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
{
return;
}
@@ -1537,7 +1471,7 @@
var order = await _lifePayOrderRepository.FirstOrDefaultAsync(x => x.Id == input.Id);
CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
- if (order.PayStatus == LifePayStatusEnum.宸查��娆�)
+ if(order.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
{
return;
}
--
Gitblit v1.9.1