From fc85a3382990bcfb5f4d1a77f1525328343b3c8c Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 25 三月 2025 18:20:47 +0800
Subject: [PATCH] fix: 新增修改实际到账金额接口
---
LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 50 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 11bc1ec..a6519a5 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -27,6 +27,7 @@
using Volo.Abp.ObjectMapping;
using NPOI.SS.Formula.Functions;
using StackExchange.Redis;
+using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace LifePayment.Application;
@@ -157,7 +158,7 @@
/// <returns></returns>
public async Task<ChannelRateOutput> GetChannelRate(ChannelsBaseInput input)
{
- return _lifePayChannlesRep.Where(x => x.IsDeleted == false && x.ChannlesNum == input.CheckChannelId).Select(x => new ChannelRateOutput() { ChannlesRate = x.ChannlesRate })
+ return _lifePayChannlesRep.Where(x => x.IsDeleted == false && x.ChannlesNum == input.CheckChannelId).Select(x => new ChannelRateOutput() { ChannlesRate = x.ChannlesRate })
.FirstOrDefault();
}
@@ -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.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;
}
@@ -396,14 +399,14 @@
{
var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId);
- CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
+ 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 orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate, order.PremiumRate);
var result = new LifePayOrderOutput()
- {
+ {
UserName = user.Name,
UserPhoneNumber = user.PhoneNumber,
DiscountAmount = order.DiscountAmount,
@@ -730,7 +733,7 @@
LifePayType = x.LifePayType,
OrderNo = x.OrderNo,
PayAmount = x.PayAmount,
- ActualRechargeAmount = x.ActualRechargeAmount.HasValue?x.ActualRechargeAmount.Value:0,
+ ActualRechargeAmount = x.ActualRechargeAmount.HasValue ? x.ActualRechargeAmount.Value : 0,
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.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);
@@ -839,7 +842,7 @@
var amount = CalculateAmount(input.ProductData.ParValue, rate.FirstOrDefault(x => x.RateType == LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸).Rate);
var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
-
+
var orderInput = new CreateLifePayOrderInput
{
@@ -856,7 +859,7 @@
RechargeAmount = amount.RechargeAmount,
ChannelId = channle.ChannlesNum,
PlatformRate = platformRate.Rate,
- PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate /100,
+ PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
ChannleRate = channle.ChannlesRate,
ChannlesRakeRate = channle.ChannlesRakeRate,
//ChannlesRakePrice = amount.RechargeAmount * (channle.ChannlesRate - platformRate.Rate) / 100 * channle.ChannlesRakeRate / 100
@@ -1055,6 +1058,25 @@
}
/// <summary>
+ /// 淇敼瀹為檯鍒拌处閲戦
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ public async Task<int> UpdateLifePayOrderActualReceivedAmount(UpdateLifePayOrderInput input)
+ {
+ var order = await _lifePayOrderRepository.Where(x => x.Id == input.Id).FirstOrDefaultAsync();
+
+ CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
+ CheckExtensions.IfTrueThrowUserFriendlyException(order.ACOOLYStatus != ACOOLYStatusEnum.閮ㄥ垎鍏呭�兼垚鍔�, "璇ヨ鍗曟棤娉曚慨鏀瑰埌璐﹂噾棰�");
+
+ order.ActualReceivedAmount = input.ActualReceivedAmount;
+
+ await _lifePayOrderRepository.UpdateAsync(order);
+
+ return Constant.SUCCESS;
+ }
+
+ /// <summary>
/// 鍒涘缓鐢熸椿缂磋垂璁㈠崟
/// </summary>
/// <param name="input"></param>
@@ -1388,10 +1410,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.宸查��娆�;
--
Gitblit v1.10.0