From 3c2769df2a28a4381d1d27c4a891f5bf0916a6ed Mon Sep 17 00:00:00 2001 From: hjhan Date: Thu, 22 Jan 2026 16:33:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(SwapModule):=20=E6=B7=BB=E5=8A=A0=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E8=B4=B9=E7=8E=87=E5=AD=97=E6=AE=B5=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增线下费率字符串读取功能 - 实现百分比格式解析转换为小数 - 添加非百分比格式的直接解析处理 - 增加解析失败时的默认值设置 - 将解析结果赋值给swapRate对象的OfflineRate属性 - 确保费率数据验证通过后才进行创建者信息设置 --- .../Modules/SwapModule/SwapRateService.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/YLErpDAL/Modules/SwapModule/SwapRateService.cs b/YLErpDAL/Modules/SwapModule/SwapRateService.cs index c84a6e24..810db1c6 100644 --- a/YLErpDAL/Modules/SwapModule/SwapRateService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapRateService.cs @@ -307,6 +307,32 @@ namespace YLErp.Modules.SwapModule // swapRate.BackDeskCharge = rate * 0.0001m; //} swapRate.DiscountAccDown = reader.GetDecimal("优惠累计量下限"); + + // 处理线下费率 + var offlineRate = reader.GetString("线下费率"); + if (!string.IsNullOrEmpty(offlineRate)) + { + decimal rate = 0; + if (offlineRate.EndsWith("%")) + { + offlineRate = offlineRate.Replace("%", ""); + if (decimal.TryParse(offlineRate, out rate)) + { + rate = rate / 100; + } + } + else + { + // 如果不是百分比格式,直接尝试解析为小数 + if (!decimal.TryParse(offlineRate, out rate)) + { + // 解析失败时的处理 + rate = 0; + } + } + swapRate.OfflineRate = rate; + } + ValidateSwapRate(swapRate); swapRate.SetCreator(UserId, UserName); swapRate.SetOpt(UserId, UserName);