From 524c87eff1400efe49a26bb46faa49f1a79c464e Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期二, 25 三月 2025 16:28:27 +0800
Subject: [PATCH] fix:导出提款
---
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 71 +++++++++++++++++++++--------------
1 files changed, 42 insertions(+), 29 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 6872d9d..d9596c9 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -246,6 +246,7 @@
{
var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWords)).Select(x => x.ChannlesNum).ToListAsync();
var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
+ .Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
.WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
.WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime)
.WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime)
@@ -283,7 +284,7 @@
RefundApplyRemark = a.RefundApplyRemark,
RefundTime = a.RefundTime,
ChannelName = b.ChannlesName,
- ActualRechargeAmount = a.ActualRechargeAmount,
+ ActualRechargeAmount = a.RechargeAmount,
PlatformDeductionAmount = a.PlatformDeductionAmount,
ACOOLYStatus = a.ACOOLYStatus,
LifePayRefundStatus = a.LifePayRefundStatus,
@@ -302,7 +303,7 @@
var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
.Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑
- || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�)
+ || (x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆� && x.LifePayRefundStatus != LifePayRefundStatusEnum.閫�娆鹃┏鍥�))
.WhereIf(input.BeginRefundTime.HasValue, x => x.RefundTime >= input.BeginRefundTime)
.WhereIf(input.EndRefundTime.HasValue, x => x.RefundTime <= input.EndRefundTime)
.WhereIf(input.BeginRefundApplyTime.HasValue, x => x.RefundApplyTime >= input.BeginRefundApplyTime)
@@ -337,10 +338,11 @@
RefundCheckRemark = a.RefundCheckRemark,
RefundApplyRemark = a.RefundApplyRemark,
RefundApplyTime = a.RefundApplyTime,
+ RefundOrderNo = a.RefundOrderNo,
RefundTime = a.RefundTime,
RefundPrice = a.RefundPrice,
ChannelName = b.ChannlesName,
- ActualRechargeAmount = a.ActualRechargeAmount,
+ ActualRechargeAmount = a.RechargeAmount,
PlatformDeductionAmount = a.PlatformDeductionAmount,
ACOOLYStatus = a.ACOOLYStatus,
LifePayRefundStatus = a.LifePayRefundStatus,
@@ -365,6 +367,7 @@
PayAmount = x.PayAmount,
PhoneNumber = x.PhoneNumber,
RefundOrderNo = x.RefundOrderNo,
+ RefundApplyTime = x.RefundApplyTime,
ChannelName = x.ChannelName,
CreationTime = x.CreationTime,
ACOOLYStatus = x.ACOOLYStatus,
@@ -380,13 +383,13 @@
s.SerialNumber = ++i;
s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription();
s.LifePayOrderTypeStr = s.LifePayOrderType.GetDescription();
- s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
s.RechargeAmountStr = s.RechargeAmount.ToString("F2");
s.ActualReceivedAmount = s.ActualReceivedAmount;
- s.LifePayRefundStatusStr = s.LifePayRefundStatus.GetDescription();
+ s.LifePayRefundStatusStr = s.LifePayRefundStatus == LifePayRefundStatusEnum.鏃犻渶閫�娆� ? "" : s.LifePayRefundStatus.GetDescription();
s.PayAmountStr = s.PayAmount.ToString("F2");
s.LifePayTypeStr = s.LifePayType.GetDescription();
s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
+ s.RefundApplyTimeStr = !s.RefundApplyTime.HasValue? string.Empty:s.RefundApplyTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm);
});
return result;
}
@@ -427,7 +430,7 @@
RefundTime = order.RefundTime,
ACOOLYOrderNo = order.ACOOLYOrderNo,
LifePayRefundStatus = order.LifePayRefundStatus,
- ActualRechargeAmount = order.ActualRechargeAmount,
+ ActualRechargeAmount = order.RechargeAmount,
RefundPrice = order.RefundPrice,
PlatformRate = order.PlatformRate,
PlatformPrice = order.PlatformDeductionAmount,
@@ -730,7 +733,7 @@
LifePayType = x.LifePayType,
OrderNo = x.OrderNo,
PayAmount = x.PayAmount,
- ActualRechargeAmount = x.ActualRechargeAmount.HasValue?x.ActualRechargeAmount.Value:0,
+ ActualRechargeAmount = x.RechargeAmount,
PhoneNumber = x.PhoneNumber,
RechargeAmount = x.RechargeAmount,
OutOrderNo = x.OutOrderNo,
@@ -756,7 +759,7 @@
s.LifePayTypeStr = s.LifePayType.GetDescription();
s.PayStatusStr = s.PayStatus.GetDescription();
s.ActualRechargeAmountStr = s.ActualRechargeAmount.ToString("F2");
- s.LifePayRefundStatusStr = s.LifePayRefundStatusStr.GetDescription();
+ s.LifePayRefundStatusStr = s.LifePayRefundStatus == LifePayRefundStatusEnum.鏃犻渶閫�娆� ? "" : s.LifePayRefundStatus.GetDescription();
s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription();
//s.LifePayOrderStatusStr = s.LifePayOrderStatus.GetDescription();
s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss);
@@ -831,12 +834,12 @@
var channle = await GetLifePayChannlesDtoByNum(input.ChannelId);
CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
- var rate = await GetRate();
- CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
+ //var rate = await GetRate();
+ //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
- //var rate = await GetLifePayRate();
+ var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸);
- var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸).Rate);
+ var amount = CalculateAmount(input.ProductData.ParValue, rate);
var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
@@ -857,7 +860,7 @@
ChannelId = channle.ChannlesNum,
PlatformRate = platformRate.Rate,
PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate /100,
- ChannleRate = channle.ChannlesRate,
+ ChannleRate = rate,
ChannlesRakeRate = channle.ChannlesRakeRate,
//ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100
};
@@ -885,10 +888,13 @@
CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.绂佺敤, "娓犻亾宸茶绂佺敤");
- var rate = await GetRate();
- CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
+ //var rate = await GetRate();
+ //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
- var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸).Rate);
+
+ var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸);
+
+ var amount = CalculateAmount(input.ProductData.ParValue, rate);
var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
@@ -907,7 +913,7 @@
RechargeAmount = amount.RechargeAmount,
ChannelId = channle.ChannlesNum,
PlatformRate = platformRate.Rate,
- ChannleRate = channle.ChannlesRate,
+ ChannleRate = rate,
ChannlesRakeRate = channle.ChannlesRakeRate,
};
@@ -934,10 +940,13 @@
CheckExtensions.IfTrueThrowUserFriendlyException(channle == null, "娓犻亾涓嶅瓨鍦�");
CheckExtensions.IfTrueThrowUserFriendlyException(channle.Status == LifePayChannelsStatsEnum.绂佺敤, "娓犻亾宸茶绂佺敤");
- var rate = await GetRate();
- CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
+ //var rate = await GetRate();
+ //CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
- var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸).Rate);
+
+ var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸);
+
+ var amount = CalculateAmount(input.ProductData.ParValue, rate);
var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
@@ -954,7 +963,10 @@
PayAmount = amount.PayAmont,
DiscountAmount = amount.DiscountAmount,
RechargeAmount = amount.RechargeAmount,
- ChannelId = channle.ChannlesNum
+ ChannelId = channle.ChannlesNum,
+ PlatformRate = platformRate.Rate,
+ ChannleRate = rate,
+ ChannlesRakeRate = channle.ChannlesRakeRate,
};
await CreateLifePayOrder(orderInput);
@@ -1011,7 +1023,7 @@
}
/// <summary>
- /// 璁剧疆鐢熸椿缂磋垂鏀粯绫诲瀷
+ /// 鑾峰彇寰俊鏀粯鐨凧SAPI
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -1023,6 +1035,8 @@
CheckExtensions.IfTrueThrowUserFriendlyException(order.LifePayType.HasValue, "褰撳墠璁㈠崟宸查�夋嫨鏀粯绫诲瀷");
order.LifePayType = input.LifePayType;
+ var premium = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync();
+ order.PremiumRate = premium == null ? 0 : premium.Rate;
await _lifePayOrderRepository.UpdateAsync(order);
var desc = "鐢熸椿缂磋垂-";
@@ -1388,10 +1402,10 @@
break;
case LifePayTypeEnum.AliPay:
- var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() });
+ var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = input.RefundPrice.ToString() });
if (aliRefundResult.Code != AlipayResultCode.Success)
{
- throw new UserFriendlyException("閫�娆惧け璐�");
+ throw new UserFriendlyException("閫�娆惧け璐�:" + aliRefundResult.SubMsg);
}
order.LifePayOrderStatus = LifePayOrderStatusEnum.宸查��娆�;
@@ -1975,6 +1989,7 @@
{
var channles = await _lifePayChannlesRep.Where(x => x.ChannlesName.Contains(input.KeyWords)).Select(x => x.ChannlesNum).ToListAsync();
var result = (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository)
+ .Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
.WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
.WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime)
.WhereIf(input.BeginPayTime.HasValue, x => x.PayTime >= input.BeginPayTime)
@@ -2062,6 +2077,7 @@
RefundApplyRemark = a.RefundApplyRemark,
RefundApplyTime = a.RefundApplyTime,
RefundTime = a.RefundTime,
+ RefundOrderNo = a.RefundOrderNo,
RefundPrice = a.RefundPrice,
ChannelName = b.ChannlesName,
ActualRechargeAmount = a.ActualRechargeAmount,
@@ -2115,9 +2131,9 @@
};
}
- public async Task<decimal> GetLifePayRate(string channelId, LifePayRateTypeEnum lifePayRateType)
+ public async Task<decimal> GetLifePayRate(CreateEditPayChannelsInput channel, LifePayRateTypeEnum lifePayRateType)
{
- if (string.IsNullOrEmpty(channelId))
+ if (channel == null)
{
var rate = await GetRate();
CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
@@ -2126,9 +2142,6 @@
}
else
{
- var channel = await _lifePayChannlesRep.Where(x => x.ChannlesNum == channelId).FirstOrDefaultAsync();
-
- CheckExtensions.IfTrueThrowUserFriendlyException(channel == null, "鏈壘鍒板搴旀笭閬�");
return channel.ChannlesRate;
}
}
--
Gitblit v1.9.1