From 72845b9ade14bae50bc99a739d8ca5459b491c45 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期二, 25 三月 2025 09:34:48 +0800 Subject: [PATCH] fix:开启1分钱支付 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 65 ++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 17 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index e4a7211..a33468f 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -246,8 +246,8 @@ { 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) - .WhereIf(input.BeginRefundTime.HasValue, x => x.FinishTime >= input.BeginRefundTime) - .WhereIf(input.EndRefundTime.HasValue, x => x.FinishTime <= input.EndRefundTime) + .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) .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType) .WhereIf(input.EndPayTime.HasValue, x => x.PayTime <= input.EndPayTime) @@ -303,8 +303,8 @@ var result = await (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository) .Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑 || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�) - .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime) - .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime) + .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) .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType) .WhereIf(input.EndRefundApplyTime.HasValue, x => x.RefundApplyTime <= input.EndRefundApplyTime) @@ -358,7 +358,7 @@ { var result = await (await GetLifePayRefundOrderListFilter(input)).Select(x => new LifePayRefundOrderListTemplate { - FinishTime = x.FinishTime, + FinishTime = x.RefundTime, RefundPrice = x.RefundPrice, LifePayOrderType = x.LifePayOrderType, LifePayType = x.LifePayType, @@ -368,6 +368,7 @@ ChannelName = x.ChannelName, CreationTime = x.CreationTime, ACOOLYStatus = x.ACOOLYStatus, + RefundApplyRemark = x.RefundApplyRemark, RechargeAmount = x.RechargeAmount, ActualReceivedAmount = x.ActualReceivedAmount.ToString("F2"), LifePayRefundStatus = x.LifePayRefundStatus, @@ -397,8 +398,10 @@ var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�"); var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); - var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channle.ChannlesRakeRate / 100; + var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount,order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate,order.PremiumRate); + + var result = new LifePayOrderOutput() { UserName = user.Name, @@ -430,12 +433,12 @@ PlatformPrice = order.PlatformDeductionAmount, ElecBillUrl = order.ElecBillUrl.GetOssPath(), RefundElecBillUrl = order.RefundElecBillUrl.GetOssPath(), - ChannleRate = channle.ChannlesRate, - ChannlesRakeRate = channle.ChannlesRakeRate, - ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2), + ChannleRate = order.ChannleRate, + ChannlesRakeRate = order.ChannlesRakeRate, + ChannlesRakePrice = orderpirce.ChannlesRakePrice, PremiumRate = order.PremiumRate, - 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) + PremiumPrice = orderpirce.PremiumPrice, + Profit = orderpirce.Profit }; return result; @@ -745,17 +748,17 @@ { s.SerialNumber = ++i; s.LifePayOrderTypeStr = s.LifePayOrderType.GetDescription(); - s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); + s.CreationTimeStr = s.CreationTime.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss); s.RechargeAmountStr = s.RechargeAmount.ToString("F2"); s.PayAmountStr = s.PayAmount.ToString("F2"); - s.PayTimeStr = !s.PayTime.HasValue ? string.Empty : s.PayTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); + s.PayTimeStr = !s.PayTime.HasValue ? string.Empty : s.PayTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss); s.LifePayTypeStr = s.LifePayType.GetDescription(); s.PayStatusStr = s.PayStatus.GetDescription(); s.ActualRechargeAmountStr = s.ActualRechargeAmount.ToString("F2"); s.LifePayRefundStatusStr = s.LifePayRefundStatusStr.GetDescription(); s.ACOOLYStatusStr = s.ACOOLYStatus.GetDescription(); //s.LifePayOrderStatusStr = s.LifePayOrderStatus.GetDescription(); - s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmm); + s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss); }); return result; } @@ -1305,6 +1308,7 @@ { order.ACOOLYOrderNo = acoolyOrderNo; } + if (refundApplyRemark.IsNotNullOrEmpty()) { order.RefundApplyRemark = refundApplyRemark; @@ -1312,7 +1316,7 @@ order.LifePayOrderStatus = status; order.ACOOLYStatus = acoolyStatus; - + order.FinishTime = DateTime.Now; await _lifePayOrderRepository.UpdateAsync(order); } @@ -2008,8 +2012,8 @@ var result = (from a in _channelFilter.GetChannelLifePayOrderFilter(_lifePayOrderRepository) .Where(x => x.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.宸查��娆� || x.LifePayOrderStatus == LifePayOrderStatusEnum.閫�娆句腑 || x.LifePayRefundStatus > LifePayRefundStatusEnum.鏃犻渶閫�娆�) - .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime) - .WhereIf(input.EndFinishTime.HasValue, x => x.FinishTime <= input.EndFinishTime) + .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) .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType) .WhereIf(input.EndRefundApplyTime.HasValue, x => x.RefundApplyTime <= input.EndRefundApplyTime) @@ -2069,5 +2073,32 @@ }); } + public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal? platformRate,decimal? channleRate, + decimal? channlesRakeRate,decimal? premiumRate) + { + /// 姣涘埄 + var grossProfit = price * (channleRate - platformRate) / 100; + + /// 骞冲彴鎵f閲戦 鍏呭�奸潰棰� * 骞冲彴鎶樻墸姣斾緥 + var platformPrice = price * platformRate / 100; + + /// 鎵嬬画璐� + var premiumPrice = priceAmount * premiumRate / 100; + + /// 娓犻亾浣i噾 锛�(鍏呭�奸潰棰� * 娓犻亾鎶樻墸姣斾緥)-(鍏呭�奸潰棰� * 骞冲彴鎶樻墸姣斾緥)锛�* 浣i噾姣斾緥 + var channlesRakePrice = grossProfit * channlesRakeRate / 100; + + /// 鍒╂鼎 + var profit = grossProfit - channlesRakePrice - premiumPrice; + + return new OrderPriceReturn() + { + PlatformPrice = platformPrice.HasValue? platformPrice.Value :0, + PremiumPrice = premiumPrice.HasValue ? premiumPrice.Value : 0, + ChannlesRakePrice = channlesRakePrice.HasValue? channlesRakePrice.Value:0, + Profit = profit.HasValue ? profit.Value : 0 + }; + } + #endregion } -- Gitblit v1.9.1