From 4419a4125bce13e31fffaed24975893f97177bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=86=B0=E5=86=B0?= <437394478@qq.com> Date: Wed, 22 Jul 2026 16:27:36 +0800 Subject: [PATCH] =?UTF-8?q?(fix):=20=E5=B0=86=E5=8E=9F=E4=BF=9D=E8=AF=81?= =?UTF-8?q?=E9=87=91=E6=A8=A1=E6=9D=BF=E5=90=8D=E7=A7=B0=3D=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=BB=98=E8=AE=A4=20=E7=9A=84=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E6=94=B9=E4=B8=BAnull=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EodModule/SettlementModule/EodHandleSwapFlowService.cs | 4 ++-- YLErpDAL/Modules/SwapModule/SwapTradeService.cs | 2 +- .../TradeModule/SwapModule/SwapTradeFlowImportService.cs | 2 +- .../SwapModule/SwapTradeFlowMoreImportService.cs | 2 +- .../TradeModule/SwapModule/SwapTradeImportService.cs | 4 ++-- YLErpWeb/Controllers/SwapTrade2Controller.cs | 6 ++++++ YLErpWeb/Controllers/SwapTradeController.cs | 4 ++-- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/YLErpDAL/Modules/EodModule/SettlementModule/EodHandleSwapFlowService.cs b/YLErpDAL/Modules/EodModule/SettlementModule/EodHandleSwapFlowService.cs index 4fbe9235..44683a41 100644 --- a/YLErpDAL/Modules/EodModule/SettlementModule/EodHandleSwapFlowService.cs +++ b/YLErpDAL/Modules/EodModule/SettlementModule/EodHandleSwapFlowService.cs @@ -455,7 +455,7 @@ namespace YLErp.Modules.EodModule Lots = swapFlow.Lots, IsNight = swapFlow.IsNight, OpponentRole = "甲方", - MarginTemplateName = "系统默认", + MarginTemplateName = null, MarginType = MarginTypeEnum.DEFAULT, IsGroup = isSingleTrade ? 0 : 2 }; @@ -743,7 +743,7 @@ namespace YLErp.Modules.EodModule td.OriginalNotional = td.Notional; td.OriginalStockEqvNotional = td.StockEqvNotional; td.StockEqvNotionalReal = td.StockEqvNotionalReal; - td.MarginTemplateName = "系统默认"; + td.MarginTemplateName = null; td.MarginType = MarginTypeEnum.DEFAULT; td.IsTradePricePayType = true; td.TradeSource = TradeSourceEnum.导入交易.ToString(); diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs index f95b4718..d5c04664 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs @@ -321,7 +321,7 @@ namespace YLErp.Modules.SwapModule TradeDate = flowMerge.OccurTime, TraderId = asset.TraderIdsInt.FirstOrDefault(), TraderName = asset.TraderNamesList.FirstOrDefault(), - MarginTemplateName = "系统默认", + MarginTemplateName = null, OpponentRole = "乙方", StructureType = structureType, InitialMargin = 0, diff --git a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowImportService.cs b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowImportService.cs index efac3554..fb8d835d 100644 --- a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowImportService.cs +++ b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowImportService.cs @@ -378,7 +378,7 @@ namespace YLErp.Modules.TradeModule.SwapModule importTrade.StockEqvNotionalReal = importTrade.StockEqvNotionalReal; importTrade.trade_swap.RateCalcMode = "01"; importTrade.IsUsePremiumRate = true; - importTrade.MarginTemplateName = "系统默认"; + importTrade.MarginTemplateName = null; importTrade.MarginType = MarginTypeEnum.DEFAULT; importTrade.IsTradePricePayType = true; importTrade.TradeSource = TradeSourceEnum.导入交易.ToString(); diff --git a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowMoreImportService.cs b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowMoreImportService.cs index 64c89cae..5e0f2ee2 100644 --- a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowMoreImportService.cs +++ b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeFlowMoreImportService.cs @@ -519,7 +519,7 @@ namespace YLErp.Modules.TradeModule.SwapModule importTrade.ParticipationRate = 1; //预付金 - importTrade.MarginTemplateName = "系统默认"; + importTrade.MarginTemplateName = null; importTrade.MarginType = MarginTypeEnum.DEFAULT; SetDBModelCreator(importTrade); diff --git a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeImportService.cs b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeImportService.cs index 4ae8a21b..6f985cbf 100644 --- a/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeImportService.cs +++ b/YLErpDAL/Modules/TradeModule/SwapModule/SwapTradeImportService.cs @@ -726,7 +726,7 @@ namespace YLErp.Modules.TradeModule.SwapModule td.OriginalStockEqvNotional = td.StockEqvNotional; td.StockEqvNotionalReal = td.StockEqvNotionalReal; td.IsUsePremiumRate = true; - td.MarginTemplateName = "系统默认"; + td.MarginTemplateName = null; td.MarginType = MarginTypeEnum.DEFAULT; td.IsTradePricePayType = true; td.TradeSource = TradeSourceEnum.导入交易.ToString(); @@ -2815,7 +2815,7 @@ namespace YLErp.Modules.TradeModule.SwapModule td.SettlementDate = td.ExerciseDate; td.StockEqvNotional = reader.GetDouble("名义本金(人民币)", true) ?? 0; - td.MarginTemplateName = "系统默认"; + td.MarginTemplateName = null; td.UnWindDate = reader.GetDate("提前终止日/终止日", true); td.Comments = reader.GetString("备注", false); //td.UnderlyingName = reader.GetString("标的名称", true); diff --git a/YLErpWeb/Controllers/SwapTrade2Controller.cs b/YLErpWeb/Controllers/SwapTrade2Controller.cs index 76a82824..6f38abe5 100644 --- a/YLErpWeb/Controllers/SwapTrade2Controller.cs +++ b/YLErpWeb/Controllers/SwapTrade2Controller.cs @@ -116,6 +116,12 @@ namespace YLErp.Web.Controllers { return ShowError("没有找到交易数据"); } + var marginTemplateConfig = SwapMarginTemplateConfigService.GetConfig(); + if (string.IsNullOrWhiteSpace(tradeObj.MarginTemplateName) + || !marginTemplateConfig.options.Any(item => item.Value == tradeObj.MarginTemplateName)) + { + tradeObj.MarginTemplateName = marginTemplateConfig.defaultValue; + } TradeViewModel model; model = new TradeViewModel(tradeObj) diff --git a/YLErpWeb/Controllers/SwapTradeController.cs b/YLErpWeb/Controllers/SwapTradeController.cs index 8746b33b..ad82b7c7 100644 --- a/YLErpWeb/Controllers/SwapTradeController.cs +++ b/YLErpWeb/Controllers/SwapTradeController.cs @@ -303,7 +303,7 @@ namespace YLErp.Web.Controllers TradeDate = valuedateBLL.ValueDate, TraderId = CurUser.UserId, TraderName = CurUser.UserName, - MarginTemplateName = "系统默认", + MarginTemplateName = null, OpponentRole = "乙方", trade_swap = new trade_swap() { @@ -1196,4 +1196,4 @@ namespace YLErp.Web.Controllers return JsonSuccess("", 0); } } -} \ No newline at end of file +}