zhengyuxuan
2025-03-21 78bf5ae3845bd2d7008eae76a1d4facb2d29280b
fix:部分退款接口更新
5个文件已修改
114 ■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
@@ -352,9 +352,25 @@
{
    public Guid Id { get; set; }
    /// <summary>
    /// 上传凭证
    /// </summary>
    public string RefundCredentialsImgUrl { get; set; }
    /// <summary>
    /// 退款驳回原因
    /// </summary>
    public string RefundCheckRemark { get; set; }
    /// <summary>
    /// 退款类型
    /// </summary>
    public LifePayRefundTypeEnum LifePayRefundType { get; set; }
    /// <summary>
    /// 退款金额
    /// </summary>
    public decimal RefundPrice { get; set; }
}
public class RefundUserLifePayOrderInput : ChannelsBaseInput
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -869,6 +869,11 @@
public class TopStatisticsOutput
{
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreationTime { get; set; }
    /// <summary>
    /// 账户余额
    /// </summary>
    public decimal Amount { get; set; }
@@ -881,7 +886,7 @@
    /// <summary>
    /// 昨日收款
    /// </summary>
    public decimal ReceiptsYesterda { get; set; }
    public decimal ReceiptsYesterday { get; set; }
    /// <summary>
@@ -897,17 +902,17 @@
    /// <summary>
    /// 昨日下单
    /// </summary>
    public int OrdersNumYesterda { get; set; }
    public int OrdersNumYesterday { get; set; }
    /// <summary>
    /// 昨日成功
    /// </summary>
    public int YesterdaSuccess { get; set; }
    public int YesterdaySuccess { get; set; }
    /// <summary>
    /// 昨日失败
    /// </summary>
    public int YesterdaFail { get; set; }
    public int YesterdayFail { get; set; }
    /// <summary>
    /// 累计用户
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -122,13 +122,34 @@
                AccumulatedUsers = accumulatedUsers,
            };
            await _dallyStatisticsRepository.InsertAsync(entity);
            //var result = ObjectMapper.Map<DallyStatistics, TopStatisticsOutput>(entity);
            return new TopStatisticsOutput();
            TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
            {
                Amount = entity.Amount,
                AccumulatedReceipts = entity.AccumulatedReceipts,
                ReceiptsYesterday = entity.ReceiptsYesterday,
                AccumulatedOrders = entity.AccumulatedOrders,
                OrdersNumYesterday = entity.OrdersNumYesterday,
                YesterdaySuccess = entity.YesterdaySuccess,
                YesterdayFail = entity.YesterdayFail,
                AccumulatedUsers = entity.AccumulatedUsers,
            };
            return topStatisticsOutput;
        }
        else
        {
            var result = ObjectMapper.Map<DallyStatistics, TopStatisticsOutput>(statistics);
            return result;
            TopStatisticsOutput topStatisticsOutput = new TopStatisticsOutput()
            {
                Amount = statistics.Amount,
                AccumulatedReceipts = statistics.AccumulatedReceipts,
                ReceiptsYesterday = statistics.ReceiptsYesterday,
                AccumulatedOrders = statistics.AccumulatedOrders,
                OrdersNumYesterday = statistics.OrdersNumYesterday,
                YesterdaySuccess = statistics.YesterdaySuccess,
                YesterdayFail = statistics.YesterdayFail,
                AccumulatedUsers = statistics.AccumulatedUsers,
            };
            return topStatisticsOutput;
        }
    }
@@ -1283,6 +1304,14 @@
        {
            return;
        }
        if (input.RefundPrice > order.PayAmount)
        {
            throw new UserFriendlyException("退款的金额不能大于实付金额");
        }
        if (input.LifePayRefundType == LifePayRefundTypeEnum.全额退款 && input.RefundPrice != order.PayAmount)
        {
            throw new UserFriendlyException("全额退款的金额与实付金额不一致");
        }
        if (order.LifePayOrderStatus != LifePayOrderStatusEnum.已失败 && order.PayStatus != LifePayStatusEnum.待退款 && order.LifePayOrderStatus != LifePayOrderStatusEnum.退款待审核)
        {
@@ -1294,7 +1323,7 @@
        switch (order.LifePayType)
        {
            case LifePayTypeEnum.WxPay:
                var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo,order.RefundApplyRemark, Convert.ToInt32(order.PayAmount * 100), Convert.ToInt32(order.PayAmount * 100));
                var wxRefundResult = await WxPayDomesticRefunds(order.OrderNo, outRefundNo,order.RefundApplyRemark, Convert.ToInt32(input.RefundPrice * 100), Convert.ToInt32(order.PayAmount * 100));
                if (wxRefundResult.Status == "SUCCESS")
                {
                    order.PayStatus = LifePayStatusEnum.已退款;
@@ -1316,7 +1345,7 @@
                break;
            case LifePayTypeEnum.AliPay:
                var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = order.PayAmount.ToString() });
                var aliRefundResult = await AliTradeRefund(new AlipayTradeRefundRequest() { OutTradeNo = order.OrderNo, RefundAmount = Convert.ToInt32(input.RefundPrice * 100).ToString() });
                if (aliRefundResult.Code != AlipayResultCode.Success)
                {
                    throw new UserFriendlyException("退款失败");
@@ -1332,7 +1361,7 @@
        order.RefundCheckRemark = input.RefundCheckRemark;
        order.RefundTime = DateTime.Now;
        order.RefundCheckUserId = CurrentUser.Id;
        order.RefundPrice = order.PayAmount;
        order.RefundPrice = input.RefundPrice;
        await _lifePayOrderRepository.UpdateAsync(order);
LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayEnum.cs
@@ -150,4 +150,13 @@
    [Description("微信的内容")]
    微信的内容 = 4,
}
public enum LifePayRefundTypeEnum
{
    [Description("全额退款")]
    全额退款 = 10,
    [Description("部分退款")]
    部分退款 = 20
}
LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -510,6 +510,26 @@
            搜索关键词
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RefundLifePayOrderInput.RefundCredentialsImgUrl">
            <summary>
            上传凭证
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RefundLifePayOrderInput.RefundCheckRemark">
            <summary>
            退款驳回原因
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RefundLifePayOrderInput.LifePayRefundType">
            <summary>
            退款类型
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RefundLifePayOrderInput.RefundPrice">
            <summary>
            退款金额
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.RefundUserLifePayOrderInput.UserId">
            <summary>
            用户Id
@@ -1265,6 +1285,11 @@
            创建时间
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.CreationTime">
            <summary>
            创建时间
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.Amount">
            <summary>
            账户余额
@@ -1275,7 +1300,7 @@
            累计收款
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.ReceiptsYesterda">
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.ReceiptsYesterday">
            <summary>
            昨日收款
            </summary>
@@ -1290,17 +1315,17 @@
            累计下单
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.OrdersNumYesterda">
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.OrdersNumYesterday">
            <summary>
            昨日下单
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.YesterdaSuccess">
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.YesterdaySuccess">
            <summary>
            昨日成功
            </summary>
        </member>
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.YesterdaFail">
        <member name="P:LifePayment.Application.Contracts.TopStatisticsOutput.YesterdayFail">
            <summary>
            昨日失败
            </summary>