diff --git a/YLErpDAL/Modules/SwapModule/SwapRateService.cs b/YLErpDAL/Modules/SwapModule/SwapRateService.cs index 518644e6..e016f5ed 100644 --- a/YLErpDAL/Modules/SwapModule/SwapRateService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapRateService.cs @@ -310,28 +310,48 @@ namespace YLErp.Modules.SwapModule // 处理线下费率 var offlineRate = reader.GetString("线下费率"); + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,原始线下费率值: '{offlineRate}', IsNullOrEmpty: {string.IsNullOrEmpty(offlineRate)}"); + if (!string.IsNullOrEmpty(offlineRate)) { + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,线下费率非空,准备解析: '{offlineRate}'"); decimal rate = 0; if (offlineRate.EndsWith("%")) { + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,线下费率是百分比格式: '{offlineRate}'"); offlineRate = offlineRate.Replace("%", ""); if (decimal.TryParse(offlineRate, out rate)) { rate /= 100; + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,百分比解析成功: {offlineRate}% -> {rate}"); + } + else + { + LogFactory.GetLogger("导入阶梯费率").Error($"第{rowIndex}行,百分比数值解析失败: '{offlineRate}'"); + rate = 0; } } else { + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,线下费率不是百分比格式: '{offlineRate}', 尝试直接解析"); // 如果不是百分比格式,直接尝试解析为小数 if (!decimal.TryParse(offlineRate, out rate)) { // 解析失败时的处理 - LogFactory.GetLogger("导入阶梯费率").Error($"第{rowIndex}行,线下费率解析失败:{offlineRate}"); + LogFactory.GetLogger("导入阶梯费率").Error($"第{rowIndex}行,线下费率解析失败: '{offlineRate}'"); rate = 0; } + else + { + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,直接解析成功: {offlineRate} -> {rate}"); + } } swapRate.OfflineRate = rate; + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,最终设置OfflineRate为: {rate}"); + } + else + { + LogFactory.GetLogger("导入阶梯费率").Info($"第{rowIndex}行,线下费率为null或空字符串"); } ValidateSwapRate(swapRate);