From 132fb9d381c6d2c431d77deb7b678ceb0a761614 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 20 三月 2025 16:00:41 +0800 Subject: [PATCH] fix:bug修复 --- LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs | 13 +++++++++++++ LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 22 ++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs index 96fcfd4..6bbd71c 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs @@ -457,6 +457,14 @@ public Guid Id { get; set; } /// <summary> + /// 鐢ㄦ埛璐﹀彿 + /// </summary> + public string UserPhoneNumber { get; set; } + + public string UserName { get; set; } + + public string LifePayChannle { get; set; } + /// <summary> /// 鐢熸椿缂磋垂鏀粯绫诲瀷 /// </summary> public LifePayTypeEnum? LifePayType { get; set; } @@ -507,6 +515,11 @@ public DateTime? FinishTime { get; set; } /// <summary> + /// 澶栭儴璁㈠崟鍙� + /// </summary> + public string OutOrderNo { get; set; } + + /// <summary> /// 璁㈠崟璇︾粏鏁版嵁 /// </summary> public string OrderParamDetailJsonStr { get; set; } diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 6c06444..6531979 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -271,15 +271,21 @@ { var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync(); var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环); - var channleRate = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); - var premiumRate = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync(); + var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); + var premium = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync(); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); - var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channleRate.ChannlesRakeRate / 100; + var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); + + var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channle.ChannlesRakeRate / 100; var result = new LifePayOrderOutput() { + UserName = user.Name, + UserPhoneNumber = user.PhoneNumber, DiscountAmount = order.DiscountAmount, FinishTime = order.FinishTime, Id = order.Id, + OutOrderNo = order.OutOrderNo, + LifePayChannle = channle.ChannlesName, LifePayOrderStatus = order.LifePayOrderStatus, LifePayOrderType = order.LifePayOrderType, LifePayType = order.LifePayType, @@ -300,12 +306,12 @@ RefundPrice = order.RefundPrice, PlatformRate = platformRate.Rate, PlatformPrice = order.PlatformDeductionAmount, - ChannleRate = channleRate.ChannlesRate, - ChannlesRakeRate = channleRate.ChannlesRakeRate, + ChannleRate = channle.ChannlesRate, + ChannlesRakeRate = channle.ChannlesRakeRate, ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2), - PremiumRate = premiumRate == null ? 0 : premiumRate.Rate, - PremiumPrice = premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2), - Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channleRate.ChannlesRakeRate / 100) - (premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2)) + PremiumRate = premium == null ? 0 : premium.Rate, + PremiumPrice = premium == null ? 0 : Math.Round(order.PayAmount * premium.Rate, 2), + Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channle.ChannlesRakeRate / 100) - (premium == null ? 0 : Math.Round(order.PayAmount * premium.Rate, 2)) }; return result; -- Gitblit v1.9.1