From d5f58449670f05b8022fc103934ba860e8ddce5d Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期二, 25 三月 2025 15:57:39 +0800
Subject: [PATCH] fix:隐藏未支付订单
---
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 215 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 145 insertions(+), 70 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index a4e76a1..26b1780 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,
@@ -358,16 +360,18 @@
{
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,
PayAmount = x.PayAmount,
PhoneNumber = x.PhoneNumber,
RefundOrderNo = x.RefundOrderNo,
+ RefundApplyTime = x.RefundApplyTime,
ChannelName = x.ChannelName,
CreationTime = x.CreationTime,
ACOOLYStatus = x.ACOOLYStatus,
+ RefundApplyRemark = x.RefundApplyRemark,
RechargeAmount = x.RechargeAmount,
ActualReceivedAmount = x.ActualReceivedAmount.ToString("F2"),
LifePayRefundStatus = x.LifePayRefundStatus,
@@ -379,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.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;
}
@@ -397,8 +401,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,
@@ -424,18 +430,18 @@
RefundTime = order.RefundTime,
ACOOLYOrderNo = order.ACOOLYOrderNo,
LifePayRefundStatus = order.LifePayRefundStatus,
- ActualRechargeAmount = order.ActualRechargeAmount,
+ ActualRechargeAmount = order.RechargeAmount,
RefundPrice = order.RefundPrice,
PlatformRate = order.PlatformRate,
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;
@@ -527,6 +533,7 @@
CreationTime = x.CreationTime,
RefundCheckRemark = x.RefundCheckRemark,
RefundApplyRemark = x.RefundApplyRemark,
+ RefundApplyTime = x.RefundApplyTime,
RefundTime = x.RefundTime,
ACOOLYOrderNo = x.ACOOLYOrderNo,
LifePayRefundStatus = x.LifePayRefundStatus,
@@ -726,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,
@@ -738,24 +745,24 @@
ACOOLYStatus = x.ACOOLYStatus,
//RefundApplyRemark = x.RefundApplyRemark,
ChannelName = x.ChannelName,
- PlatformPrice = x.PlatformDeductionAmount.HasValue ? x.PlatformDeductionAmount.Value : 0
+ PlatformPrice = x.PlatformDeductionAmount.HasValue ? x.PlatformDeductionAmount.Value : 0.00m
}).OrderByDescending(r => r.CreationTime).ToListAsync();
var i = 0;
result.ForEach(s =>
{
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.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.yyyyMMddHHmm);
+ s.FinishTimeStr = !s.FinishTime.HasValue ? string.Empty : s.FinishTime.Value.ToString(LifePaymentConstant.DateTimeFormatStr.yyyyMMddHHmmss);
});
return result;
}
@@ -827,10 +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 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环);
@@ -851,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
};
@@ -879,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环);
@@ -901,7 +913,7 @@
RechargeAmount = amount.RechargeAmount,
ChannelId = channle.ChannlesNum,
PlatformRate = platformRate.Rate,
- ChannleRate = channle.ChannlesRate,
+ ChannleRate = rate,
ChannlesRakeRate = channle.ChannlesRakeRate,
};
@@ -928,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环);
@@ -948,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);
@@ -1305,6 +1323,12 @@
{
order.ACOOLYOrderNo = acoolyOrderNo;
}
+
+ if (status == LifePayOrderStatusEnum.寰呴��娆�)
+ {
+ order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
+ }
+
if (refundApplyRemark.IsNotNullOrEmpty())
{
order.RefundApplyRemark = refundApplyRemark;
@@ -1312,7 +1336,7 @@
order.LifePayOrderStatus = status;
order.ACOOLYStatus = acoolyStatus;
-
+ order.FinishTime = DateTime.Now;
await _lifePayOrderRepository.UpdateAsync(order);
}
@@ -1376,10 +1400,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.宸查��娆�;
@@ -1561,24 +1585,21 @@
var order = await _lifePayOrderRepository.FirstOrDefaultAsync(x => x.Id == input.Id);
CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
- if(order.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
+ if (order.LifePayRefundStatus == LifePayRefundStatusEnum.宸查��娆�)
{
return;
}
- if (order.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆�)
+ if (order.LifePayOrderStatus == LifePayOrderStatusEnum.寰呴��娆� || order.LifePayRefundStatus == LifePayRefundStatusEnum.寰呴��娆�)
{
- if (order.ACOOLYStatus == ACOOLYStatusEnum.宸插畬鎴� || order.ACOOLYStatus == ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�)
+ if (order.ACOOLYStatus == ACOOLYStatusEnum.宸插畬鎴� || order.ACOOLYStatus == ACOOLYStatusEnum.鍏呭�兼垚鍔� || order.ACOOLYStatus == ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�)
{
order.LifePayOrderStatus = LifePayOrderStatusEnum.宸插畬鎴�;
- }
- else if (order.ACOOLYStatus == ACOOLYStatusEnum.鍏呭�煎け璐�)
- {
- order.LifePayOrderStatus = LifePayOrderStatusEnum.閫�娆惧け璐�;
}
order.RefundCheckRemark = input.RefundCheckRemark;
order.RefundCheckUserId = CurrentUser.Id;
+ order.LifePayRefundStatus = LifePayRefundStatusEnum.閫�娆鹃┏鍥�;
await _lifePayOrderRepository.UpdateAsync(order);
@@ -1964,42 +1985,53 @@
private async Task<IQueryable<LifePayOrderListOutput>> GetLifePayOrderListFilter(QueryLifePayOrderListInput input)
{
- var result = (from a in _lifePayOrderRepository.Where(x => x.PayStatus != LifePayStatusEnum.鏈敮浠�)
- .WhereIf(input.BeginFinishTime.HasValue, x => x.FinishTime >= input.BeginFinishTime)
+ 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)
+ .WhereIf(input.LifePayType.HasValue, x => x.LifePayType == input.LifePayType)
.WhereIf(input.EndPayTime.HasValue, x => x.PayTime <= input.EndPayTime)
.WhereIf(input.LifePayOrderStatus.HasValue, x => x.LifePayOrderStatus == input.LifePayOrderStatus.Value)
.WhereIf(input.PayStatus.HasValue, x => x.PayStatus == input.PayStatus.Value)
+ .WhereIf(input.ACOOLYStatus.HasValue, x => x.ACOOLYStatus == input.ACOOLYStatus.Value)
.WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType.Value)
.WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId.Value)
- .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.PhoneNumber.Contains(input.KeyWords) || x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords))
- join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp
- from b in temp.DefaultIfEmpty()
- select new LifePayOrderListOutput
- {
- DiscountAmount = a.DiscountAmount,
- FinishTime = a.FinishTime,
- Id = a.Id,
- LifePayOrderStatus = a.LifePayOrderStatus,
- LifePayOrderType = a.LifePayOrderType,
- LifePayType = a.LifePayType,
- OrderNo = a.OrderNo,
- PayAmount = a.PayAmount,
- PhoneNumber = a.PhoneNumber,
- RechargeAmount = a.RechargeAmount,
- UserId = a.UserId,
- OutOrderNo = a.OutOrderNo,
- PayStatus = a.PayStatus,
- PayTime = a.PayTime,
- ACOOLYOrderNo = a.ACOOLYOrderNo,
- RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(),
- CreationTime = a.CreationTime,
- RefundCheckRemark = a.RefundCheckRemark,
- RefundApplyRemark = a.RefundApplyRemark,
- RefundTime = a.RefundTime,
- ChannelName = b.ChannlesName
- });
+ .WhereIf(input.KeyWords.IsNotNullOrEmpty(), x => x.OrderNo.Contains(input.KeyWords) || x.OutOrderNo.Contains(input.KeyWords) || x.ACOOLYOrderNo.Contains(input.KeyWords) || channles.Contains(x.ChannelId))
+ join b in _lifePayChannlesRep on a.ChannelId equals b.ChannlesNum into temp
+ from b in temp.DefaultIfEmpty()
+ select new LifePayOrderListOutput
+ {
+ DiscountAmount = a.DiscountAmount,
+ FinishTime = a.FinishTime,
+ Id = a.Id,
+ LifePayOrderStatus = a.LifePayOrderStatus,
+ LifePayOrderType = a.LifePayOrderType,
+ LifePayType = a.LifePayType,
+ OrderNo = a.OrderNo,
+ PayAmount = a.PayAmount,
+ PhoneNumber = a.PhoneNumber,
+ RechargeAmount = a.RechargeAmount,
+ UserId = a.UserId,
+ OutOrderNo = a.OutOrderNo,
+ PayStatus = a.PayStatus,
+ PayTime = a.PayTime,
+ ACOOLYOrderNo = a.ACOOLYOrderNo,
+ RefundCredentialsImgUrl = a.RefundCredentialsImgUrl.GetOssPath(),
+ RefundPrice = a.RefundPrice,
+ CreationTime = a.CreationTime,
+ RefundCheckRemark = a.RefundCheckRemark,
+ RefundApplyRemark = a.RefundApplyRemark,
+ RefundTime = a.RefundTime,
+ ChannelName = b.ChannlesName,
+ ActualRechargeAmount = a.ActualRechargeAmount,
+ PlatformDeductionAmount = a.PlatformDeductionAmount,
+ ACOOLYStatus = a.ACOOLYStatus,
+ LifePayRefundStatus = a.LifePayRefundStatus,
+ });
+
+
return result;
}
@@ -2007,7 +2039,7 @@
{
var result = (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)
@@ -2043,6 +2075,7 @@
RefundApplyRemark = a.RefundApplyRemark,
RefundApplyTime = a.RefundApplyTime,
RefundTime = a.RefundTime,
+ RefundOrderNo = a.RefundOrderNo,
RefundPrice = a.RefundPrice,
ChannelName = b.ChannlesName,
ActualRechargeAmount = a.ActualRechargeAmount,
@@ -2069,5 +2102,47 @@
});
}
+ 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
+ };
+ }
+
+ public async Task<decimal> GetLifePayRate(CreateEditPayChannelsInput channel, LifePayRateTypeEnum lifePayRateType)
+ {
+ if (channel == null)
+ {
+ var rate = await GetRate();
+ CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
+ var result = rate.FirstOrDefault(x => x.RateType == lifePayRateType).Rate;
+ return result;
+ }
+ else
+ {
+ return channel.ChannlesRate;
+ }
+ }
+
#endregion
}
--
Gitblit v1.9.1