feat(SwapModule): 添加线下费率字段处理逻辑

- 新增线下费率字符串读取功能
- 实现百分比格式解析转换为小数
- 添加非百分比格式的直接解析处理
- 增加解析失败时的默认值设置
- 将解析结果赋值给swapRate对象的OfflineRate属性
- 确保费率数据验证通过后才进行创建者信息设置
This commit is contained in:
hjhan
2026-01-22 16:33:06 +08:00
parent af5823a570
commit 3c2769df2a
@@ -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);