diff --git a/Framework/YLErp.Core/DBModels/Consts/ConsReport.cs b/Framework/YLErp.Core/DBModels/Consts/ConsReport.cs index 1e5559e7..9152f16e 100644 --- a/Framework/YLErp.Core/DBModels/Consts/ConsReport.cs +++ b/Framework/YLErp.Core/DBModels/Consts/ConsReport.cs @@ -1,4 +1,10 @@ -using YLErp.Commons; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using YLErp.Commons; namespace YLErp.DBModels.Consts { @@ -98,6 +104,16 @@ namespace YLErp.DBModels.Consts /// [Description("收益互换交易确认书附件")] A1017, + /// + /// 场外期权-估值 + /// + [Description("场外期权-估值")] + A1018, + /// + /// 场外期权交易确认书附件 + /// + [Description("场外期权交易确认书附件")] + A1019, } /// /// 操作标识 @@ -131,20 +147,20 @@ namespace YLErp.DBModels.Consts [Flags] public enum SAC_ReportDataSourceEnum : byte { - /// - /// 系统数据 - /// - System = 1, + ///// + ///// 系统数据 + ///// + //System = 1, /// /// Excel模板 /// - Template = 1<<1, + Template = 1 << 1, - /// - /// 金仕达视图 - /// - KingstarView = 1<<2 + ///// + ///// 金仕达视图 + ///// + //KingstarView = 1 << 2 } /// @@ -255,6 +271,14 @@ namespace YLErp.DBModels.Consts {"SAC(2018年12月发布)","5" }, {"SAC信用保护合约专用版","6" }, {"其他","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" }, + {"4","4" }, + {"5","5" }, + {"6","6" }, + {"99","99" } }); } return _masterAgrmtVerMap; @@ -276,6 +300,8 @@ namespace YLErp.DBModels.Consts { {"甲方","0" }, {"乙方","1" }, + {"0","0" }, + {"1","1" } }); } return _fillPartyMap; @@ -296,6 +322,8 @@ namespace YLErp.DBModels.Consts { {"甲方","0" }, {"乙方","1" }, + {"0","0" }, + {"1","1" } }); } return _fillPartyMap; @@ -321,6 +349,10 @@ namespace YLErp.DBModels.Consts {"客户空头","1" }, {"多空组合","2" }, {"其他","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"99","99" } }); } return _swapTypeMap; @@ -342,6 +374,8 @@ namespace YLErp.DBModels.Consts { {"非专业","0" }, {"专业","1" }, + {"0","0" }, + {"1","1" } }); } return _proCounterpartyMap; @@ -411,6 +445,28 @@ namespace YLErp.DBModels.Consts {"政策性银行","19" }, {"外资银行","20" }, {"期货资产管理公司","21" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" }, + {"4","4" }, + {"5","5" }, + {"6","6" }, + {"7","7" }, + {"8","8" }, + {"9","9" }, + {"10","10" }, + {"11","11" }, + {"12","12" }, + {"13","13" }, + {"14","14" }, + {"15","15" }, + {"16","16" }, + {"17","17" }, + {"18","18" }, + {"19","19" }, + {"20","20" }, + {"21","21" } }); } return _counterpartyTypeMap; @@ -480,6 +536,28 @@ namespace YLErp.DBModels.Consts {"外资银行","20" }, {"期货资产管理公司","21" }, {"其他","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"4","4" }, + {"5","5" }, + {"6","6" }, + {"7","7" }, + {"8","8" }, + {"9","9" }, + {"10","10" }, + {"11","11" }, + {"12","12" }, + {"13","13" }, + {"14","14" }, + {"15","15" }, + {"16","16" }, + {"17","17" }, + {"18","18" }, + {"19","19" }, + {"20","20" }, + {"21","21" }, + {"99","99" } }); } return _nafmiiCounterpartyTypeMap; @@ -501,6 +579,8 @@ namespace YLErp.DBModels.Consts { {"产品管理人","1" }, {"自营","2" }, + {"1","1" }, + {"2","2" } }); } return _counterpartyIdentityMap; @@ -522,6 +602,8 @@ namespace YLErp.DBModels.Consts { {"首次","0" }, {"变更","1" }, + {"0","0" }, + {"1","1" } }); } return _reportTypeMap; @@ -545,6 +627,12 @@ namespace YLErp.DBModels.Consts {"首次","01" }, {"补充","02" }, {"变更","03" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"01","01" }, + {"02","02" }, + {"03","03" } }); } return _isdaReportTypeMap; @@ -566,6 +654,10 @@ namespace YLErp.DBModels.Consts { {"首次","01" }, {"变更","02" }, + {"1","01" }, + {"2","02" }, + {"01","01" }, + {"02","02" } }); } return _isdaReportTypeMap2; @@ -590,6 +682,10 @@ namespace YLErp.DBModels.Consts {"填报机构","01" }, {"对手方","02" }, {"交易对手方","02" }, + {"1","01" }, + {"2","02" }, + {"01","01" }, + {"02","02" } }); } return _optionTraderMap; @@ -612,27 +708,49 @@ namespace YLErp.DBModels.Consts {"看涨","0" }, {"看跌","1" }, {"双向","2" }, + {"0","0" }, + {"1","1" }, + {"2","2" } }); } return _optionDirectionMap; } } + private static ExpandoDictionary _multiOrderOptionTypeMap; + /// + /// 多标的期权类型 + /// Best of:0 + /// Worst of:1 + /// 其他类型:2 + /// + public static ExpandoDictionary MultiOrderOptionTypeMap + { + get + { + if (_multiOrderOptionTypeMap == null) + { + _multiOrderOptionTypeMap = new ExpandoDictionary(new Dictionary() { + { "Best of","0"}, + { "Worst of","1"}, + { "其他类型","2"}, + {"0","0" }, + {"1","1" }, + {"2","2" } + }); + } + return _multiOrderOptionTypeMap; + } + } + private static ExpandoDictionary _optionStructureTypeMap; /// /// 期权结构类型 - /// 香草:0 - /// 二元:1 - /// 价差:2 - /// 鲨鱼鳍:4 - /// 障碍:5 - /// 区间累计:6 - /// 自动看涨:7 - /// AutoCallable:7 - /// Auto Callable:7 - /// 自动看涨(AutoCallable):7 - /// 自动看涨(Auto Callable):7 - /// 自动看涨(AutoCallable):7 - /// 自动看涨(Auto Callable):7 + /// 香草及其组合:0 + /// 二元及其组合:1 + /// 障碍及其组合:2 + /// 自动赎回:3 + /// 区间累计:4 + /// 安全气囊:5 /// 其他:99 /// public static ExpandoDictionary OptionStructureTypeMap @@ -642,20 +760,20 @@ namespace YLErp.DBModels.Consts if (_optionStructureTypeMap == null) { _optionStructureTypeMap = new ExpandoDictionary(new Dictionary() { - {"香草","0" }, - {"二元","1" }, - {"价差","2" }, - {"鲨鱼鳍","4" }, - {"障碍","5" }, - {"区间累计","6" }, - {"自动看涨","7" }, - {"AutoCallable","7" }, - {"Auto Callable","7" }, - {"自动看涨(AutoCallable)","7" }, - {"自动看涨(Auto Callable)","7" }, - {"自动看涨(AutoCallable)","7" }, - {"自动看涨(Auto Callable)","7" }, + {"香草及其组合","0" }, + {"二元及其组合","1" }, + {"障碍及其组合","2" }, + {"自动赎回","3" }, + {"区间累计","4" }, + {"安全气囊","5" }, {"其他","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" }, + {"4","4" }, + {"5","5" }, + {"99","99" } }); } return _optionStructureTypeMap; @@ -688,6 +806,22 @@ namespace YLErp.DBModels.Consts {"单鲨","06" }, {"双鲨","07" }, {"其他","08" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"4","04" }, + {"5","05" }, + {"6","06" }, + {"7","07" }, + {"8","08" }, + {"01","01" }, + {"02","02" }, + {"03","03" }, + {"04","04" }, + {"05","05" }, + {"06","06" }, + {"07","07" }, + {"08","08" } }); } return _sacOptionStructureTypeMap; @@ -712,11 +846,37 @@ namespace YLErp.DBModels.Consts {"美式","1" }, {"百慕大","2" }, {"亚式","3" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" } }); } return _exerciseApproachMap; } } + + private static ExpandoDictionary _clearingAgencyMap_optionDisplay; + + public static ExpandoDictionary ClearingAgencyMap_OptionDisplay + { + get + { + if (_clearingAgencyMap_optionDisplay == null) + { + _clearingAgencyMap_optionDisplay = new ExpandoDictionary(new Dictionary() + { + //{"甲方","0" }, + {"乙方","1" }, + {"甲方","0" },//原本是甲方,为了方便交易员理解,创建交易时直观,改成交易员方 + //{"中金","1" },//原本是乙方,为了方便交易员理解,创建交易时直观,改成客户方 + {"报价系统","3" } + }); + } + return _clearingAgencyMap_optionDisplay; + } + } + private static ExpandoDictionary _clearingAgencyMap; /// /// 清算机构 @@ -737,10 +897,18 @@ namespace YLErp.DBModels.Consts { {"甲方","0" }, {"乙方","1" }, + {"交易员方","0" },//原本是甲方,为了方便交易员理解,创建交易时直观,改成交易员方 + {"客户方","1" },//原本是乙方,为了方便交易员理解,创建交易时直观,改成客户方 {"报价系统","3" }, {"中债登","4" }, {"上清所","5" }, {"其他","99" }, + {"1","1" }, + {"0","0" }, + {"3","3" }, + {"4","4" }, + {"5","5" }, + {"99","99" } }); } return _clearingAgencyMap; @@ -769,7 +937,7 @@ namespace YLErp.DBModels.Consts {"报价系统","3" }, {"中债登","4" }, {"上清所","5" }, - {"其他","99" } + {"其他","99" }, }); } return _clearingAgencyMapDisplay; @@ -777,7 +945,7 @@ namespace YLErp.DBModels.Consts } private static ExpandoDictionary _tradingPlaceMap; /// - /// 交易场所 + /// 交易场所(用于报送) ///柜台市场:0 ///报价系统:1 ///银行间市场:2 @@ -795,6 +963,10 @@ namespace YLErp.DBModels.Consts {"报价系统","1" }, {"银行间市场","2" }, {"其他交易场所","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"99","99" } }); } return _tradingPlaceMap; @@ -845,6 +1017,13 @@ namespace YLErp.DBModels.Consts {"报价系统","02" }, {"银行间市场","03" }, {"其他交易场所","99" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"01","01" }, + {"02","02" }, + {"03","03" }, + {"99","99" } }); } return _isdaTradingPlaceMap; @@ -864,6 +1043,7 @@ namespace YLErp.DBModels.Consts _businessModelTypeMap = new ExpandoDictionary(new Dictionary() { {"传统型期权","1" }, + {"1","1" } }); } return _businessModelTypeMap; @@ -895,6 +1075,13 @@ namespace YLErp.DBModels.Consts {"汇率","4" }, {"混合类","5" }, {"其他","99" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" }, + {"4","4" }, + {"5","5" }, + {"99","99" } }); } return _undrlygAssetTypeMap; @@ -925,43 +1112,22 @@ namespace YLErp.DBModels.Consts {"信用类","04" }, {"汇率","05" }, {"其他","99" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"4","04" }, + {"5","05" }, + {"01","01" }, + {"02","02" }, + {"03","03" }, + {"04","04" }, + {"05","05" }, + {"99","99" } }); } return _sacUndrlygAssetTypeMap; } } - - private static ExpandoDictionary _isdaUndrlygAssetDtldTypeMap; - /// - /// ISDA标的类型 - /// 权益类(境内):01 - /// 权益类(境外):02 - /// 大宗商品:03 - /// 利率:04 - /// 信用类:05 - /// 汇率:06 - /// 其他:99 - /// - public static ExpandoDictionary ISDAUndrlygAssetDtldTypeMap - { - get - { - if (_isdaUndrlygAssetDtldTypeMap == null) - { - _isdaUndrlygAssetDtldTypeMap = new ExpandoDictionary(new Dictionary() - { - {"权益类(境内)","01"}, - {"权益类(境外)","02"}, - {"大宗商品","03"}, - {"利率","04"}, - {"信用类","05"}, - {"汇率","06"}, - {"其他","99"}, - }); - } - return _isdaUndrlygAssetDtldTypeMap; - } - } private static ExpandoDictionary _nafmiiUndrlygAssetDtldTypeMap; /// /// NAFMII标的类型 @@ -986,6 +1152,18 @@ namespace YLErp.DBModels.Consts {"黄金期货","04"}, {"利率类","05"}, {"其他","06"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"} }); } return _nafmiiUndrlygAssetDtldTypeMap; @@ -1009,6 +1187,8 @@ namespace YLErp.DBModels.Consts {"单一标的","0" }, {"组合标的","1" }, {"多标的","1" }, + {"0","0" }, + {"1","1" } }); } return _undrlygAssetNoMap; @@ -1021,6 +1201,7 @@ namespace YLErp.DBModels.Consts ///无履约担保:0 ///部分担保:1 ///全额担保:2 + ///双方不涉及履约担保:3 /// public static ExpandoDictionary PerformanceGuaranteeMap { @@ -1034,14 +1215,17 @@ namespace YLErp.DBModels.Consts {"无履约担保","0" }, {"部分担保","1" }, {"全额担保","2" }, + {"双方不涉及履约担保","3" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" }, }); } return _performanceGuaranteeTypeMap; } } - private static ExpandoDictionary _performanceCollProviderMap; private static ExpandoDictionary _performanceGuaranteeMapDisplay; - /// /// 履约担保类型(用于页面展示) ///否:0 @@ -1058,7 +1242,6 @@ namespace YLErp.DBModels.Consts { _performanceGuaranteeMapDisplay = new ExpandoDictionary(new Dictionary() { - {"无","" }, {"无履约担保","0" }, {"部分担保","1" }, {"全额担保","2" }, @@ -1067,6 +1250,7 @@ namespace YLErp.DBModels.Consts return _performanceGuaranteeMapDisplay; } } + private static ExpandoDictionary _performanceCollProviderMap; /// /// 履约担保品提供方 ///甲方:0 @@ -1088,13 +1272,16 @@ namespace YLErp.DBModels.Consts {"第三方","2" }, {"第三方(需在履约担保备注中说明第三方相关情况)","2" }, {"交易双方","3" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" } }); } return _performanceCollProviderMap; } } private static ExpandoDictionary _performanceCollProviderMapDisplay; - /// /// 履约担保品提供方(用于页面展示) ///甲方:0 @@ -1120,7 +1307,6 @@ namespace YLErp.DBModels.Consts return _performanceCollProviderMapDisplay; } } - private static ExpandoDictionary _boolMap; /// /// Bool @@ -1137,11 +1323,14 @@ namespace YLErp.DBModels.Consts { {"是","true" }, {"否","false" }, + {"true","true" }, + {"false","false" } }); } return _boolMap; } } + private static ExpandoDictionary _boolMapDisplay; /// /// Bool (用于页面展示) @@ -1179,6 +1368,10 @@ namespace YLErp.DBModels.Consts { {"是","01" }, {"否","02" }, + {"1","01" }, + {"2","02" }, + {"01","01" }, + {"02","02" } }); } return _boolNumberMap; @@ -1245,6 +1438,28 @@ namespace YLErp.DBModels.Consts {"银行间回购定盘(Fixing Repo Rate)","19"}, {"其他利率","20"}, {"其他标的","99"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"}, + {"7","7"}, + {"8","8"}, + {"9","9"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"19","19"}, + {"20","20"}, + {"99","99"} }); } return _undrlygAssetDtldTypeMap; @@ -1304,6 +1519,26 @@ namespace YLErp.DBModels.Consts {"汇率","17"}, {"利率","18"}, {"其他标的","99"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"}, + {"7","7"}, + {"8","8"}, + {"9","9"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"99","99"} }); } return _swapUndrlygAssetDtldTypeMap; @@ -1366,6 +1601,37 @@ namespace YLErp.DBModels.Consts {"银行间回购定盘(FixingRepoRate)","20"}, {"其他利率","21"}, {"其他标的","99"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"9","09"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"09","09"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"19","19"}, + {"20","20"}, + {"21","21"}, + {"99","99"} }); } return _sacUndrlygAssetDtldTypeMap; @@ -1402,25 +1668,34 @@ namespace YLErp.DBModels.Consts { _swapSACUndrlygAssetDtldTypeMap = new ExpandoDictionary(new Dictionary() { - {"股票","01"}, - {"股指","02"}, - {"新三板挂牌股票","03"}, - {"香港股票","04"}, - {"香港股指","05"}, - {"基金及基金专户","06"}, - {"债券","07"}, - {"黄金期货","08"}, - {"国债期货","09"}, - {"股指期货","10"}, - {"其他期货","11"}, - {"黄金现货","12"}, - {"其他现货","13"}, - {"境外期货","14"}, - {"境外现货","15"}, - {"境外股票","16"}, - {"境外股指","17"}, - {"汇率","18"}, - {"其他标的","99"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"9","09"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"09","09"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"99","99"}, }); } return _swapSACUndrlygAssetDtldTypeMap; @@ -1459,6 +1734,19 @@ namespace YLErp.DBModels.Consts {"香港股指","06"}, {"其他","99"}, {"其他标的","99"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"99","99"} }); } return _hedgeSACUndrlygAssetDtldTypeMap; @@ -1501,6 +1789,27 @@ namespace YLErp.DBModels.Consts {"境外交易所","11"}, {"其他","99"}, {"其他(注明具体场所)","99"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"9","09"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"09","09"}, + {"10","10"}, + {"11","11"}, + {"99","99"} }); } return _undrlygAssetTradgPlcMap; @@ -1537,6 +1846,23 @@ namespace YLErp.DBModels.Consts {"外汇交易中心","08"}, {"其他","99"}, {"其他(注明具体场所)","99"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"99","99"} }); } return _hedgeUndrlygAssetTradgPlcMap; @@ -1574,11 +1900,18 @@ namespace YLErp.DBModels.Consts {"其他(须在履约担保备注栏进行说明)","99" }, {"其他(需在履约担保备注栏进行说明)","99" }, {"其他(须在履约担保备注栏进行说明)","99" }, + {"0","0"}, + {"1","1"}, + {"2","2" }, + {"3","3" }, + {"99","99" } }); } return _performanceCollTypeMap; } } + + private static ExpandoDictionary _performanceCollTypeMapDisplay; /// /// 履约担保品类型(用于页面展示) ///现金:0 @@ -1605,7 +1938,6 @@ namespace YLErp.DBModels.Consts return _performanceCollTypeMapDisplay; } } - private static ExpandoDictionary _performanceCollTypeMapDisplay; private static ExpandoDictionary _performanceCollRangeMap; /// @@ -1627,11 +1959,16 @@ namespace YLErp.DBModels.Consts {"本笔交易对应主协议框架下的所有交易(在附件中上传履约担保协议)","1"}, {"其他情况下多笔交易","2"}, {"其他情况下多笔交易(在附件中上传履约担保协议)","2"}, + {"0","0"}, + {"1","1"}, + {"2","2"} }); } return _performanceCollRangeMap; } } + + private static ExpandoDictionary _performanceCollRangeMapDisplay; /// /// 担保品担保范围(用于页面展示) ///仅本笔交易:0 @@ -1654,7 +1991,6 @@ namespace YLErp.DBModels.Consts return _performanceCollRangeMapDisplay; } } - private static ExpandoDictionary _performanceCollRangeMapDisplay; private static ExpandoDictionary _paymentMethodMap; /// @@ -1686,6 +2022,11 @@ namespace YLErp.DBModels.Consts {"固定利率","3"}, {"固定利率收益","3"}, {"权益收益多空组合","4"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"} }); } return _paymentMethodMap; @@ -1709,6 +2050,9 @@ namespace YLErp.DBModels.Consts {"期初支付","0"}, {"期末支付","1"}, {"期间多次支付","2"}, + {"0","0"}, + {"1","1"}, + {"2","2"} }); } return _paymentFreqMap; @@ -1730,6 +2074,8 @@ namespace YLErp.DBModels.Consts { {"单一标的","0"}, {"多标的","1"}, + {"0","0"}, + {"1","1"} }); } return _ptyBUndrlygAssetNoMap; @@ -1755,6 +2101,10 @@ namespace YLErp.DBModels.Consts {"开空仓","1" }, {"平多仓","2" }, {"平空仓","3" }, + {"0","0" }, + {"1","1" }, + {"2","2" }, + {"3","3" } }); } return _undrlygAssetPositionMap; @@ -1790,6 +2140,15 @@ namespace YLErp.DBModels.Consts {"Libor1M","6"}, {"Hibor1M","7"}, {"其他","99"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"}, + {"7","7"}, + {"99","99"} }); } return _refRateTypeMap; @@ -1797,11 +2156,13 @@ namespace YLErp.DBModels.Consts } private static ExpandoDictionary _operationTypeMap; /// - /// 参考利率类型 + /// 存续期操作类型 /// 展期:01 /// 终止:02 /// 违约终止:03 /// 调仓:04 + /// 敲入:05 + /// 敲出:06 /// public static ExpandoDictionary OperationTypeMap { @@ -1815,11 +2176,58 @@ namespace YLErp.DBModels.Consts {"终止","02"}, {"违约终止","03"}, {"调仓","04"}, + {"敲入","05"}, + {"敲出","06"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"} }); } return _operationTypeMap; } } + private static ExpandoDictionary _swapOperationTypeMap; + /// + /// 互换存续期操作类型 + /// 展期:1 + /// 终止:2 + /// 违约终止:3 + /// 调仓:4 + /// + public static ExpandoDictionary SwapOperationTypeMap + { + get + { + if (_swapOperationTypeMap == null) + { + _swapOperationTypeMap = new ExpandoDictionary(new Dictionary() + { + {"展期","1"}, + {"终止","2"}, + {"违约终止","3"}, + {"调仓","4"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"01","1"}, + {"02","2"}, + {"03","3"}, + {"04","4"}, + }); + } + return _swapOperationTypeMap; + } + } private static ExpandoDictionary _businessTypeMap; /// /// 业务类型 @@ -1850,6 +2258,18 @@ namespace YLErp.DBModels.Consts {"收益互换(客户空头)","12"}, {"多空组合收益互换","13"}, {"其他收益互换","14"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"} }); } return _businessTypeMap; @@ -1875,6 +2295,14 @@ namespace YLErp.DBModels.Consts {"互换看跌","02" }, {"利率上限","03" }, {"利率下限","04" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"4","04" }, + {"01","01" }, + {"02","02" }, + {"03","03" }, + {"04","04" } }); } return _nafmiiOptionDirectionMap; @@ -1902,6 +2330,16 @@ namespace YLErp.DBModels.Consts {"lpr1y_irs","03" }, {"lpr5y_irs","04" }, {"其他","05" }, + {"1","01" }, + {"2","02" }, + {"3","03" }, + {"4","04" }, + {"5","05" }, + {"01","01" }, + {"02","02" }, + {"03","03" }, + {"04","04" }, + {"05","05" } }); } return _nafmiiInvestmentNameMap; @@ -1923,6 +2361,10 @@ namespace YLErp.DBModels.Consts { {"实物交割","01" }, {"现金交割","02" }, + {"1","01" }, + {"2","02" }, + {"01","01" }, + {"02","02" } }); } return _nafmiiDeliveryTypeMap; @@ -1944,6 +2386,10 @@ namespace YLErp.DBModels.Consts { {"本月新增业务","01"}, {"截至上月底尚未完全终止业务","02"}, + {"1","01"}, + {"2","02"}, + {"01","01"}, + {"02","02"} }); } return _dataTypeForBusinessMap; @@ -2040,6 +2486,55 @@ namespace YLErp.DBModels.Consts {"期权","36"}, {"其他衍生品","37"}, {"其他标的","99"}, + {"0","00"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"9","09"}, + {"00","00"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"09","09"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"19","19"}, + {"20","20"}, + {"21","21"}, + {"22","22"}, + {"23","23"}, + {"24","24"}, + {"25","25"}, + {"26","26"}, + {"27","27"}, + {"28","28"}, + {"29","29"}, + {"30","30"}, + {"31","31"}, + {"32","32"}, + {"33","33"}, + {"34","34"}, + {"35","35"}, + {"36","36"}, + {"37","37"}, + {"99","99"} }); } return _investmentTargetTypeMap; @@ -2135,10 +2630,505 @@ namespace YLErp.DBModels.Consts {"期权","36"}, {"其他衍生品","37"}, {"其他标的","99"}, + {"0","00"}, + {"1","01"}, + {"2","02"}, + {"3","03"}, + {"4","04"}, + {"5","05"}, + {"6","06"}, + {"7","07"}, + {"8","08"}, + {"9","09"}, + {"00","00"}, + {"01","01"}, + {"02","02"}, + {"03","03"}, + {"04","04"}, + {"05","05"}, + {"06","06"}, + {"07","07"}, + {"08","08"}, + {"09","09"}, + {"10","10"}, + {"11","11"}, + {"12","12"}, + {"13","13"}, + {"14","14"}, + {"15","15"}, + {"16","16"}, + {"17","17"}, + {"18","18"}, + {"19","19"}, + {"20","20"}, + {"21","21"}, + {"22","22"}, + {"23","23"}, + {"24","24"}, + {"25","25"}, + {"26","26"}, + {"27","27"}, + {"28","28"}, + {"29","29"}, + {"30","30"}, + {"31","31"}, + {"32","32"}, + {"33","33"}, + {"34","34"}, + {"35","35"}, + {"36","36"}, + {"37","37"}, + {"99","99"} }); } return _hedgeUnderlyingTypeMap; } } + + private static ExpandoDictionary _vanillaOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///香草:0 + ///跨式:1 + ///宽跨式:2 + ///参与式看涨:3 + ///两段参与式看涨:4 + ///价差:5 + ///区间保护看涨:6 + ///有限区间保护看涨:7 + ///区间保护看涨价差:8 + ///有限区间保护看涨价差:9 + ///鹰式:10 + ///蝶式:11 + ///其他香草及其组合:12 + /// + public static ExpandoDictionary VanillaOptionStructureSubclassMap + { + get + { + if (_vanillaOptionStructureSubclassMap == null) + { + _vanillaOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"香草","0"}, + {"跨式","1"}, + {"宽跨式","2"}, + {"参与式看涨","3"}, + {"两段参与式看涨","4"}, + {"价差","5"}, + {"区间保护看涨","6"}, + {"有限区间保护看涨","7"}, + {"区间保护看涨价差","8"}, + {"有限区间保护看涨价差","9"}, + {"鹰式","10"}, + {"蝶式","11"}, + {"其他香草及其组合","12"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"}, + {"7","7"}, + {"8","8"}, + {"9","9"}, + {"10","10"}, + {"11","11"}, + {"12","12"} + }); + } + return _vanillaOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _digitalOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///欧式二元:0 + ///美式二元触碰:1 + ///美式二元不触碰:2 + ///美式双触碰:3 + ///美式双不触碰:4 + ///二元凹式:5 + ///二元凸式:6 + ///三层阶梯:7 + ///四层阶梯:8 + ///四层阶梯/:8 + ///其他二元及其组合:9 + /// + public static ExpandoDictionary DigitalOptionStructureSubclassMap + { + get + { + if (_digitalOptionStructureSubclassMap == null) + { + _digitalOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"欧式二元","0"}, + {"美式二元触碰","1"}, + {"美式二元不触碰","2"}, + {"美式双触碰","3"}, + {"美式双不触碰","4"}, + {"二元凹式","5"}, + {"二元凸式","6"}, + {"三层阶梯","7"}, + {"四层阶梯","8"}, + {"四层阶梯/","8"}, + {"其他二元及其组合","9"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"}, + {"7","7"}, + {"8","8"}, + {"9","9"} + }); + } + return _digitalOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _barrierOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///敲入障碍类:0 + ///单向鲨鱼鳍:1 + ///双向鲨鱼鳍:2 + ///其他障碍及其组合:3 + /// + public static ExpandoDictionary BarrierOptionStructureSubclassMap + { + get + { + if (_barrierOptionStructureSubclassMap == null) + { + _barrierOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"敲入障碍类","0"}, + {"单向鲨鱼鳍","1"}, + {"双向鲨鱼鳍","2"}, + {"其他障碍及其组合","3"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"} + }); + } + return _barrierOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _barrierObservationTypeMap; + /// + /// 期权结构小类 + ///到期观察:0 + ///每日观察:1 + ///离散观察:2 + /// + public static ExpandoDictionary BarrierObservationTypeMap + { + get + { + if (_barrierObservationTypeMap == null) + { + _barrierObservationTypeMap = new ExpandoDictionary(new Dictionary() + { + {"到期观察","0"}, + {"每日观察","1"}, + {"离散观察","2"}, + {"0","0"}, + {"1","1"}, + {"2","2"} + }); + } + return _barrierObservationTypeMap; + } + } + + private static ExpandoDictionary _autoCallableOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///保本雪球(二元):0 + ///保本雪球(三元):1 + ///非保本普通型雪球:2 + ///非保本要素(敲入、敲出、收益率)可变型雪球:3 + ///非保本普通型凤凰:4 + ///非保本要素(敲入、敲出、收益率) 可变型凤凰:5 + ///其他自动赎回:6 + /// + public static ExpandoDictionary AutoCallableOptionStructureSubclassMap + { + get + { + if (_autoCallableOptionStructureSubclassMap == null) + { + _autoCallableOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"保本雪球(二元)","0"}, + {"保本雪球(二元)","0"}, + {"保本雪球(三元)","1"}, + {"保本雪球(三元)","1"}, + {"非保本普通型雪球","2"}, + {"非保本要素(敲入、敲出、收益率)可变型雪球","3"}, + {"非保本要素(敲入、敲出、收益率)可变型雪球","3"}, + {"非保本要素(敲入\\敲出\\收益率)可变型雪球","3"}, + {"非保本要素(敲入\\敲出\\收益率)可变型雪球","3"}, + {"非保本普通型凤凰","4"}, + {"非保本要素(敲入、敲出、收益率)可变型凤凰","5"}, + {"非保本要素(敲入、敲出、收益率)可变型凤凰","5"}, + {"非保本要素(敲入\\敲出\\收益率)可变型凤凰","5"}, + {"非保本要素(敲入\\敲出\\收益率)可变型凤凰","5"}, + {"其他自动赎回","6"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"}, + {"6","6"} + }); + } + return _autoCallableOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherDiscountedWarehouseTypeMap; + /// + /// 是否为折价建仓型 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherDiscountedWarehouseTypeMap + { + get + { + if (_autoCallableWhetherDiscountedWarehouseTypeMap == null) + { + _autoCallableWhetherDiscountedWarehouseTypeMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherDiscountedWarehouseTypeMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherRevenueEnhancedTypeMap; + /// + /// 是否为收益增强型 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherRevenueEnhancedTypeMap + { + get + { + if (_autoCallableWhetherRevenueEnhancedTypeMap == null) + { + _autoCallableWhetherRevenueEnhancedTypeMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherRevenueEnhancedTypeMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherKnockInPriceCoefficientIsVariableMap; + /// + /// 敲入价格系数是否可变 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherKnockInPriceCoefficientIsVariableMap + { + get + { + if (_autoCallableWhetherKnockInPriceCoefficientIsVariableMap == null) + { + _autoCallableWhetherKnockInPriceCoefficientIsVariableMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherKnockInPriceCoefficientIsVariableMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherKnockOutPriceCoefficientIsVariableMap; + /// + /// 敲出价格系数是否可变 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherKnockOutPriceCoefficientIsVariableMap + { + get + { + if (_autoCallableWhetherKnockOutPriceCoefficientIsVariableMap == null) + { + _autoCallableWhetherKnockOutPriceCoefficientIsVariableMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherKnockOutPriceCoefficientIsVariableMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherKnockOutYieldIsVariableMap; + /// + /// 敲出收益率是否可变 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherKnockOutYieldIsVariableMap + { + get + { + if (_autoCallableWhetherKnockOutYieldIsVariableMap == null) + { + _autoCallableWhetherKnockOutYieldIsVariableMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherKnockOutYieldIsVariableMap; + } + } + + private static ExpandoDictionary _autoCallableWhetherDividendYieldIsVariableMap; + /// + /// 敲出收益率是否可变 + ///是:0 + ///否:1 + /// + public static ExpandoDictionary AutoCallableWhetherDividendYieldIsVariableMap + { + get + { + if (_autoCallableWhetherDividendYieldIsVariableMap == null) + { + _autoCallableWhetherDividendYieldIsVariableMap = new ExpandoDictionary(new Dictionary() + { + {"是","0"}, + {"否","1"}, + {"0","0"}, + {"1","1"} + }); + } + return _autoCallableWhetherDividendYieldIsVariableMap; + } + } + + private static ExpandoDictionary _rangeAccrualOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///区间累计:0 + ///双层区间累计:1 + ///其他区间累计:2 + /// + public static ExpandoDictionary RangeAccrualOptionStructureSubclassMap + { + get + { + if (_rangeAccrualOptionStructureSubclassMap == null) + { + _rangeAccrualOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"区间累计","0"}, + {"双层区间累计","1"}, + {"其他区间累计","2"}, + {"0","0"}, + {"1","1"}, + {"2","2"} + }); + } + return _rangeAccrualOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _airbagOptionStructureSubclassMap; + /// + /// 期权结构小类 + ///安全气囊看涨:0 + ///安全气囊看涨价差:1 + ///安全气囊看涨保护:2 + ///安全气囊看涨价差保护:3 + ///上段封顶安全气囊:4 + ///上端封顶安全气囊:4 + ///其他气囊结构:5 + /// + public static ExpandoDictionary AirbagOptionStructureSubclassMap + { + get + { + if (_airbagOptionStructureSubclassMap == null) + { + _airbagOptionStructureSubclassMap = new ExpandoDictionary(new Dictionary() + { + {"安全气囊看涨","0"}, + {"安全气囊看涨价差","1"}, + {"安全气囊看涨保护","2"}, + {"安全气囊看涨价差保护","3"}, + {"上段封顶安全气囊","4"}, + {"上端封顶安全气囊","4"}, + {"其他气囊结构","5"}, + {"0","0"}, + {"1","1"}, + {"2","2"}, + {"3","3"}, + {"4","4"}, + {"5","5"} + }); + } + return _airbagOptionStructureSubclassMap; + } + } + + private static ExpandoDictionary _barrierEventStatusMap; + /// + /// 期权结构小类 + ///已敲入:01 + ///已敲出:02 + /// + public static ExpandoDictionary BarrierEventStatusMap + { + get + { + if (_barrierEventStatusMap == null) + { + _barrierEventStatusMap = new ExpandoDictionary(new Dictionary() + { + {"已敲入","01"}, + {"已敲出","02"}, + {"1","01"}, + {"2","02"}, + {"01","01"}, + {"02","02"} + }); + } + return _barrierEventStatusMap; + } + } } } diff --git a/Framework/YLErp.Core/DBModels/Enums/SuperviseReportTypeEnum.cs b/Framework/YLErp.Core/DBModels/Enums/SuperviseReportTypeEnum.cs index 8689596d..df8d9e83 100644 --- a/Framework/YLErp.Core/DBModels/Enums/SuperviseReportTypeEnum.cs +++ b/Framework/YLErp.Core/DBModels/Enums/SuperviseReportTypeEnum.cs @@ -95,5 +95,15 @@ /// [Description("互换交易确认书附件")] SAC_ConfirmationAtt = 17, + /// + /// 场外期权估值 + /// + [Description("场外期权估值")] + SAC_ValuationInformation = 18, + /// + /// 场外期权交易确认书附件 + /// + [Description("场外期权交易确认书附件")] + SAC_OptionConfirmationAtt = 19, } } diff --git a/YLErpDAL/Modules/AppModule/AppUpgrader.cs b/YLErpDAL/Modules/AppModule/AppUpgrader.cs index f9488b0b..4617f13f 100644 --- a/YLErpDAL/Modules/AppModule/AppUpgrader.cs +++ b/YLErpDAL/Modules/AppModule/AppUpgrader.cs @@ -210,7 +210,7 @@ namespace YLErp.Modules.AppModule configService.AddDataIfNotExists("ProjectConfig", "SAC_FDEPOutboxPath", data?.PValue ?? "", "string", "FDEP发件箱目录,支持本地目录,内网共享目录和Ftp目录,共享路径例:\\\\192.168.1.200\\share-test\\ ;Ftp目录应填不包含根目录的相对目录例\\share-test\\ 注意:共享路径和ftp模式下,不要忘记最后的\\"); data = configService.RemoveData("ProjectConfig", "SACReportDataSource"); - configService.AddDataIfNotExists("ProjectConfig", "SAC_ReportDataSource", data?.PValue ?? "3", "int", "证券业报送数据源;1=Db;2=Excel模板;3=Db+Excel模板(该方式中涉及百分比汇总计算时仍使用模板中数据)"); + configService.AddDataIfNotExists("ProjectConfig", "SAC_ReportDataSource", data?.PValue ?? "3", "int", "证券业报送数据源;2=Excel模板;"); configService.AddDataIfNotExists("ProjectConfig", "SAC_FtpUsePassive", data?.PValue ?? "false", "bool", "FDEP收发目录如果采用Ftp时,这里要选择是否为被动模式,不确定就选false"); diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/BaseCheckHelper.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/BaseCheckHelper.cs index 6e6a5a8b..29eabe0e 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/BaseCheckHelper.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/BaseCheckHelper.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Reflection; namespace YLErp.Modules.SuperviseReportModule.SAC.Common @@ -56,11 +56,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - bool state = false; - string text = (value?.ToString()) ?? ""; + var state = false; + var text = (value?.ToString()) ?? ""; if (text.Length == 0) { - state = (!Required || IgnoreNullOrEmpty); + state = !Required || IgnoreNullOrEmpty; } else { @@ -258,7 +258,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - bool match = false; + var match = false; if (Multiple) { var split = EndsWithString.Split(SplitStr.ToCharArray()); @@ -316,13 +316,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - bool result = true; + var result = true; try { - result = DateTime.TryParseExact((value ?? ""), FormatString, CultureInfo.CurrentCulture, DateTimeStyles.None, out _); + result = DateTime.TryParseExact(value ?? "", FormatString, CultureInfo.CurrentCulture, DateTimeStyles.None, out _); if (!result) { - result = DateTime.TryParse(value ?? "", out DateTime temp); + result = DateTime.TryParse(value ?? "", out var temp); if (result) { UseChangeValue = true; @@ -410,7 +410,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common minValue = MinValue_Number; maxValue = MaxValue_Number; } - List msgArr = new List(); + var msgArr = new List(); if (!double.IsNaN(minValue)) { msgArr.Add(">={MinValue}"); @@ -439,7 +439,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common int beforePointMaxLength, afterPointMaxLength; double maxValue, minValue; - isPercent = value.EndsWith("%"); + isPercent = isPercent = value != null && value.EndsWith("%"); if (isPercent) { value = value.Remove(value.Length - 1); @@ -455,11 +455,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common maxValue = MaxValue_Number; minValue = MinValue_Number; } - if (!double.TryParse(value, out double temp)) + if (!double.TryParse(value, out var temp)) { return false; } - string[] part = (value ?? "").Split('.'); + var part = (value ?? "").Split('.'); if (part.Length > 2) { return false; @@ -468,6 +468,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { return false; } + if (!double.IsNaN(maxValue) && temp > maxValue) + { + return false; + } + if (!double.IsNaN(minValue) && temp < minValue) + { + return false; + } if (part.Length > 1 && part[1].Length > afterPointMaxLength) { UseChangeValue = true; @@ -476,14 +484,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common ChangedValue = temp.ToString(sufix) + (isPercent ? "%" : ""); return true; } - if (!double.IsNaN(maxValue) && temp > maxValue) - { - return false; - } - if (!double.IsNaN(minValue) && temp < minValue) - { - return false; - } return true; } @@ -492,7 +492,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common int beforePointMaxLength, afterPointMaxLength; double maxValue, minValue; - isPercent = isPercent = value != null && value.EndsWith("%"); + isPercent = isPercent = value != null && value.EndsWith("%"); if (isPercent) { value = value.Remove(value.Length - 2); @@ -512,8 +512,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common .Replace("{fieldValue}", value) .Replace("{BeforePointMaxLength}", beforePointMaxLength.ToString()) .Replace("{AfterPointMaxLength}", afterPointMaxLength.ToString()) - .Replace("{MinValue}", maxValue.ToString()) - .Replace("{MaxValue}", minValue.ToString()); + .Replace("{MinValue}", minValue.ToString()) + .Replace("{MaxValue}", maxValue.ToString()); } } @@ -554,7 +554,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { //_errMsg = "{fieldName}={fieldValue}不合法,值应为数字,且最大保留位数为[{BeforePointMaxLength},{AfterPointMaxLength}]"; _errMsg = "值应为数字,且最大保留位数为[{BeforePointMaxLength},{AfterPointMaxLength}]"; - List msgArr = new List(); + var msgArr = new List(); if (!double.IsNaN(MinValue)) { msgArr.Add(">={MinValue}"); @@ -578,11 +578,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - if (!double.TryParse(value, out double temp)) + if (!double.TryParse(value, out var temp)) { return false; } - string[] part = (value ?? "").Split('.'); + var part = (value ?? "").Split('.'); if (part.Length > 2) { return false; @@ -591,23 +591,24 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { return false; } + var state = true; if (part.Length == 1 || (part.Length > 1 && part[1].Length != AfterPointMaxLength)) { UseChangeValue = true; - string sufix = "0.".PadRight(AfterPointMaxLength + 2, '0'); + var sufix = "0.".PadRight(AfterPointMaxLength + 2, '0'); UseChangeValue = true; ChangedValue = temp.ToString(sufix); - return true; + state = true; } if (!double.IsNaN(MinValue) && temp < MinValue) { - return false; + state = false; } if (!double.IsNaN(MaxValue) && temp > MaxValue) { - return false; + state = false; } - return true; + return state; } protected override string GenerateErrMsg(string value) @@ -659,7 +660,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { //_errMsg = "{fieldName}={fieldValue}不合法,值应为数字,且保留位数必须为[{BeforePointMaxLength},{AfterPointLength}]"; _errMsg = "值应为数字,且保留位数必须为[{BeforePointMaxLength},{AfterPointLength}]"; - List msgArr = new List(); + var msgArr = new List(); if (!double.IsNaN(MinValue)) { msgArr.Add(">={MinValue}"); @@ -683,7 +684,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - if (!double.TryParse(value, out double temp)) + if (!double.TryParse(value, out var temp)) { return false; } @@ -695,14 +696,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { return false; } - string[] part = (value ?? "").Split('.'); + var part = (value ?? "").Split('.'); if (part[0].Length > BeforePointMaxLength) { return false; } if (part.Length == 1 || (part.Length > 1 && part[1].Length != AfterPointLength)) { - string sufix = "0.".PadRight(AfterPointLength + 2, '0'); + var sufix = "0.".PadRight(AfterPointLength + 2, '0'); UseChangeValue = true; ChangedValue = temp.ToString(sufix); return true; @@ -728,8 +729,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { public override bool Execute(object value) { - bool state = false; - IEnumerable objs = value as IEnumerable; + var state = false; + var objs = value as IEnumerable; //if (objs != null) //{ state = Execute(objs); @@ -869,7 +870,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - return Map.Contains((value ?? "")); + return Map.Contains(value ?? ""); } protected override string GenerateErrMsg(string value) @@ -912,7 +913,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common protected override bool Execute(string value) { - int length = value.Length; + var length = value.Length; return Map.Contains(length); } @@ -974,7 +975,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - return (value?.ToString() == ConditionValue); + return value?.ToString() == ConditionValue; } } /// @@ -989,7 +990,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - return (value?.ToString() != ConditionValue); + return value?.ToString() != ConditionValue; } } @@ -1012,7 +1013,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - if (double.TryParse((value ?? "").ToString(), out double temp)) + if (double.TryParse((value ?? "").ToString(), out var temp)) { return temp >= MinValue && temp <= MaxValue; } @@ -1038,7 +1039,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - if (int.TryParse((value ?? "").ToString(), out int temp)) + if (double.TryParse((value ?? "").ToString(), out double temp)) { return temp < MinValue || temp > MaxValue; } @@ -1055,7 +1056,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - return ConditionMap.Contains((value?.ToString() ?? "")); + return ConditionMap.Contains(value?.ToString() ?? ""); } } @@ -1068,7 +1069,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common public override bool Execute(object value) { - return !ConditionMap.Contains((value?.ToString() ?? "")); + return !ConditionMap.Contains(value?.ToString() ?? ""); } } @@ -1078,14 +1079,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common /// 检查帮助类 /// /// - public class CheckHelper + public class CheckHelper where T:notnull { - private PropertyInfo[] _properties = null; + private readonly PropertyInfo[]? _properties = null; /// /// 属性缓存 /// 应通过方法访问 /// - private Dictionary> _propertyInfoDict = null; + private Dictionary>? _propertyInfoDict = null; /// /// 检查不通过时回调的委托 /// @@ -1101,10 +1102,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common private Dictionary getPropertyInfos(T obj) { - if (_propertyInfoDict == null) - { - _propertyInfoDict = new Dictionary>(); - } + _propertyInfoDict ??= new Dictionary>(); if (!_propertyInfoDict.ContainsKey(obj)) { _propertyInfoDict[obj] = _properties.ToDictionary(K => K.Name, V => V.GetValue(obj)); @@ -1114,7 +1112,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common private bool checkCondition(List conditionAttributes, Dictionary dict) { - bool state = true; + var state = true; foreach (var item in conditionAttributes) { if (!dict.ContainsKey(item.ConditionName)) @@ -1132,14 +1130,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common private bool checkCondition(PropertyInfo pInfo, T obj, Func callback) { - bool state = true; - IEnumerable conditionAttrs = pInfo.GetCustomAttributes(typeof(BaseCheckConditionAttribute), true).Cast(); + var state = true; + var conditionAttrs = pInfo.GetCustomAttributes(typeof(BaseCheckConditionAttribute), true).Cast(); var conditGroup = conditionAttrs.GroupBy(O => O.CheckHandleNameArr == null ? "" : string.Join(",", O.CheckHandleNameArr)).ToDictionary(K => K.Key, V => V.ToList()); if (conditGroup.Count > 0) { foreach (var condit in conditGroup) { - Dictionary dict = getPropertyInfos(obj); + var dict = getPropertyInfos(obj); state = checkCondition(condit.Value, dict); if (state) { @@ -1161,7 +1159,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common private bool checkValue(string checkName, BaseCheckAttribute[] checkAttributes, PropertyInfo pInfo, T obj, out string errMsg) { errMsg = ""; - bool state = true; + var state = true; var attrs = checkAttributes.Where(O => (O.CheckHandleName ?? "") == checkName); foreach (var item in attrs) { @@ -1187,23 +1185,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common /// public bool ExecuteCheck(T obj, CheckErrorCallback callback) { - bool checkState = false; - string errMsg; + var checkState = false; if (obj == null) { return checkState; } foreach (var p in _properties) { - BaseCheckAttribute[] attr = p.GetCustomAttributes(typeof(BaseCheckAttribute), true).Cast().ToArray(); + var attr = p.GetCustomAttributes(typeof(BaseCheckAttribute), true).Cast().ToArray(); if (attr.Length == 0) { continue; } checkCondition(p, obj, (checkNames) => { - bool status = true; + var status = true; foreach (var item in checkNames) { - if (!checkValue((item ?? ""), attr, p, obj, out errMsg)) + if (!checkValue(item ?? "", attr, p, obj, out var errMsg)) { callback(p.Name, p.GetValue(obj), errMsg); status = false; diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/ReportInfoHelper.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/ReportInfoHelper.cs new file mode 100644 index 00000000..1f27fee7 --- /dev/null +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/ReportInfoHelper.cs @@ -0,0 +1,2499 @@ +using DocumentFormat.OpenXml; +using NPOI.OpenXmlFormats.Dml; +using NPOI.SS.Formula.Functions; +using OfficeOpenXml; +using Qdp.Foundation.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using YLErp.BLL; +using YLErp.DBModels.Consts; +using YLErp.Helpers; +using YLErp.Modules.SuperviseReportModule.SAC.Model; +using YLErp.Office; +using static YLErp.DBModels.Consts.ConsReport; +using XmlHelper = YLErp.Helpers.XmlHelper; + +namespace YLErp.Modules.SuperviseReportModule.SAC.Common +{ + public class ReportInfoHelper + { + static readonly IYcLogger logger; + + /// + /// 映射虚拟路径到物理路径 + /// + public Func MapPath { get; private set; } = null!; + + private List _reportInfoList = new List(); + + /// + /// 错误信息 + /// + public string ErrorMsg { get; private set; } = ""; + + static ReportInfoHelper() + { + logger = LogFactory.GetLogger(); + } + + public ReportInfoHelper() : this(OtcAppContext.MapPath) { } + + public ReportInfoHelper(Func mapPath) + { + this.MapPath = mapPath; + } + + public bool Init(int id) + { + var masterFileTag = DbContextFactory.GetYLDbContext().supervise_report.Where(O => O.id == id).Select(O => O.FileTag).FirstOrDefault(); + if (masterFileTag is null) + { + ErrorMsg = "未找到对应的报告"; + return false; + } + return Init(id, masterFileTag); + } + + public bool Init(int id, string fileTag) + { + return init(id, fileTag); + } + + public bool Init(params ReportRootModel[] reportInfo) + { + try + { + if (reportInfo is null || reportInfo.Length == 0) + { + ErrorMsg = "报告信息不应为空"; + return false; + } + foreach (var item in reportInfo) + { + switch (item.Header.BusiDataType) + { + case DataFlagsEnum.A1001: + setMasterAgrmtInfo(item); + break; + case DataFlagsEnum.A1002: + setMasterAgrmtProductInfo(item); + break; + case DataFlagsEnum.A1003: + setMasterSupAgrmtInfo(item); + break; + case DataFlagsEnum.A1004: + setOptionConfirmationInfo(item); + break; + case DataFlagsEnum.A1005: + setSwapConfirmationInfo(item); + break; + case DataFlagsEnum.A1006: + setSwapTerminationInfo(item); + break; + case DataFlagsEnum.A1007: + setOptionTerminationInfo(item); + break; + case DataFlagsEnum.A1008: + setPerformanceGuaranteeAgrmtInfo(item); + break; + case DataFlagsEnum.A1011: + setPeriodicReportSACInfo(item); + break; + case DataFlagsEnum.A1012: + setPeriodicReportNAFMIIInfo(item); + break; + case DataFlagsEnum.A1013: + setPeriodicReportISDAInfo(item); + break; + case DataFlagsEnum.A1016: + setSwapEquityPaymentInfo(item); + break; + case DataFlagsEnum.A1017: + setSwapConfirmationAttInfo(item); + break; + case DataFlagsEnum.A1018: + setValuationInformationInfo(item); + break; + case DataFlagsEnum.A1019: + setOptionConfirmationAttInfo(item); + break; + case DataFlagsEnum.A1009: + case DataFlagsEnum.A1010: + case DataFlagsEnum.A1014: + case DataFlagsEnum.A1015: + case DataFlagsEnum.NONE: + default: + break; + } + if (item.Annex != null && item.Annex.Count > 0) + { + item.Annex = item.Annex.Where(O => !string.IsNullOrWhiteSpace(O)).Select(O => MapPath(O)).ToList(); + } + _reportInfoList.Add(item); + } + return true; + } + catch (Exception ex) + { + ErrorMsg = "未知错误:" + ex.ToJson(); + return false; + } + } + + public bool Init(ReportResponse res) + { + if (res is null) + { + ErrorMsg = "报告信息不应为空"; + return false; + } + Init(res.Infos.ToArray()); + return true; + } + + /// + /// 转换为Zip文件 + /// 可用于重新上传的格式 + /// + /// 包含文件名的输出路径 + /// + public bool SaveToZipFile(string outZipPath) + { + try + { + if (_reportInfoList.Count == 0) + { + ErrorMsg = "未找到报告信息"; + return false; + } + ExcelPackage.LicenseContext = LicenseContext.NonCommercial; + var outPath = MapPath(outZipPath); + var originPath = Path.GetDirectoryName(outPath); + var tempPath = Path.Combine(originPath, DateTime.Now.ToString("yyyyMMddHHmmssfff")); + createDirectory(tempPath); + var masterAgrmtStatus = saveMasterAgrmtInfoToExcel(tempPath); + var optionConfirmationStatus = saveOptionConfirmationInfoToExcel(tempPath); + var optionValuationStatus = saveValuationInformationInfoToExcel(tempPath); + var optionConfirmationAttStatus = saveOptionConfirmationAttInfoToExcel(tempPath); + var optionTerminationStatus = saveOptionTerminationInfoToExcel(tempPath); + var swapConfirmationStatus = saveSwapConfirmationInfoToExcel(tempPath); + var swapEquityPaymentStatus = saveSwapEquityPaymentInfoToExcel(tempPath); + var swapConfirmationAttStatus = saveSwapConfirmationAttInfoToExcel(tempPath); + var swapTerminationStatus = saveSwapTerminationInfoToExcel(tempPath); + var sacStatus = saveSACReportInfoToExcel(tempPath); + var nafmiiStatus = saveNAFMIIReportInfoToExcel(tempPath); + var isdaStatus = saveISDAReportInfoToExcel(tempPath); + var attStatus = saveAttachment(tempPath); + + ZipHelper.ZipDirectory(tempPath, outPath); + Directory.Delete(tempPath, true); + + _reportInfoList.Clear(); + + return true; + } + catch (Exception ex) + { + ErrorMsg = "未知错误:" + ex.ToJson(); + return false; + } + } + + #region 保存到Excel + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveMasterAgrmtInfoToExcel(string rootPath) + { + var reportInfo_masterAgrmt = _reportInfoList.Where(O => O.Body.MasterAgrmt != null).SelectMany(O => O.Body.MasterAgrmt ?? new List()).ToList(); + var reportInfo_supAgrmt = _reportInfoList.Where(O => O.Body.SupAgrmt != null).SelectMany(O => O.Body.SupAgrmt ?? new List()).ToList(); + var reportInfo_masterProductAgrmt = _reportInfoList.Where(O => O.Body.MasterAgrmtProduct != null).SelectMany(O => O.Body.MasterAgrmtProduct ?? new List()).ToList(); + var reportInfo_performanceGuaranteeAgrmt = _reportInfoList.Where(O => O.Body.PerformanceGuaranteeAgrmt != null).SelectMany(O => O.Body.PerformanceGuaranteeAgrmt ?? new List()).ToList(); + + if (reportInfo_masterAgrmt.Count > 0 || + reportInfo_supAgrmt.Count > 0 || + reportInfo_masterProductAgrmt.Count > 0 || + reportInfo_performanceGuaranteeAgrmt.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "协议相关")); + var outPath = Path.Combine(path, "import_MasterAgrmt_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/协议相关/import_MasterAgrmt_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["主协议"] = reportInfo_masterAgrmt, + ["填报方业务代表明细"] = reportInfo_masterAgrmt.SelectMany(O => O.CounterpartyInformationTuple ?? new List()), + ["主协议关联产品列表"] = reportInfo_masterProductAgrmt, + ["补充协议"] = reportInfo_supAgrmt, + ["履约保证书明细"] = reportInfo_performanceGuaranteeAgrmt + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveOptionConfirmationInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.OptionConfirmation != null).SelectMany(O => O.Body.OptionConfirmation ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_OptionConfirmation_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_OptionConfirmation_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["期权交易确认书明细"] = reportInfo, + ["标的详情明细"] = reportInfo.SelectMany(O => O.UndrlygAssetTuple ?? new List()).ToList(), + ["履约担保品详情明细"] = reportInfo.SelectMany(O => O.PerformanceCollTuple ?? new List()).ToList(), + ["期权结构类型详情(香草及其组合)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["香草及其组合"]).ToList(), + ["期权结构类型详情(二元及其组合)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["二元及其组合"]).ToList(), + ["期权结构类型详情(障碍及其组合)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["障碍及其组合"]).ToList(), + ["期权结构类型详情(自动赎回)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["自动赎回"]).ToList(), + ["期权结构类型详情(区间累计)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["区间累计"]).ToList(), + ["期权结构类型详情(安全气囊)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["安全气囊"]).ToList(), + ["期权结构类型详情(其他)"] = reportInfo.Where(O => O.OptionStructureType == ConsReport.OptionStructureTypeMap["其他"]).ToList() + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveValuationInformationInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.ValuationInformation != null).SelectMany(O => O.Body.ValuationInformation ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_ValuationInformation_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_ValuationInformation_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["每日估值信息"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveOptionConfirmationAttInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.ConfirmationAtt != null && O.Body.ConfirmationAtt.Any(B => !string.IsNullOrWhiteSpace(B.ConfirmationAtt))).SelectMany(O => O.Body.ConfirmationAtt ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_OptionConfirmationAtt_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_OptionConfirmationAtt_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["场外期权确认书附件明细"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveOptionTerminationInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.OptionTermination != null).SelectMany(O => O.Body.OptionTermination ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_OptionTermination_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_OptionTermination_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["期权交易存续期明细"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveSwapConfirmationInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.SwapConfirmation != null).SelectMany(O => O.Body.SwapConfirmation ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_SwapConfirmation_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_SwapConfirmation_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["互换交易确认书明细"] = reportInfo, + ["收益互换交易费用支付端"] = reportInfo.SelectMany(O => O.CostPaymentTuple ?? new List()).ToList(), + ["履约担保品明细"] = reportInfo.SelectMany(O => O.PerformanceCollTuple ?? new List()).ToList() + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveSwapEquityPaymentInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.SwapEquityPayment != null).SelectMany(O => O.Body.SwapEquityPayment ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_SwapEquityPayment_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_SwapEquityPayment_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["收益互换交易权益端支付"] = reportInfo, + ["权益端支付明细"] = reportInfo.SelectMany(O => O.SwapEquityPaymentTuple ?? new List()).ToList() + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveSwapConfirmationAttInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.ConfirmationAtt != null && O.Body.ConfirmationAtt.Any(B => !string.IsNullOrWhiteSpace(B.ConfirmationFiles))).SelectMany(O => O.Body.ConfirmationAtt ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_SwapConfirmationAtt_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_SwapConfirmationAtt_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["收益互换确认书附件明细"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveSwapTerminationInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.SwapDurationManagement != null).SelectMany(O => O.Body.SwapDurationManagement ?? new List()).ToList(); + if (reportInfo?.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "交易相关")); + var outPath = Path.Combine(path, "import_SwapTermination_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/交易相关/import_SwapTermination_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["互换交易存续期明细"] = reportInfo, + ["合约持仓明细"] = reportInfo.SelectMany(O => O.CurrentPositionDetails ?? new List()).ToList(), + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveSACReportInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.PeriodicReportSAC != null).Select(O => O.Body.PeriodicReportSAC).FirstOrDefault(); + if (reportInfo != null) + { + var path = createDirectory(Path.Combine(rootPath, "定期报告")); + var outPath = Path.Combine(path, "import_SAC_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/定期报告/import_SAC_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["业务统计"] = reportInfo, + ["本月新增业务明细"] = reportInfo.IncreaseBusinessDetailsThisMonthTuple ?? new List(), + ["本月末存量业务明细"] = reportInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple ?? new List(), + ["标的情况与对冲"] = reportInfo.TargetCaseAndHedgeTuple ?? new List(), + ["履约担保情况"] = reportInfo, + ["盈亏情况"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveNAFMIIReportInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.PeriodicReportNAFMII != null).Select(O => O.Body.PeriodicReportNAFMII).FirstOrDefault(); + if (reportInfo != null) + { + var path = createDirectory(Path.Combine(rootPath, "定期报告")); + var outPath = Path.Combine(path, "import_NAFMII_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/定期报告/import_NAFMII_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["业务统计"] = reportInfo, + ["利率互换明细"] = reportInfo.InterestRateSwapDetails ?? new List(), + ["利率期权明细"] = reportInfo.InterestRateOptionDetails ?? new List(), + ["其他交易明细"] = reportInfo.ScheduleOfOtherTransactions ?? new List() + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存对象到Excel + /// + /// + /// + private bool saveISDAReportInfoToExcel(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Body.PeriodicReportISDA != null).Select(O => O.Body.PeriodicReportISDA).FirstOrDefault(); + if (reportInfo != null) + { + var path = createDirectory(Path.Combine(rootPath, "定期报告")); + var outPath = Path.Combine(path, "import_ISDA_template.xlsx"); + new ExcelTemplateGenerator() + .SetTemplateFile(MapPath("~/App_Docs/导出模板/报送模板/定期报告/import_ISDA_template.xlsx")) + .SetTemplateData(new Dictionary + { + ["业务统计"] = reportInfo, + ["本月新增业务明细"] = reportInfo.IncreaseBusinessDetailsThisMonthTuple ?? new List(), + ["本月末存量业务明细"] = reportInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple ?? new List(), + ["标的情况与对冲"] = reportInfo.TargetCaseAndHedgeTuple ?? new List(), + ["履约担保情况"] = reportInfo, + ["盈亏情况"] = reportInfo + }) + .OutputToFile(outPath); + } + return true; + } + + /// + /// 保存附件 + /// + /// + /// + private bool saveAttachment(string rootPath) + { + var reportInfo = _reportInfoList.Where(O => O.Annex != null).SelectMany(O => O.Annex ?? new List()).ToList(); + if (reportInfo != null && reportInfo.Count > 0) + { + var path = createDirectory(Path.Combine(rootPath, "附件")); + foreach (var att in reportInfo) + { + var fileName = Path.GetFileName(att); + var attPath = Path.Combine(path, fileName); + File.Copy(att, attPath, true); + } + } + return true; + } + + /// + /// 目录不存在,则创建目录 + /// + /// + /// + private string createDirectory(string p) + { + if (!Directory.Exists(p)) + { + Directory.CreateDirectory(p); + } + + return p; + } + #endregion + + #region 从Xml中获取数据 + private bool init(int id, string masterFileTag) + { + try + { + var fileTag = masterFileTag.Replace("YSP_", ""); + var fileInfos = DbContextFactory.GetYLDbContext().supervise_report.Where(O => O.id == id || O.FileTag.Contains(fileTag)).ToList(); + if (fileInfos.Count == 0) + { + ErrorMsg = "未找到对应的报告"; + return false; + } + logger.Info($"找到符合Id={id}或FileTag包含{fileTag}的记录数: {fileInfos.Count}"); + var filePath = fileInfos.Where(O => O.id == id).Select(O => O.FilePath).FirstOrDefault(); + if (string.IsNullOrEmpty(filePath)) + { + ErrorMsg = "报告文件不存在"; + return false; + } + logger.Info($"查找对应解压文件: {filePath}"); + if (!getXmlFilePath(filePath, out var xmlPath)) + { + ErrorMsg = "报告文件解压失败"; + return false; + } + + convertToMasterAgrmtInfo(fileInfos, xmlPath); + convertToMasterSupAgrmtInfo(fileInfos, xmlPath); + convertToMasterAgrmtProductInfo(fileInfos, xmlPath); + convertToPerformanceGuaranteeAgrmtInfo(fileInfos, xmlPath); + convertToOptionConfirmationInfo(fileInfos, xmlPath); + convertToValuationInformationInfo(fileInfos, xmlPath); + convertToOptionConfirmationAttInfo(fileInfos, xmlPath); + convertToOptionTerminationInfo(fileInfos, xmlPath); + convertToSwapConfirmationInfo(fileInfos, xmlPath); + convertToSwapEquityPaymentInfo(fileInfos, xmlPath); + convertToSwapTerminationInfo(fileInfos, xmlPath); + convertToSwapConfirmationAttInfo(fileInfos, xmlPath); + convertToPeriodicReportSACInfo(fileInfos, xmlPath); + convertToPeriodicReportNAFMIIInfo(fileInfos, xmlPath); + convertToPeriodicReportISDAInfo(fileInfos, xmlPath); + getAttachment(xmlPath); + return true; + } + catch (Exception ex) + { + ErrorMsg = "解析报告失败,未知错误:" + ex.ToJson(); + return false; + } + } + + /// + /// 设置主协议信息 + /// + /// + /// + private void convertToMasterAgrmtInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_MasterAgrmt).ToList(); + xmlToObj(xmlPath, reportList, setMasterAgrmtInfo); + } + + /// + /// 设置补充协议信息 + /// + /// + /// + private void convertToMasterSupAgrmtInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_SupAgrmt).ToList(); + xmlToObj(xmlPath, reportList, setMasterSupAgrmtInfo); + } + + /// + /// 设置履约保障信息 + /// + /// + /// + private void convertToPerformanceGuaranteeAgrmtInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt).ToList(); + xmlToObj(xmlPath, reportList, setPerformanceGuaranteeAgrmtInfo); + } + + /// + /// 设置代签产品信息 + /// + /// + /// + private void convertToMasterAgrmtProductInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_MasterAgrmtProduct).ToList(); + xmlToObj(xmlPath, reportList, setMasterAgrmtProductInfo); + } + + /// + /// 设置期权交易信息 + /// + /// + /// + private void convertToOptionConfirmationInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_OptionConfirmation).ToList(); + xmlToObj(xmlPath, reportList, setOptionConfirmationInfo); + } + + /// + /// 设置每日估值信息 + /// + /// + /// + private void convertToValuationInformationInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_ValuationInformation).ToList(); + xmlToObj(xmlPath, reportList, setValuationInformationInfo); + } + + /// + /// 设置期权确认附件信息 + /// + /// + /// + private void convertToOptionConfirmationAttInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_OptionConfirmationAtt).ToList(); + xmlToObj(xmlPath, reportList, setOptionConfirmationAttInfo); + } + + /// + /// 设置期权存续期信息 + /// + /// + /// + private void convertToOptionTerminationInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_OptionTermination).ToList(); + xmlToObj(xmlPath, reportList, setOptionTerminationInfo); + } + + /// + /// 设置互换确认书信息 + /// + /// + /// + private void convertToSwapConfirmationInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_SwapConfirmation).ToList(); + xmlToObj(xmlPath, reportList, setSwapConfirmationInfo); + } + + /// + /// 设置互换权益端支付信息 + /// + /// + /// + private void convertToSwapEquityPaymentInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_SwapEquityPayment).ToList(); + xmlToObj(xmlPath, reportList, setSwapEquityPaymentInfo); + } + + /// + /// 设置互换存续期信息 + /// + /// + /// + private void convertToSwapTerminationInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_SwapDurationManagement).ToList(); + xmlToObj(xmlPath, reportList, setSwapTerminationInfo); + } + + /// + /// 设置互换确认书附件信息 + /// + /// + /// + private void convertToSwapConfirmationAttInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_ConfirmationAtt).ToList(); + xmlToObj(xmlPath, reportList, setSwapConfirmationAttInfo); + } + + /// + /// 设置SAC月报信息 + /// + /// + /// + private void convertToPeriodicReportSACInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_PeriodicReportSAC).ToList(); + xmlToObj(xmlPath, reportList, setPeriodicReportSACInfo); + } + + /// + /// 设置NAFMII月报信息 + /// + /// + /// + private void convertToPeriodicReportNAFMIIInfo(List fileInfos, string xmlPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII).ToList(); + xmlToObj(xmlPath, reportList, setPeriodicReportNAFMIIInfo); + } + + /// + /// 设置ISDA月报信息 + /// + /// + /// + private void convertToPeriodicReportISDAInfo(List fileInfos, string tempPath) + { + var reportList = fileInfos.Where(O => O.ReportType == DBModels.Enums.SuperviseReportTypeEnum.SAC_PeriodicReportISDA).ToList(); + xmlToObj(tempPath, reportList, setPeriodicReportISDAInfo); + } + + private void getAttachment(string tempPath) + { + if (_reportInfoList.Count == 0) + { + return; + } + var filePath = Path.Combine(tempPath, "ATTACHMENT"); + if (!Directory.Exists(filePath)) + { + return; + } + var files = Directory.GetFiles(filePath).ToList(); + _reportInfoList[0].Annex = _reportInfoList[0].Annex == null ? new List() : _reportInfoList[0].Annex; + _reportInfoList[0].Annex.AddRange(files); + logger.Info($"处理附件: {filePath}"); + + } + + /// + /// 转换Xml为对象 + /// + /// + /// + /// + private void xmlToObj(string tempPath, List reportList, Action action) + { + foreach (var item in reportList) + { + var xmlPath = Path.Combine(tempPath, $"{item.FileTag}.xml"); + logger.Info($"准备读取报告文件: {xmlPath}"); + var xml = File.ReadAllText(xmlPath); + logger.Info($"准备解析报告文件: {xmlPath}"); + var rootObj = XmlHelper.Deserialize(xml); + action?.Invoke(rootObj); + logger.Info($"解析成功"); + _reportInfoList.Add(rootObj); + } + } + + /// + /// 获取Xml文件路径 + /// + /// + /// + /// + /// + private bool getXmlFilePath(string filePath, out string xmlPath) + { + var zipPath = MapPath(filePath) ?? ""; + if (!File.Exists(zipPath)) + { + ErrorMsg = "文件不存在"; + xmlPath = ""; + return false; + } + + var rootPath = Path.Combine(Path.GetDirectoryName(zipPath), "Temp"); + xmlPath = Path.Combine(rootPath, Path.GetFileNameWithoutExtension(zipPath)); + if (!Directory.Exists(xmlPath)) + { + logger.Info($"文件不存在,准备解压: {xmlPath}"); + Directory.CreateDirectory(xmlPath); + ZipHelper.unZipFile(zipPath, rootPath, out var msg); + if (msg.StartsWith("解压失败")) + { + Directory.Delete(xmlPath, true); + ErrorMsg = $"解压失败:{msg}"; + return false; + } + } + return true; + } + #endregion + + #region 设置附加信息 + /// + /// 设置主协议信息 + /// + /// + private void setMasterAgrmtInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.MasterAgrmt; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var operationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var reportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = operationType; + item.ReportDate = reportDate; + if (item.CounterpartyInformationTuple != null) + { + foreach (var counterpartyInfo in item.CounterpartyInformationTuple) + { + counterpartyInfo.MasterAgrmtNo = item.MasterAgrmtNo; + counterpartyInfo.ReportDate = item.ReportDate; + counterpartyInfo.ExceID = item.ExceID; + } + } + } + } + + /// + /// 设置补充协议信息 + /// + /// + private void setMasterSupAgrmtInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.SupAgrmt; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var operationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var reportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = operationType; + item.ReportDate = reportDate; + if (item.SupAgrmtAttTuple?.Count > 0) + { + var attList = item.SupAgrmtAttTuple!.Select(O => O.SupAgrmtAtt).ToList(); + item.SupAgrmtAtt = string.Join(",", attList); + } + } + } + + /// + /// 设置履约保障信息 + /// + /// + private void setPerformanceGuaranteeAgrmtInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.PerformanceGuaranteeAgrmt; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var operationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var reportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = operationType; + item.ReportDate = reportDate; + } + } + + /// + /// 设置代签产品信息 + /// + /// + private void setMasterAgrmtProductInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.MasterAgrmtProduct; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + } + } + + /// + /// 设置期权交易信息 + /// + /// + private void setOptionConfirmationInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.OptionConfirmation; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + if (item.UndrlygAssetTuple != null) + { + foreach (var undrlyAsset in item.UndrlygAssetTuple) + { + undrlyAsset.UndrlygAssetNo = item.UndrlygAssetNo; + undrlyAsset.ConfirmationNo = item.ConfirmationNo; + undrlyAsset.ReportDate = item.ReportDate; + undrlyAsset.ExceID = item.ExceID; + } + } + if (item.PerformanceCollTuple != null) + { + foreach (var performanceGuarantee in item.PerformanceCollTuple) + { + performanceGuarantee.PerformanceGuaranteeType = item.PerformanceGuaranteeType; + performanceGuarantee.ConfirmationNo = item.ConfirmationNo; + performanceGuarantee.ReportDate = item.ReportDate; + performanceGuarantee.ExceID = item.ExceID; + } + } + } + } + + /// + /// 设置每日估值信息 + /// + /// + private void setValuationInformationInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.ValuationInformation; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + } + } + + /// + /// 设置期权确认附件信息 + /// + /// + private void setOptionConfirmationAttInfo(ReportRootModel model) + { + if (model.Body.ConfirmationAtt == null) + { + return; + } + var reportObj = model.Body.ConfirmationAtt.Where(O => O.ConfirmationFilesTuple.Any(B => !string.IsNullOrEmpty(B.ConfirmationAtt))).ToList(); + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + var attList = item.ConfirmationFilesTuple.Select(O => O.ConfirmationAtt); + item.OperationType = OperationType; + item.ReportDate = ReportDate; + item.ConfirmationAtt = string.Join(",", attList); + } + } + + /// + /// 设置期权存续期信息 + /// + /// + private void setOptionTerminationInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.OptionTermination; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + } + } + + /// + /// 设置互换确认书信息 + /// + /// + private void setSwapConfirmationInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.SwapConfirmation; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + + if (item.CostPaymentTuple != null) + { + foreach (var detail in item.CostPaymentTuple) + { + detail.ConfirmationNo = item.ConfirmationNo; + detail.ReportDate = item.ReportDate; + detail.ExceID = item.ExceID; + } + } + if (item.PerformanceCollTuple != null) + { + foreach (var performance in item.PerformanceCollTuple) + { + performance.ConfirmationNo = item.ConfirmationNo; + performance.ReportDate = item.ReportDate; + performance.ExceID = item.ExceID; + } + } + } + } + + /// + /// 设置互换权益端支付信息 + /// + /// + private void setSwapEquityPaymentInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.SwapEquityPayment; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + if (item.SwapEquityPaymentTuple != null) + { + foreach (var equityPayment in item.SwapEquityPaymentTuple) + { + equityPayment.ConfirmationNo = item.ConfirmationNo; + equityPayment.ReportDate = item.ReportDate; + equityPayment.ExceID = item.ExceID; + + } + } + } + } + + /// + /// 设置互换存续期信息 + /// + /// + private void setSwapTerminationInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.SwapDurationManagement; + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + item.OperationType = OperationType; + item.ReportDate = ReportDate; + item.SwapType = item.DurationOperationType == SwapOperationTypeMap["调仓"] ? SwapTypeMap["多空组合"] : SwapTypeMap["其他"]; + + if (item.CurrentPositionDetails != null) + { + foreach (var detail in item.CurrentPositionDetails) + { + detail.ConfirmationNo = item.ConfirmationNo; + detail.ReportDate = item.ReportDate; + detail.ExceID = item.ExceID; + } + } + } + } + + /// + /// 设置互换确认书附件信息 + /// + /// + private void setSwapConfirmationAttInfo(ReportRootModel model) + { + if (model.Body.ConfirmationAtt == null) + { + return; + } + var reportObj = model.Body.ConfirmationAtt.Where(O => O.ConfirmationFilesTuple.Any(B => !string.IsNullOrEmpty(B.ConfirmationFiles))).ToList(); + if (reportObj == null || reportObj.Count == 0) + { + return; + } + var OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + var ReportDate = DateTime.Parse(model.Header.SendDate); + foreach (var item in reportObj) + { + var attList = item.ConfirmationFilesTuple.Select(O => O.ConfirmationFiles); + item.OperationType = OperationType; + item.ReportDate = ReportDate; + item.ConfirmationFiles = string.Join(",", attList); + } + } + + /// + /// 设置SAC月报信息 + /// + /// + private void setPeriodicReportSACInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.PeriodicReportSAC; + if (reportObj == null) + { + return; + } + reportObj.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + reportObj.ReportDate = DateTime.Parse(model.Header.SendDate); + if (reportObj.IncreaseBusinessDetailsThisMonthTuple != null) + { + index = 0; + foreach (var item in reportObj.IncreaseBusinessDetailsThisMonthTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + if (reportObj.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) + { + index = 0; + foreach (var item in reportObj.InventoryBusinessDetailsAtTheEndOfThisMonthTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + if (reportObj.TargetCaseAndHedgeTuple != null) + { + index = 0; + foreach (var item in reportObj.TargetCaseAndHedgeTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + } + + /// + /// 设置NAFMII月报信息 + /// + /// + private void setPeriodicReportNAFMIIInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.PeriodicReportNAFMII; + if (reportObj == null) + { + return; + } + reportObj.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + reportObj.ReportDate = DateTime.Parse(model.Header.SendDate); + if (reportObj.InterestRateSwapDetails != null) + { + index = 0; + foreach (var item in reportObj.InterestRateSwapDetails) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + if (reportObj.InterestRateOptionDetails != null) + { + index = 0; + foreach (var item in reportObj.InterestRateOptionDetails) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + if (reportObj.ScheduleOfOtherTransactions != null) + { + index = 0; + foreach (var item in reportObj.ScheduleOfOtherTransactions) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + } + + /// + /// 设置ISDA月报信息 + /// + /// + private void setPeriodicReportISDAInfo(ReportRootModel model) + { + var index = 0; + var reportObj = model.Body.PeriodicReportISDA; + if (reportObj == null) + { + return; + } + reportObj.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType); + reportObj.ReportDate = DateTime.Parse(model.Header.SendDate); + if (reportObj.IncreaseBusinessDetailsThisMonthTuple != null) + { + index = 0; + foreach (var item in reportObj.IncreaseBusinessDetailsThisMonthTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + + if (reportObj.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) + { + index = 0; + foreach (var item in reportObj.InventoryBusinessDetailsAtTheEndOfThisMonthTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + + if (reportObj.TargetCaseAndHedgeTuple != null) + { + index = 0; + foreach (var item in reportObj.TargetCaseAndHedgeTuple) + { + item.ReportDate = reportObj.ReportDate; + item.ExceID = reportObj.ExceID; + item.Index = $"{++index}"; + } + } + } + #endregion + } +} + +/*暂存所有报送相关表的sql +CREATE TABLE `A1001_MasterAgrmt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`MasterAgrmtID` varchar(32) NULL COMMENT '主协议编号', +`MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`SigningDate` varchar(10) NOT NULL COMMENT '签订时间', +`MasterAgrmtVer` varchar(10) NOT NULL COMMENT '主协议版本', +`FillParty` varchar(2) NOT NULL COMMENT '填报方角色', +`NameOfCounterparty` varchar(200) NOT NULL COMMENT '交易对手方名称(全称)', +`CODS` varchar(18) NULL COMMENT '统一社会信用代码', +`CounterpartyCode` varchar(20) NULL COMMENT '交易对手编码', +`LEI` varchar(20) NULL COMMENT 'LEI码', +`ProCounterparty` varchar(200) NOT NULL COMMENT '交易对手类别', +`CounterpartyType` varchar(20) NOT NULL COMMENT '交易对手方类型', +`NFICode` varchar(20) NULL COMMENT '非金融机构行业代码', +`CounterpartyRegdCptl` varchar(37) NULL COMMENT '交易对手方注册资本(万元)', +`MasterAgrmtRemark` text NULL COMMENT '主协议备注', +`MasterAgrmtAtt` varchar(255) NOT NULL COMMENT '主协议附件', +`CounterpartyIdentity` varchar(2) NOT NULL COMMENT '交易对手方身份', + PRIMARY KEY (`id`) +) COMMENT = '主协议'; +CREATE TABLE `A1001_CounterpartyInfomation` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', +`MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', + `Name` varchar(200) NOT NULL COMMENT '填报方业务代表姓名', +`Title` varchar(200) NULL COMMENT '职务', +`Telephone` varchar(200) NULL COMMENT '电话', +`Mobile` varchar(11) NULL COMMENT '手机', +`Email` varchar(200) NULL COMMENT '邮箱', + + PRIMARY KEY (`id`) +) COMMENT = '填报方业务代表明细'; +CREATE TABLE `A1003_SupAgrmt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`SupAgrmtID` varchar(32) NULL COMMENT '补充议编号', +`SupAgrmtNo` varchar(100) NOT NULL COMMENT '补充协议编号(双方约定)', +`SupAgrmtType` varchar(2) NOT NULL COMMENT '补充协议类型', +`SigningDate` varchar(10) NOT NULL COMMENT '签署时间', +`SupAgrmtRemark` text NULL COMMENT '补充协议备注', +`SupAgrmtAtt` text NULL COMMENT '补充协议附件', + + PRIMARY KEY (`id`) +) COMMENT = '补充协议'; +CREATE TABLE `A1002_MasterAgrmtProduct` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`ProductNo` varchar(32) NULL COMMENT '代签产品编号', +`ClientType` varchar(255) NULL COMMENT '客户类型', +`ProductName` varchar(100) NULL COMMENT '产品名称', +`CounterpartyCodeProducts` varchar(20) NULL COMMENT '交易对手码(产品)', +`ManagerName` varchar(100) NULL COMMENT '产品投资经理姓名', +`InvestmentManagerContactNumber` varchar(20) NULL COMMENT '投资经理联系电话', +`TrusteeAgency` varchar(200) NULL COMMENT '托管机构(如有)', +`TheDateTable` varchar(10) NULL COMMENT '入表日期', +`SuchProducts` varchar(255) NULL COMMENT '代签产品附件', + + PRIMARY KEY (`id`) +) COMMENT = '主协议关联产品'; +CREATE TABLE `A1008_PerformanceGuaranteeAgrmt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`SupAgrmtNo` varchar(100) NOT NULL COMMENT '补充协议编号(双方约定)', +`PerformanceGuaranteeAgrmtID` varchar(32) NULL COMMENT '履约担保协议编号', +`PerformanceGuaranteeAgrmt` varchar(100) NOT NULL COMMENT '履约担保协议(附件)', +`SigningDate` varchar(10) NOT NULL COMMENT '签署时间', + + PRIMARY KEY (`id`) +) COMMENT = '履约保证书'; +CREATE TABLE `A1004_OptionConfirmation` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`SupAgrmtNo` varchar(100) NOT NULL COMMENT '补充协议编号(双方约定)', +`OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`ConfirmationID` varchar(32) NULL COMMENT '交易确认书编号', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`ConfirmationType` varchar(2) NOT NULL COMMENT '交易确认书类型', +`FillParty` varchar(2) NOT NULL COMMENT '填报方角色', +`OptionSeller` varchar(2) NOT NULL COMMENT '期权卖方', +`OptionDirection` varchar(2) NOT NULL COMMENT '期权方向', +`OptionStructureType` varchar(2) NOT NULL COMMENT '期权结构类型', +`OptionStructure` varchar(2000) NULL COMMENT '期权结构类型', +`ExerciseApproach` varchar(2) NOT NULL COMMENT '行权方式', +`StartDate` varchar(10) NOT NULL COMMENT '起始日', +`DueDate` varchar(10) NOT NULL COMMENT '到期日', +`SettlementDate` varchar(10) NULL COMMENT '结算日', +`OptionPremium` varchar(6) NOT NULL COMMENT '期权费(非年化)(%)', +`AnnualizedDays` varchar(3) NOT NULL COMMENT '年化天数', +`PricingVolatility` varchar(6) NOT NULL COMMENT '定价波动率(%)', +`RiskFreeInterestRates` varchar(6) NOT NULL COMMENT '无风险利率(%)', +`Currency` varchar(2) NOT NULL COMMENT '结算货币', +`NotinalPrincipleAmt` varchar(37) NOT NULL COMMENT '名义本金(元)', +`ClearingAgency` varchar(2) NOT NULL COMMENT '清算机构', +`TradingPlace` varchar(2) NOT NULL COMMENT '交易场所', +`TradingPlaceOther` varchar(200) NULL COMMENT '交易场所(其他)', +`ConfirmationRemark` text NULL COMMENT '基本信息备注', +`UndrlygAssetType` varchar(2) NOT NULL COMMENT '标的类型', +`UndrlygAssetNo` varchar(2) NOT NULL COMMENT '标的个数', +`ProfitCalculationInfo` text NOT NULL COMMENT '期权收益计算说明', +`ProfitRemark` text NULL COMMENT '备注/收益备注', +`PerformanceGuaranteeType` varchar(2) NOT NULL COMMENT '履约担保类型', +`PerformanceCollProvider` varchar(2) NULL COMMENT '履约担保品提供方', +`PartyUseColl` varchar(6) NULL COMMENT '担保品收取方是否可使用担保品', +`CollInstruction` text NULL COMMENT '担保品使用说明', +`CalculateCollInterest` varchar(6) NULL COMMENT '是否计算担保品价值产生利息', +`PerformanceCollInitialRatio` varchar(6) NULL COMMENT '履约担保品初始比率(%)', +`PerformanceCollInitialRatioCash` varchar(6) NULL COMMENT '履约担保品初始比率(现金部分)(%)', +`PerformanceCollAddtlRatio` varchar(6) NULL COMMENT '履约担保品追保比率(%)', +`PerformanceCollOffsetRatio` varchar(6) NULL COMMENT '履约担保品平仓比率(%)', +`MaintainGuaranteeRatio` varchar(6) NULL COMMENT '维持担保比率(%)', +`PerformanceGuaranteeRemark` text NULL COMMENT '备注/履约担保备注', +`PerformanceGuaranteeAtt` text NULL COMMENT '履约担保附件', +`Remark` text NULL COMMENT '备注/其他信息备注', +`ValidNotinalPrincipleAmt` varchar(37) NOT NULL COMMENT '有效名义本金(元)', +`ComplianceOpinion` text NULL COMMENT '合规意见书', +`PtyAPdctName` varchar(100) NULL COMMENT '甲方代签产品名称', +`PytAPdctCode` varchar(20) NULL COMMENT '甲方交易对手码(产品)', +`PtyBPdctName` varchar(100) NULL COMMENT '乙方代签产品名称', +`PytBPdctCode` varchar(20) NULL COMMENT '乙方交易对手码(产品)', +`CrossBorderTransactions` varchar(6) NOT NULL COMMENT '是否为跨境交易', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', +`VanillaOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`VanillaStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`VanillaStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`VanillaStrikePriceCoefficientThree` varchar(6) NULL COMMENT '行权价格系数3(%)', +`VanillaStrikePriceCoefficientFour` varchar(6) NULL COMMENT '行权价格系数4(%)', +`VanillaEngagementRateOne` varchar(6) NULL COMMENT '参与率1(%)', +`VanillaEngagementRateTwo` varchar(6) NULL COMMENT '参与率2(%)', +`VanillaEngagementRateThree` varchar(6) NULL COMMENT '参与率3(%)', +`VanillaEngagementRateFour` varchar(6) NULL COMMENT '参与率4(%)', +`VanillaBackCoverYield` varchar(6) NULL COMMENT '封底收益率(非年化)(%)', +`VanillaCappingYield` varchar(6) NULL COMMENT '封顶收益率(非年化)(%)', +`VanillaBlank1` text NULL COMMENT '空白1', +`VanillaBlank2` text NULL COMMENT '空白2', +`DigitalOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`DigitalStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`DigitalStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`DigitalStrikePriceCoefficientThree` varchar(6) NULL COMMENT '行权价格系数3(%)', +`DigitalEngagementRateOne` varchar(6) NULL COMMENT '参与率1(%)', +`DigitalEngagementRateTwo` varchar(6) NULL COMMENT '参与率2(%)', +`DigitalEngagementRateThree` varchar(6) NULL COMMENT '参与率3(%)', +`DigitalYieldOneNonAnnualized` varchar(6) NULL COMMENT '收益率1(非年化)(%)', +`DigitalYieldTwoNonAnnualized` varchar(6) NULL COMMENT '收益率2(非年化)(%)', +`DigitalYieldThreeNonAnnualized` varchar(6) NULL COMMENT '收益率3(非年化)(%)', +`DigitalYieldFourNonAnnualized` varchar(6) NULL COMMENT '收益率4(非年化)(%)', +`DigitalBlank1` text NULL COMMENT '空白1', +`DigitalBlank2` text NULL COMMENT '空白2', +`BarrierOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`BarrierStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`BarrierStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`BarrierEngagementRateOne` varchar(6) NULL COMMENT '参与率1(%)', +`BarrierEngagementRateTwo` varchar(6) NULL COMMENT '参与率2(%)', +`BarrierKnockInPriceCoefficient` varchar(6) NULL COMMENT '敲入价格系数(%)', +`BarrierKnockOutPriceCoefficientOne` varchar(6) NULL COMMENT '敲出价格系数1(%)', +`BarrierKnockOutYieldOneNonAnnualized` varchar(6) NULL COMMENT '敲出收益率1(非年化)(%)', +`BarrierKnockOutPriceCoefficientTwo` varchar(6) NULL COMMENT '敲出价格系数2(%)', +`BarrierKnockOutYieldTwoNonAnnualized` varchar(6) NULL COMMENT '敲出收益率2(非年化)(%)', +`BarrierObservationType` varchar(2) NULL COMMENT '观察类型', +`BarrierBackCoverYield` varchar(6) NULL COMMENT '封底收益率(非年化)(%)', +`BarrierUnknockedYield` varchar(6) NULL COMMENT '未敲入收益率(非年化)(%)', +`BarrierBlank1` text NULL COMMENT '空白1', +`BarrierBlank2` text NULL COMMENT '空白2', +`AutoCallableOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`AutoCallableEngagementRate` varchar(6) NULL COMMENT '参与率(%)', +`AutoCallableStrikePriceCoefficient` varchar(6) NULL COMMENT '行权价格系数(%)', +`AutoCallableKnockOutPriceCoefficient` text NULL COMMENT '敲出价格系数(%)', +`AutoCallableKnockOutYieldAnnualized` text NULL COMMENT '敲出收益率(年化)(%)', +`AutoCallableKnockOutObservationDay` varchar(2048) NULL COMMENT '敲出观察日', +`AutoCallableKnockOutSettlementDay` varchar(2048) NULL COMMENT '敲出结算日', +`AutoCallableKnockInPriceCoefficient` text NULL COMMENT '敲入价格系数(%)', +`AutoCallableKnockInObservationDay` text NULL COMMENT '敲入观察日', +`AutoCallableDividendYieldAnnualized` varchar(6) NULL COMMENT '红利收益率(年化)(%)', +`AutoCallableMinimumYieldAnnualized` varchar(6) NULL COMMENT '最低收益率(年化)(%)', +`AutoCallableMinimumPrincipalProtectionRatio` varchar(6) NULL COMMENT '最低本金保障比例(%)', +`AutoCallableWhetherDiscountedWarehouseType` varchar(2) NULL COMMENT '是否为折价建仓型', +`AutoCallableWhetherRevenueEnhancedType` varchar(2) NULL COMMENT '是否为收益增强型', +`AutoCallableWhetherFixedCouponNote` varchar(2) NULL COMMENT '是否为FCN型', +`AutoCallableWhetherKnockInPriceCoefficientIsVariable` varchar(2) NULL COMMENT '敲入价格系数是否可变', +`AutoCallableWhetherKnockOutPriceCoefficientIsVariable` varchar(2) NULL COMMENT '敲出价格系数是否可变', +`AutoCallableWhetherKnockOutYieldIsVariable` varchar(2) NULL COMMENT '敲出收益率是否可变', +`AutoCallableWhetherDividendYieldIsVariable` varchar(2) NULL COMMENT '红利收益率是否可变', +`AutoCallableBlank1` text NULL COMMENT '空白1', +`AutoCallableBlank2` text NULL COMMENT '空白2', +`RangeAccrualOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`RangeAccrualStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`RangeAccrualStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`RangeAccrualStrikePriceCoefficientThree` varchar(6) NULL COMMENT '行权价格系数3(%)', +`RangeAccrualStrikePriceCoefficientFour` varchar(6) NULL COMMENT '行权价格系数4(%)', +`RangeAccrualEngagementRate` varchar(6) NULL COMMENT '参与率(%)', +`RangeAccrualOneNonAnnualized` varchar(6) NULL COMMENT '收益率1(非年化)(%)', +`RangeAccrualTwoNonAnnualized` varchar(6) NULL COMMENT '收益率2(非年化)(%)', +`RangeAccrualThreeNonAnnualized` varchar(6) NULL COMMENT '收益率3(非年化)(%)', +`RangeAccrualFourNonAnnualized` varchar(6) NULL COMMENT '收益率4(非年化)(%)', +`RangeAccrualBlank1` text NULL COMMENT '空白1', +`RangeAccrualBlank2` text NULL COMMENT '空白2', +`AirbagOptionStructureSubclass` varchar(2) NULL COMMENT '期权结构小类', +`AirbagStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`AirbagStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`AirbagStrikePriceCoefficientThree` varchar(6) NULL COMMENT '行权价格系数3(%)', +`AirbagStrikePriceCoefficientFour` varchar(6) NULL COMMENT '行权价格系数4(%)', +`AirbagEngagementRateOne` varchar(6) NULL COMMENT '参与率1(%)', +`AirbagEngagementRateTwo` varchar(6) NULL COMMENT '参与率2(%)', +`AirbagEngagementRateThree` varchar(6) NULL COMMENT '参与率3(%)', +`AirbagKnockInPriceCoefficient` varchar(6) NULL COMMENT '敲入价格系数(%)', +`AirbagBackCoverYield` varchar(6) NULL COMMENT '封底收益率(非年化)(%)', +`AirbagCappingYield` varchar(6) NULL COMMENT '封顶收益率(非年化)(%)', +`AirbagBlank1` text NULL COMMENT '空白1', +`AirbagBlank2` text NULL COMMENT '空白2', +`OthersOptionStructureSubclass` text NULL COMMENT '期权结构类型', +`OthersStrikePriceCoefficientOne` varchar(6) NULL COMMENT '行权价格系数1(%)', +`OthersStrikePriceCoefficientTwo` varchar(6) NULL COMMENT '行权价格系数2(%)', +`OthersStrikePriceCoefficientThree` varchar(6) NULL COMMENT '行权价格系数3(%)', +`OthersStrikePriceCoefficientFour` varchar(6) NULL COMMENT '行权价格系数4(%)', +`OthersEngagementRateOne` varchar(6) NULL COMMENT '参与率1(%)', +`OthersEngagementRateTwo` varchar(6) NULL COMMENT '参与率2(%)', +`OthersEngagementRateThree` varchar(6) NULL COMMENT '参与率3(%)', +`OthersEngagementRateFour` varchar(6) NULL COMMENT '参与率4(%)', +`OthersBarrierPricesCoefficientOne` varchar(6) NULL COMMENT '障碍价格系数1(%)', +`OthersBarrierPricesCoefficientTwo` varchar(6) NULL COMMENT '障碍价格系数2(%)', +`OthersBackCoverYield` varchar(6) NULL COMMENT '封底收益率(非年化)(%)', +`OthersCappingYield` varchar(6) NULL COMMENT '封顶收益率(非年化)(%)', +`OthersBlank1` text NULL COMMENT '空白1', +`OthersBlank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '期权交易确认书'; +CREATE TABLE `A1004_UndrlygAsset` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `UndrlygAssetDtldType` varchar(2) NOT NULL COMMENT '标的小类', +`UndrlygAssetName` varchar(200) NOT NULL COMMENT '标的名称', +`UndrlygAssetTradgPlc` varchar(200) NOT NULL COMMENT '标的交易场所', +`UndrlygAssetCode` varchar(200) NOT NULL COMMENT '标的编码', +`UndrlygAssetAmt` varchar(37) NOT NULL COMMENT '标的数量', +`ContractMultiplier` varchar(37) NOT NULL COMMENT '合约乘数', +`UndrlygAssetNo` varchar(2) NOT NULL COMMENT '标的个数', +`MultiOrderOptionType` varchar(2) NULL COMMENT '多标的期权类型', +`UndrlygAssetNotinalPrincipleAmtRMB` varchar(37) NOT NULL COMMENT '标的名义本金(元)', +`OpeningPrice` varchar(37) NOT NULL COMMENT '标的价格', +`UndrlygAssetType` varchar(2) NULL COMMENT '标的类型', +`OpeningPriceCurrency` varchar(2) NULL COMMENT '标的价格货币', +`ConfirmationNo` varchar(32) NULL COMMENT '关联交易确认书编号', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '标的详情'; +CREATE TABLE `A1004_PerformanceGuaranteeAtt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `PerformanceCollType` varchar(2) NULL COMMENT '履约担保品类型', +`PerformanceGuaranteeType` varchar(2) NOT NULL COMMENT '履约担保类型', +`PerformanceCollRange` varchar(2) NULL COMMENT '担保品担保范围', +`MultiConfirmationID` text NULL COMMENT '多笔担保交易确认书编号', +`ConfirmationNo` varchar(32) NULL COMMENT '关联交易确认书编号', +`Remarks` text NULL COMMENT '备注', + + PRIMARY KEY (`id`) +) COMMENT = '履约担保品详情'; +CREATE TABLE `A1018_ValuationInformation` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`ValuationDate` varchar(10) NOT NULL COMMENT '估值日期', +`Balance` varchar(37) NOT NULL COMMENT '存量名义本金(元)', +`MarginRatio` varchar(8) NULL COMMENT '保证金比例(%)', +`OptionValuation` varchar(37) NOT NULL COMMENT '期权估值', +`Delta` varchar(37) NOT NULL COMMENT 'Delta', +`Gamma` varchar(37) NOT NULL COMMENT 'Gamma', +`Vega` varchar(37) NOT NULL COMMENT 'Vega', +`Theta` varchar(37) NOT NULL COMMENT 'Theta', +`Rho` varchar(37) NOT NULL COMMENT 'Rho', +`RhoQ` varchar(37) NULL COMMENT 'RhoQ', +`DeltaCash` varchar(37) NOT NULL COMMENT 'DeltaCash', +`GammaCash` varchar(37) NOT NULL COMMENT 'GammaCash', +`VegaCash` varchar(37) NOT NULL COMMENT 'VegaCash', +`ThetaCash` varchar(37) NULL COMMENT 'ThetaCash', +`RhoCash` varchar(37) NULL COMMENT 'RhoCash', +`RhoQCash` varchar(37) NULL COMMENT 'RhoQCash', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '场外期权合约估值信息'; +CREATE TABLE `A1019_ConfirmationAtt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`ConfirmationAtt` varchar(1024) NULL COMMENT '期权交易确认书附件', +`ConfirmationFiles` varchar(1024) NULL COMMENT '互换交易确认书附件', + + PRIMARY KEY (`id`) +) COMMENT = '交易确认书附件'; +CREATE TABLE `A1007_OptionTermination` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`BizID` varchar(50) NULL COMMENT '业务编号', +`DurationEventNO` varchar(6) NOT NULL COMMENT '操作事件编号', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`DurationOperationType` varchar(2) NOT NULL COMMENT '存续期操作类型', +`ExpirationDate` varchar(10) NOT NULL COMMENT '操作发生日期', +`RenewalDate` varchar(10) NULL COMMENT '展期后到期日', +`DefaultingParty` varchar(2) NULL COMMENT '违约方', +`DefaultEvent` text NULL COMMENT '违约事件说明', +`TerminationAmount` varchar(37) NULL COMMENT '名义本金变动(元)', +`Balance` varchar(37) NOT NULL COMMENT '存量名义本金(元)', +`AmountPaidThisTime` varchar(37) NULL COMMENT '本次支付金额(元)', +`ClosedTransactionsRealRateReturn` varchar(8) NULL COMMENT '已了结交易实际收益率(%)', +`OptionDurationManagementAtt` text NULL COMMENT '存续期信息附件', +`BarrierEventStatus` varchar(2) NULL COMMENT '障碍事件状态', +`TradeId` varchar(37) NULL COMMENT '本次支付金额', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '期权存续期报告'; +CREATE TABLE `A1005_SwapConfirmation` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `PaymentMethod` varchar(2) NULL COMMENT '支付方式', +`OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`MasterAgrmtNo` varchar(100) NOT NULL COMMENT '主协议编号(双方约定)', +`SupAgrmtNo` varchar(100) NOT NULL COMMENT '补充协议编号(双方约定)', +`ConfirmationID` varchar(32) NULL COMMENT '交易确认书编号', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`ConfirmationType` varchar(2) NOT NULL COMMENT '交易确认书类型', +`FillParty` varchar(2) NOT NULL COMMENT '填报方角色', +`SwapType` varchar(2) NOT NULL COMMENT '收益互换交易类型', +`StartDate` varchar(10) NOT NULL COMMENT '起始日', +`DueDate` varchar(10) NOT NULL COMMENT '到期日', +`SettlementDate` varchar(10) NULL COMMENT '结算日', +`Currency` varchar(2) NOT NULL COMMENT '结算货币', +`NotinalPrincipleAmt` varchar(37) NOT NULL COMMENT '名义本金(元)', +`ClearingAgency` varchar(2) NOT NULL COMMENT '清算机构', +`TradingPlace` varchar(2) NOT NULL COMMENT '交易场所', +`TradingPlaceOther` varchar(200) NULL COMMENT '交易场所(其他)', +`UndrlygAssetType` varchar(2) NOT NULL COMMENT '标的类型', +`ConfirmationRemark` text NULL COMMENT '基本信息备注', +`PerformanceGuaranteeType` varchar(2) NOT NULL COMMENT '履约担保类型', +`PerformanceCollProvider` varchar(2) NULL COMMENT '履约担保品提供方', +`PartyUseColl` varchar(6) NULL COMMENT '担保品收取方是否可使用担保品', +`CollInstruction` text NULL COMMENT '担保品使用说明', +`CalculateCollInterest` varchar(6) NULL COMMENT '是否计算担保品价值产生利息', +`PerformanceCollInitialRatio` varchar(6) NOT NULL COMMENT '履约担保品初始比率(%)', +`PerformanceCollAddtlRatio` varchar(6) NULL COMMENT '履约担保品追保比率(%)', +`PerformanceCollOffsetRatio` varchar(6) NULL COMMENT '履约担保品平仓比率(%)', +`MaintainGuaranteeRatio` varchar(6) NOT NULL COMMENT '维持担保比率(%)', +`PerformanceGuaranteeAtt` text NULL COMMENT '履约担保附件', +`PerformanceGuaranteeRemark` text NULL COMMENT '履约担保备注', +`Remark` text NULL COMMENT '备注', +`ComplianceOpinion` text NULL COMMENT '合规意见书', +`PtyAUndrlygAssetNo` varchar(2) NOT NULL COMMENT '标的个数', +`PtyAPrOfitCalculationInfo` text NOT NULL COMMENT '收益计算说明', +`PtyAProfitRemark` text NULL COMMENT '收益备注', +`PtyAPdctName` varchar(200) NULL COMMENT '甲方代签产品名称', +`PytAPdctCode` varchar(20) NULL COMMENT '甲方交易对手码(产品)', +`PtyBPdctName` varchar(200) NULL COMMENT '乙方代签产品名称', +`PytBPdctCode` varchar(20) NULL COMMENT '乙方交易对手码(产品)', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '互换交易确认书'; +CREATE TABLE `A1005_SwapPerformanceGuaranteeAtt` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `PerformanceCollType` varchar(2) NULL COMMENT '履约担保品类型', +`PerformanceCollRange` varchar(2) NULL COMMENT '担保品担保范围', +`MultiConfirmationID` text NULL COMMENT '多笔担保交易确认书编号', +`Remarks` text NULL COMMENT '备注', +`ConfirmationNo` varchar(100) NULL COMMENT '交易确认书编号', + + PRIMARY KEY (`id`) +) COMMENT = '履约担保品详情'; +CREATE TABLE `A1005_PaymentMethod` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `PaymentMethod` varchar(2) NOT NULL COMMENT '支付方式', +`Payer` varchar(2) NOT NULL COMMENT '支付方', +`PaymentFreq` varchar(2) NOT NULL COMMENT '支付频率', +`FixedInterestRate` varchar(8) NULL COMMENT '固定利率(%)', +`FloatInterestRate` varchar(2) NULL COMMENT '浮动利率类型', +`ReferenceofFloatingInterestRate` varchar(200) NULL COMMENT '浮动利率参考标的', +`BasePoint` varchar(20) NULL COMMENT '浮动基点', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', +`ConfirmationNo` varchar(100) NULL COMMENT '交易确认书编号', + + PRIMARY KEY (`id`) +) COMMENT = '收益互换交易费用端支付'; +CREATE TABLE `A1016_SwapEquityPayment` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书(双方约定)', +`DurationEventNO` varchar(6) NULL COMMENT '操作事件编号', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '收益互换交易权益端支付'; +CREATE TABLE `A1016_SwapEquityPaymentTuple` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `PaymentMethod` varchar(2) NOT NULL COMMENT '支付方式', +`Payer` varchar(2) NOT NULL COMMENT '支付方', +`PaymentFreq` varchar(2) NOT NULL COMMENT '支付频率', +`OpenandClosingDate` varchar(10) NOT NULL COMMENT '标的开/平仓日期', +`UndrlygAssetDtldType` varchar(2) NOT NULL COMMENT '标的小类', +`UndrlygAssetCode` varchar(200) NOT NULL COMMENT '挂钩标的编码', +`UndrlygAssetName` varchar(200) NOT NULL COMMENT '标的名称', +`UndrlygAssetTradgPlc` varchar(200) NOT NULL COMMENT '标的交易场所', +`UndrlygAssetPrice` varchar(37) NOT NULL COMMENT '标的价格', +`UndrlygAssetPosition` varchar(2) NOT NULL COMMENT '开平仓', +`UndrlygAssetAmt` varchar(37) NOT NULL COMMENT '标的数量', +`ContractMultiplier` varchar(37) NOT NULL COMMENT '合约乘数', +`LNotinalPrincipleAmt` varchar(37) NULL COMMENT '多头名义本金(元)', +`SNotinalPrincipleAmt` varchar(37) NULL COMMENT '空头名义本金(元)', +`InterestRate` varchar(8) NULL COMMENT '利率(%)', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', +`ConfirmationNo` varchar(100) NULL COMMENT '交易确认书编号', + + PRIMARY KEY (`id`) +) COMMENT = '权益端支付'; +CREATE TABLE `A1006_SwapDurationManagement` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期',`PaymentMethod` varchar(2) NOT NULL COMMENT '支付方式', +`OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`SwapType` varchar(2) NOT NULL COMMENT '收益互换交易类型', +`DurationEventNO` varchar(6) NOT NULL COMMENT '操作事件编号', +`ConfirmationNo` varchar(100) NOT NULL COMMENT '交易确认书编号(双方约定)', +`DurationOperationType` varchar(2) NOT NULL COMMENT '存续期操作类型', +`DurationOperationDate` varchar(10) NOT NULL COMMENT '操作发生日期', +`RenewalDate` varchar(10) NULL COMMENT '展期后到期日', +`DefaultingParty` varchar(2) NULL COMMENT '违约方', +`DefaultEvent` text NULL COMMENT '违约事件说明', +`ChangeAmount` varchar(37) NULL COMMENT '名义本金变动(元)', +`Balance` varchar(37) NOT NULL COMMENT '存量名义本金(元)', +`AmountPaidThisTime` varchar(37) NULL COMMENT '本次支付金额(元)', +`MarginRatio` varchar(8) NOT NULL COMMENT '保证金比例(%)', +`SwapDurationManagementAtt` text NULL COMMENT '存续期信息附件', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', + + PRIMARY KEY (`id`) +) COMMENT = '收益互换交易存续期管理'; +CREATE TABLE `A1006_CurrentPositionDetail` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `UndrlygAssetCode` varchar(200) NOT NULL COMMENT '挂钩标的编码', +`UndrlygAssetDtldType` varchar(2) NOT NULL COMMENT '标的小类', +`UndrlygAssetName` varchar(200) NOT NULL COMMENT '标的名称', +`UndrlygAssetTradgPlc` varchar(200) NOT NULL COMMENT '标的交易场所', +`UndrlygAssetPrice` varchar(37) NOT NULL COMMENT '标的价格', +`InvestorPosition` varchar(2) NOT NULL COMMENT '客户持仓方向', +`UndrlygAssetAmt` varchar(37) NOT NULL COMMENT '标的数量', +`ContractMultiplier` varchar(37) NOT NULL COMMENT '合约乘数', +`NotinalPrincipleAmt` varchar(37) NOT NULL COMMENT '名义本金(元)', +`Blank1` text NULL COMMENT '空白1', +`Blank2` text NULL COMMENT '空白2', +`ConfirmationNo` varchar(100) NULL COMMENT '交易确认书编号', + + PRIMARY KEY (`id`) +) COMMENT = '合约持仓明细'; +CREATE TABLE `A1011_PeriodicReportSAC` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`BizID` varchar(50) NULL COMMENT '业务编号', +`Year` varchar(4) NOT NULL COMMENT '年份', +`Month` varchar(2) NOT NULL COMMENT '月份', +`MainAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增主协议(笔)', +`MainAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计主协议(笔)', +`MainAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '截至月末存续主协议数量(笔)', +`SupplementalAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增补充协议(笔)', +`SupplementalAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计补充协议(笔)', +`SupplementalAgreementValidedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '截至月末存续补充协议数量(笔)', +`PerformanceGuaranteeAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增履约担保协议(笔)', +`PerformanceGuaranteeAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计履约担保协议(笔)', +`PerformanceGuaranteeAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '截至月末存续履约担保协议数量(笔)', +`TransactionConfirmationAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增交易确认书(笔)', +`TransactionConfirmationBookAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计交易确认书(笔)', +`TransactionConfirmationValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '截至月末存续交易确认书数量', +`ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence` varchar(37) NOT NULL COMMENT '开展场外个股期权业务对应的自营权益类证券及衍生品规模(元)', +`NetCapitalAtEndOfTheMonth` varchar(37) NOT NULL COMMENT '本月末净资本(元)', +`ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital` varchar(37) NOT NULL COMMENT '开展场外个股期权业务对应的自营权益类证券及衍生品规模占净资本比例(%)', +`OTCOptionHasSignedByLegalPerson` varchar(20) NOT NULL COMMENT '场外期权已签约法人(家)', +`OTCOptionsHaveContractedProducts` varchar(20) NOT NULL COMMENT '场外期权已签约产品(家)', +`OTCOptionsForTheMonthOfTheNewAddLegalPerson` varchar(20) NOT NULL COMMENT '场外期权当月新增法人(家)', +`OTCOptionsForTheMonthOfTheNewAddProduct` varchar(20) NOT NULL COMMENT '场外期权当月新增产品(家)', +`OTCOptionsLegalPersonInDurationForThisMouth` varchar(20) NOT NULL COMMENT '场外期权当月末存续法人(家)', +`OTCOptionsProductsInDurationForThisMouth` varchar(20) NOT NULL COMMENT '场外期权当月末存续产品(家)', +`IncomeSwapHasSignedLegalPersonNumber` varchar(20) NOT NULL COMMENT '收益互换已签约法人(家)', +`IncomeSwapHasSignedProductNumber` varchar(20) NOT NULL COMMENT '收益互换已签约产品(家)', +`IncomeSwapForTheMonthOfTheNewAddLegalPerson` varchar(20) NOT NULL COMMENT '收益互换当月新增法人(家)', +`IncomeSwapForTheMonthOfTheNewAddProduct` varchar(20) NOT NULL COMMENT '收益互换当月新增产品(家)', +`IncomeSwapLegalPersonInDurationForThisMouth` varchar(20) NOT NULL COMMENT '收益互换当月末存续法人(家)', +`IncomeSwapProductsInDurationForThisMouth` varchar(20) NOT NULL COMMENT '收益互换当月末存续产品(家)', +`OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale` varchar(37) NOT NULL COMMENT '场外期权境内股指上月末存续规模(亿元)', +`OTCOptionsWithinIndividualStocksLateLastMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权境内个股上月末存续期规模(亿元)', +`OTCOptionsCommoditiesLastMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权大宗商品上月末存续期规模(亿元)', +`OTCOptionsOtherSubjectLastMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权其他标的上月末存续期规模(亿元)', +`RevenueExchangeDomesticStockIndexLastMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换境内股指上月末存续规模(亿元)', +`RevenueExchangeDomesticIndividualStocksLastMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换境内个股上月末存续规模(亿元)', +`RevenueExchangeCommoditiesLastMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换大宗商品上月末存续规模(亿元)', +`RevenueExchangeOtherSubjectLastMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换其他标的上月末存续规模(亿元)', +`TotalOfLastMonthDurationScale` varchar(37) NOT NULL COMMENT '上月末存续规模合计(亿元)', +`OTCOptionsWithinTheIndexThisMonthOfTheNewScale` varchar(37) NOT NULL COMMENT '场外期权境内股指本月新增规模(亿元)', +`OTCOptionsToAddScaleDomesticStocksInThisMonth` varchar(37) NOT NULL COMMENT '场外期权境内个股本月新增规模(亿元)', +`OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '场外期权大宗商品本月新增规模(亿元)', +`OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '场外期权其他标的本月新增规模(亿元)', +`RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '收益互换境内股指本月新增规模(亿元)', +`RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '收益互换境内个股本月新增规模(亿元)', +`RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '收益互换大宗商品本月新增规模(亿元)', +`RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '收益互换其他标的本月新增规模(亿元)', +`TotalOfTheNewSizeOfTheIncreaseInThisMonth` varchar(37) NOT NULL COMMENT '本月新增规模合计(亿元)', +`OTCOptionsTerminateScaleDomesticStockIndexThisMonth` varchar(37) NOT NULL COMMENT '场外期权境内股指本月终止规模(亿元)', +`OTCOptionsTerminateScaleDomesticStocksInThisMonth` varchar(37) NOT NULL COMMENT '场外期权境内个股本月终止规模(亿元)', +`OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '场外期权大宗商品本月终止规模(亿元)', +`OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '场外期权其他标的本月终止规模(亿元)', +`RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '收益互换境内股指本月终止规模(亿元)', +`RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '收益互换境内个股本月终止规模(亿元)', +`RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '收益互换大宗商品本月终止规模(亿元)', +`RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '收益互换其他标的本月终止规模(亿元)', +`TotalOfTerminationOfTheScaleOfThisMonth` varchar(37) NOT NULL COMMENT '本月终止规模合计(亿元)', +`OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale` varchar(37) NOT NULL COMMENT '场外期权境内股指本月末存续规模(亿元)', +`OTCOptionsWithinIndividualStocksInThisMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权境内个股本月末存续规模(亿元)', +`OTCOptionsCommoditiesInThisMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权大宗商品本月末存续规模(亿元)', +`OTCOptionsOtherSubjectThisMonthDurationScale` varchar(37) NOT NULL COMMENT '场外期权其他标的本月末存续期规模(亿元)', +`RevenueExchangeDomesticStockIndexThisMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换境内股指本月末存续规模(亿元)', +`RevenueExchangeDomesticIndividualStocksThisMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换境内个股本月末存续规模(亿元)', +`RevenueExchangeCommoditiesThisMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换大宗商品本月末存续规模(亿元)', +`RevenueExchangeOtherSubjectThisMonthDurationScale` varchar(37) NOT NULL COMMENT '收益互换其他标的本月末存续规模(亿元)', +`TotalOfThisMonthDurationScale` varchar(37) NOT NULL COMMENT '本月末存续规模合计(亿元)', +`OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory` varchar(37) NOT NULL COMMENT '场外期权境内股指本年累计新增规模(亿元)', +`OTCOptionsStockThisYearCumulativeScaleOfNewTerritory` varchar(37) NOT NULL COMMENT '场外期权境内个股本年累计新增规模(亿元)', +`OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory` varchar(37) NOT NULL COMMENT '场外期权大宗商品本年累计新增规模(亿元)', +`OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory` varchar(37) NOT NULL COMMENT '场外期权其他标的本年累计新增规模(亿元)', +`IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear` varchar(37) NOT NULL COMMENT '收益互换境内股指本年累计新增规模(亿元)', +`IncomeSwapDomesticStockHasAddedNewScaleInThisYear` varchar(37) NOT NULL COMMENT '收益互换境内个股本年累计新增规模(亿元)', +`IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear` varchar(37) NOT NULL COMMENT '收益互换大宗商品本年累计新增规模(亿元)', +`IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear` varchar(37) NOT NULL COMMENT '收益互换其他标的本年累计新增规模(亿元)', +`TotalNewScaleInThisYear` varchar(37) NOT NULL COMMENT '本年累计新增规模规模合计(亿元)', +`OTCOptionsStockIndexAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '场外期权境内股指上月末存续合约笔数(笔)', +`OTCOptionsStockAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '场外期权境内个股上月末存续合约笔数(笔)', +`OTCOptionsCommoditiesAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '场外期权大宗商品上月末存续合约笔数(笔)', +`OTCOptionsOtherSubjectAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '场外期权其他标的上月末存续合约笔数(笔)', +`IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '收益互换境内股指上月末存续合约笔数(笔)', +`IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '收益互换境内个股上月末存续合约笔数(笔)', +`IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '收益互换大宗商品上月末存续合约笔数(笔)', +`IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '收益互换其他标的上月末存续合约笔数(笔)', +`TotalNumberOfContractsAtTheEndOfLastMonth` varchar(20) NOT NULL COMMENT '上月末存续合约笔数规模合计(笔)', +`OTCOptionsStockIndexThisMonthNewDomesticContractNumber` varchar(20) NOT NULL COMMENT '场外期权境内股指本月新增合约笔数(笔)', +`OTCOptionsStockThisMonthNewDomesticContractNumber` varchar(20) NOT NULL COMMENT '场外期权境内个股本月新增合约笔数(笔)', +`OTCOptionsCommoditiesThisMonthNewDomesticContractNumber` varchar(20) NOT NULL COMMENT '场外期权大宗商品本月新增合约笔数(笔)', +`OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber` varchar(20) NOT NULL COMMENT '场外期权其他标的本月新增合约笔数(笔)', +`IncomeSwapDomesticStockIndexNewContractInThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内股指本月新增合约笔数(笔)', +`IncomeSwapDomesticStockNewContractInThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内个股本月新增合约笔数(笔)', +`IncomeSwapCommoditiesNewContractInThisMonth` varchar(20) NOT NULL COMMENT '收益互换大宗商品本月新增合约笔数(笔)', +`IncomeSwapOtherSubjectNewContractInThisMonth` varchar(20) NOT NULL COMMENT '收益互换其他标的本月新增合约笔数(笔)', +`TotalNumberOfNewContractsInThisMonth` varchar(20) NOT NULL COMMENT '本月新增合约笔数规模合计(笔)', +`OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber` varchar(20) NOT NULL COMMENT '场外期权境内股指本月终止合约笔数(笔)', +`OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber` varchar(20) NOT NULL COMMENT '场外期权境内个股本月终止合约笔数(笔)', +`OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber` varchar(20) NOT NULL COMMENT '场外期权大宗商品本月终止合约笔数(笔)', +`OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber` varchar(20) NOT NULL COMMENT '场外期权其他标的本月终止合约笔数(笔)', +`IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内股指本月终止合约笔数(笔)', +`IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内个股本月终止合约笔数(笔)', +`IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth` varchar(20) NOT NULL COMMENT '收益互换大宗商品本月终止合约笔数(笔)', +`IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth` varchar(20) NOT NULL COMMENT '收益互换其他标的本月终止合约笔数(笔)', +`TotalNumberOfContractsTerminatedThisMonth` varchar(20) NOT NULL COMMENT '本月终止合约笔数规模合计(笔)', +`OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '场外期权境内股指本月末存续合约笔数(笔)', +`OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '场外期权境内个股本月末存续合约笔数(笔)', +`OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '场外期权大宗商品本月末存续合约笔数(笔)', +`OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '场外期权其他标的本月末存续合约笔数(笔)', +`IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内股指本月末存续合约笔数(笔)', +`IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '收益互换境内个股本月末存续合约笔数(笔)', +`IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '收益互换大宗商品本月末存续合约笔数(笔)', +`IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '收益互换其他标的本月末存续合约笔数(笔)', +`TotalNumberOfContractsAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末存续合约笔数规模合计(笔)', +`OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear` varchar(20) NOT NULL COMMENT '场外期权境内股指本年累计新增合约笔数(笔)', +`OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear` varchar(20) NOT NULL COMMENT '场外期权境内个股本年累计新增合约笔数(笔)', +`OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear` varchar(20) NOT NULL COMMENT '场外期权大宗商品本年累计新增合约笔数(笔)', +`OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear` varchar(20) NOT NULL COMMENT '场外期权其他标的本年累计新增合约笔数(笔)', +`IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear` varchar(20) NOT NULL COMMENT '收益互换境内股指本年累计新增合约笔数(笔)', +`IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear` varchar(20) NOT NULL COMMENT '收益互换境内个股本年累计新增合约笔数(笔)', +`IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear` varchar(20) NOT NULL COMMENT '收益互换大宗商品本年累计新增合约笔数(笔)', +`IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear` varchar(20) NOT NULL COMMENT '收益互换其他标的本年累计新增合约笔数(笔)', +`TotalNumberOfNewContractsInThisYear` varchar(20) NOT NULL COMMENT '本年累计新增合约笔数规模合计(笔)', +`TotalNominalPrincipalAmountOfSwapThisMonth` varchar(37) NOT NULL COMMENT '本月末互换存量名义本金总额(亿元)', +`TotalNominalPrincipalAmountOfSwapLastMonth` varchar(37) NOT NULL COMMENT '上月末互换存量名义本金总额(亿元)', +`TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth` varchar(37) NOT NULL COMMENT '本月末互换存量交易对应履约担保品价值(元)', +`TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth` varchar(37) NOT NULL COMMENT '上月末互换存量交易对应履约担保品价值(元)', +`SwapCashCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末互换现金担保物价值(元)', +`SwapCashCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末互换现金担保物价值(元)', +`SwapSecuritiesCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末互换证券担保物价值(元)', +`SwapSecuritiesCollateralValueLastMonthThisMonth` varchar(37) NOT NULL COMMENT '上月末互换证券担保物价值(元)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull` varchar(37) NOT NULL COMMENT '本月末互换业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull` varchar(37) NOT NULL COMMENT '上月末互换业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet` varchar(37) NOT NULL COMMENT '本月末互换业务整体履约担保比例(净额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet` varchar(37) NOT NULL COMMENT '上月末互换业务整体履约担保比例(净额)(%)', +`SwapNumberOfDefaultCustomersAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末互换本月违约客户数(家)', +`SwapNumberOfDefaultCustomersAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末互换本月违约客户数(家)', +`SwapDefaultTransactionNumberAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末互换本月违约交易数(笔)', +`SwapDefaultTransactionNumberAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末互换本月违约交易数(笔)', +`TotalSwapDefaultCustomerNumberInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末互换本年累计违约客户数(家)', +`TotalSwapDefaultCustomerNumberInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末互换本年累计违约客户数(家)', +`SwapNumberOfDefaultCustomersInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末互换本年累计违约交易数(笔)', +`SwapNumberOfDefaultCustomersInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末互换本年累计违约交易数(笔)', +`StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末存量交易对应履约担保品价值(元)', +`StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末存量交易对应履约担保品价值(元)', +`CashBalanceAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有现金余额(元)', +`CashBalanceAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有现金余额(元)', +`HoldStockMarketValueAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有股票市值(元)', +`HoldStockMarketValueAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有股票市值(元)', +`HoldMarketValueOfBondsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有债券市值(元)', +`HoldMarketValueOfBondsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有债券市值(元)', +`OwnedAssetManagementProductsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有证券公司资产管理产品(元)', +`OwnedAssetManagementProductsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有证券公司资产管理产品(元)', +`OwnedBankFinanceAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有银行理财(元)', +`OwnedBankFinanceAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有银行理财(元)', +`HoldTrustProductAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有信托产品(元)', +`HoldTrustProductAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有信托产品(元)', +`InsuranceProductsAreHeldAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有保险产品(元)', +`InsuranceProductsAreHeldAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有保险产品(元)', +`HoldOtherProductsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有其他产品(元)', +`HoldOtherProductsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有其他产品(元)', +`SettledSwapItemsAtThisMonth` varchar(20) NOT NULL COMMENT '互换本月了结笔数(笔)', +`SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth` varchar(37) NOT NULL COMMENT '互换本月了结交易涉及名义本金(亿元)', +`SwapIncomeCashFlow` varchar(37) NOT NULL COMMENT '互换收入现金流(万元)', +`SwapExpensesCashFlow` varchar(37) NOT NULL COMMENT '互换支出现金流(万元)', +`CashFlowCorrespondingToNetIncomeOnSwapMargin` varchar(37) NOT NULL COMMENT '互换使用保证金形成的净收益对应现金流(万元)', +`SwapHedgeCost` varchar(37) NOT NULL COMMENT '互换对冲成本(万元)', +`SettledOptionItemsAtThisMonth` varchar(20) NOT NULL COMMENT '期权本月了结笔数(笔)', +`SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth` varchar(37) NOT NULL COMMENT '期权本月了结交易涉及名义本金(亿元)', +`OptionPremiumIncome` varchar(37) NOT NULL COMMENT '期权权利金收入(万元)', +`OptionHedgeCost` varchar(37) NOT NULL COMMENT '期权对冲成本(万元)', +`BalanceOfSwapRealizedGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '互换合约端损益本月发生额(万元)', +`BalanceOfOptionRealizedGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '期权合约端损益本月发生额(万元)', +`BalanceOfSwapRealizedGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '互换合约端损益本年累计额(万元)', +`BalanceOfOptionRealizedGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '期权合约端损益本年累计额(万元)', +`BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth` varchar(37) NOT NULL COMMENT '互换对冲端损益本月发生额(万元)', +`BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth` varchar(37) NOT NULL COMMENT '期权对冲端损益本月发生额(万元)', +`BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear` varchar(37) NOT NULL COMMENT '互换对冲端损益本年累计额(万元)', +`BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear` varchar(37) NOT NULL COMMENT '期权对冲端损益本年累计额(万元)', +`BalanceOfSwapTotalGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '互换损益合计本月发生额(万元)', +`BalanceOfOptionTotalGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '期权损益合计本月发生额(万元)', +`BalanceOfSwapTotalGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '互换损益合计本年累计额(万元)', +`BalanceOfOptionTotalGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '期权损益合计本年累计额(万元)', +`MarginOfSubsistSwap` varchar(37) NOT NULL COMMENT '收益互换整体业务存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfSwap` varchar(37) NOT NULL COMMENT '收益互换整体业务对冲持仓市值(元)', +`LeverageRatiOfSwap` varchar(6) NOT NULL COMMENT '收益互换整体业务杠杆率(%)', +`MarginOfSubsistStockIndexSwap` varchar(37) NOT NULL COMMENT '收益互换股指标的存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfStockIndexSwap` varchar(37) NOT NULL COMMENT '收益互换股指标的对冲持仓市值(元)', +`LeverageRatioOfStockIndexSwap` varchar(6) NOT NULL COMMENT '收益互换股指标的杠杆率(%)', +`MarginOfSubsistStockSwap` varchar(37) NOT NULL COMMENT '收益互换个股标的存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfStockSwap` varchar(37) NOT NULL COMMENT '收益互换个股标的对冲持仓市值(元)', +`LeverageRatioOfStockSwap` varchar(6) NOT NULL COMMENT '收益互换个股标的杠杆率(%)', +`MarginandPremiumOfSubsistOption` varchar(37) NOT NULL COMMENT '场外期权整体业务存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfOption` varchar(37) NOT NULL COMMENT '场外期权整体业务对冲持仓市值(元)', +`LeverageRatioOfOption` varchar(6) NOT NULL COMMENT '场外期权整体业务杠杆率(%)', +`MarginandPremiumOfSubsistStockIndexOption` varchar(37) NOT NULL COMMENT '场外期权股指标的存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfStockIndexOption` varchar(37) NOT NULL COMMENT '场外期权股指标的对冲持仓市值(元)', +`LeverageRatioOfStockIndexOption` varchar(6) NOT NULL COMMENT '场外期权股指标的杠杆率(%)', +`MarginandPremiumOfSubsistStockOption` varchar(37) NOT NULL COMMENT '场外期权个股标的存量对应保证金(元)+期权费(元)', +`HedgedMarketValueOfStockOption` varchar(37) NOT NULL COMMENT '场外期权个股标的对冲持仓市值(元)', +`LeverageRatioOfStockOption` varchar(6) NOT NULL COMMENT '场外期权个股标的杠杆率(%)', +`TotalNominalPrincipalAmountOfOptionThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权存量名义本金总额(亿元)', +`TotalNominalPrincipalAmountOfOptionLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权存量名义本金总额(亿元)', +`TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权存量交易对应履约担保品价值(元)', +`TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权存量交易对应履约担保品价值(元)', +`OptionCashCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权现金担保物价值(元)', +`OptionCashCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权现金担保物价值(元)', +`OptionSecuritiesCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权证券担保物价值(元)', +`OptionSecuritiesCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权证券担保物价值(元)', +`ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull` varchar(37) NOT NULL COMMENT '本月末场外期权业务整体履约担保比例全额(%)', +`ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull` varchar(37) NOT NULL COMMENT '上月末场外期权业务整体履约担保比例全额(%)', +`ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet` varchar(37) NOT NULL COMMENT '本月末场外期权业务整体履约担保比例净额(%)', +`ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet` varchar(37) NOT NULL COMMENT '上月末场外期权业务整体履约担保比例净额(%)', +`OptionNumberOfDefaultCustomersAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本月违约客户数(家)', +`OptionNumberOfDefaultCustomersAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本月违约客户数(家)', +`OptionTransactionNumberAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本月违约交易数(笔)', +`OptionTransactionNumberAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本月违约交易数(笔)', +`TotalOptionDefaultCustomerNumberInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本年累计违约客户数(家)', +`TotalOptionDefaultCustomerNumberInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本年累计违约客户数(家)', +`OptionNumberOfDefaultCustomersInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本年累计违约交易数(笔)', +`OptionNumberOfDefaultCustomersInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本年累计违约交易数(笔)', + + PRIMARY KEY (`id`) +) COMMENT = 'SAC月报'; +CREATE TABLE `A1011_TargetCaseAndHedge` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`SumInvestmentTargetType` varchar(2) NULL COMMENT '标的分类', +`SumInvestmentTargetName` varchar(200) NULL COMMENT '标的名称/品种名称', +`UndrlygAssetCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`BuyingImpulseVolume` varchar(37) NULL COMMENT '买入对冲交易量(元)', +`SellingImpulseVolume` varchar(37) NULL COMMENT '卖出对冲交易量(元)', +`ImpulseVolume` varchar(37) NULL COMMENT '对冲交易量(元)(买入+卖出)', +`PositionAtTheEndOfThisMonth` varchar(37) NULL COMMENT '本月末持仓规模/合约价值(元)', +`TheNumberOfPositionsHeldAtTheEndOfThisMonth` varchar(37) NULL COMMENT '本月末持仓数量(股/手)', +`AveragePriceAtTheEndOfTheMonth` varchar(37) NULL COMMENT '本月末持仓平均价格(元)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '标的情况与对冲'; +CREATE TABLE `A1011_InventoryBusinessDetailsAtTheEndOfThisMonth` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手名称(全称)', +`NameOfCounterpartyProduct` varchar(100) NULL COMMENT '交易对手产品名称(如有)', +`TradeConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(双方约定)', +`TransactionConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(报告库编号)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`NotionalPrincipalAmountLNotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(或多头名义本金)(元)', +`SNotionalPrincipalAmount` varchar(37) NULL COMMENT '空头名义本金(元)(多空组合填写)', +`StartDay` varchar(10) NULL COMMENT '起始日(T日)', +`DueDate` varchar(10) NULL COMMENT '到期日', +`SumInvestmentTargetType` varchar(2) NULL COMMENT '标的类型', +`UndrlygAssetName` varchar(200) NULL COMMENT '标的名称', +`UndrlygAssetCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`OptionSumInvestmentTargetType` varchar(2) NULL COMMENT '期权标的小类(场外期权填写)', +`ExchangeSumInvestmentTargetType` varchar(2) NULL COMMENT '收益互换标的小类(收益互换填写)', +`OptionFee` varchar(6) NULL COMMENT '期权费(非年化)(%)', +`OptionType` varchar(2) NULL COMMENT '期权结构类型(期权填写)', +`MaitainMarginRation` varchar(37) NULL COMMENT '本月末维持保证金比例(%)', +`CorrelationCoefficient` varchar(20) NULL COMMENT '标的相关系数', +`LongPositionContractValue` varchar(37) NULL COMMENT '多头合约价值(元)', +`ShortPositionContractValue` varchar(37) NULL COMMENT '空头合约价值(元)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '本月末存量业务明细'; +CREATE TABLE `A1011_IncreaseBusinessDetailsThisMonth` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手名称(全称)', +`CounterpartyProductName` varchar(100) NULL COMMENT '交易对手产品名称(如有)', +`TradeConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(双方约定)', +`TransactionConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(报告库编号)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`NotionalPrincipalAmountLNotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(或多头名义本金)(元)', +`SNotionalPrincipalAmount` varchar(37) NULL COMMENT '空头名义本金(元)(多空组合填写)', +`StartDate` varchar(10) NULL COMMENT '起始日(T日)', +`DueDate` varchar(10) NULL COMMENT '到期日', +`InvestmentTargetType` varchar(2) NULL COMMENT '标的类型', +`UndrlygAssetName` varchar(200) NULL COMMENT '标的名称', +`UndrlygAssetCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`OptionObjectSecondClass` varchar(2) NULL COMMENT '期权标的小类(场外期权填写)', +`ReturnSwapObjectSecondClass` varchar(2) NULL COMMENT '收益互换标的小类(收益互换填写)', +`NonAnnualOptionFee` varchar(6) NULL COMMENT '期权费(非年化)(%)', +`OptionType` varchar(2) NULL COMMENT '期权结构类型(期权填写)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '本月新增业务明细'; +CREATE TABLE `A1012_PeriodicReportNAFMII` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`BizID` varchar(50) NULL COMMENT '业务编号', +`Year` varchar(4) NOT NULL COMMENT '年份', +`Month` varchar(2) NOT NULL COMMENT '月份', +`MainAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计主协议(笔)', +`MainAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增主协议(笔)', +`MainAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计主协议(笔)', +`MainAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效主协议(笔)', +`SupplementalAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计补充协议(笔)', +`SupplementalAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增补充协议(笔)', +`SupplementalAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计补充协议(笔)', +`SupplementalAgreementValidedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效补充协议(笔)', +`PerformanceGuaranteeAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计履约担保协议(笔)', +`PerformanceGuaranteeAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增履约担保协议(笔)', +`PerformanceGuaranteeAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计履约担保协议(笔)', +`PerformanceGuaranteeAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效履约担保协议(笔)', +`TransactionConfirmationLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计交易确认书(笔)', +`TransactionConfirmationAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增交易确认书(笔)', +`TransactionConfirmationBookAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计交易确认书(笔)', +`TransactionConfirmationValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效交易确认书(笔)', +`NominalPrincipalInterestRateTradedAtTheBeginningOfThisMonth` varchar(37) NOT NULL COMMENT '本月初利率类存续交易名义本金(亿元)', +`NominalPrincipalRateIncreasesThisMonth` varchar(37) NOT NULL COMMENT '本月新增利率类交易名义本金(亿元)', +`NominalPrincipalRateIsSettledThisMonth` varchar(37) NOT NULL COMMENT '本月了结利率类交易名义本金(亿元)', +`NominalPrincipalRateRemainsTradedAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末利率类存续交易名义本金(亿元)', +`NominalPrincipalRateAsOfTheEndOfThisMonthToAddTransactions` varchar(37) NOT NULL COMMENT '截至本月末利率类年度新增交易名义本金(亿元)', +`ContractsInterestRateTradedAtTheBeginningOfThisMonth` varchar(20) NOT NULL COMMENT '本月初利率类存续交易合约笔数(笔)', +`NumberOfContractedInterestRatesThisMonthToAddTransactions` varchar(20) NOT NULL COMMENT '本月利率类新增交易合约笔数(笔)', +`AmountOfInterestInTheContractIsSettledThisMonth` varchar(20) NOT NULL COMMENT '合约笔数利率本月了结交易(笔)', +`ContractInterestRatesRemainTradedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末利率类存续交易合约笔数(笔)', +`ContractsInterestRateAsOfTheEndOfThisMonthAddNewTransactions` varchar(20) NOT NULL COMMENT '截至本月末利率类年度新增交易合约笔数(笔)', +`NominalPrincipalGoldTradedAtTheBeginningOfThisMonth` varchar(37) NOT NULL COMMENT '本月初黄金类存续交易名义本金(亿元)', +`NominalGoldThisMonthToAddTransactions` varchar(37) NOT NULL COMMENT '本月黄金类新增交易名义本金(亿元)', +`TheNominalGoldIsTradingThisMonth` varchar(37) NOT NULL COMMENT '本月了结黄金类交易名义本金(亿元)', +`NominalPrincipalGoldIsTradedAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末黄金类存续交易名义本金(亿元)', +`NominalPrincipalGoldAsOfTheEndOfThisYearTheNewTransaction` varchar(37) NOT NULL COMMENT '截至本月末黄金类年度新增交易名义本金(亿元)', +`TheNumberOfContractsForGoldIsTradedAtTheBeginningOfThisMonth` varchar(20) NOT NULL COMMENT '本月初黄金类存续交易合约笔数(笔)', +`TheNumberOfContractsGoldThisMonthToAddTransactions` varchar(20) NOT NULL COMMENT '本月黄金类新增交易合约笔数(笔)', +`TheNumberOfContractsIsGoldThisMonth` varchar(20) NOT NULL COMMENT '本月了结黄金类交易(笔)', +`TheNumberOfContractsIsGoldAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末黄金类存续交易合约笔数(笔)', +`TheNumberOfContractsForTheGoldAsOfTheEndOfThisYearTheNewTransaction` varchar(20) NOT NULL COMMENT '截至本月末年度黄金类新增交易合约笔数(笔)', +`NominalPrincipalForeignExchangeTradedAtTheBeginningOfThisMonth` varchar(37) NOT NULL COMMENT '本月初外汇类存续交易名义本金(亿元)', +`NominalPrincipalForeignExchangeThisMonthToAddTransactions` varchar(37) NOT NULL COMMENT '本月新增外汇类交易名义本金(亿元)', +`TheNominalPrincipalForeignExchangeSettledThisMonth` varchar(37) NOT NULL COMMENT '本月了结外汇类交易名义本金(亿元)', +`NominalPrincipalForeignExchangeTradedAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末存续外汇类交易名义本金(亿元)', +`NominalPrincipalForeignExchangeAsOfTheEndOfThisYearTheNewTransaction` varchar(37) NOT NULL COMMENT '截至本月末年度外汇类新增交易名义本金(亿元)', +`ContractsForeignExchangeIsTradedAtTheBeginningOfThisMonth` varchar(20) NOT NULL COMMENT '本月初外汇类存续交易合约笔数(笔)', +`ContractNumberForeignExchangeThisMonthNewTransaction` varchar(20) NOT NULL COMMENT '本月外汇类新增交易合约笔数(笔)', +`TheNumberOfContractsForForeignExchangeTransactionsThisMonth` varchar(20) NOT NULL COMMENT '本月外汇类了结交易合约笔数(笔)', +`ContractsForeignExchangeIsTradedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末外汇类存续交易合约笔数(笔)', +`NumberOfContractsForeignExchangeAsOfTheEndOfThisMonthTheNewTransaction` varchar(20) NOT NULL COMMENT '截至本月末外汇类年度新增交易合约笔数(笔)', +`TheNameOfThePrincipalOtherTransactionsHeldEarlierThisMonth` varchar(37) NOT NULL COMMENT '本月初其他类存续交易名义本金(亿元)', +`NominalPrincipalOtherNewTransactionsThisMonth` varchar(37) NOT NULL COMMENT '本月其他类新增交易名义本金(亿元)', +`TheNameOfThePrincipalOtherTransactionsThisMonth` varchar(37) NOT NULL COMMENT '本月其他类了结交易名义本金(亿元)', +`NominalPrincipalOtherTransactionsRemainAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末其他类存续交易名义本金(亿元)', +`NominalPrincipalOtherTransactionsUpToTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '截至本月末其他类年度新增交易名义本金(亿元)', +`TheNumberOfContractsIsTheBeginningOfThisMonth` varchar(20) NOT NULL COMMENT '本月初其他类存续交易合约笔数(笔)', +`ContractNumberOtherNewTransactionsThisMonth` varchar(20) NOT NULL COMMENT '本月其他类新增交易合约笔数(笔)', +`TheNumberOfContractsOtherTransactionsThisMonth` varchar(20) NOT NULL COMMENT '本月其他类了结交易合约笔数(笔)', +`ContractsOthersRemainTradedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末其他类存续交易合约笔数(笔)', +`NumberOfContractsOtherTransactionsAsOfTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '截至本月末其他类年度新增交易合约笔数(笔)', +`TheNominalPrincipalIsTradedAtTheBeginningOfThisMonth` varchar(37) NOT NULL COMMENT '本月初存续交易名义本金合计(亿元)', +`NominalPrincipalTotalNewTransactionsThisMonth` varchar(37) NOT NULL COMMENT '本月新增交易名义本金合计(亿元)', +`NominalPrincipalTotalSettledThisMonth` varchar(37) NOT NULL COMMENT '本月了结交易名义本金合计(亿元)', +`TheNominalPrincipalIsTradedAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末存续交易名义本金合计(亿元)', +`NominalPrincipalTotalNewTransactionAsOfTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '截至本月末年度新增交易名义本金合计(亿元)', +`TheTotalNumberOfContractsIsTradedAtTheBeginningOfThisMonth` varchar(20) NOT NULL COMMENT '本月初存续交易合约笔数合计(笔)', +`TheTotalNumberOfContractsIsAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增交易合约笔数合计(笔)', +`TheTotalNumberOfContractsIsSettledThisMonth` varchar(20) NOT NULL COMMENT '本月了结交易合约笔数合计(笔)', +`TheTotalNumberOfContractsIsTradedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末存续交易合约笔数合计(笔)', +`TheTotalNumberOfContractsAsOfTheEndOfThisYearAddTheNewTransaction` varchar(20) NOT NULL COMMENT '截至本月末年度新增交易合约笔数合计(笔)', + + PRIMARY KEY (`id`) +) COMMENT = 'NAFMII月报'; +CREATE TABLE `A1012_ScheduleOfOtherTransaction` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `TradingDate` varchar(10) NULL COMMENT '起始日', +`NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`FillInTheNameOfTheAgency` varchar(100) NULL COMMENT '填报机构代签产品名称', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手方名称', +`CounterpartyAllographProduct` varchar(100) NULL COMMENT '交易对手方代签产品名称', +`BusinessType` varchar(2) NULL COMMENT '交易类型', +`CounterpartyType` varchar(2) NULL COMMENT '交易对手方类型', +`CounterpartyIsProfessionalInstitutionsOrNot` varchar(2) NULL COMMENT '交易对手是否专业机构', +`NotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(元)', +`InvestmentTargetType` varchar(2) NULL COMMENT '标的类型', +`InvestmentTarget` varchar(100) NULL COMMENT '标的名称', +`StartDate` varchar(10) NULL COMMENT '合约起始日', +`ContractExpirationDate` varchar(10) NULL COMMENT '合约到期日', +`Index` text NULL COMMENT '序号', + + + PRIMARY KEY (`id`) +) COMMENT = '其他交易明细表'; +CREATE TABLE `A1012_InterestRateOptionDetail` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `TradingDate` varchar(10) NULL COMMENT '起始日', +`NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`FillInTheNameOfTheAgency` varchar(100) NULL COMMENT '填报机构代签产品名称', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手方名称(全称)', +`CounterpartyAllographProduct` varchar(100) NULL COMMENT '交易对手方代签产品名称', +`BusinessType` varchar(2) NULL COMMENT '期权卖方', +`OptionType` varchar(2) NULL COMMENT '期权类型', +`OptionPosition` varchar(2) NULL COMMENT '期权方向', +`CounterpartyType` varchar(2) NULL COMMENT '交易对手方类型', +`CounterpartyIsProfessionalInstitutionsOrNot` varchar(2) NULL COMMENT '交易对手是否专业机构', +`NotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(元)', +`ExcerciseInterestRate` varchar(8) NULL COMMENT '行权利率(%)', +`InvestmentTarget` varchar(2) NULL COMMENT '标的名称', +`DeliveryType` varchar(2) NULL COMMENT '交割方式', +`StartDate` varchar(10) NULL COMMENT '合约起始日', +`ContractExpirationDate` varchar(10) NULL COMMENT '合约到期日', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '利率期权明细'; +CREATE TABLE `A1012_InterestRateSwapDetail` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `TransactionDate` varchar(10) NULL COMMENT '交易日期', +`NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`FillInTheNameOfTheAgency` varchar(100) NULL COMMENT '填报机构代签产品名称', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手方名称(全称)', +`CounterpartyAllographProduct` varchar(100) NULL COMMENT '交易对手方代签产品名称', +`CounterpartyType` varchar(2) NULL COMMENT '交易对手方类型', +`CounterpartyIsProfessionalInstitutionsOrNot` varchar(2) NULL COMMENT '交易对手是否专业机构', +`FixedInterestPaymentParty` varchar(100) NULL COMMENT '固定利息支付方', +`FloatingInterestPaymentParty` varchar(100) NULL COMMENT '浮动利息支付方', +`NotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金金额', +`ContractPeriod` varchar(40) NULL COMMENT '合约期限', +`DalueDate` varchar(10) NULL COMMENT '起息日', +`DueDate` varchar(10) NULL COMMENT '到期日', +`FixedRate` varchar(8) NULL COMMENT '固定利率', +`FixedRatePaymentCycle` varchar(1000) NULL COMMENT '固定利率支付周期', +`FixedInterestRateBasis` varchar(1000) NULL COMMENT '固定利率计息基准', +`NameOfReferenceRate` varchar(1000) NULL COMMENT '参考利率名称', +`Spreads` varchar(1000) NULL COMMENT '利差', +`FloatingRatePaymentCycle` varchar(1000) NULL COMMENT '浮动利率支付周期', +`ResetTheFrequency` varchar(1000) NULL COMMENT '重置频率', +`FloatingInterestRateBasis` varchar(1000) NULL COMMENT '浮动利率计息基准', +`FirstInterestPaymentDay` varchar(10) NULL COMMENT '首次利息支付(互换)日', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '利率互换明细'; +CREATE TABLE `A1013_PeriodicReportISDA` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `OperationType` varchar(1) NOT NULL COMMENT '操作标识', +`BizID` varchar(50) NULL COMMENT '业务编号', +`Year` varchar(4) NOT NULL COMMENT '年份', +`Month` varchar(2) NOT NULL COMMENT '月份', +`MainAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计主协议(笔)', +`MainAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增主协议(笔)', +`MainAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计主协议(笔)', +`MainAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效主协议(笔)', +`SupplementalAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计补充协议(笔)', +`SupplementalAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增补充协议(笔)', +`SupplementalAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计补充协议(笔)', +`SupplementalAgreementValidedAtTheEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效补充协议(笔)', +`PerformanceGuaranteeAgreementLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计履约担保协议(笔)', +`PerformanceGuaranteeAgreementAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增履约担保协议(笔)', +`PerformanceGuaranteeAgreementAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计履约担保协议(笔)', +`PerformanceGuaranteeAgreementValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效履约担保协议(笔)', +`TransactionConfirmationLastMonthAccumulatedThisYear` varchar(20) NOT NULL COMMENT '上月末本年累计交易确认书(笔)', +`TransactionConfirmationAddedThisMonth` varchar(20) NOT NULL COMMENT '本月新增交易确认书(笔)', +`TransactionConfirmationBookAccumulatedThisYear` varchar(20) NOT NULL COMMENT '本年累计交易确认书(笔)', +`TransactionConfirmationValidedAtEndOfThisMonth` varchar(20) NOT NULL COMMENT '本月末有效交易确认书(笔)', +`SWAPNominalCapitalStockAtBeginning` varchar(36,4) NOT NULL COMMENT '收益互换期初存量名义本金(亿元)', +`SWAPIncreasedOriginalTransactionNominalCapitalAtThisMonth` varchar(36,4) NOT NULL COMMENT '收益互换本月新增初始交易名义本金(亿元)', +`SWAPNotionalPrincipalAmountAllowedToBeTerminatedAtThisMonth` varchar(36,4) NOT NULL COMMENT '收益互换本月终止交易名义本金(亿元)', +`SWAPNominalCapitalStockAtEnding` varchar(36,4) NOT NULL COMMENT '收益互换期末存量名义本金(亿元)', +`SwapCategoryNominalPrincipalThisYearCumulativeInitialTransaction` varchar(36,4) NOT NULL COMMENT '收益互换本年累计新增初始交易名义本金(亿元)', +`OptionOfNotionalPrincipalStockAtBeginning` varchar(36,4) NOT NULL COMMENT '场外期权期初存量名义本金(亿元)', +`OptionIncreasedOriginalTransactionNominalCapitalAtThisMonth` varchar(36,4) NOT NULL COMMENT '场外期权本月新增初始交易名义本金(亿元)', +`OptionNotionalPrincipalAmountAllowedToBeTerminatedAtThisMonth` varchar(36,4) NOT NULL COMMENT '场外期权本月终止交易名义本金(亿元)', +`OptionOfNotionalPrincipalStockAtEnding` varchar(36,4) NOT NULL COMMENT '场外期权期末存量名义本金(亿元)', +`NominalPrincipalOfOptionClassHasBeenAddedToInitialTransaction` varchar(36,4) NOT NULL COMMENT '场外期权本年累计新增初始交易名义本金(亿元)', +`StockOfSwapContractsAtBeginning` varchar(20) NOT NULL COMMENT '收益互换合约数量期初存量(笔)', +`NumberOfNewSwapInitialTradingContractsAtThisMonth` varchar(20) NOT NULL COMMENT '收益互换本月新增初始交易合约数量(笔)', +`NumberOfSwapContractsToTerminateAtThisMonth` varchar(20) NOT NULL COMMENT '收益互换本月终止交易合约数量(笔)', +`StockOfSwapContractsAtEnding` varchar(20) NOT NULL COMMENT '收益互换合约数量期末存量(笔)', +`NumberOfSwapContractsIncreasedByThisYear` varchar(20) NOT NULL COMMENT '收益互换本年累计新增初始交易合约数量(笔)', +`StockOfOptionContractsAtBeginning` varchar(20) NOT NULL COMMENT '场外期权合约数量期初存量(笔)', +`NumberOfNewOptionInitialTradingContractsAtThisMonth` varchar(20) NOT NULL COMMENT '场外期权本月新增初始交易合约数量(笔)', +`NumberOfOptionContractsToTerminateAtThisMonth` varchar(20) NOT NULL COMMENT '场外期权本月终止交易合约数量(笔)', +`StockOfOptionContractsAtEnding` varchar(20) NOT NULL COMMENT '场外期权合约数量期末存量(笔)', +`NumberOfOptionContractsHasIncreasedInitialTransaction` varchar(20) NOT NULL COMMENT '场外期权本年累计新增初始交易合约数量(笔)', +`SwapSignedWithTheCustomerThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换已签约客户(家)', +`NumberOfSwapTradingAccountsAtThisPeriodThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换当期参与交易的账户数量(个)', +`NumberOfSwapTradingClientStockThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换存量交易客户数量(家)', +`SwapSignedWithTheCustomerLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换已签约客户(家)', +`NumberOfSwapTradingAccountsLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换当期参与交易的账户数量(个)', +`NumberOfSwapTradingClientStockLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换存量交易客户数量(家)', +`OptionSignedWithTheCustomerThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权已签约客户(家)', +`NumberOfOptionTradingAccountsThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权当期参与交易的账户数量(个)', +`NumberOfOptionTradingClientStockThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权存量交易客户数量(家)', +`OptionSignedWithTheCustomerLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权已签约客户(家)', +`NumberOfOptionTradingAccountsLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权当期参与交易的账户数量(个)', +`NumberOfOptionTradingClientStockLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权存量交易客户数量(家)', +`SignedTotalCustomer` varchar(20) NOT NULL COMMENT '已签约客户合计(家)', +`TotalNumberOfTradingAccountsAtThisPeriod` varchar(20) NOT NULL COMMENT '当期参与交易的账户数量合计(个)', +`TotalNumberOfTradingClientAccounts` varchar(20) NOT NULL COMMENT '存量交易客户数量合计(家)', +`SignedTotalCustomerLastMonth` varchar(20) NOT NULL COMMENT '上月末已签约客户合计(家)', +`TotalNumberOfTradingAccountsAtThisPeriodLastMonth` varchar(20) NOT NULL COMMENT '上月末当期参与交易的账户数量合计(个)', +`TotalNumberOfTradingClientAccountsLastMonth` varchar(20) NOT NULL COMMENT '上月末存量交易客户数量合计(家)', +`TotalNominalPrincipalAmountOfSwapThisMonth` varchar(37) NOT NULL COMMENT '本月末收益互换存量名义本金总额(亿元)', +`TotalNominalPrincipalAmountOfSwapLastMonth` varchar(37) NOT NULL COMMENT '上月末收益互换存量名义本金总额(亿元)', +`TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth` varchar(37) NOT NULL COMMENT '本月末收益互换存量交易对应履约担保品价值(元)', +`TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth` varchar(37) NOT NULL COMMENT '上月末收益互换存量交易对应履约担保品价值(元)', +`SwapCashCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末收益互换现金担保物价值(元)', +`SwapCashCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末收益互换现金担保物价值(元)', +`SwapSecuritiesCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末收益互换证券担保物价值(元)', +`SwapSecuritiesCollateralValueLastMonthThisMonth` varchar(37) NOT NULL COMMENT '上月末收益互换证券担保物价值(元)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull` varchar(37) NOT NULL COMMENT '本月末收益互换业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull` varchar(37) NOT NULL COMMENT '上月末收益互换业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet` varchar(37) NOT NULL COMMENT '本月末收益互换业务整体履约担保比例(净额)(%)', +`ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet` varchar(37) NOT NULL COMMENT '上月末收益互换业务整体履约担保比例(净额)(%)', +`SwapNumberOfDefaultCustomersAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换本月违约客户数(家)', +`SwapNumberOfDefaultCustomersAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换本月违约客户数(家)', +`SwapDefaultTransactionNumberAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换本月违约交易数(笔)', +`SwapDefaultTransactionNumberAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换本月违约交易数(笔)', +`TotalSwapDefaultCustomerNumberInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换本年累计违约客户数(家)', +`TotalSwapDefaultCustomerNumberInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换本年累计违约客户数(家)', +`SwapNumberOfDefaultCustomersInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末收益互换本年累计违约交易数(笔)', +`SwapNumberOfDefaultCustomersInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末收益互换本年累计违约交易数(笔)', +`TotalNominalPrincipalAmountOfOTCOptionsThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权存量名义本金总额(亿元)', +`TotalNominalPrincipalAmountOfOTCOptionsLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权存量名义本金总额(亿元)', +`TheValueOfTheStockOTCOptionsCorrespondingPerformanceGuaranteeThisMonth` varchar(37) NOT NULL COMMENT '上月末场外期权存量名义本金总额(元)', +`TheValueOfTheStockOTCOptionsCorrespondingPerformanceGuaranteeLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权存量交易对应履约担保品价值(元)', +`OTCOptionsCashCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权现金担保物价值(元)', +`OTCOptionsCashCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权现金担保物价值(元)', +`OTCOptionsSecuritiesCollateralValueThisMonth` varchar(37) NOT NULL COMMENT '本月末场外期权证券担保物价值(元)', +`OTCOptionsSecuritiesCollateralValueLastMonth` varchar(37) NOT NULL COMMENT '上月末场外期权证券担保物价值(元)', +`ProportionOfTheOverallPerformanceOfTheOTCOptionsBusinessThisMonthFull` varchar(37) NOT NULL COMMENT '本月末场外期权业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheOTCOptionsBusinessLastMonthFull` varchar(37) NOT NULL COMMENT '上月末场外期权业务整体履约担保比例(全额)(%)', +`ProportionOfTheOverallPerformanceOfTheOTCOptionsBusinessThisMonthNet` varchar(37) NOT NULL COMMENT '本月末场外期权业务整体履约担保比例(净额)(%)', +`ProportionOfTheOverallPerformanceOfTheOTCOptionsBusinessLastMonthNet` varchar(37) NOT NULL COMMENT '上月末场外期权业务整体履约担保比例(净额)(%)', +`OTCOptionsNumberOfDefaultCustomersAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本月违约客户数(家)', +`OTCOptionsNumberOfDefaultCustomersAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本月违约客户数(家)', +`OTCOptionsTransactionNumberAtThisMonthThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本月违约交易数(家)', +`OTCOptionsTransactionNumberAtThisMonthLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本月违约交易数(家)', +`TotalOTCOptionsDefaultCustomerNumberInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本年累计违约客户数(家)', +`TotalOTCOptionsDefaultCustomerNumberInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本年累计违约客户数(家)', +`OTCOptionsNumberOfDefaultCustomersInThisYearThisMonth` varchar(20) NOT NULL COMMENT '本月末场外期权本年累计违约交易数(家)', +`OTCOptionsNumberOfDefaultCustomersInThisYearLastMonth` varchar(20) NOT NULL COMMENT '上月末场外期权本年累计违约交易数(家)', +`StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末存量交易对应履约担保品价值(元)', +`StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末存量交易对应履约担保品价值(元)', +`CashBalanceAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有现金余额(元)', +`CashBalanceAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有现金余额(元)', +`HoldStockMarketValueAtEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有股票市值(元)', +`HoldStockMarketValueAtEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有股票市值(元)', +`HoldMarketValueOfBondsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有债券市值(元)', +`HoldMarketValueOfBondsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有债券市值(元)', +`OwnedAssetManagementProductsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有证券公司资产管理产品(元)', +`OwnedAssetManagementProductsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有证券公司资产管理产品(元)', +`OwnedBankFinanceAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有银行理财(元)', +`OwnedBankFinanceAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有银行理财(元)', +`HoldTrustProductAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有信托产品(元)', +`HoldTrustProductAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有信托产品(元)', +`InsuranceProductsAreHeldAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有保险产品(元)', +`InsuranceProductsAreHeldAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有保险产品(元)', +`HoldOtherProductsAtTheEndOfThisMonth` varchar(37) NOT NULL COMMENT '本月末持有其他产品(元)', +`HoldOtherProductsAtTheEndOfLastMonth` varchar(37) NOT NULL COMMENT '上月末持有其他产品(元)', +`SettledSwapItemsAtThisMonth` varchar(20) NOT NULL COMMENT '互换本月了结笔数(笔)', +`SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth` varchar(37) NOT NULL COMMENT '互换本月了结交易涉及名义本金(亿元)', +`SwapIncomeCashFlow` varchar(37) NOT NULL COMMENT '互换收入现金流(万元)', +`SwapExpensesCashFlow` varchar(37) NOT NULL COMMENT '互换支出现金流(万元)', +`CashFlowCorrespondingToNetIncomeOnSwapMargin` varchar(37) NOT NULL COMMENT '互换使用保证金形成的净收益对应现金流(万元)', +`SwapHedgeCost` varchar(37) NOT NULL COMMENT '互换对冲成本(万元)', +`SettledOptionItemsAtThisMonth` varchar(20) NOT NULL COMMENT '期权本月了结笔数(笔)', +`SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth` varchar(37) NOT NULL COMMENT '期权本月了结交易涉及名义本金(亿元)', +`OptionPremiumIncome` varchar(37) NOT NULL COMMENT '期权权利金收入(万元)', +`OptionHedgeCost` varchar(37) NOT NULL COMMENT '期权对冲成本(万元)', +`BalanceOfSwapRealizedGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '互换合约端损益本月发生额(万元)', +`BalanceOfOptionRealizedGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '期权合约端损益本月发生额(万元)', +`BalanceOfSwapRealizedGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '互换合约端损益本年累计额(万元)', +`BalanceOfOptionRealizedGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '期权合约端损益本年累计额(万元)', +`BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth` varchar(37) NOT NULL COMMENT '互换对冲端损益本月发生额(万元)', +`BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth` varchar(37) NOT NULL COMMENT '期权对冲端损益本月发生额(万元)', +`BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear` varchar(37) NOT NULL COMMENT '互换对冲端损益本年累计额(万元)', +`BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear` varchar(37) NOT NULL COMMENT '期权对冲端损益本年累计额(万元)', +`BalanceOfSwapTotalGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '互换损益合计本月发生额(万元)', +`BalanceOfOptionTotalGainsAndLossesAtThisMonth` varchar(37) NOT NULL COMMENT '期权损益合计本月发生额(万元)', +`BalanceOfSwapTotalGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '互换损益合计本年累计额(万元)', +`BalanceOfOptionTotalGainsAndLossesAtThisYear` varchar(37) NOT NULL COMMENT '期权损益合计本年累计额(万元)', + + PRIMARY KEY (`id`) +) COMMENT = 'ISDA月报'; +CREATE TABLE `A1013_ISDATargetCaseAndHedge` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`InvestmentTargetType` varchar(2) NULL COMMENT '标的分类', +`InvestmentTarget` varchar(100) NULL COMMENT '标的名称(或品种名称)', +`UnderlyingCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`BuyingImpulseVolume` varchar(37) NULL COMMENT '买入对冲交易量(元)', +`SellingImpulseVolume` varchar(37) NULL COMMENT '卖出对冲交易量(元)', +`ImpulseVolume` varchar(37) NULL COMMENT '对冲交易量(元)(买入+卖出)', +`PositionAtTheEndOfThisMonth` varchar(37) NULL COMMENT '本月末持仓规模(或合约价值)(元)', +`TheNumberOfPositionsHeldAtTheEndOfThisMonth` varchar(37) NULL COMMENT '本月末持仓数量(股/手)', +`AveragePriceAtTheEndOfTheMonth` varchar(37) NULL COMMENT '本月末持仓平均价格(元)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '标的情况与对冲'; +CREATE TABLE `A1013_ISDAInventoryBusinessDetailsAtTheEndOfThisMonth` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手名称(全称)', +`NameOfCounterpartyProduct` varchar(100) NULL COMMENT '交易对手产品名称(如有)', +`TradeConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(双方约定)', +`TransactionConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(报告库编号)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`NotionalPrincipalAmountLNotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(或多头名义本金)(元)', +`SNotionalPrincipalAmount` varchar(37) NULL COMMENT '空头名义本金(元)(多空组合填写)', +`StartDay` varchar(10) NULL COMMENT '起始日', +`DueDate` varchar(10) NULL COMMENT '到期日', +`InvestmentTargetType` varchar(2) NULL COMMENT '标的类型', +`UndrlygAssetName` varchar(200) NULL COMMENT '标的名称', +`UndrlygAssetCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`OptionObjectSecondClass` varchar(2) NULL COMMENT '场外期权标的小类(场外期权填写)', +`SwapObjectSecondClass` varchar(2) NULL COMMENT '收益互换标的小类(收益互换填写)', +`NonAnnualOptionFee` varchar(6) NULL COMMENT '期权费(非年化)(%)(场外期权填写)', +`OptionType` varchar(6) NULL COMMENT '期权类型(场外期权填写)', +`MaitainMarginRation` varchar(37) NULL COMMENT '本月末维持保证金比例(%)', +`CorrelationCoefficient` varchar(20) NULL COMMENT '标的相关系数', +`LongPositionContractValue` varchar(37) NULL COMMENT '多头合约价值(元)', +`ShortPositionContractValue` varchar(37) NULL COMMENT '空头合约价值(元)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '本月末存量业务明细'; +CREATE TABLE `A1013_ISDAIncreaseBusinessDetailsThisMonth` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `ExceID` varchar(28) NOT NULL COMMENT '业务数据流水号:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);', + `ReportDate` date NOT NULL COMMENT '报送日期', + `NameOfSecuritiesCompany` varchar(100) NULL COMMENT '报送机构名称(全称)', +`NameOfCounterparty` varchar(100) NULL COMMENT '交易对手名称(全称)', +`NameOfCounterpartyProduct` varchar(100) NULL COMMENT '交易对手产品名称(如有)', +`TradeConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(双方约定)', +`TransactionConfirmationNumber` varchar(100) NULL COMMENT '交易确认书编号(报告库编号)', +`BusinessType` varchar(2) NULL COMMENT '业务类型', +`NotionalPrincipalAmountLNotionalPrincipalAmount` varchar(37) NULL COMMENT '名义本金(或多头名义本金)(元)', +`SNotionalPrincipalAmount` varchar(37) NULL COMMENT '空头名义本金(元)(多空组合填写)', +`StartDay` varchar(10) NULL COMMENT '起始日', +`DueDate` varchar(10) NULL COMMENT '到期日', +`InvestmentTargetType` varchar(2) NULL COMMENT '标的类型', +`UndrlygAssetName` varchar(200) NULL COMMENT '标的名称', +`UndrlygAssetCode` varchar(200) NULL COMMENT '标的编码', +`UndrlygAssetTradgPlc` varchar(200) NULL COMMENT '标的交易场所', +`OptionObjectSecondClass` varchar(2) NULL COMMENT '场外期权标的小类(场外期权填写)', +`SwapObjectSecondClass` varchar(2) NULL COMMENT '收益互换标的小类(收益互换填写)', +`NonAnnualOptionFee` varchar(6) NULL COMMENT '期权费(非年化)(%)(场外期权填写)', +`OptionType` varchar(6) NULL COMMENT '期权类型(场外期权填写)', +`Index` text NULL COMMENT '序号', + + PRIMARY KEY (`id`) +) COMMENT = '本月新增业务明细'; + */ \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/Sac_TranslateHelper.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/Sac_TranslateHelper.cs index 5f3fa441..822f4c2e 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/Sac_TranslateHelper.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Common/Sac_TranslateHelper.cs @@ -5,7 +5,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common { class Sac_TranslateHelper { - private static SacMap Map = null; + private static SacMap? Map = null; private static List GetSacInfo(PropertyInfo[] properties) { @@ -71,6 +71,44 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common } return map; } + + public static string TranslateFieldName(string fieldName, string fileType = "") + { + if (Map == null) + { + Init(); + } + SacMap map = Map; + return getFieldName_CN(map, fieldName, fileType); + } + private static string getFieldName_CN(SacMap map, string fieldName, string fileType = "") + { + if (map.FieldName == fieldName) + { + return map.FieldName_CN; + } + + if (map.SubMaps.Count > 0) + { + foreach (var m in map.SubMaps) + { + if (map.FieldName == "Body") + { + if (!string.IsNullOrWhiteSpace(fileType) && m.FieldName != fileType) + { + continue; + } + } + var ret = getFieldName_CN(m, fieldName, fileType); + if (!string.IsNullOrWhiteSpace(ret)) + { + return ret; + } + } + } + return ""; + + } } /// @@ -197,9 +235,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common FieldLength = info.FieldLength; FieldDescription = info.FieldDescription; Required = info.Required; - if (SubMaps != null) + if (this.SubMaps != null && this.SubMaps.Count > 0) { - SubMaps.ForEach(O => + SubMaps?.ForEach(O => { if (O == null) { @@ -210,4 +248,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common } } } + + + public class ExceptionExtensionInfo + { + public List Tag { get; set; } + + public string ErrFilePath { get; set; } + } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ConfirmationAttModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ConfirmationAttModel.cs new file mode 100644 index 00000000..3fe818db --- /dev/null +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ConfirmationAttModel.cs @@ -0,0 +1,101 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml.Serialization; +using YLErp.Modules.SuperviseReportModule.SAC.Common; +using static YLErp.DBModels.Consts.ConsReport; + +namespace YLErp.Modules.SuperviseReportModule.SAC.Model +{ + /// + /// 交易确认书附件 + /// + [Table("A1019_ConfirmationAtt")] + public class ConfirmationAttModel : ReportBaseModel + { + /// + /// 交易确认书编号(双方约定) + /// 长度:100 + /// 必填:是 + /// 说明:双方约定 + /// + [CheckStringMaxLength(MaxLength = 100)] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")] + public string ConfirmationNo { get; set; } + /// + /// 操作标识 + /// 长度:1 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [SacDescription("OperationType", "操作标识", "1", true, "")] + public OptFlagsEnum OperationType { get; set; } + /// + /// 交易确认书附件 + /// 长度:1 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [SacDescription("ConfirmationAtt", "交易确认书附件", "1", true, "说明:校验规则:只支持PDF格式")] + public string ConfirmationAtt { get; set; } + /// + /// 交易确认书附件 + /// 长度:1 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [SacDescription("ConfirmationFiles", "交易确认书附件", "1", true, "说明:校验规则:只支持PDF格式")] + public string ConfirmationFiles { get; set; } + /// + /// 交易确认书附件 + /// 长度: + /// 必填:是 + /// 说明:多附件; + /// + [CheckIEnumerableTMinCount(MinCount = 1)] + [XmlElement] + [NotMapped] + [SacDescription("ConfirmationFilesTuple", "交易确认书附件", "", true, "多附件;")] + public List ConfirmationFilesTuple { get; set; } + } + + public class ConfirmationFilesTupleModel + { + /// + /// 是否为收益互换 + /// + //[CheckStringInMap(Map = new[] { "true", "false" })] + [XmlIgnore] + public string IsSwap { get; set; } + /// + /// 场外期权交易确认书附件 + /// 长度:100 + /// 必填:是 + /// 说明:校验规则:只支持PDF格式 + /// + [CheckConditionStringValue(ConditionName = "IsSwap", ConditionValue = "false", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringValue(ConditionName = "IsSwap", ConditionValue = "true", CheckHandleNameArr = new[] { "B" })] + [CheckStringEndsWith(EndsWithString = ".pdf", CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("ConfirmationAtt", "交易确认书附件", "100", true, "校验规则:只支持PDF格式;")] + public string ConfirmationAtt { get; set; } + + /// + /// 收益互换交易确认书附件 + /// 长度:100 + /// 必填:是 + /// 说明:校验规则:只支持PDF格式 + /// + [CheckConditionStringValue(ConditionName = "IsSwap", ConditionValue = "true", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringValue(ConditionName = "IsSwap", ConditionValue = "false", CheckHandleNameArr = new[] { "B" })] + [CheckStringEndsWith(EndsWithString = ".pdf", CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("ConfirmationFiles", "交易确认书附件", "100", true, "校验规则:只支持PDF格式;")] + public string ConfirmationFiles { get; set; } + } +} \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtModel.cs index b4afe496..9735afcb 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +9,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 主协议 /// + [Table("A1001_MasterAgrmt")] public class MasterAgrmtModel : ReportBaseModel { /// @@ -44,7 +46,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "双方约定;")] public string MasterAgrmtNo { get; set; } /// - /// 签署时间 + /// 签订时间 /// 长度:10 /// 必填:是 /// 说明:校验规则:必须是yyyy-MM-dd @@ -52,7 +54,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] [DefaultValue("")] - [SacDescription("SigningDate", "签署时间", "10", true, "校验规则:必须是yyyy-MM-dd;")] + [SacDescription("SigningDate", "签订时间", "10", true, "校验规则:必须是YYYY-MM-DD;")] public string SigningDate { get; set; } /// /// 主协议版本 @@ -75,28 +77,28 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("FillParty", "填报方角色", "2", true, "")] public string FillParty { get; set; } /// - /// 交易对手方名称 + /// 交易对手方名称(全称) /// 长度:200 /// 必填:是 /// 说明: /// [CheckStringMaxLength(MaxLength = 200)] [DefaultValue("")] - [SacDescription("NameOfCounterparty", "交易对手方名称", "200", true, "")] + [SacDescription("NameOfCounterparty", "交易对手方名称(全称)", "200", true, "")] public string NameOfCounterparty { get; set; } /// /// 统一社会信用代码 /// 长度:18 - /// 必填:是 + /// 必填:否 /// 说明:校验规则:字段长度18位;当交易对手方类型是除了境外金融机构、境外非金融机构外的机构时,必填 /// [CheckConditionStringInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "14", "15" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "14", "15" }, CheckHandleNameArr = new[] { "B" })] [CheckStringMaxLength(MaxLength = 18, CheckHandleName = "A", Required = false)] - [CheckStringMinLength(MinLength = 18, CheckHandleName = "B")] + [CheckStringMinLength(MinLength = 1, CheckHandleName = "B")] [CheckStringMaxLength(MaxLength = 18, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("CODS", "统一社会信用代码", "18", true, "校验规则:字段长度18位;\r\n当交易对手方类型是除了境外金融机构、境外非金融机构外的机构时,必填;")] + [SacDescription("CODS", "统一社会信用代码", "18", false, "校验规则:字段长度18位;\r\n当交易对手方类型是除了境外金融机构、境外非金融机构外的机构时,必填;")] public string CODS { get; set; } /// /// 交易对手编码 @@ -112,13 +114,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// LEI码 /// 长度:20 /// 必填:否 - /// 说明:校验规则:当交易对手方类型是境外金融机构、境外非金融机构外的机构时,必填 + /// 说明:校验规则:当交易对手方类型是境外金融机构、境外非金融机构时,必填 /// [CheckConditionStringInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "14", "15" }, CheckHandleNameArr = new[] { "A" })] [CheckStringMinLength(MinLength = 1, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 20, CheckHandleName = "A")] [DefaultValue("")] - [SacDescription("LEI", "LEI码", "20", false, "校验规则:当交易对手方类型是境外金融机构、境外非金融机构外的机构时,必填;")] + [SacDescription("LEI", "LEI码", "20", false, "校验规则:当交易对手方类型是境外金融机构、境外非金融机构时,必填;")] public string LEI { get; set; } /// /// 交易对手类别 @@ -144,14 +146,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 非金融机构行业代码 /// 长度:20 /// 必填:否 - /// 说明:校验规则:交易对手方类型为非金融机构时必填;参照国家统计局发布的《国民经济行业分类》 + /// 说明:校验规则:当“交易对手方类型”选择境内非金融机构时,必填;参照国家统计局发布的《国民经济行业分类》 /// - [CheckConditionStringInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "13", "15" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "13", "15" }, CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "13" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(CounterpartyType), ConditionMap = new[] { "13" }, CheckHandleNameArr = new[] { "B" })] [CheckStringMaxLength(MaxLength = 20, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 20, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("NFICode", "非金融机构行业代码", "20", false, "校验规则:交易对手方类型为非金融机构时必填;\r\n参照国家统计局发布的《国民经济行业分类》;")] + [SacDescription("NFICode", "非金融机构行业代码", "20", false, "校验规则:当“交易对手方类型”选择境内非金融机构时,必填;\r\n参照国家统计局发布的《国民经济行业分类》;")] public string NFICode { get; set; } /// /// 交易对手方注册资本(万元) @@ -161,7 +163,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("CounterpartyRegdCptl", "交易对手方注册资本(万元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("CounterpartyRegdCptl", "交易对手方注册资本(万元)", "36,2", false, "校验规则:必须两位小数以内")] public string CounterpartyRegdCptl { get; set; } /// /// 主协议备注 @@ -201,6 +203,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckIEnumerableTMinCount(MinCount = 1)] [XmlElement] + [NotMapped] [SacDescription("CounterpartyInformationTuple", "填报方业务代表明细", "", false, "")] public List CounterpartyInformationTuple { get; set; } } @@ -208,8 +211,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 填报方业务代表明细 /// - public class CounterpartyInfomationModel + [Table("A1001_CounterpartyInfomation")] + public class CounterpartyInfomationModel : ReportSubBaseModel { + /// + /// 主协议编号 + /// 长度:200 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + public string MasterAgrmtNo { get; set; } /// /// 填报方业务代表姓名 /// 长度:200 diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtProductModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtProductModel.cs index 2bc91c2d..ce2fb705 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtProductModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/MasterAgrmtProductModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +9,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 主协议关联产品 /// + [Table("A1002_MasterAgrmtProduct")] public class MasterAgrmtProductModel : ReportBaseModel { /// @@ -52,11 +54,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 产品名称 /// 长度:100 - /// 必填:是 + /// 必填:否 /// /// 说明:校验规则: /// 1 主协议交易对手方身份为产品管理人时必填; - /// 2 主协议交易对手方身份为自营时禁止填值; + /// 2 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -64,26 +66,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 100, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("ProductName", "产品名称", "100", true, "校验规则:\r\n1 主协议交易对手方身份为产品管理人时必填;\r\n2 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("ProductName", "产品名称", "100", false, "校验规则:\r\n1 主协议交易对手方身份为产品管理人时必填;\r\n2 主协议交易对手方身份为自营禁止填值;")] public string ProductName { get; set; } /// /// 交易对手码(产品) /// 长度:20 - /// 必填:是 - /// 说明:应当符合标准规范 + /// 必填:否 + /// 说明:校验规则:1、主协议交易对手方身份为产品管理人必填;2、主协议交易对手方身份为自营禁止填值;3、应当符合标准规范 /// [CheckStringMaxLength(MaxLength = 20)] [DefaultValue("")] - [SacDescription("CounterpartyCodeProducts", "交易对手码(产品)", "20", true, "应当符合标准规范;")] + [SacDescription("CounterpartyCodeProducts", "交易对手码(产品)", "20", false, "校验规则:\r\n1、主协议交易对手方身份为产品管理人必填;\r\n2、主协议交易对手方身份为自营禁止填值;\r\n3、应当符合标准规范;")] public string CounterpartyCodeProducts { get; set; } /// /// 产品投资经理姓名 /// 长度:100 - /// 必填:是 + /// 必填:否 /// /// 说明:校验规则: - /// 1 主协议交易对手方身份为产品管理人时必填; - /// 2 主协议交易对手方身份为自营时禁止填值; + /// 1 主协议交易对手方身份为产品管理人必填; + /// 2 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -91,16 +93,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 100, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("ManagerName", "产品投资经理姓名", "100", true, "校验规则:\r\n1 主协议交易对手方身份为产品管理人时必填;\r\n2 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("ManagerName", "产品投资经理姓名", "100", false, "校验规则:\r\n1 主协议交易对手方身份为产品管理人必填;\r\n2 主协议交易对手方身份为自营禁止填值;")] public string ManagerName { get; set; } /// /// 投资经理联系电话 /// 长度:20 - /// 必填:是 + /// 必填:否 /// /// 说明:校验规则: - /// 1 主协议交易对手方身份为产品管理人时必填; - /// 2 主协议交易对手方身份为自营时禁止填值; + /// 1 主协议交易对手方身份为产品管理人必填; + /// 2 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -108,7 +110,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 20, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("InvestmentManagerContactNumber", "投资经理联系电话", "20", true, "校验规则:\r\n1 主协议交易对手方身份为产品管理人时必填;\r\n2 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("InvestmentManagerContactNumber", "投资经理联系电话", "20", false, "校验规则:\r\n1 主协议交易对手方身份为产品管理人必填;\r\n2 主协议交易对手方身份为自营禁止填值;")] public string InvestmentManagerContactNumber { get; set; } /// /// 托管机构(如有) @@ -116,7 +118,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:否 /// /// 说明:校验规则: - /// 1 主协议交易对手方身份为自营时禁止填值; + /// 1 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -124,17 +126,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 200, Required = false, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("TrusteeAgency", "托管机构(如有)", "200", false, "校验规则:\r\n1 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("TrusteeAgency", "托管机构(如有)", "200", false, "校验规则:\r\n1 主协议交易对手方身份为自营禁止填值;")] public string TrusteeAgency { get; set; } /// /// 入表日期 /// 长度:10 - /// 必填:是 + /// 必填:否 /// /// 说明:校验规则: - /// 1 必须是yyyy-MM-dd; - /// 2 主协议交易对手方身份为产品管理人时必填; - /// 3 主协议交易对手方身份为自营时禁止填值; + /// 1 必须是YYYY-MM-DD; + /// 2 主协议交易对手方身份为产品管理人必填; + /// 3 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -143,17 +145,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd", CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("TheDateTable", "入表日期", "10", true, "校验规则:\r\n1 必须是yyyy-MM-dd;\r\n2 主协议交易对手方身份为产品管理人时必填;\r\n3 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("TheDateTable", "入表日期", "10", false, "校验规则:\r\n1 必须是YYYY-MM-DD;\r\n2 主协议交易对手方身份为产品管理人必填;\r\n3 主协议交易对手方身份为自营禁止填值;")] public string TheDateTable { get; set; } /// /// 代签产品附件 /// 长度:10 - /// 必填:是 + /// 必填:否 /// /// 说明:校验规则: /// 1 只支持PDF格式; - /// 2 主协议交易对手方身份为产品管理人时必填; - /// 3 主协议交易对手方身份为自营时禁止填值; + /// 2 主协议交易对手方身份为产品管理人必填; + /// 3 主协议交易对手方身份为自营禁止填值; /// /// [CheckConditionStringInMap(ConditionName = nameof(ClientType), ConditionMap = new[] { "产品", "产品管理人" }, CheckHandleNameArr = new[] { "A" })] @@ -161,7 +163,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringEndsWith(EndsWithString = ".pdf", CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("SuchProducts", "代签产品附件", "10", true, "校验规则:\r\n1 只支持PDF格式;\r\n2 主协议交易对手方身份为产品管理人时必填;\r\n3 主协议交易对手方身份为自营时禁止填值;")] + [SacDescription("SuchProducts", "代签产品附件", "10", false, "校验规则:\r\n1 只支持PDF格式;\r\n2 主协议交易对手方身份为产品管理人必填;\r\n3 主协议交易对手方身份为自营禁止填值;")] public string SuchProducts { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionConfirmationModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionConfirmationModel.cs index 0fe504d6..a7f0f9cf 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionConfirmationModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionConfirmationModel.cs @@ -1,4 +1,8 @@ -using System.ComponentModel; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +12,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 期权交易确认书 /// + [Table("A1004_OptionConfirmation")] public class OptionConfirmationModel : ReportBaseModel { /// @@ -45,10 +50,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:否 /// 说明:校验规则:补正时必填 /// - [CheckConditionStringValue(ConditionName = nameof(OperationType), ConditionValue = "A", CheckHandleNameArr = new[] { "B" })] - [CheckConditionStringNEQValue(ConditionName = nameof(OperationType), ConditionValue = "A", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringValue(ConditionName = nameof(OperationType), ConditionValue = "A", + CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringNEQValue(ConditionName = nameof(OperationType), ConditionValue = "A", + CheckHandleNameArr = new[] { "A" })] [CheckStringMaxLength(MaxLength = 32, CheckHandleName = "A")] - [CheckStringMaxLength(MaxLength = 32, Required = false, CheckHandleName = "B")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("ConfirmationID", "交易确认书编号", "32", false, "校验规则:补正时必填;")] public string ConfirmationID { get; set; } @@ -70,7 +77,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringInMap(Map = new[] { "0", "1" })] [DefaultValue("")] - [SacDescription("ConfirmationType", "交易确认书类型", "2", true, "")] + [SacDescription("ConfirmationType", "交易确认书类型", "2", true, "校验规则:首次提交时填0,补正时填1")] public string ConfirmationType { get; set; } /// /// 填报方角色 @@ -102,28 +109,32 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("OptionDirection", "期权方向", "2", true, "")] public string OptionDirection { get; set; } + /// /// 期权结构类型 /// 长度:2 /// 必填:是 - /// 说明: + /// 说明:选择期权结构类型后填写对应的【期权结构类型详情】 /// - [CheckStringInMap(Map = new[] { "0", "1", "2", "4", "5", "6", "7", "99" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" })] [DefaultValue("")] - [SacDescription("OptionStructureType", "期权结构类型", "2", true, "")] + [SacDescription("OptionStructureType", "期权结构类型", "2", true, "选择期权结构类型后填写对应的【期权结构类型详情】")] public string OptionStructureType { get; set; } + /// - /// 期权结构 + /// 期权结构类型 /// 长度:2000 /// 必填:否 /// 说明:校验规则:=其他时,该字段必填 /// - [CheckConditionStringValue(ConditionName = nameof(OptionStructureType), ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNEQValue(ConditionName = nameof(OptionStructureType), ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringValue(ConditionName = nameof(OptionStructureType), ConditionValue = "99", + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(OptionStructureType), ConditionValue = "99", + CheckHandleNameArr = new[] { "B" })] [CheckStringMaxLength(MaxLength = 2000, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("OptionStructure", "期权结构", "2000", false, "校验规则:期权结构类型=其他时,该字段必填;")] + [SacDescription("OptionStructure", "期权结构类型", "2000", false, "校验规则:期权结构类型选择为其他时,该字段必填;")] public string OptionStructure { get; set; } /// /// 行权方式 @@ -148,7 +159,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] [DefaultValue("")] - [SacDescription("StartDate", "起始日", "10", true, "交易条款开始执行的日期.\r\n校验规则:\r\n1 起始日不能大于到期日日期;\r\n2 必须是yyyy-MM-dd;")] + [SacDescription("StartDate", "起始日", "10", true, "交易条款开始执行的日期.\r\n校验规则:\r\n1 起始日不能大于到期日日期;\r\n2 必须是YYYY-MM-DD;")] public string StartDate { get; set; } /// /// 到期日 @@ -164,7 +175,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] [DefaultValue("")] - [SacDescription("DueDate", "到期日", "10", true, "指定交易结束的日期.\r\n校验规则:\r\n1 到期日不能小于起始日日期;\r\n2 必须是yyyy-MM-dd;\r\n3 补正时,如果该交易还有未被废除的存续期记录(包括展期,终止数据),到期日字段不能修改;")] + [SacDescription("DueDate", "到期日", "10", true, + "指定交易结束的日期.\r\n校验规则:\r\n1 到期日不能小于起始日日期;\r\n2 必须是YYYY-MM-DD;\r\n3 补正时,如果该交易还有未被废除的存续期记录(包括展期,终止数据),到期日字段不能修改;")] public string DueDate { get; set; } /// /// 结算日 @@ -178,50 +190,75 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10, Required = false)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd", Required = false)] [DefaultValue("")] - [SacDescription("SettlementDate", "结算日", "10", false, "指定的进行结算金额收付的日期.\r\n校验规则:必须是yyyy-MM-dd;")] + [SacDescription("SettlementDate", "结算日", "10", false, "指定的进行结算金额收付的日期.\r\n校验规则:必须是YYYY-MM-DD;")] public string SettlementDate { get; set; } + /// - /// 期权费(非年化)% + /// 期权费(非年化)(%) /// 长度:6 /// 必填:是 - /// 说明:校验规则:1 数值处于0~100之间最多两位小数;2 百分比处于0~100之间整数带% + /// 说明:校验规则:1 数值处于0~100之间最多两位小数;2 百分比处于0~100之间整数不带% /// - [CheckStringIntOrPercentRange( - BeforePointMaxLength_Percent = 3, - AfterPointMaxLength_Percent = 0, - MinValue_Percent = 0, - MaxValue_Percent = 100, - BeforePointMaxLength_Number = 3, - AfterPointMaxLength_Number = 2, - MinValue_Number = 0, - MaxValue_Number = 100 - )] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0)] [DefaultValue("")] - [SacDescription("OptionPremium", "期权费(非年化)%", "6", true, "校验规则:\r\n1 数值处于0~100之间最多两位小数;\r\n2 百分比处于0~100之间整数带%;")] + [SacDescription("OptionPremium", "期权费(非年化)(%)", "6", true, "校验规则:\r\n1 数值处于0至100之间最多两位小数;\r\n2 百分比处于0至100之间整数;")] public string OptionPremium { get; set; } /// + /// 年化天数 + /// 长度:3 + /// 必填:是 + /// 说明:正整数 + /// + [CheckStringIntMaxLength(AfterPointMaxLength = 0, BeforePointMaxLength = 3, MinValue = 0)] + [DefaultValue("")] + [SacDescription("AnnualizedDays", "年化天数", "3", true, "填写不为零的正整数")] + public string AnnualizedDays { get; set; } + + /// + /// 定价波动率(%) + /// 长度:5,2 + /// 必填:是 + /// 说明: + /// + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2)] + [DefaultValue("")] + [SacDescription("PricingVolatility", "定价波动率(%)", "5,2", true, "期权期初估值定价时的波动率")] + public string PricingVolatility { get; set; } + + /// + /// 无风险利率(%) + /// 长度:5,2 + /// 必填:是 + /// 说明: + /// + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2)] + [DefaultValue("")] + [SacDescription("RiskFreeInterestRates", "无风险利率(%)", "5,2", true, "期权期初估值定价时的无风险利率")] + public string RiskFreeInterestRates { get; set; } + /// /// 结算货币 /// 长度:2 /// 必填:是 - /// 说明: + /// 说明: /// - [CheckStringMaxLength(MaxLength = 3)] + [CheckStringMaxLength(MaxLength = 2)] [DefaultValue("")] - [SacDescription("Currency", "结算货币", "2", true, "")] + [SacDescription("Currency", "结算货币", "2", true, "使用货币通用代码(大写)")] public string Currency { get; set; } /// - /// 名义金额(人民币) + /// 名义本金(元) /// 长度:36,2 /// 必填:是 /// /// 说明:控件提示:单位元,小数点后保留两位. - /// 校验规则:1 必须两位小数; - /// 2 补正时,如果该交易还有未被废除的存续期记录(包括展期,终止数据),名义本金额(人民币)字段不能修改; + /// 校验规则:1 必须两位小数;2 名义本金为标的期初价格乘以数量乘以乘数; + /// 3 补正时,如果该交易还有未被废除的存续期记录(包括展期,终止数据),名义本金额(人民币)字段不能修改; /// /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("NotinalPrincipleAmt", "名义金额(人民币)", "36,2", true, "控件提示:单位元,小数点后保留两位.\r\n校验规则:\r\n1 必须两位小数;\r\n2 补正时,如果该交易还有未被废除的存续期记录(包括展期,终止数据),名义本金额(人民币)字段不能修改;")] + [SacDescription("NotinalPrincipleAmt", "名义本金(元)", "36,2", true, + "控件提示:单位元,小数点后保留两位.\r\n校验规则:\r\n1 保留两位小数;\r\n2 名义本金为标的期初价格乘以数量乘以乘数;\r\n3 补正时,如果该交易还有未被废除的存续期记录(包括展期、终止数据),名义本金(人民币)字段不能修改;")] public string NotinalPrincipleAmt { get; set; } /// /// 清算机构 @@ -244,31 +281,44 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("TradingPlace", "交易场所", "2", true, "")] public string TradingPlace { get; set; } /// - /// 业务模式类型 - /// 长度:2 - /// 必填:是 - /// 说明: + /// 交易场所(其他) + /// 长度:200 + /// 必填:否 + /// 说明:当"交易场所"选择"其他交易场所"时,必填;选其他选项时不能填写 /// - [CheckStringInMap(Map = new[] { "1" })] + [CheckConditionStringValue(ConditionName = nameof(TradingPlace), ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(TradingPlace), ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 200, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("BusinessModelType", "业务模式类型", "2", true, "")] - public string BusinessModelType { get; set; } + [SacDescription("TradingPlaceOther", "交易场所(其他)", "200", false, "当\"交易场所\"选择\"其他交易场所\"时,必填;\r\n选其他选项时不能填写;")] + public string TradingPlaceOther { get; set; } + ///// + ///// 业务模式类型 + ///// 长度:2 + ///// 必填:是 + ///// 说明: + ///// + //// [CheckStringInMap(Map = new[] { "1" })] + //// [DefaultValue("")] + //// [SacDescription("BusinessModelType", "业务模式类型", "2", true, "")] + //// public string BusinessModelType { get; set; } + ///// + ///// 交易确认书附件 + ///// + //[CheckIEnumerableTMinCount(MinCount = 1)] + //[XmlElement] + //[SacDescription("ConfirmationAttTuple", "交易确认书附件", "", false, "")] + //public List ConfirmationAttTuple { get; set; } /// - /// 交易确认书附件 - /// - [CheckIEnumerableTMinCount(MinCount = 1)] - [XmlElement] - [SacDescription("ConfirmationAttTuple", "交易确认书附件", "", false, "")] - public List ConfirmationAttTuple { get; set; } - /// - /// 备注 + /// 基本信息备注 /// 长度:1024 /// 必填:否 /// 说明:填写上述字段或交易确认书中不能包含的信息 /// [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] - [SacDescription("ConfirmationRemark", "备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] + [SacDescription("ConfirmationRemark", "基本信息备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] public string ConfirmationRemark { get; set; } /// /// 标的类型 @@ -301,14 +351,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("ProfitCalculationInfo", "期权收益计算说明", "1024", true, "")] public string ProfitCalculationInfo { get; set; } /// - /// 备注 + /// 备注/收益备注 /// 长度:1024 /// 必填:否 /// 说明:填写上述字段或交易确认书中不能包含的信息 /// [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] - [SacDescription("ProfitRemark", "备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] + [SacDescription("ProfitRemark", "备注/收益备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] public string ProfitRemark { get; set; } /// /// 标的详情 @@ -318,8 +368,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckIEnumerableTMinCount(MinCount = 1)] [XmlElement] - [SacDescription("UndrlygAssetTuple", "标的详情", "", false, "数组结构支持新增多条;")] + [NotMapped] + [SacDescription("UndrlygAssetTuple", "标的详情", "", false, "数组结构,支持新增多条;")] public List UndrlygAssetTuple { get; set; } + /// /// 履约担保类型 /// 长度:2 @@ -330,152 +382,219 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("PerformanceGuaranteeType", "履约担保类型", "2", true, "")] public string PerformanceGuaranteeType { get; set; } + /// /// 履约担保品提供方 /// 长度:2 /// 必填:否 - /// 说明: + /// 说明:校验规则:当“履约担保类型”选择部分担保、全额担保时,必填; /// - [CheckStringInMap(Map = new[] { "0", "1", "2", "3" }, Required = false)] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollProvider", "履约担保品提供方", "2", false, "")] + [SacDescription("PerformanceCollProvider", "履约担保品提供方", "2", false, "校验规则:当“履约担保类型”选择部分担保、全额担保时,必填;")] public string PerformanceCollProvider { get; set; } + /// /// 担保品收取方是否可使用担保品 /// 长度:5 /// 必填:否 - /// 说明: + /// 说明:校验规则:当“履约担保类型”选择部分担保、全额担保时,必填; /// - [CheckStringInMap(Map = new[] { "true", "false" }, Required = false)] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "true", "false" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PartyUseColl", "担保品收取方是否可使用担保品", "5", false, "")] + [SacDescription("PartyUseColl", "担保品收取方是否可使用担保品", "5", false, "校验规则:当“履约担保类型”选择部分担保、全额担保时,必填;")] public string PartyUseColl { get; set; } + /// /// 担保品使用说明 /// 长度:1024 /// 必填:否 - /// 说明:校验规则:当履约保障类型()选择部分担保或全额担保时必填; + /// 说明:检验规则:当“担保品收取方是否可使用担保品”选择“是”时,必填; /// - [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringValue(ConditionName = nameof(PartyUseColl), ConditionValue = "true", + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(PartyUseColl), ConditionValue = "true", + CheckHandleNameArr = new[] { "B" })] [CheckStringMaxLength(MaxLength = 1024, IgnoreNullOrEmpty = false, CheckHandleName = "A")] - [CheckStringMaxLength(MaxLength = 1024, Required = false, CheckHandleName = "B")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("CollInstruction", "担保品使用说明", "1024", false, "校验规则:当履约保障类型选择部分担保或全额担保时必填;")] + [SacDescription("CollInstruction", "担保品使用说明", "1024", false, "检验规则:当“担保品收取方是否可使用担保品”选择“是”时,必填;")] public string CollInstruction { get; set; } + /// /// 是否计算担保品价值产生利息 /// 长度:5 /// 必填:否 - /// 说明: + /// 说明:校验规则:当“履约担保类型”选择部分担保、全额担保时,必填 /// - [CheckStringInMap(Map = new[] { "true", "false" }, Required = false)] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "true", "false" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("CalculateCollInterest", "是否计算担保品价值产生利息", "5", false, "")] + [SacDescription("CalculateCollInterest", "是否计算担保品价值产生利息", "5", false, "校验规则:当“履约担保类型”选择部分担保、全额担保时,必填")] public string CalculateCollInterest { get; set; } + /// /// 履约担保品初始比率(%) /// 长度:5,2 /// 必填:否 /// - /// 说明:校验规则: - /// 1 当履约保障类型()选择部分担保或全额担保时必填; - /// 2 请输入0~100之间的最多两位小数的数字; + /// 说明:校验规则:1.当“履约担保类型”选择部分担保、全额担保时,必填;2.大于等于0的数字,保留两位小数,该值为100%时,填写100.00; /// /// - [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, CheckHandleName = "A")] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, Required = false, CheckHandleName = "B")] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MinValue = 0, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollInitialRatio", "履约担保品初始比率(%)", "5,2", false, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 请输入0~100之间的最多两位小数的数字;")] + [SacDescription("PerformanceCollInitialRatio", "履约担保品初始比率(%)", "5,2", false, + "校验规则:\r\n1.当“履约担保类型”选择部分担保、全额担保时,必填;\r\n2.大于等于0的数字,保留两位小数,该值为100%时,填写100.00;")] public string PerformanceCollInitialRatio { get; set; } + + /// + /// 履约担保品初始比率(现金部分)(%) + /// 长度:5,2 + /// 必填:否 + /// + /// 说明:校验规则:1、当“履约担保类型”选择部分担保、全额担保时,必填;2、大于等于0 的数字,保留两位小数,该值为100% 时 , 填写100.00 + /// + /// + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MinValue = 0, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("PerformanceCollInitialRatioCash", "履约担保品初始比率(现金部分)(%)", "5,2", false, + "校验规则:\r\n1、当“履约担保类型”选择部分担保、全额担保时,必填;\r\n2、大于等于0 的数字,保留两位小数,该值为100% 时 , 填写100.00")] + public string PerformanceCollInitialRatioCash { get; set; } + /// /// 履约担保品追保比率(%) /// 长度:5,2 /// 必填:否 - /// - /// 说明:校验规则: - /// 1 当履约保障类型()选择部分担保或全额担保时必填; - /// 2 请输入0~100之间的最多两位小数的数字; - /// + /// 校验规则:1.当“履约担保类型”选择部分担保、全额担保时,必填;2.大于等于0的数字,保留两位小数,该值为100%时,填写100.00; /// - [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, CheckHandleName = "A")] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, Required = false, CheckHandleName = "B")] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MinValue = 0, + CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollAddtlRatio", "履约担保品追保比率(%)", "5,2", false, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 请输入0~100之间的最多两位小数的数字;")] + [SacDescription("PerformanceCollAddtlRatio", "履约担保品追保比率(%)", "5,2", false, + "校验规则:\r\n1.当“履约担保类型”选择部分担保、全额担保时,必填;\r\n2.大于等于0的数字,保留两位小数,该值为100%时,填写100.00;")] public string PerformanceCollAddtlRatio { get; set; } + /// /// 履约担保品平仓比率(%) /// 长度:5,2 /// 必填:否 - /// - /// 说明:校验规则: - /// 1 当履约保障类型()选择部分担保或全额担保时必填; - /// 2 请输入0~100之间的最多两位小数的数字; - /// 备注:强行平仓时比率 - /// + /// 校验规则:1、当“履约担保类型”选择部分担保、全额担保时,必填;2、大于等于0的数字,保留两位小数,该值为100%时,填写100.00; /// - [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, CheckHandleName = "A")] - [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, Required = false, CheckHandleName = "B")] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MinValue = 0, + CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollOffsetRatio", "履约担保品平仓比率(%)", "5,2", false, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 请输入0~100之间的最多两位小数的数字;\r\n备注:强行平仓时比率;")] + [SacDescription("PerformanceCollOffsetRatio", "履约担保品平仓比率(%)", "5,2", false, + "校验规则:\r\n1、当“履约担保类型”选择部分担保、全额担保时,必填;\r\n2、大于等于0的数字,保留两位小数,该值为100%时,填写100.00;")] public string PerformanceCollOffsetRatio { get; set; } + /// - /// 备注 + /// 维持担保比率(%) + /// 长度:5,2 + /// 必填:否 + /// 校验规则:当"履约担保类型"选择部分担保、全额担保 时必填;选其他选项时不能填写; + /// + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntMaxLength(BeforePointMaxLength = 5, AfterPointMaxLength = 2, MinValue = 0, + CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("MaintainGuaranteeRatio", "维持担保比率(%)", "5,2", false, + "校验规则:当\"履约担保类型\"选择部分担保、全额担保 时必填;选其他选项时不能填写;")] + public string MaintainGuaranteeRatio { get; set; } + + /// + /// 备注/履约担保备注 /// 长度:1024 /// 必填:否 /// 说明:校验规则:填写上述字段或交易确认书中不能包含的信息 /// [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] - [SacDescription("PerformanceGuaranteeRemark", "备注", "1024", false, "校验规则:填写上述字段或交易确认书中不能包含的信息;")] + [SacDescription("PerformanceGuaranteeRemark", "备注/履约担保备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] public string PerformanceGuaranteeRemark { get; set; } /// - /// 履约保障书附件附件 + /// 履约担保附件 /// 长度: /// 必填:否 /// 说明:校验规则:只支持PDF格式 /// [CheckStringEndsWith(EndsWithString = ".pdf", Required = false)] [DefaultValue("")] - [SacDescription("PerformanceGuaranteeAtt", "履约保障书附件附件", "", false, "校验规则:只支持PDF格式;")] + [SacDescription("PerformanceGuaranteeAtt", "履约担保附件", "", false, "校验规则:只支持PDF格式;")] public string PerformanceGuaranteeAtt { get; set; } /// /// 履约担保品详情 /// 长度: /// 必填: - /// 说明:校验规则:当履约保障类型()选择部分担保或全额担保时必填; /// 说明:数组结构,支持新增多条 /// - [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] - [CheckIEnumerableTMinCount(CheckHandleName = "A", MinCount = 1)] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "B" })] + [CheckIEnumerableTMinCount(MinCount = 1, CheckHandleName = "A")] + [CheckIEnumerableTMaxCount(MaxCount = 0, CheckHandleName = "B", Required = false)] [XmlElement] - [SacDescription("PerformanceCollTuple", "履约担保品详情", "", false, "校验规则:当履约保障类型选择部分担保或全额担保时必填;\r\n数组结构,支持新增多条;")] + [NotMapped] + [SacDescription("PerformanceCollTuple", "履约担保品详情", "", false, "数组结构,支持新增多条;")] public List PerformanceCollTuple { get; set; } /// - /// 备注 + /// 备注/其他信息备注 /// 长度:1024 /// 必填:否 /// 说明:填写上述字段或交易确认书中不能包含的信息填写上述字段或交易确认书中不能包含的信息 /// [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] - [SacDescription("Remark", "备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息填写上述字段或交易确认书中不能包含的信息;")] + [SacDescription("Remark", "备注/其他信息备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息填写上述字段或交易确认书中不能包含的信息;")] public string Remark { get; set; } /// - /// 有效名义本金(人民币) + /// 有效名义本金(元) /// 长度:36,2 /// 必填:是 - /// 说明:有效名义本金是指期权参与率为100%且剔除了年化系数影响之后的名义本金, 校验规则:保留两位小数; + /// 说明: /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("ValidNotinalPrincipleAmt", "有效名义本金(人民币)", "36,2", true, "有效名义本金是指期权参与率为100%且剔除了年化系数影响之后的名义本金;\r\n校验规则:保留两位小数;")] + [SacDescription("ValidNotinalPrincipleAmt", "有效名义本金(元)", "36,2", true, + "")] public string ValidNotinalPrincipleAmt { get; set; } /// /// 合规意见书 @@ -487,168 +606,1894 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("ComplianceOpinion", "合规意见书", "", false, "校验规则:只支持PDF格式;")] public string ComplianceOpinion { get; set; } - /// - /// 行权价格1 - /// 长度:36,2 - /// 必填:是 - /// 说明:校验规则:保留两位小数; - /// - [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] - [DefaultValue("")] - [SacDescription("ExercisePriceOne", "行权价格1", "36,2", true, "校验规则:保留两位小数;")] - public string ExercisePriceOne { get; set; } - /// - /// 行权价格2 - /// 长度:36,2 - /// 必填:否 - /// 说明:校验规则:保留两位小数; - /// - [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] - [DefaultValue("")] - [SacDescription("ExercisePriceTwo", "行权价格2", "36,2", false, "校验规则:保留两位小数;")] - public string ExercisePriceTwo { get; set; } + + // /// + // /// 行权价格1 + // /// 长度:36,2 + // /// 必填:是 + // /// 说明:校验规则:保留两位小数; + // /// + // [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] + // [DefaultValue("")] + // [SacDescription("ExercisePriceOne", "行权价格1", "36,2", true, "校验规则:保留两位小数;")] + // public string ExercisePriceOne { get; set; } + // /// + // /// 行权价格2 + // /// 长度:36,2 + // /// 必填:否 + // /// 说明:校验规则:保留两位小数; + // /// + // [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] + // [DefaultValue("")] + // [SacDescription("ExercisePriceTwo", "行权价格2", "36,2", false, "校验规则:保留两位小数;")] + // public string ExercisePriceTwo { get; set; } /// /// 甲方代签产品名称 - /// 长度:200 + /// 长度:100 /// 必填:否 - /// 说明:校验规则:1 如甲方代签产品名称或甲方代签产品代码填值,则乙方代签产品名称和乙方代签产品代码禁止填值;2 甲方代签产品名称必须在主协议关联产品列表-产品名称中存在; + /// 说明:校验规则:1、如甲方代签产品名称或甲方交易对手方码(产品)填值,则乙方代签产品名称和乙方交易对手码(产品)禁止填值;2、甲方代签产品名称必须在主协议关联产品列表-产品名称中存在; /// - [CheckStringMaxLength(MaxLength = 200, Required = false)] + [CheckStringMaxLength(MaxLength = 100, Required = false)] [DefaultValue("")] - [SacDescription("PtyAPdctName", "甲方代签产品名称", "200", false, "校验规则:\r\n1 如甲方代签产品名称或甲方代签产品代码填值,则乙方代签产品名称和乙方代签产品代码禁止填值;\r\n2 甲方代签产品名称必须在主协议关联产品列表-产品名称中存在;")] + [SacDescription("PtyAPdctName", "甲方代签产品名称", "100", false, + "校验规则:\r\n1、如甲方代签产品名称或甲方交易对手方码(产品)填值,则乙方代签产品名称和乙方交易对手码(产品)禁止填值;\r\n2、甲方代签产品名称必须在主协议关联产品列表-产品名称中存在;")] public string PtyAPdctName { get; set; } /// - /// 甲方代签产品代码 + /// 甲方交易对手码(产品) /// 长度:20 /// 必填:否 - /// 说明:校验规则:如甲方代签产品名称或甲方代签产品代码填值,则乙方代签产品名称和乙方代签产品代码禁止填值; + /// 说明:校验规则:如甲方代签产品名称或甲方交易对手方码(产品)填值,则乙方代签产品名称和乙方交易对手码(产品)禁止填值; /// [CheckStringMaxLength(MaxLength = 20, Required = false)] [DefaultValue("")] - [SacDescription("PytAPdctCode", "甲方代签产品代码", "20", false, "校验规则:如甲方代签产品名称或甲方代签产品代码填值,则乙方代签产品名称和乙方代签产品代码禁止填值;")] + [SacDescription("PytAPdctCode", "甲方交易对手码(产品)", "20", false, "校验规则:如甲方代签产品名称或甲方交易对手方码(产品)填值,则乙方代签产品名称和乙方交易对手码(产品)禁止填值;")] public string PytAPdctCode { get; set; } /// /// 乙方代签产品名称 - /// 长度:200 + /// 长度:100 /// 必填:否 - /// 说明:校验规则:1 如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;2 乙方代签产品名称必须在主协议关联产品列表-产品名称中存在; + /// 说明:校验规则:1、如乙方代签产品名称或乙方交易对手方码(产品)填值,则甲方代签产品名称和甲方交易对手码(产品)禁止填值;2、乙方代签产品名称必须在主协议关联产品列表-产品名称中存在; /// - [CheckStringMaxLength(MaxLength = 200, Required = false)] + [CheckStringMaxLength(MaxLength = 100, Required = false)] [DefaultValue("")] - [SacDescription("PtyBPdctName", "乙方代签产品名称", "200", false, "校验规则:\r\n1 如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;\r\n2 乙方代签产品名称必须在主协议关联产品列表-产品名称中存在;")] + [SacDescription("PtyBPdctName", "乙方代签产品名称", "100", false, + "校验规则:\r\n1、如乙方代签产品名称或乙方交易对手方码(产品)填值,则甲方代签产品名称和甲方交易对手码(产品)禁止填值;\r\n2、乙方代签产品名称必须在主协议关联产品列表-产品名称中存在;")] public string PtyBPdctName { get; set; } /// - /// 乙方代签产品代码 + /// 乙方交易对手码(产品) /// 长度:20 /// 必填:否 - /// 说明:校验规则:如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值; + /// 说明:校验规则:如乙方代签产品名称或乙方交易对手方码(产品)填值,则甲方代签产品名称和甲方交易对手码(产品)禁止填值; /// [CheckStringMaxLength(MaxLength = 20, Required = false)] [DefaultValue("")] - [SacDescription("PytBPdctCode", "乙方代签产品代码", "20", false, "校验规则:如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;")] + [SacDescription("PytBPdctCode", "乙方交易对手码(产品)", "20", false, "校验规则:如乙方代签产品名称或乙方交易对手方码(产品)填值,则甲方代签产品名称和甲方交易对手码(产品)禁止填值;")] public string PytBPdctCode { get; set; } + + /// + /// 是否为跨境交易 + /// 长度:5 + /// 必填:是 + /// 说明: + /// + [CheckStringInMap(Map = new[] { "true", "false" })] + [DefaultValue("")] + [SacDescription("CrossBorderTransactions", "是否为跨境交易", "5", true, "")] + public string CrossBorderTransactions { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// [XmlIgnore] [DefaultValue("")] - [SacDescription("TradeId", "乙方代签产品代码", "20", false, "校验规则:如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;")] - public string TradeId { get; set; } - } + [SacDescription("Blank1", "空白1", "", false, "")] + public string Blank1 { get; set; } - /// - /// 交易确认书附件 - /// - public class ConfirmationAttModel - { /// - /// 交易确认书附件 + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: /// - [CheckStringEndsWith(EndsWithString = ".pdf")] + [XmlIgnore] [DefaultValue("")] - [SacDescription("ConfirmationAtt", "交易确认书附件", "", false, "")] - public string ConfirmationAtt { get; set; } + [SacDescription("Blank2", "空白2", "", false, "")] + public string Blank2 { get; set; } + + #region 香草及其组合 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string VanillaOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填;")] + public string VanillaStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及2个执行价时,必填;")] + public string VanillaStrikePriceCoefficientTwo { get; set; } + + /// + /// 行权价格系数3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaStrikePriceCoefficientThree", "行权价格系数3(%)", "5,2", false, "当期权涉及3个执行价时,必填;")] + public string VanillaStrikePriceCoefficientThree { get; set; } + + /// + /// 行权价格系数4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及4个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaStrikePriceCoefficientFour", "行权价格系数4(%)", "5,2", false, "当期权涉及4个执行价时,必填;")] + public string VanillaStrikePriceCoefficientFour { get; set; } + + /// + /// 参与率1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaEngagementRateOne", "参与率1(%)", "5,2", false, "当期权涉及1个参与率时,必填;")] + public string VanillaEngagementRateOne { get; set; } + + /// + /// 参与率2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaEngagementRateTwo", "参与率2(%)", "5,2", false, "当期权涉及2个参与率时,必填;")] + public string VanillaEngagementRateTwo { get; set; } + + /// + /// 参与率3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaEngagementRateThree", "参与率3(%)", "5,2", false, "当期权涉及3个参与率时,必填;")] + public string VanillaEngagementRateThree { get; set; } + + /// + /// 参与率4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及4个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaEngagementRateFour", "参与率4(%)", "5,2", false, "当期权涉及4个参与率时,必填;")] + public string VanillaEngagementRateFour { get; set; } + + /// + /// 封底收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限亏损时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaBackCoverYield", "封底收益率(非年化)(%)", "5,2", false, "当期权涉及有限亏损时,必填;")] + public string VanillaBackCoverYield { get; set; } + + /// + /// 封顶收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限收益时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaCappingYield", "封顶收益率(非年化)(%)", "5,2", false, "当期权涉及有限收益时,必填;")] + public string VanillaCappingYield { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaBlank1", "空白1", "", false, "")] + public string VanillaBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "0", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("VanillaBlank2", "空白2", "", false, "")] + public string VanillaBlank2 { get; set; } + + #endregion + + #region 二元及其组合 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string DigitalOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填;")] + public string DigitalStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及2个执行价时,必填;")] + public string DigitalStrikePriceCoefficientTwo { get; set; } + + /// + /// 行权价格系数3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalStrikePriceCoefficientThree", "行权价格系数3(%)", "5,2", false, "当期权涉及3个执行价时,必填;")] + public string DigitalStrikePriceCoefficientThree { get; set; } + + /// + /// 参与率1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalEngagementRateOne", "参与率1(%)", "5,2", false, "当期权涉及1个参与率时,必填;")] + public string DigitalEngagementRateOne { get; set; } + + /// + /// 参与率2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalEngagementRateTwo", "参与率2(%)", "5,2", false, "当期权涉及2个参与率时,必填;")] + public string DigitalEngagementRateTwo { get; set; } + + /// + /// 参与率3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个参与率时,必填; + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalEngagementRateThree", "参与率3(%)", "5,2", false, "当期权涉及3个参与率时,必填;")] + public string DigitalEngagementRateThree { get; set; } + + /// + /// 收益率1(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以获得的行权收益,当期权涉及1个收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalYieldOneNonAnnualized", "收益率1(非年化)(%)", "5,2", false, "期权买方可以获得的行权收益,当期权涉及1个收益率时,必填;")] + public string DigitalYieldOneNonAnnualized { get; set; } + + /// + /// 收益率2(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalYieldTwoNonAnnualized", "收益率2(非年化)(%)", "5,2", false, "当期权涉及2个收益率时,必填;")] + public string DigitalYieldTwoNonAnnualized { get; set; } + + /// + /// 收益率3(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalYieldThreeNonAnnualized", "收益率3(非年化)(%)", "5,2", false, "当期权涉及3个收益率时,必填;")] + public string DigitalYieldThreeNonAnnualized { get; set; } + + /// + /// 收益率4(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及4个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00, */Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalYieldFourNonAnnualized", "收益率4(非年化)(%)", "5,2", false, "当期权涉及4个收益率时,必填;")] + public string DigitalYieldFourNonAnnualized { get; set; } + + ///// + ///// 最低收益率(年化)(%) + ///// 长度:5,2 + ///// 必填:否 + ///// 说明:期权存在最低保底收益时,必填 + ///// + //[CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + //[CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + //[CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + //[CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + //[DefaultValue("")] + //[SacDescription("DigitalMinimumYieldAnnualized", "最低收益率(年化)(%)", "5,2", false, "期权存在最低保底收益时,必填;")] + //public string DigitalMinimumYieldAnnualized { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalBlank1", "空白1", "", false, "")] + public string DigitalBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "1", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DigitalBlank2", "空白2", "", false, "")] + public string DigitalBlank2 { get; set; } + + #endregion + + #region 障碍及其组合 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string BarrierOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产的价格,当期权涉及1个执行价时,必填;")] + public string BarrierStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及2个执行价时,必填;")] + public string BarrierStrikePriceCoefficientTwo { get; set; } + + /// + /// 参与率1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierEngagementRateOne", "参与率1(%)", "5,2", false, "当期权涉及1个参与率时,必填;")] + public string BarrierEngagementRateOne { get; set; } + + /// + /// 参与率2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierEngagementRateTwo", "参与率2(%)", "5,2", false, "当期权涉及2个参与率时,必填;")] + public string BarrierEngagementRateTwo { get; set; } + + /// + /// 敲入价格系数(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:存在敲入障碍价格时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierKnockInPriceCoefficient", "敲入价格系数(%)", "5,2", false, "存在敲入障碍价格时,必填;")] + public string BarrierKnockInPriceCoefficient { get; set; } + + /// + /// 敲出价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个敲出障碍价格时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierKnockOutPriceCoefficientOne", "敲出价格系数1(%)", "5,2", false, "当期权涉及1个敲出障碍价格时,必填;")] + public string BarrierKnockOutPriceCoefficientOne { get; set; } + + /// + /// 敲出收益率1(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个敲出收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierKnockOutYieldOneNonAnnualized", "敲出收益率1(非年化)(%)", "5,2", false, + "当期权涉及1个敲出收益率时,必填;")] + public string BarrierKnockOutYieldOneNonAnnualized { get; set; } + + /// + /// 敲出价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个敲出障碍价格时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierKnockOutPriceCoefficientTwo", "敲出价格系数2(%)", "5,2", false, "当期权涉及2个敲出障碍价格时,必填;")] + public string BarrierKnockOutPriceCoefficientTwo { get; set; } + + /// + /// 敲出收益率2(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个敲出收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0.00,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierKnockOutYieldTwoNonAnnualized", "敲出收益率2(非年化)(%)", "5,2", false, "当期权涉及2个敲出收益率时,必填;")] + public string BarrierKnockOutYieldTwoNonAnnualized { get; set; } + + /// + /// 观察类型 + /// 长度:2 + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2" }, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierObservationType", "观察类型", "2", false, "")] + public string BarrierObservationType { get; set; } + + /// + /// 封底收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限亏损时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierBackCoverYield", "封底收益率(非年化)(%)", "5,2", false, "当期权涉及有限亏损时,必填;")] + public string BarrierBackCoverYield { get; set; } + + /// + /// 未敲入收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及未敲入收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierUnknockedYield", "未敲入收益率(非年化)(%)", "5,2", false, "当期权涉及未敲入收益率时,必填;")] + public string BarrierUnknockedYield { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierBlank1", "空白1", "", false, "")] + public string BarrierBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "2", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("BarrierBlank2", "空白2", "", false, "")] + public string BarrierBlank2 { get; set; } + + #endregion + + #region 自动赎回 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string AutoCallableOptionStructureSubclass { get; set; } + + /// + /// 参与率(%) + /// 长度:5,2 + /// 必填:是 + /// 说明:当期权涉及1个参与率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0.00, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableEngagementRate", "参与率(%)", "5,2", true, "当期权涉及1个参与率时,必填;")] + public string AutoCallableEngagementRate { get; set; } + + /// + /// 行权价格系数(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:用于计算行权价格;当“期权结构小类”选择“非保本普通型雪球”“非保本要素(敲入、敲出、收益率)可变型雪球”“非保本普通型凤凰”“非保本要素(敲入、敲出、收益率)可变型凤凰”时,必填; + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "2", "3", "4", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "2", "3", "4", "5", "6" }, CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "6" }, CheckHandleNameArr = new[] { "C" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, CheckHandleName = "A")] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "C")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableStrikePriceCoefficient", "行权价格系数(%)", "5,2", false, "用于计算行权价格;\r\n当“期权结构小类”选择“非保本普通型雪球”“非保本要素(敲入、敲出、收益率)可变型雪球”“非保本普通型凤凰”“非保本要素(敲入、敲出、收益率)可变型凤凰”时,必填;")] + public string AutoCallableStrikePriceCoefficient { get; set; } + + /// + /// 敲出价格系数(%) + /// 长度:1024 + /// 必填:是 + /// 说明:正数,保留两位小数;当期权涉及敲出价格系数时,必填,以数组形式提交,半角字符,数组元素以分号隔开,示例:(95.00;90.00;85.00) + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockOutPriceCoefficient", "敲出价格系数(%)", "1024", true, + "当期权涉及敲出价格系数时,必填,以数组形式提交,半角字符,数组元素以分号隔开,示例:(95.00;90.00;85.00);")] + public string AutoCallableKnockOutPriceCoefficient { get; set; } + + /// + /// 敲出收益率(年化)(%) + /// 长度:1024 + /// 必填:是 + /// 说明:合约中既定的收益利率;当标的物触及敲出障碍价时的所得收益将通过该数值计算,以数组形式提交,半角字符,数组元素以分号隔开,示例:(10.00;10.00;10.00) + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockOutYieldAnnualized", "敲出收益率(年化)(%)", "1024", true, + "合约中既定的收益利率;当标的物触及敲出障碍价时的所得收益将通过该数值计算,以数组形式提交,半角字符,数组元素以分号隔开,示例:(10.00;10.00;10.00);")] + public string AutoCallableKnockOutYieldAnnualized { get; set; } + + /// + /// 敲出观察日 + /// 长度:2048 + /// 必填:是 + /// 说明:YYYY-MM-DD;半角字符,以数组形式提交,数组元素以分号隔开;示例:(2023-01-01;2023-02-01;2023-03-01) + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 2048, CheckHandleName = "A")] + // [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockOutObservationDay", "敲出观察日", "2048", true, + "半角字符,以数组形式提交,数组元素以分号隔开;示例:(2023-01-01;2023-02-01;2023-03-01)")] + public string AutoCallableKnockOutObservationDay { get; set; } + + /// + /// 敲出结算日 + /// 长度:2048 + /// 必填:是 + /// 说明:半角字符,以数组形式提交,数组元素以分号隔开;示例:(2023-01-02;2023-02-02;2023-03-02) + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 2048, CheckHandleName = "A")] + // [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockOutSettlementDay", "敲出结算日", "2048", true, + "半角字符,以数组形式提交,数组元素以分号隔开;示例:(2023-01-02;2023-02-02;2023-03-02)")] + public string AutoCallableKnockOutSettlementDay { get; set; } + + /// + /// 敲入价格系数(%) + /// 长度:1024 + /// 必填:否 + /// 说明:当“期权结构小类”选择 “保本雪球(三元)”“非保本普通型雪球”“非保本要素(敲入、敲出、收益率)可变型雪球”“非保本普通型凤凰”“非保本要素(敲入、敲出、收益率)可变型凤凰”或涉及敲入障碍价格时,必填;涉及多个时以数组形式提交,半角字符,数组元素以分号隔开,示例:(95.00;90.00;85.00) + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "1", "2", "3", "4", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "1", "2", "3", "4", "5", "6" }, CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "6" }, CheckHandleNameArr = new[] { "C" })] + [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [CheckStringMaxLength(MaxLength = 1024, Required = false, CheckHandleName = "C")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockInPriceCoefficient", "敲入价格系数(%)", "1024", false, + "当“期权结构小类”选择 “保本雪球(三元)”“非保本普通型雪球”“非保本要素(敲入、敲出、收益率)可变型雪球”“非保本普通型凤凰”“非保本要素(敲入、敲出、收益率)可变型凤凰”或涉及敲入障碍价格时,必填;\r\n涉及多个时以数组形式提交,半角字符,数组元素以分号隔开,示例:(95.00;90.00;85.00)")] + public string AutoCallableKnockInPriceCoefficient { get; set; } + + /// + /// 敲入观察日 + /// 长度:1024 + /// 必填:否 + /// 说明:当期权涉及到多个敲入价格系数(%)时,必填;半角字符,以时间区间的数组形式提交,数组元素以分号隔开,示例:(2023-01-01:2023-12-31;2024-01-01:2024-12-31;2025-01-01:2025-12-31); + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 1024, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableKnockInObservationDay", "敲入观察日", "1024", false, + "当期权涉及到多个敲入价格系数(%)时,必填;\r\n半角字符,以时间区间的数组形式提交,数组元素以分号隔开,示例:(2023-01-01:2023-12-31;2024-01-01:2024-12-31;2025-01-01:2025-12-31);")] + public string AutoCallableKnockInObservationDay { get; set; } + + /// + /// 红利收益率(年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当"期权结构小类"选择"保本雪球(二元)"或"保本雪球(三元)"时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "0", "1" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "0", "1" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, IgnoreNullOrEmpty = false, + CheckHandleName = "A")] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, + CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableDividendYieldAnnualized", "红利收益率(年化)(%)", "5,2", false, + "当\"期权结构小类\"选择\"保本雪球(二元)\"或\"保本雪球(三元)\"时,必填;")] + public string AutoCallableDividendYieldAnnualized { get; set; } + + /// + /// 最低收益率(年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当“期权结构小类”选择“保本雪球(三元)”时,必填;当“是否为FCN型”字段选择“是”时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "1" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableWhetherFixedCouponNote), + ConditionMap = new[] { "0" }, CheckHandleNameArr = new[] { "C" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "1" }, CheckHandleNameArr = new[] { "B" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableWhetherFixedCouponNote), + ConditionMap = new[] { "0" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, IgnoreNullOrEmpty = false, + CheckHandleName = "A")] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, IgnoreNullOrEmpty = false, + CheckHandleName = "C")] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, IgnoreNullOrEmpty = false, + Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableMinimumYieldAnnualized", "最低收益率(年化)(%)", "5,2", false, + "当“期权结构小类”选择“保本雪球(三元)”时,必填;\r\n当“是否为FCN型”字段选择“是”时,必填;")] + public string AutoCallableMinimumYieldAnnualized { get; set; } + + /// + /// 最低本金保障比例(%) + /// 长度:5,2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableMinimumPrincipalProtectionRatio", "最低本金保障比例(%)", "5,2", true, "")] + public string AutoCallableMinimumPrincipalProtectionRatio { get; set; } + + /// + /// 是否为折价建仓型 + /// 长度:2 + /// 必填:是 + /// 说明:当期权涉及到敲入后转线性结构的情形时,填"是" + /// + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false)] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherDiscountedWarehouseType", "是否为折价建仓型", "2", true, + "当期权涉及到敲入后转线性结构的情形时,填\"是\"")] + public string AutoCallableWhetherDiscountedWarehouseType { get; set; } + + /// + /// 是否为收益增强型 + /// 长度:2 + /// 必填:是 + /// 说明:当期权涉及到敲出时收益增强的情形时,填"是" + /// + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false)] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherRevenueEnhancedType", "是否为收益增强型", "2", true, "当期权涉及到敲出时收益增强的情形时,填\"是\"")] + public string AutoCallableWhetherRevenueEnhancedType { get; set; } + + /// + /// 是否为FCN型 + /// 长度:2 + /// 必填:是 + /// 说明:当期权为FCN结构时,填“是” + /// + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false)] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherFixedCouponNote", "是否为FCN型", "2", true, "当期权为FCN结构时,填“是”")] + public string AutoCallableWhetherFixedCouponNote { get; set; } + + /// + /// 敲入价格系数是否可变 + /// 长度:2 + /// 必填:否 + /// 说明:当"期权结构小类"选择"非保本要素(敲入、敲出、收益率)可变型雪球"或"非保本要素(敲入、敲出、收益率)可变型凤凰"时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherKnockInPriceCoefficientIsVariable", "敲入价格系数是否可变", "2", false, + "当\"期权结构小类\"选择\"非保本要素(敲入、敲出、收益率)可变型雪球\"或\"非保本要素(敲入、敲出、收益率)可变型凤凰\"时,必填;")] + public string AutoCallableWhetherKnockInPriceCoefficientIsVariable { get; set; } + + /// + /// 敲出价格系数是否可变 + /// 长度:2 + /// 必填:否 + /// 说明:当"期权结构小类"选择"非保本要素(敲入、敲出、收益率)可变型雪球"或"非保本要素(敲入、敲出、收益率)可变型凤凰"时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherKnockOutPriceCoefficientIsVariable", "敲出价格系数是否可变", "2", false, + "当\"期权结构小类\"选择\"非保本要素(敲入、敲出、收益率)可变型雪球\"或\"非保本要素(敲入、敲出、收益率)可变型凤凰\"时,必填;")] + public string AutoCallableWhetherKnockOutPriceCoefficientIsVariable { get; set; } + + /// + /// 敲出收益率是否可变 + /// 长度:2 + /// 必填:否 + /// 说明:当"期权结构小类"选择"非保本要素(敲入、敲出、收益率)可变型雪球"或"非保本要素(敲入、敲出、收益率)可变型凤凰"时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherKnockOutYieldIsVariable", "敲出收益率是否可变", "2", false, + "当\"期权结构小类\"选择\"非保本要素(敲入、敲出、收益率)可变型雪球\"或\"非保本要素(敲入、敲出、收益率)可变型凤凰\"时,必填;")] + public string AutoCallableWhetherKnockOutYieldIsVariable { get; set; } + + /// + /// 红利收益率是否可变 + /// 长度:2 + /// 必填:否 + /// 说明:当"期权结构小类"选择"非保本要素(敲入、敲出、收益率)可变型雪球"或"非保本要素(敲入、敲出、收益率)可变型凤凰"时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(AutoCallableOptionStructureSubclass), + ConditionMap = new[] { "3", "5" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1" }, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableWhetherDividendYieldIsVariable", "红利收益率是否可变", "2", false, + "当\"期权结构小类\"选择\"非保本要素(敲入、敲出、收益率)可变型雪球\"或\"非保本要素(敲入、敲出、收益率)可变型凤凰\"时,必填;")] + public string AutoCallableWhetherDividendYieldIsVariable { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableBlank1", "空白1", "", false, "")] + public string AutoCallableBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "3", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AutoCallableBlank2", "空白2", "", false, "")] + public string AutoCallableBlank2 { get; set; } + + #endregion + + #region 区间累计 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string RangeAccrualOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填;")] + public string RangeAccrualStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及到2个执行价时,必填;")] + public string RangeAccrualStrikePriceCoefficientTwo { get; set; } + + /// + /// 行权价格系数3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到3个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualStrikePriceCoefficientThree", "行权价格系数3(%)", "5,2", false, "当期权涉及到3个执行价时,必填;")] + public string RangeAccrualStrikePriceCoefficientThree { get; set; } + + /// + /// 行权价格系数4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到4个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualStrikePriceCoefficientFour", "行权价格系数4(%)", "5,2", false, "当期权涉及到4个执行价时,必填;")] + public string RangeAccrualStrikePriceCoefficientFour { get; set; } + + /// + /// 参与率(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到1个参与率时,必须为正数;每份合约中参与率的大小决定了实际名义本金的数额 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualEngagementRate", "参与率(%)", "5,2", false, + "当期权涉及到1个参与率时,必须为正数;\r\n每份合约中参与率的大小决定了实际名义本金的数额;")] + public string RangeAccrualEngagementRate { get; set; } + + /// + /// 收益率1(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以获得的行权收益,当期权涉及到1个收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualOneNonAnnualized", "收益率1(非年化)(%)", "5,2", false, + "期权买方可以获得的行权收益,当期权涉及到1个收益率时,必填;")] + public string RangeAccrualOneNonAnnualized { get; set; } + + /// + /// 收益率2(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualTwoNonAnnualized", "收益率2(非年化)(%)", "5,2", false, "当期权涉及到2个收益率时,必填;")] + public string RangeAccrualTwoNonAnnualized { get; set; } + + /// + /// 收益率3(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualThreeNonAnnualized", "收益率3(非年化)(%)", "5,2", false, "当期权涉及到3个收益率时,必填;")] + public string RangeAccrualThreeNonAnnualized { get; set; } + + /// + /// 收益率4(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个收益率时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, /*MinValue = 0,*/ Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualFourNonAnnualized", "收益率4(非年化)(%)", "5,2", false, "当期权涉及到4个收益率时,必填;")] + public string RangeAccrualFourNonAnnualized { get; set; } + + ///// + ///// 最低收益率(年化)(%) + ///// 长度:5,2 + ///// 必填:否 + ///// 说明:期权存在最低保底收益时,必填;无论标的合约价格如何变动,投资者可以获得的最低收益 + ///// + //[CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + //[CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + //[CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + //[CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + //[DefaultValue("")] + //[SacDescription("RangeAccrualMinimumYieldAnnualized", "最低收益率(年化)(%)", "5,2", false, + // "期权存在最低保底收益时,必填;无论标的合约价格如何变动,投资者可以获得的最低收益;")] + //public string RangeAccrualMinimumYieldAnnualized { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualBlank1", "空白1", "", false, "")] + public string RangeAccrualBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "4", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("RangeAccrualBlank2", "空白2", "", false, "")] + public string RangeAccrualBlank2 { get; set; } + + #endregion + + #region 安全气囊 + + /// + /// 期权结构小类 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagOptionStructureSubclass", "期权结构小类", "2", true, "")] + public string AirbagOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填;")] + public string AirbagStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及到2个执行价时,必填;")] + public string AirbagStrikePriceCoefficientTwo { get; set; } + + /// + /// 行权价格系数3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到3个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagStrikePriceCoefficientThree", "行权价格系数3(%)", "5,2", false, "当期权涉及到3个执行价时,必填;")] + public string AirbagStrikePriceCoefficientThree { get; set; } + + /// + /// 行权价格系数4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到4个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagStrikePriceCoefficientFour", "行权价格系数4(%)", "5,2", false, "当期权涉及到4个执行价时,必填;")] + public string AirbagStrikePriceCoefficientFour { get; set; } + + /// + /// 参与率1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagEngagementRateOne", "参与率1(%)", "5,2", false, "当期权涉及1个参与率时,必须为正数;")] + public string AirbagEngagementRateOne { get; set; } + + /// + /// 参与率2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagEngagementRateTwo", "参与率2(%)", "5,2", false, "当期权涉及2个参与率时,必须为正数;")] + public string AirbagEngagementRateTwo { get; set; } + + /// + /// 参与率3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagEngagementRateThree", "参与率3(%)", "5,2", false, "当期权涉及3个参与率时,必须为正数;")] + public string AirbagEngagementRateThree { get; set; } + + /// + /// 敲入价格系数(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:存在敲入障碍价格时,必填,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagKnockInPriceCoefficient", "敲入价格系数(%)", "5,2", false, "存在敲入障碍价格时,必填,必须为正数;")] + public string AirbagKnockInPriceCoefficient { get; set; } + + ///// + ///// 上端封顶收益率(非年化)(%) + ///// 长度:5,2 + ///// 必填:否 + ///// 说明:上端封顶类安全气囊类期权,必填 + ///// + //[CheckConditionStringInMap(ConditionName = nameof(AirbagOptionStructureSubclass), + // ConditionMap = new[] { "4" }, CheckHandleNameArr = new[] { "A" })] + //[CheckConditionStringNotInMap(ConditionName = nameof(AirbagOptionStructureSubclass), + // ConditionMap = new[] { "4" }, CheckHandleNameArr = new[] { "B" })] + //[CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, CheckHandleName = "A")] + //[CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + //[DefaultValue("")] + //[SacDescription("AirbagTopCapYieldAnnualized", "上端封顶收益率(非年化)(%)", "5,2", false, "上端封顶类安全气囊类期权,必填;")] + //public string AirbagTopCapYieldAnnualized { get; set; } + + ///// + ///// 最低收益率(年化)(%) + ///// 长度:5,2 + ///// 必填:否 + ///// 说明:期权存在最低保底收益时,必填 + ///// + //[CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + //[CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + //[CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + //[CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + //[DefaultValue("")] + //[SacDescription("AirbagMinimumYieldAnnualized", "最低收益率(年化)(%)", "5,2", false, "期权存在最低保底收益时,必填;")] + //public string AirbagMinimumYieldAnnualized { get; set; } + + /// + /// 封底收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限亏损时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagBackCoverYield", "封底收益率(非年化)(%)", "5,2", false, "当期权涉及有限亏损时,必填;")] + public string AirbagBackCoverYield { get; set; } + + /// + /// 封顶收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限收益时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagCappingYield", "封顶收益率(非年化)(%)", "5,2", false, "当期权涉及有限收益时,必填;")] + public string AirbagCappingYield { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagBlank1", "空白1", "", false, "")] + public string AirbagBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "5", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("AirbagBlank2", "空白2", "", false, "")] + public string AirbagBlank2 { get; set; } + + #endregion + + #region 其他 + + /// + /// 期权结构类型 + /// 长度:1024 + /// 必填:是 + /// 说明:必填,请以文字形式描述期权结构类型名称 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersOptionStructureSubclass", "期权结构类型", "1024", true, "必填,请以文字形式描述期权结构类型名称;")] + public string OthersOptionStructureSubclass { get; set; } + + /// + /// 行权价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersStrikePriceCoefficientOne", "行权价格系数1(%)", "5,2", false, + "期权买方可以买入或卖出标的资产价格,当期权涉及到1个执行价时,必填;")] + public string OthersStrikePriceCoefficientOne { get; set; } + + /// + /// 行权价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersStrikePriceCoefficientTwo", "行权价格系数2(%)", "5,2", false, "当期权涉及到2个执行价时,必填;")] + public string OthersStrikePriceCoefficientTwo { get; set; } + + /// + /// 行权价格系数3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到3个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersStrikePriceCoefficientThree", "行权价格系数3(%)", "5,2", false, "当期权涉及到3个执行价时,必填;")] + public string OthersStrikePriceCoefficientThree { get; set; } + + /// + /// 行权价格系数4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到4个执行价时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersStrikePriceCoefficientFour", "行权价格系数4(%)", "5,2", false, "当期权涉及到4个执行价时,必填;")] + public string OthersStrikePriceCoefficientFour { get; set; } + + /// + /// 参与率1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及1个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersEngagementRateOne", "参与率1(%)", "5,2", false, "当期权涉及1个参与率时,必须为正数;")] + public string OthersEngagementRateOne { get; set; } + + /// + /// 参与率2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及2个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersEngagementRateTwo", "参与率2(%)", "5,2", false, "当期权涉及2个参与率时,必须为正数;")] + public string OthersEngagementRateTwo { get; set; } + + /// + /// 参与率3(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及3个参与率时,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersEngagementRateThree", "参与率3(%)", "5,2", false, "当期权涉及3个参与率时,必须为正数;")] + public string OthersEngagementRateThree { get; set; } + + /// + /// 参与率4(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及4个参与率时,必填,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersEngagementRateFour", "参与率4(%)", "5,2", false, "当期权涉及4个参与率时,必填,必须为正数;")] + public string OthersEngagementRateFour { get; set; } + + /// + /// 障碍价格系数1(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到1个障碍价格时,必填,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersBarrierPricesCoefficientOne", "障碍价格系数1(%)", "5,2", false, "当期权涉及到1个障碍价格时,必填,必须为正数;")] + public string OthersBarrierPricesCoefficientOne { get; set; } + + /// + /// 障碍价格系数2(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及到2个障碍价格时,必填,必须为正数 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersBarrierPricesCoefficientTwo", "障碍价格系数2(%)", "5,2", false, "当期权涉及到2个障碍价格时,必填,必须为正数;")] + public string OthersBarrierPricesCoefficientTwo { get; set; } + + /// + /// 封底收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限亏损时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersBackCoverYield", "封底收益率(非年化)(%)", "5,2", false, "当期权涉及有限亏损时,必填")] + public string OthersBackCoverYield { get; set; } + + /// + /// 封顶收益率(非年化)(%) + /// 长度:5,2 + /// 必填:否 + /// 说明:当期权涉及有限收益时,必填 + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 5, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersCappingYield", "封顶收益率(非年化)(%)", "5,2", false, "当期权涉及有限收益时,必填")] + public string OthersCappingYield { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersBlank1", "空白1", "", false, "")] + public string OthersBlank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [CheckConditionStringValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "OptionStructureType", ConditionValue = "99", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 9999, Required = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OthersBlank2", "空白2", "", false, "")] + public string OthersBlank2 { get; set; } + + #endregion } - /// - /// 标的详情 - /// - public class UndrlygAssetModel + // + // 标的详情 + // + [Table("A1004_UndrlygAsset")] + public class UndrlygAssetModel : ReportSubBaseModel { /// /// 标的小类 /// 长度:2 /// 必填:是 - /// 说明: + /// 说明: /// - [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "99" })] + [CheckStringInMap(Map = new[] + { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", + "99" + })] [DefaultValue("")] [SacDescription("UndrlygAssetDtldType", "标的小类", "2", true, "")] public string UndrlygAssetDtldType { get; set; } /// - /// 挂钩标的名称 + /// 标的名称 /// 长度:200 /// 必填:是 /// 说明: /// [CheckStringMaxLength(MaxLength = 200)] [DefaultValue("")] - [SacDescription("UndrlygAssetName", "挂钩标的名称", "200", true, "")] + [SacDescription("UndrlygAssetName", "标的名称", "200", true, "")] public string UndrlygAssetName { get; set; } /// /// 标的交易场所 /// 长度:2 /// 必填:是 - /// 说明: + ///// 说明: /// - [CheckStringInMap(Map = new[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "99" })] + //[CheckStringInMap(Map = new[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "99" })] + [CheckStringMaxLength(MaxLength = 200)] [DefaultValue("")] - [SacDescription("UndrlygAssetTradgPlc", "标的交易场所", "2", true, "")] + [SacDescription("UndrlygAssetTradgPlc", "标的交易场所", "200", true, "")] public string UndrlygAssetTradgPlc { get; set; } /// - /// 标的代码 - /// 长度:32 + /// 标的编码 + /// 长度:200 /// 必填:是 /// 说明: /// - [CheckStringMaxLength(MaxLength = 32)] + [CheckStringMaxLength(MaxLength = 200)] [DefaultValue("")] - [SacDescription("UndrlygAssetCode", "标的代码", "32", true, "")] + [SacDescription("UndrlygAssetCode", "标的编码", "200", true, "")] public string UndrlygAssetCode { get; set; } /// /// 标的数量 + /// 长度:36,6 + /// 必填:是 + /// 说明:校验规则:六位小数且大于0 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 6)] + [DefaultValue("")] + [SacDescription("UndrlygAssetAmt", "标的数量", "36,6", true, "校验规则:六位小数且大于0;")] + public string UndrlygAssetAmt { get; set; } + + /// + /// 合约乘数 + /// 长度:36,6 + /// 必填:是 + /// 说明:校验规则:整数 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 0)] + [DefaultValue("")] + [SacDescription("ContractMultiplier", "合约乘数", "36", true, "校验规则:整数;")] + public string ContractMultiplier { get; set; } + + /// + /// 标的个数 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [CheckStringInMap(Map = new[] { "0", "1" })] + [DefaultValue("")] + [SacDescription("UndrlygAssetNo", "标的个数", "2", true, "")] + public string UndrlygAssetNo { get; set; } + + /// + /// 多标的期权类型 /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:必须两位小数以内; + /// 说明:多标的期权必填; /// - [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] + [CheckConditionStringValue(ConditionName = "UndrlygAssetNo", ConditionValue = "1", + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = "UndrlygAssetNo", ConditionValue = "1", + CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 2, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("UndrlygAssetAmt", "标的数量", "36,2", false, "校验规则:必须两位小数以内;")] - public string UndrlygAssetAmt { get; set; } + [SacDescription("MultiOrderOptionType", "多标的期权类型", "2", false, "多标的期权必填;")] + public string MultiOrderOptionType { get; set; } + + /// + /// 标的名义本金(元) + /// 长度:36,2 + /// 必填:是 + /// 说明:包含多个标的的期权交易,每个标的须填写一份标的详情表 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("UndrlygAssetNotinalPrincipleAmtRMB", "标的名义本金(元)", "36,2", true, "包含多个标的的期权交易,每个标的须填写一份标的详情表")] + public string UndrlygAssetNotinalPrincipleAmtRMB { get; set; } + + /// + /// 标的价格 + /// 长度:36,4 + /// 必填:是 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 4)] + [DefaultValue("")] + [SacDescription("OpeningPrice", "标的价格", "36,4", true, "")] + public string OpeningPrice { get; set; } + + /// + /// 标的类型 + /// 长度:2 + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("UndrlygAssetType", "标的类型", "2", false, "")] + public string UndrlygAssetType { get; set; } + + /// + /// 标的价格货币 + /// 长度:2 + /// 必填:否 + /// 说明:当“标的类型”选择“权益类”“大宗商品”“利率”“信用类”“其他”时,必填 + /// + [CheckConditionStringInMap(ConditionName = nameof(UndrlygAssetType), + ConditionMap = new[] { "0", "1", "2", "3", "99" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(UndrlygAssetType), + ConditionMap = new[] { "0", "1", "2", "3", "99" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 2, IgnoreNullOrEmpty = false, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("OpeningPriceCurrency", "标的价格货币", "2", false, "当标的类型选择权益类、大宗商品、利率、信用类、其他时,必填")] + public string OpeningPriceCurrency { get; set; } + + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "关联交易确认书编号", "32", false, "")] + public string ConfirmationNo { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank1", "空白1", "", false, "")] + public string Blank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank2", "空白2", "", false, "")] + public string Blank2 { get; set; } + + } - /// - /// 履约担保品详情 - /// - public class PerformanceGuaranteeAttModel + // + // 履约担保品详情 + // + [Table("A1004_PerformanceGuaranteeAtt")] + public class PerformanceGuaranteeAttModel : ReportSubBaseModel { /// /// 履约担保品类型 /// 长度:2 /// 必填:否 - /// 说明:校验规则:当履约保障类型()选择部分担保或全额担保时必填; - /// 说明: + /// 说明:校验规则:当“履约担保类型”选择部分担保、全额担保时,必填; /// - [CheckStringInMap(Map = new[] { "0", "1", "99" })] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "99" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollType", "履约担保品类型", "2", false, "校验规则:当履约保障类型选择部分担保或全额担保时必填;")] + [SacDescription("PerformanceCollType", "履约担保品类型", "2", false, "校验规则:当“履约担保类型”选择部分担保、全额担保时,必填;")] public string PerformanceCollType { get; set; } + + /// + /// 履约担保类型 + /// 长度:2 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [CheckStringInMap(Map = new[] { "1", "2", "3" })] + [DefaultValue("")] + [SacDescription("PerformanceGuaranteeType", "履约担保类型", "2", true, "")] + public string PerformanceGuaranteeType { get; set; } + /// /// 担保品担保范围 /// 长度:2 /// 必填:否 - /// 说明: + /// 说明:校验规则:当“履约担保类型”选择部分担保、全额担保时,必填; /// - [CheckStringInMap(Map = new[] { "0", "1", "2" }, Required = false)] + [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, + CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), + ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2" }, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollRange", "担保品担保范围", "2", false, "")] + [SacDescription("PerformanceCollRange", "担保品担保范围", "2", false, "校验规则:当“履约担保类型”选择部分担保、全额担保时,必填;")] public string PerformanceCollRange { get; set; } /// /// 多笔担保交易确认书编号 @@ -660,5 +2505,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("MultiConfirmationID", "多笔担保交易确认书编号", "1024", false, "")] public string MultiConfirmationID { get; set; } + + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "关联交易确认书编号", "32", false, "")] + public string ConfirmationNo { get; set; } + + /// + /// 备注 + /// 长度:1024 + /// 必填:否 + /// 说明: + /// + [CheckStringMaxLength(MaxLength = 1024, Required = false)] + [DefaultValue("")] + [SacDescription("Remarks", "备注", "", false, "")] + public string Remarks { get; set; } } + + } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionTerminationModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionTerminationModel.cs index 01346e46..4fdf7652 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionTerminationModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OptionTerminationModel.cs @@ -1,10 +1,18 @@ -using System.ComponentModel; +using Newtonsoft.Json; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; namespace YLErp.Modules.SuperviseReportModule.SAC.Model { + + /// + /// 了结确认书 + /// + [Table("A1007_OptionTermination")] public class OptionTerminationModel : ReportBaseModel { /// @@ -30,6 +38,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("BizID", "业务编号", "50", false, "校验规则:补正时必填;")] public new string BizID { get; set; } /// + /// 操作事件编号 + /// 长度:6 + /// 必填:是 + /// + /// 说明:存续期发生相关事件时,必填; + /// 同一笔交易确认书下应当保证唯一性,并按照事件发生顺序进行编号,起始编号为0000. + /// 如一笔交易下依次发生展期\调仓\终止事件,编号应当分别为0000\0001\0002, + /// 场外业务报告系统返回编号分别为E0000\R0001\T0002 + /// + /// + [CheckStringLengthInMap(Map = new[] { 4, 5 })] + [DefaultValue("")] + [SacDescription("DurationEventNO", "操作事件编号", "6", true, "存续期发生相关事件时,必填;\r\n同一笔交易确认书下应当保证唯一性,并按照事件发生顺序进行编号,起始编号为0000.\r\n如一笔交易下依次发生展期、调仓、终止事件,编号应当分别为0000、0001、0002,\r\n场外业务报告系统返回编号分别为E0000、R0001、T0002;")] + public new string DurationEventNO { get; set; } + /// /// 交易确认书编号(双方约定) /// 长度:100 /// 必填:是 @@ -37,53 +60,37 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringMaxLength(MaxLength = 100)] [DefaultValue("")] - [SacDescription("ConfirmationNo", "交易确认书编号", "100", true, "双方约定;")] + [SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")] public string ConfirmationNo { get; set; } /// - /// 终止日期 + /// 存续期操作类型 + /// 长度:2 + /// 必填:是 + /// 说明:敲入、敲出只限于自动赎回、安全气囊、障碍及其组合类期权填写 + /// + [CheckStringInMap(Map = new[] { "01", "02", "03", "05", "06" })] + [DefaultValue("")] + [SacDescription("DurationOperationType", "存续期操作类型", "2", true, "敲入、敲出只限于自动赎回、安全气囊、障碍及其组合类期权填写")] + public string DurationOperationType { get; set; } + /// + /// 操作发生日期 /// 长度:10 /// 必填:是 - /// 说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 必须是yyyy-MM-dd;3 不存在展期数据:不得等于晚于原合约到期日;4 存在展期数据:不得等于晚于最新展期日期;5 新增终止:一个日期只能存在一条终止数据; + /// 说明:分别为“确定进行展期日期”“合约终止日期”“交易发生违约日期”“发生敲入事件日期”“发生敲出事件日期” /// - [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringMaxLength(MaxLength = 10, CheckHandleName = "A")] - [CheckStringIsDateTimeFormat(CheckHandleName = "A")] - [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] + // [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] + // [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 10)] + [CheckStringIsDateTimeFormat()] + // [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("ExpirationDate", "终止日期", "10", true, "校验规则:\r\n1 当存续期操作类型,选择终止、违约终止时必填;\r\n2 必须是yyyy-MM-dd;\r\n3 不存在展期数据:不得等于晚于原合约到期日;\r\n4 存在展期数据:不得等于晚于最新展期日期;\r\n5 新增终止:一个日期只能存在一条终止数据;")] + [SacDescription("ExpirationDate", "操作发生日期", "10", true, "分别为“确定进行展期日期”“合约终止日期”“交易发生违约日期”“发生敲入事件日期”“发生敲出事件日期”")] public string ExpirationDate { get; set; } /// - /// 违约方 - /// 长度:2 - /// 必填:否 - /// 说明: 校验规则:存续期操作类型为违约终止时必填; - /// - [CheckConditionStringValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNEQValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "B" })] - [CheckStringInMap(Map = new[] { "01", "02" }, CheckHandleName = "A")] - [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] - [DefaultValue("")] - [SacDescription("DefaultingParty", "违约方", "2", false, "校验规则:存续期操作类型为违约终止时必填;")] - public string DefaultingParty { get; set; } - /// - /// 违约事件说明 - /// 长度:1024 - /// 必填:否 - /// 说明:校验规则:存续期操作类型为违约终止时必填; - /// - [CheckConditionStringValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNEQValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "B" })] - [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] - [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] - [DefaultValue("")] - [SacDescription("DefaultEvent", "违约事件说明", "1024", false, "校验规则:存续期操作类型为违约终止时必填;")] - public string DefaultEvent { get; set; } - /// - /// 展期日期 + /// 展期后到期日 /// 长度:10 /// 必填:否 - /// 说明:校验规则:1 存续期操作类型为展期时必填;2 必须是yyyy-MM-dd;3 不存在展期数据:不得早于等于原合约到期日;4 存在展期数据:不得早于等于最新展期日期;5 新增终止:一个日期只能存在一条终止数据; + /// 说明:当“存续期操作类型”为“展期”时,必填;不存在展期操作数据,不得早于原合约到期日;存在展期操作数据,不得早于最近一次展期数据的“展期后到期日” /// [CheckConditionStringValue(ConditionName = nameof(DurationOperationType), ConditionValue = "01", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(DurationOperationType), ConditionValue = "01", CheckHandleNameArr = new[] { "B" })] @@ -91,57 +98,120 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringIsDateTimeFormat(CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("RenewalDate", "展期日期", "10", false, "校验规则:\r\n1 存续期操作类型为展期时必填;\r\n2 必须是yyyy-MM-dd;\r\n3 不存在展期数据:不得早于等于原合约到期日;\r\n4 存在展期数据:不得早于等于最新展期日期;\r\n5 新增终止:一个日期只能存在一条终止数据;")] + [SacDescription("RenewalDate", "展期后到期日", "10", false, "当“存续期操作类型”为“展期”时,必填;不存在展期操作数据,不得早于原合约到期日;存在展期操作数据,不得早于最近一次展期数据的“展期后到期日”")] public string RenewalDate { get; set; } /// - /// 存续期操作类型 + /// 违约方 /// 长度:2 - /// 必填:是 - /// 说明: - /// - [CheckStringInMap(Map = new[] { "01", "02", "03" })] - [DefaultValue("")] - [SacDescription("DurationOperationType", "存续期操作类型", "2", true, "")] - public string DurationOperationType { get; set; } - /// - /// 本次终止金额 - /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 保留两位小数;3 TODO 选展期时,该字段不能填,否则报送失败.4 大于0且小于等于上次余额; + /// 说明:当"存续期操作类型"为"违约终止"时,必填 /// - [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] - [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 34, MinValue = 0.01, CheckHandleName = "A")] + [CheckConditionStringValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1" }, CheckHandleName = "A")] [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("TerminationAmount", "本次终止金额", "36,2", false, "校验规则:\r\n1 当存续期操作类型,选择终止、违约终止时必填;\r\n2 保留两位小数;\r\n3 TODO 选展期时,该字段不能填,否则报送失败.4 大于0且小于等于上次余额;")] + [SacDescription("DefaultingParty", "违约方", "2", false, "当存续期操作类型为违约终止时,必填;")] + public string DefaultingParty { get; set; } + /// + /// 违约事件说明 + /// 长度:1024 + /// 必填:否 + /// 说明:当"存续期操作类型"为"违约终止"时,必填 + /// + [CheckConditionStringValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(DurationOperationType), ConditionValue = "03", CheckHandleNameArr = new[] { "B" })] + [CheckStringMaxLength(MaxLength = 1024, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("DefaultEvent", "违约事件说明", "1024", false, "当存续期操作类型为违约终止时,必填;")] + public string DefaultEvent { get; set; } + /// + /// 名义本金变动(元) + /// 长度:36,2 + /// 必填:否 + /// 说明:当"存续期操作类型"选择"终止""违约终止"时,必填,数值必须为负数 + /// + [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, MaxValue = 0, CheckHandleName = "A")] + [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("TerminationAmount", "名义本金变动(元)", "36,2", false, "当存续期操作类型选择终止、违约终止时,必填,数值必须为负数;")] public string TerminationAmount { get; set; } /// - /// 余额 + /// 存量名义本金(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:1 保留两位小数;2 值等于该交易上次余额-本次终止金额; + /// 说明:大于等于 0 的数字 /// - [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 34, MinValue = 0)] + [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 36, MinValue = 0)] [DefaultValue("")] - [SacDescription("Balance", "余额", "36,2", true, "校验规则:\r\n1 保留两位小数;\r\n2 值等于该交易上次余额-本次终止金额;")] + [SacDescription("Balance", "存量名义本金(元)", "36,2", true, "大于等于 0 的数字")] public string Balance { get; set; } /// - /// 本次支付金额 + /// 本次支付金额(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 保留两位小数;3 TODO 选展期时,该字段不能填,否则报送失败; + /// 说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 支付为正,收取为负 /// [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 34, CheckHandleName = "A")] - [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] + [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 36, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("AmountPaidThisTime", "本次支付金额", "36,2", false, "校验规则:\r\n1 当存续期操作类型,选择终止、违约终止时必填;\r\n2 保留两位小数;\r\n3 TODO 选展期时,该字段不能填,否则报送失败;")] + [SacDescription("AmountPaidThisTime", "本次支付金额(元)", "36,2", false, "校验规则:\r\n1 当存续期操作类型,选择终止、违约终止时必填;\r\n2 支付为正,收取为负;")] public string AmountPaidThisTime { get; set; } + /// + /// 已了结交易实际收益率(%) + /// 长度:8,2 + /// 必填:否 + /// 说明:当“存续期操作类型”选择“终止”“违约终止”时,必填; + /// + [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new string[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] + [CheckStringIntLength(AfterPointLength = 2, BeforePointMaxLength = 8, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 0, Required = false, CheckHandleName = "B")] + [DefaultValue("")] + [SacDescription("ClosedTransactionsRealRateReturn", "已了结交易实际收益率(%)", "8,2", false, "当“存续期操作类型”选择“终止”“违约终止”时,必填;")] + public string ClosedTransactionsRealRateReturn { get; set; } + /// + /// 存续期信息附件 + /// 长度: + /// 必填:否 + /// 说明:校验规则:只支持 PDF 格式 + /// + [CheckStringEndsWith(EndsWithString = ".pdf", Required = false)] + [DefaultValue("")] + [SacDescription("OptionDurationManagementAtt", "存续期信息附件", "", false, "校验规则:只支持 PDF 格式")] + public string OptionDurationManagementAtt { get; set; } + /// + /// 障碍事件状态 + /// 长度:2 + /// 必填:否 + /// 说明:根据存续期操作类型中 05 敲入、06 敲出的填写情况,由系统自动取值,填报方无需填写报送 + /// + [CheckStringMaxLength(MaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("BarrierEventStatus", "障碍事件状态", "2", false, "根据存续期操作类型中 05 敲入、06 敲出的填写情况,由系统自动取值,填报方无需填写报送")] + public string BarrierEventStatus { get; set; } [XmlIgnore] [DefaultValue("")] [SacDescription("TradeId", "本次支付金额", "36,2", false, "校验规则:\r\n1 当存续期操作类型,选择终止、违约终止时必填;\r\n2 保留两位小数;\r\n3 TODO 选展期时,该字段不能填,否则报送失败;")] public string TradeId { get; set; } + /// + /// 空白1 + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank1", "空白1", "", false, "")] + public string Blank1 { get; set; } + /// + /// 空白2 + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank2", "空白2", "", false, "")] + public string Blank2 { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OtherReportModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OtherReportModel.cs index 1ccaa8ae..adc8e1ec 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OtherReportModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/OtherReportModel.cs @@ -50,7 +50,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("Telephone", "手机", "11", true, "校验规则:手机号")] public string Telephone { get; set; } /// - /// 固定电话 + /// 手机 /// 长度:200 /// 必填:否 /// 说明: diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PerformanceGuaranteeAgrmtModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PerformanceGuaranteeAgrmtModel.cs index ec31aea3..5f2a8fe3 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PerformanceGuaranteeAgrmtModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PerformanceGuaranteeAgrmtModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +9,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 履约保证书 /// + [Table("A1008_PerformanceGuaranteeAgrmt")] public class PerformanceGuaranteeAgrmtModel : ReportBaseModel { /// @@ -72,7 +74,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] [DefaultValue("")] - [SacDescription("SigningDate", "签署时间", "10", true, "校验规则:必须是yyyy-MM-dd;")] + [SacDescription("SigningDate", "签署时间", "10", true, "校验规则:必须是YYYY-MM-DD;")] public string SigningDate { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportISDAModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportISDAModel.cs index 8e8225e3..ecf049b8 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportISDAModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportISDAModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -683,55 +684,55 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 上月末收益互换存量交易对应履约担保品价值(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:保留四位小数; + /// 说明:校验规则:保留两位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth", "上月末收益互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留四位小数;")] + [SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth", "上月末收益互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth { get; set; } /// /// 本月末收益互换现金担保物价值(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:保留四位小数; + /// 说明:校验规则:保留两位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("SwapCashCollateralValueThisMonth", "本月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留四位小数;")] + [SacDescription("SwapCashCollateralValueThisMonth", "本月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapCashCollateralValueThisMonth { get; set; } /// /// 上月末收益互换现金担保物价值(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:保留四位小数; + /// 说明:校验规则:保留两位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("SwapCashCollateralValueLastMonth", "上月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留四位小数;")] + [SacDescription("SwapCashCollateralValueLastMonth", "上月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapCashCollateralValueLastMonth { get; set; } /// /// 本月末收益互换证券担保物价值(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:保留四位小数; + /// 说明:校验规则:保留两位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("SwapSecuritiesCollateralValueThisMonth", "本月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留四位小数;")] + [SacDescription("SwapSecuritiesCollateralValueThisMonth", "本月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapSecuritiesCollateralValueThisMonth { get; set; } /// /// 上月末收益互换证券担保物价值(元) /// 长度:36,2 /// 必填:是 - /// 说明:校验规则:保留四位小数; + /// 说明:校验规则:保留两位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("SwapSecuritiesCollateralValueLastMonthThisMonth", "上月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留四位小数;")] + [SacDescription("SwapSecuritiesCollateralValueLastMonthThisMonth", "上月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapSecuritiesCollateralValueLastMonthThisMonth { get; set; } /// @@ -1329,14 +1330,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string SwapExpensesCashFlow { get; set; } /// - /// 互换使用预付金形成的净收益对应现金流(万元) + /// 互换使用保证金形成的净收益对应现金流(万元) /// 长度:36,4 /// 必填:是 /// 说明:校验规则:保留四位小数; /// [CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 4)] [DefaultValue("")] - [SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用预付金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] + [SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用保证金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] public string CashFlowCorrespondingToNetIncomeOnSwapMargin { get; set; } /// @@ -1560,7 +1561,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 标的情况与对冲 /// - public class ISDATargetCaseAndHedgeModel + public class ISDATargetCaseAndHedgeModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -1621,7 +1622,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 标的交易场所 /// 长度:200 /// 必填:否 - /// 说明: + /// 说明:股指期货和大宗商品买入对冲包括开多仓和平空仓;保留两位小数 /// [CheckStringMaxLength(MaxLength = 200, Required = false)] [DefaultValue("")] @@ -1674,13 +1675,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 本月末持仓数量(股/手) - /// 长度:36,4 + /// 长度:36,6 /// 必填:否 - /// 说明:校验规则:大于等于0;\r\n权益类填写股数 + /// 说明:校验规则:大于等于0;\r\n权益类填写股数; /// - [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4, Required = false)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 6, Required = false)] [DefaultValue("")] - [SacDescription("TheNumberOfPositionsHeldAtTheEndOfThisMonth", "本月末持仓数量(股/手)", "36,4", false, "校验规则:大于等于0;\r\n权益类填写股数;")] + [SacDescription("TheNumberOfPositionsHeldAtTheEndOfThisMonth", "本月末持仓数量(股/手)", "36,6", false, "校验规则:大于等于0;\r\n权益类填写股数;")] public string TheNumberOfPositionsHeldAtTheEndOfThisMonth { get; set; } /// @@ -1693,12 +1694,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("AveragePriceAtTheEndOfTheMonth", "本月末持仓平均价格(元)", "36,2", false, "校验规则:保留两位小数;")] public string AveragePriceAtTheEndOfTheMonth { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } /// /// 本月末存量业务明细 /// - public class ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel + public class ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -1769,22 +1779,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金(或多头名义本金)(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;")] public string NotionalPrincipalAmountLNotionalPrincipalAmount { get; set; } /// /// 空头名义本金(元)(多空组合填写) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;")] public string SNotionalPrincipalAmount { get; set; } /// @@ -1859,7 +1869,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 场外期权标的小类(场外期权填写) /// 长度:2 /// 必填:否 - /// 说明: + /// 说明: /// [CheckStringMaxLength(MaxLength = 2, Required = false)] [DefaultValue("")] @@ -1897,24 +1907,27 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:否 /// 说明:校验规则:当"业务类型"为"场外期权"时,必填 /// - [CheckStringMaxLength(MaxLength = 2, Required = false)] + [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("OptionType", "期权类型(场外期权填写)", "5,2", false, "校验规则:当业务类型为场外期权时,必填;")] public string OptionType { get; set; } /// - /// 本月末维持预付金比例(%) + /// 本月末维持保证金比例(%) /// 长度:36,2 /// 必填:否 /// - /// 说明:指月末维持预付金加浮动盈亏占合约存续名义本金的比例; - /// 对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例. - /// 例如维持预付金比例为50%,填写50.00 + /// 说明:指月末维持保证金加浮动盈亏占合约存续名义本金的比例; + /// 对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例. + /// 例如维持保证金比例为50%,填写50.00 /// /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("MaitainMarginRation", "本月末维持预付金比例(%)", "36,2", false, "指月末维持预付金加浮动盈亏占合约存续名义本金的比例;\r\n对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.\r\n例如维持预付金比例为50%,填写50.00;")] + [SacDescription("MaitainMarginRation", "本月末维持保证金比例(%)", "36,2", false, "指月末维持保证金加浮动盈亏占合约存续名义本金的比例;\r\n对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.\r\n例如维持保证金比例为50%,填写50.00;")] public string MaitainMarginRation { get; set; } /// @@ -1958,12 +1971,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("ShortPositionContractValue", "空头合约价值(元)", "36,2", false, "客户空头、多空组合收益互换需填写;\r\n保留两位小数;")] public string ShortPositionContractValue { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } /// /// 本月新增业务明细 /// - public class ISDAIncreaseBusinessDetailsThisMonthModel + public class ISDAIncreaseBusinessDetailsThisMonthModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -2034,22 +2056,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金(或多头名义本金)(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,多空组合填写多头名义本; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留2位小数,多空组合填写多头;")] public string NotionalPrincipalAmountLNotionalPrincipalAmount { get; set; } /// /// 空头名义本金(元)(多空组合填写) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数, /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留2位小数;")] public string SNotionalPrincipalAmount { get; set; } /// @@ -2109,11 +2131,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("UndrlygAssetCode", "标的编码", "200", false, "")] public string UndrlygAssetCode { get; set; } + /// + /// 标的交易场所 + /// 长度:200 + /// 必填:否 + /// 说明: + /// + [CheckStringMaxLength(MaxLength = 200, Required = false)] + [DefaultValue("")] + [SacDescription("UndrlygAssetTradgPlc", "标的交易场所", "200", false, "")] + public string UndrlygAssetTradgPlc { get; set; } + /// /// 场外期权标的小类(场外期权填写) /// 长度:2 /// 必填:否 - /// 说明: + /// 说明: /// [CheckStringMaxLength(MaxLength = 2, Required = false)] [DefaultValue("")] @@ -2151,9 +2184,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:否 /// 说明: /// - [CheckStringMaxLength(MaxLength = 2, Required = false)] + [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("OptionType", "期权类型(场外期权填写)", "5,2", false, "")] public string OptionType { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportNAFMIIModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportNAFMIIModel.cs index 58b41bf0..eb20a00f 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportNAFMIIModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportNAFMIIModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -812,10 +813,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 其他交易明细表 /// - public class ScheduleOfOtherTransactionModel + public class ScheduleOfOtherTransactionModel : ReportSubBaseModel { /// - /// 交易日期 + /// 起始日 /// 长度:10 /// 必填:否 /// 说明:校验规则:必须是YYYY-MM-DD; @@ -823,7 +824,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 10, Required = false)] [CheckStringIsDateTimeFormat] [DefaultValue("")] - [SacDescription("TradingDate", "交易日期", "10", false, "校验规则:必须是YYYY-MM-DD;")] + [SacDescription("TradingDate", "起始日", "10", false, "校验规则:必须是YYYY-MM-DD;")] public string TradingDate { get; set; } /// @@ -907,11 +908,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留4位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmount", "名义本金(元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmount", "名义本金(元)", "36,2", false, "校验规则:保留4位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string NotionalPrincipalAmount { get; set; } /// @@ -960,15 +961,25 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("ContractExpirationDate", "合约到期日", "10", false, "校验规则:必须是YYYY-MM-DD;\r\n合约到期日不能小于合约起始日;")] public string ContractExpirationDate { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } + } /// /// 利率期权明细 /// - public class InterestRateOptionDetailModel + public class InterestRateOptionDetailModel : ReportSubBaseModel { /// - /// 交易日期 + /// 起始日 /// 长度:10 /// 必填:否 /// 说明:校验规则:必须是YYYY-MM-DD; @@ -976,7 +987,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 10, Required = false)] [CheckStringIsDateTimeFormat] [DefaultValue("")] - [SacDescription("TradingDate", "交易日期", "10", false, "校验规则:必须是YYYY-MM-DD;")] + [SacDescription("TradingDate", "起始日", "10", false, "校验规则:必须是YYYY-MM-DD;")] public string TradingDate { get; set; } /// @@ -1152,12 +1163,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("ContractExpirationDate", "合约到期日", "10", false, "校验规则:必须是YYYY-MM-DD;\r\n合约到期日不能小于合约起始日;")] public string ContractExpirationDate { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } /// /// 利率互换明细 /// - public class InterestRateSwapDetailModel + public class InterestRateSwapDetailModel : ReportSubBaseModel { /// /// 交易日期 @@ -1263,11 +1283,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金金额 /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 15, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmount", "名义本金金额", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmount", "名义本金金额", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string NotionalPrincipalAmount { get; set; } /// @@ -1309,11 +1329,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 固定利率 /// 长度:8,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位; /// [CheckStringIntLength(BeforePointMaxLength = 8, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("FixedRate", "固定利率", "8,2", false, "校验规则:保留两位小数;")] + [SacDescription("FixedRate", "固定利率", "8,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;")] public string FixedRate { get; set; } /// @@ -1404,5 +1424,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("FirstInterestPaymentDay", "首次利息支付(互换)日", "10", false, "校验规则:必须是YYYY-MM-DD;")] public string FirstInterestPaymentDay { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportSACModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportSACModel.cs index e1fbf706..24bca18d 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportSACModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/PeriodicReportSACModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -1348,7 +1349,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("TotalNominalPrincipalAmountOfSwapThisMonth", "本月末互换存量名义本金总额(亿元)", "36,4", true, "校验规则:保留四位小数;")] public string TotalNominalPrincipalAmountOfSwapThisMonth { get; set; } @@ -1359,7 +1360,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("TotalNominalPrincipalAmountOfSwapLastMonth", "上月末互换存量名义本金总额(亿元)", "36,4", true, "校验规则:保留四位小数;")] public string TotalNominalPrincipalAmountOfSwapLastMonth { get; set; } @@ -1370,7 +1371,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth", "本月末互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth { get; set; } @@ -1381,7 +1382,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth", "上月末互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth { get; set; } @@ -1392,7 +1393,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("SwapCashCollateralValueThisMonth", "本月末互换现金担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapCashCollateralValueThisMonth { get; set; } @@ -1403,7 +1404,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("SwapCashCollateralValueLastMonth", "上月末互换现金担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapCashCollateralValueLastMonth { get; set; } @@ -1414,7 +1415,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("SwapSecuritiesCollateralValueThisMonth", "本月末互换证券担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapSecuritiesCollateralValueThisMonth { get; set; } @@ -1425,7 +1426,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("SwapSecuritiesCollateralValueLastMonthThisMonth", "上月末互换证券担保物价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string SwapSecuritiesCollateralValueLastMonthThisMonth { get; set; } @@ -1436,7 +1437,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull", "本月末互换业务整体履约担保比例(全额)(%)", "36,2", true, "校验规则:保留两位小数;")] public string ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull { get; set; } @@ -1447,7 +1448,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull", "上月末互换业务整体履约担保比例(全额)(%)", "36,2", true, "校验规则:保留两位小数;")] public string ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull { get; set; } @@ -1458,7 +1459,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet", "本月末互换业务整体履约担保比例(净额)(%)", "36,2", true, "校验规则:保留两位小数;")] public string ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet { get; set; } @@ -1469,7 +1470,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet", "上月末互换业务整体履约担保比例(净额)(%)", "36,2", true, "校验规则:保留两位小数;")] public string ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet { get; set; } @@ -1568,7 +1569,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth", "本月末存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth { get; set; } @@ -1579,7 +1580,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth", "上月末存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留两位小数;")] public string StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth { get; set; } @@ -1590,7 +1591,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("CashBalanceAtEndOfThisMonth", "本月末持有现金余额(元)", "36,2", true, "校验规则:保留两位小数;")] public string CashBalanceAtEndOfThisMonth { get; set; } @@ -1601,7 +1602,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("CashBalanceAtEndOfLastMonth", "上月末持有现金余额(元)", "36,2", true, "校验规则:保留两位小数;")] public string CashBalanceAtEndOfLastMonth { get; set; } @@ -1612,7 +1613,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldStockMarketValueAtEndOfThisMonth", "本月末持有股票市值(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldStockMarketValueAtEndOfThisMonth { get; set; } @@ -1623,7 +1624,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldStockMarketValueAtEndOfLastMonth", "上月末持有股票市值(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldStockMarketValueAtEndOfLastMonth { get; set; } @@ -1634,7 +1635,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldMarketValueOfBondsAtTheEndOfThisMonth", "本月末持有债券市值(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldMarketValueOfBondsAtTheEndOfThisMonth { get; set; } @@ -1645,7 +1646,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldMarketValueOfBondsAtTheEndOfLastMonth", "上月末持有债券市值(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldMarketValueOfBondsAtTheEndOfLastMonth { get; set; } @@ -1656,7 +1657,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("OwnedAssetManagementProductsAtTheEndOfThisMonth", "本月末持有证券公司资产管理产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string OwnedAssetManagementProductsAtTheEndOfThisMonth { get; set; } @@ -1667,7 +1668,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("OwnedAssetManagementProductsAtTheEndOfLastMonth", "上月末持有证券公司资产管理产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string OwnedAssetManagementProductsAtTheEndOfLastMonth { get; set; } @@ -1678,7 +1679,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("OwnedBankFinanceAtTheEndOfThisMonth", "本月末持有银行理财(元)", "36,2", true, "校验规则:保留两位小数;")] public string OwnedBankFinanceAtTheEndOfThisMonth { get; set; } @@ -1689,7 +1690,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("OwnedBankFinanceAtTheEndOfLastMonth", "上月末持有银行理财(元)", "36,2", true, "校验规则:保留两位小数;")] public string OwnedBankFinanceAtTheEndOfLastMonth { get; set; } @@ -1700,7 +1701,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldTrustProductAtTheEndOfThisMonth", "本月末持有信托产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldTrustProductAtTheEndOfThisMonth { get; set; } @@ -1711,7 +1712,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldTrustProductAtTheEndOfLastMonth", "上月末持有信托产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldTrustProductAtTheEndOfLastMonth { get; set; } @@ -1722,7 +1723,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("InsuranceProductsAreHeldAtTheEndOfThisMonth", "本月末持有保险产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string InsuranceProductsAreHeldAtTheEndOfThisMonth { get; set; } @@ -1733,7 +1734,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("InsuranceProductsAreHeldAtTheEndOfLastMonth", "上月末持有保险产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string InsuranceProductsAreHeldAtTheEndOfLastMonth { get; set; } @@ -1744,7 +1745,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldOtherProductsAtTheEndOfThisMonth", "本月末持有其他产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldOtherProductsAtTheEndOfThisMonth { get; set; } @@ -1755,7 +1756,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留两位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 2)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] [SacDescription("HoldOtherProductsAtTheEndOfLastMonth", "上月末持有其他产品(元)", "36,2", true, "校验规则:保留两位小数;")] public string HoldOtherProductsAtTheEndOfLastMonth { get; set; } @@ -1777,7 +1778,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth", "互换本月了结交易涉及名义本金(亿元)", "36,4", true, "校验规则:保留四位小数;")] public string SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth { get; set; } @@ -1788,7 +1789,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("SwapIncomeCashFlow", "互换收入现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] public string SwapIncomeCashFlow { get; set; } @@ -1799,20 +1800,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("SwapExpensesCashFlow", "互换支出现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] public string SwapExpensesCashFlow { get; set; } /// - /// 互换使用预付金形成的净收益对应现金流(万元) + /// 互换使用保证金形成的净收益对应现金流(万元) /// 长度:36,4 /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] - [SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用预付金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] + [SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用保证金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")] public string CashFlowCorrespondingToNetIncomeOnSwapMargin { get; set; } /// @@ -1821,7 +1822,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("SwapHedgeCost", "互换对冲成本(万元)", "36,4", true, "校验规则:保留四位小数;")] public string SwapHedgeCost { get; set; } @@ -1843,7 +1844,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth", "期权本月了结交易涉及名义本金(亿元)", "36,4", true, "校验规则:保留四位小数;")] public string SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth { get; set; } @@ -1854,7 +1855,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("OptionPremiumIncome", "期权权利金收入(万元)", "36,4", true, "校验规则:保留四位小数;")] public string OptionPremiumIncome { get; set; } @@ -1865,7 +1866,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("OptionHedgeCost", "期权对冲成本(万元)", "36,4", true, "校验规则:保留四位小数;")] public string OptionHedgeCost { get; set; } @@ -1876,7 +1877,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapRealizedGainsAndLossesAtThisMonth", "互换合约端损益本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapRealizedGainsAndLossesAtThisMonth { get; set; } @@ -1887,7 +1888,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionRealizedGainsAndLossesAtThisMonth", "期权合约端损益本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionRealizedGainsAndLossesAtThisMonth { get; set; } @@ -1898,7 +1899,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapRealizedGainsAndLossesAtThisYear", "互换合约端损益本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapRealizedGainsAndLossesAtThisYear { get; set; } @@ -1909,7 +1910,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionRealizedGainsAndLossesAtThisYear", "期权合约端损益本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionRealizedGainsAndLossesAtThisYear { get; set; } @@ -1920,7 +1921,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth", "互换对冲端损益本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth { get; set; } @@ -1931,7 +1932,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth", "期权对冲端损益本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth { get; set; } @@ -1942,7 +1943,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear", "互换对冲端损益本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear { get; set; } @@ -1953,7 +1954,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear", "期权对冲端损益本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear { get; set; } @@ -1964,7 +1965,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapTotalGainsAndLossesAtThisMonth", "互换损益合计本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapTotalGainsAndLossesAtThisMonth { get; set; } @@ -1975,7 +1976,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionTotalGainsAndLossesAtThisMonth", "期权损益合计本月发生额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionTotalGainsAndLossesAtThisMonth { get; set; } @@ -1986,7 +1987,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfSwapTotalGainsAndLossesAtThisYear", "互换损益合计本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfSwapTotalGainsAndLossesAtThisYear { get; set; } @@ -1997,7 +1998,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 必填:是 /// 说明:校验规则:保留四位小数; /// - [CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)] [DefaultValue("")] [SacDescription("BalanceOfOptionTotalGainsAndLossesAtThisYear", "期权损益合计本年累计额(万元)", "36,4", true, "校验规则:保留四位小数;")] public string BalanceOfOptionTotalGainsAndLossesAtThisYear { get; set; } @@ -2033,14 +2034,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public List TargetCaseAndHedgeTuple { get; set; } /// - /// 收益互换整体业务存量对应预付金(元)+ 期权费(元) + /// 收益互换整体业务存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginOfSubsistSwap", "收益互换整体业务存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginOfSubsistSwap", "收益互换整体业务存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginOfSubsistSwap { get; set; } /// @@ -2066,14 +2067,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string LeverageRatiOfSwap { get; set; } /// - /// 收益互换股指标的存量对应预付金(元)+ 期权费(元) + /// 收益互换股指标的存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginOfSubsistStockIndexSwap", "收益互换股指标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginOfSubsistStockIndexSwap", "收益互换股指标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginOfSubsistStockIndexSwap { get; set; } /// @@ -2099,14 +2100,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string LeverageRatioOfStockIndexSwap { get; set; } /// - /// 收益互换个股标的存量对应预付金(元)+ 期权费(元) + /// 收益互换个股标的存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginOfSubsistStockSwap", "收益互换个股标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginOfSubsistStockSwap", "收益互换个股标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginOfSubsistStockSwap { get; set; } /// @@ -2132,14 +2133,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string LeverageRatioOfStockSwap { get; set; } /// - /// 场外期权整体业务存量对应预付金(元)+ 期权费(元) + /// 场外期权整体业务存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginandPremiumOfSubsistOption", "场外期权整体业务存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginandPremiumOfSubsistOption", "场外期权整体业务存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginandPremiumOfSubsistOption { get; set; } /// @@ -2165,14 +2166,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string LeverageRatioOfOption { get; set; } /// - /// 场外期权股指标的存量对应预付金(元)+ 期权费(元) + /// 场外期权股指标的存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginandPremiumOfSubsistStockIndexOption", "场外期权股指标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginandPremiumOfSubsistStockIndexOption", "场外期权股指标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginandPremiumOfSubsistStockIndexOption { get; set; } /// @@ -2198,14 +2199,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string LeverageRatioOfStockIndexOption { get; set; } /// - /// 场外期权个股标的存量对应预付金(元)+ 期权费(元) + /// 场外期权个股标的存量对应保证金(元)+ 期权费(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:保留两位小数 /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginandPremiumOfSubsistStockOption", "场外期权个股标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")] + [SacDescription("MarginandPremiumOfSubsistStockOption", "场外期权个股标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")] public string MarginandPremiumOfSubsistStockOption { get; set; } /// @@ -2454,7 +2455,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 标的情况与对冲 /// - public class TargetCaseAndHedgeModel + public class TargetCaseAndHedgeModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -2576,7 +2577,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 权益类填写股数 /// /// - [CheckStringIntLength(MinValue = 0, BeforePointMaxLength = 36, AfterPointLength = 6, Required = false)] + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 6, Required = false)] [DefaultValue("")] [SacDescription("TheNumberOfPositionsHeldAtTheEndOfThisMonth", "本月末持仓数量(股/手)", "36,6", false, "校验规则:大于等于0;\r\n权益类填写股数;")] public string TheNumberOfPositionsHeldAtTheEndOfThisMonth { get; set; } @@ -2591,12 +2592,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("AveragePriceAtTheEndOfTheMonth", "本月末持仓平均价格(元)", "36,2", false, "校验规则:保留两位小数;")] public string AveragePriceAtTheEndOfTheMonth { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } /// /// 本月末存量业务明细 /// - public class InventoryBusinessDetailsAtTheEndOfThisMonthModel + public class InventoryBusinessDetailsAtTheEndOfThisMonthModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -2667,22 +2677,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金(或多头名义本金)(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string NotionalPrincipalAmountLNotionalPrincipalAmount { get; set; } /// /// 空头名义本金(元)(多空组合填写) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string SNotionalPrincipalAmount { get; set; } /// @@ -2754,12 +2764,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 期权标的小类(场外期权填写) /// 长度:2 /// 必填:否 - /// 说明:校验规则:如业务类型为期权,需填写本字段; + /// 说明:校验规则:如业务类型为期权,需填写本字段; /// [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] - [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "99" }, CheckHandleName = "A")] - [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "99" }, Required = false, CheckHandleName = "B")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("OptionSumInvestmentTargetType", "期权标的小类(场外期权填写)", "2", false, "校验规则:如业务类型为期权,需填写本字段;")] public string OptionSumInvestmentTargetType { get; set; } @@ -2793,27 +2803,27 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string OptionFee { get; set; } /// - /// 期权类型 + /// 期权结构类型(期权填写) /// 长度:2 /// 必填:否 /// 说明: 校验规则:如业务类型为期权,需填写本字段; /// [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] - [CheckStringInMap(Map = new[] { "0", "1", "2", "4", "5", "6", "7", "99" }, CheckHandleName = "A")] - [CheckStringInMap(Map = new[] { "0", "1", "2", "4", "5", "6", "7", "99" }, Required = false, CheckHandleName = "B")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("OptionType", "期权类型", "2", false, "校验规则:如业务类型为期权,需填写本字段;")] + [SacDescription("OptionType", "期权结构类型(期权填写)", "2", false, "校验规则:如业务类型为期权,需填写本字段;")] public string OptionType { get; set; } /// - /// 本月末维持预付金比例(%) + /// 本月末维持保证金比例(%) /// 长度:36,2 /// 必填:否 /// - /// 说明:指月末维持预付金加浮动盈亏占合约存续名义本金的比例; - /// 对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例. - /// 例如维持预付金比例为50%,填写50.00 + /// 说明:指月末维持保证金加浮动盈亏占合约存续名义本金的比例; + /// 对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例. + /// 例如维持保证金比例为50%,填写50.00 /// /// [CheckConditionStringInMap(ConditionName = nameof(BusinessType), ConditionMap = new[] { "11", "12" }, CheckHandleNameArr = new[] { "A" })] @@ -2821,7 +2831,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, CheckHandleName = "A")] [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("MaitainMarginRation", "本月末维持预付金比例(%)", "36,2", false, "指月末维持预付金加浮动盈亏占合约存续名义本金的比例;\r\n对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.\r\n例如维持预付金比例为50%,填写50.00;")] + [SacDescription("MaitainMarginRation", "本月末维持保证金比例(%)", "36,2", false, "指月末维持保证金加浮动盈亏占合约存续名义本金的比例;\r\n对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.\r\n例如维持保证金比例为50%,填写50.00;")] public string MaitainMarginRation { get; set; } /// /// 标的相关系数 @@ -2870,12 +2880,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("ShortPositionContractValue", "空头合约价值(元)", "36,2", false, "客户空头、多空组合收益互换需填写;\r\n保留两位小数;")] public string ShortPositionContractValue { get; set; } + + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } /// /// 本月新增业务明细 /// - public class IncreaseBusinessDetailsThisMonthModel + public class IncreaseBusinessDetailsThisMonthModel : ReportSubBaseModel { /// /// 报送机构名称(全称) @@ -2949,22 +2969,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 名义本金(或多头名义本金)(元) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留4位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string NotionalPrincipalAmountLNotionalPrincipalAmount { get; set; } /// /// 空头名义本金(元)(多空组合填写) /// 长度:36,2 /// 必填:否 - /// 说明:校验规则:保留两位小数; + /// 说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位; /// [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)] [DefaultValue("")] - [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留两位小数;")] + [SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;")] public string SNotionalPrincipalAmount { get; set; } /// @@ -3030,12 +3050,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 期权标的小类(场外期权填写) /// 长度:2 /// 必填:否 - /// 说明:校验规则:如业务类型为场外期权,需填写本字段; + /// 说明:校验规则:如业务类型为场外期权,需填写本字段; /// [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] - [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "99" }, CheckHandleName = "A")] - [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "99" }, Required = false, CheckHandleName = "B")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("OptionObjectSecondClass", "期权标的小类(场外期权填写)", "2", false, "校验规则:如业务类型为场外期权,需填写本字段;")] public string OptionObjectSecondClass { get; set; } @@ -3072,17 +3092,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model public string NonAnnualOptionFee { get; set; } /// - /// 期权类型(期权填写) + /// 期权结构类型(期权填写) /// 长度:2 /// 必填:否 /// 说明:校验规则:如业务类型为期权,需填写本字段; /// [CheckConditionStringValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(BusinessType), ConditionValue = "02", CheckHandleNameArr = new[] { "B" })] - [CheckStringInMap(Map = new[] { "0", "1", "2", "4", "5", "6", "7", "99" }, Required = false, CheckHandleName = "A")] - [CheckStringInMap(Map = new[] { "0", "1", "2", "4", "5", "6", "7", "99" }, Required = false, CheckHandleName = "B")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "0", "1", "2", "3", "4", "5", "99" }, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("OptionType", "期权类型(期权填写)", "2", false, "校验规则:如业务类型为期权,需填写本字段;")] + [SacDescription("OptionType", "期权结构类型(期权填写)", "2", false, "校验规则:如业务类型为期权,需填写本字段;")] public string OptionType { get; set; } + /// + /// 序号 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [SacDescription("Index", "序号", "", false, "")] + public string Index { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportReq.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportReq.cs index 0747b149..1e546bb6 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportReq.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportReq.cs @@ -1,4 +1,6 @@ -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -95,6 +97,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 报告类型 /// public List ReportTypes { get; set; } + + /// + /// 证券业报送中定期报告取值模式 + /// 1=Db; + /// 2=Excel模板; + /// 3=Db+Excel模板(该方式中涉及百分比汇总计算时仍使用模板中数据) + /// 4=金仕达视图(该方式只涉及互换确认书及存续期的数据) + /// 5=Db+金仕达视图 + /// 6=Excel+金仕达视图 + /// 7=Db+Excel+金仕达视图 + /// + public SAC_ReportDataSourceEnum DataSource { get; set; } } public class ReportResponse @@ -112,7 +126,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model { return ""; } - return $"OTC_{Infos[0].Header.SenderCode}_{Infos[0].Header.ReceiverCode}_{Infos[0].Header.ReportType}_{Infos[0].Header.SendDate.Replace("-", "")}_{Index.ToString("0000")}"; + return $"OTC_{Infos[0].Header.SenderCode}_{Infos[0].Header.ReceiverCode}_{Infos[0].Header.ReportType}_{Infos[0].Header.SendDate.Replace("-", "")}_{Index.ToString("0000")}{(Infos.Any(O => O.Header.BusiDataType == DataFlagsEnum.A1015) ? "_checked" : "")}"; } } @@ -126,13 +140,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 仅外部数据来源使用 /// [XmlIgnore] + [NotMapped] public bool IgnoreCheck { get; set; } + + [Key] + [XmlIgnore] + public int Id { get; set; } + + /// + /// 报送日期 + /// + [XmlIgnore] + public DateTime ReportDate { get; set; } + /// /// 业务数据流水号 /// 长度:28 /// 必填:是 /// 说明:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位) /// + [CheckStringLength(Length = 28)] [SacDescription("ExceID", "业务数据流水号", "28", true, "文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位);")] public string ExceID { get; set; } @@ -143,6 +170,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明:报送时该字段应为Null /// [XmlElement(IsNullable = false)] + [NotMapped] [SacDescription("RetCode", "响应码", "6", true, "报送时该字段应为Null;")] public string RetCode { get; set; } /// @@ -152,6 +180,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明:报送时该字段应为Null /// [XmlElement(IsNullable = false)] + [NotMapped] [SacDescription("RetMsg", "响应描述", "1000", true, "报送时该字段应为Null;")] public string RetMsg { get; set; } /// @@ -162,6 +191,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 报送时该字段应为Null /// [XmlElement(IsNullable = false)] + [NotMapped] [SacDescription("BizID", "报送数据业务编号", "50", false, "报告库接口返回,数据处理异常时为空\r\n报送时该字段应为Null;")] public string BizID { get; set; } /// @@ -172,10 +202,30 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 报送时该字段应为Null /// [XmlElement(IsNullable = false)] + [NotMapped] [SacDescription("DurationEventNO", "操作事件编号", "6", false, "场外证券业务系统接口返回,当报送存续期业务时,返回操作时间编号ID\r\n报送时该字段应为Null;")] public string DurationEventNO { get; set; } } + public abstract class ReportSubBaseModel + { + [Key] + [XmlIgnore] + public int Id { get; set; } + + /// + /// 报送日期 + /// + [XmlIgnore] + public DateTime ReportDate { get; set; } + + /// + /// 来源报送文件 ExceID + /// + [XmlIgnore] + public string ExceID { get; set; } + } + /// /// 报告状态 /// @@ -198,8 +248,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model private long limitFileLength => MaxFileLength - 5242880;//留出5MB余量 - private long _currentLength = 0; - public long CurrentLength => _currentLength; + public long CurrentLength { get; private set; } = 0; public bool Continue { get; private set; } @@ -208,7 +257,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// public void ResetCurrentLength() { - _currentLength = 0; + CurrentLength = 0; Continue = false; } @@ -226,22 +275,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model { return true; } - var length = new FileInfo(path).Length; - if (length > limitFileLength) - { - LogFactory.GetLogger("CheckFileLength").Error($"单一文件大小不应超过30MB,错误文件:{path}"); - throw new ServiceException("单一文件大小不应超过30MB"); - } - _currentLength += length; - if (_currentLength <= limitFileLength) - { - return true; - } - else - { - Continue = true; - return false; - } + //var length = new FileInfo(path).Length; + //if (length > MaxAnnexLength) + //{ + // LogFactory.GetLogger("CheckFileLength").Error($"单一文件大小不应超过30MB,错误文件:{path}"); + // throw new ServiceException("单一文件大小不应超过30MB"); + //} + //CurrentLength += length; + //if (CurrentLength <= limitFileLength) + //{ + return true; + //} + //else + //{ + // Continue = true; + // return false; + //} } /// @@ -252,10 +301,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 缓存是否存在value public bool CheckCacheInfo(string key, string value) { - if (CacheInfo == null) - { - CacheInfo = new Dictionary>(); - } + CacheInfo ??= new Dictionary>(); if (!CacheInfo.ContainsKey(key)) { CacheInfo[key] = new List(); @@ -270,10 +316,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// public ReadOnlyCollection GetCacheInfo(string key) { - if (CacheInfo == null) - { - CacheInfo = new Dictionary>(); - } + CacheInfo ??= new Dictionary>(); if (!CacheInfo.ContainsKey(key)) { CacheInfo[key] = new List(); @@ -288,10 +331,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// public void AddCacheInfo(string key, string value) { - if (CacheInfo == null) - { - CacheInfo = new Dictionary>(); - } + CacheInfo ??= new Dictionary>(); if (!CacheInfo.ContainsKey(key)) { CacheInfo[key] = new List(); diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportRootModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportRootModel.cs index 73ead5f0..048b7543 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportRootModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ReportRootModel.cs @@ -1,4 +1,9 @@ -using System.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using System.Xml; using System.Xml.Serialization; using YLErp.Helpers; @@ -58,30 +63,40 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model private string check(string xml) { var result = xml; - if (Header.BusiDataType == DataFlagsEnum.A1016) + switch (this.Header.BusiDataType) { - try - { - var doc = new System.Xml.XmlDocument(); - doc.LoadXml(xml); - var body = doc.GetElementsByTagName("SwapEquityPayment"); - if (body.Count > 0) + case DataFlagsEnum.A1016: + try { - foreach (XmlElement item in body) + var doc = new System.Xml.XmlDocument(); + doc.LoadXml(xml); + var body = doc.GetElementsByTagName("SwapEquityPayment"); + if (body.Count > 0) { - var taget = item.GetElementsByTagName("DurationEventNO"); - var frist = item.GetElementsByTagName("SwapEquityPaymentTuple"); - if (taget.Count > 0) + foreach (XmlElement item in body) { - item.InsertAfter(taget[0], frist[frist.Count - 1]); + var target = item.GetElementsByTagName("DurationEventNO"); + var frist = item.GetElementsByTagName("SwapEquityPaymentTuple"); + if (target.Count > 0) + { + item.InsertAfter(target[0], frist[frist.Count - 1]); + } } + result = XmlHelper.FormatXml(doc.OuterXml); } - result = XmlHelper.FormatXml(doc.OuterXml); } - } - catch - { - } +#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 + catch (Exception ex) +#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 + { + } + break; + case DataFlagsEnum.A1004: + if (result.Contains("")) + { + result = result.Replace("", ""); + } + break; } return result; } @@ -161,7 +176,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明: /// [CheckStringInMap(Map = new[] { "A1001", "A1002","A1003","A1004", "A1005", "A1006" ,"A1007", - "A1008", "A1009","A1010", "A1011", "A1012","A1013","A1014","A1015","A1016","A1017" })] + "A1008", "A1009","A1010", "A1011", "A1012","A1013","A1014","A1015","A1016","A1017","A1018","A1019" })] [SacDescription("BusiDataType", "接口标识", "5", true, "")] public DataFlagsEnum BusiDataType { get; set; } /// @@ -241,11 +256,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("SwapEquityPayment", "收益互换交易权益端支付", "", false, "")] public List SwapEquityPayment { get; set; } /// - /// 互换交易确认书附件 + /// 交易确认书附件 /// [XmlElement] - [SacDescription("ConfirmationAtt", "互换交易确认书附件", "", false, "")] - public List ConfirmationAtt { get; set; } + [SacDescription("ConfirmationAtt", "交易确认书附件", "", false, "")] + public List ConfirmationAtt { get; set; } /// /// 期权交易存续期管理 /// @@ -259,6 +274,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("SwapDurationManagement", "收益互换交易存续期管理", "", false, "")] public List SwapDurationManagement { get; set; } /// + /// 场外期权合约估值信息 + /// + [XmlElement] + [SacDescription("ValuationInformation", "场外期权合约估值信息", "", false, "")] + public List ValuationInformation { get; set; } + /// /// 定期报告-SAC模板 /// [XmlElement] diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SupAgrmtModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SupAgrmtModel.cs index 685f1949..2d994a2d 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SupAgrmtModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SupAgrmtModel.cs @@ -1,4 +1,6 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +10,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 补充协议 /// + [Table("A1003_SupAgrmt")] public class SupAgrmtModel : ReportBaseModel { /// @@ -23,14 +26,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 主协议编号(双方约定) /// 长度:100 /// 必填:是 - /// 说明:校验规则:双方约定 + /// 说明:双方约定 /// [CheckStringMaxLength(MaxLength = 100)] [DefaultValue("")] - [SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "校验规则:双方约定;")] + [SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "双方约定;")] public string MasterAgrmtNo { get; set; } /// - /// 补充协议编号 + /// 补充议编号 /// 长度:32 /// 必填:否 /// 说明:校验规则:补正时必填 @@ -40,17 +43,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 32, CheckHandleName = "A")] [CheckStringMaxLength(MaxLength = 32, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("SupAgrmtID", "补充协议编号", "32", false, "校验规则:补正时必填;")] + [SacDescription("SupAgrmtID", "补充议编号", "32", false, "校验规则:补正时必填;")] public string SupAgrmtID { get; set; } /// /// 补充协议编号(双方约定) /// 长度:100 /// 必填:是 - /// 说明:校验规则:双方约定 + /// 说明:双方约定 /// [CheckStringMaxLength(MaxLength = 100)] [DefaultValue("")] - [SacDescription("SupAgrmtNo", "补充协议编号(双方约定)", "100", true, "校验规则:双方约定;")] + [SacDescription("SupAgrmtNo", "补充协议编号(双方约定)", "100", true, "双方约定;")] public string SupAgrmtNo { get; set; } /// /// 补充协议类型 @@ -61,7 +64,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 2)] [DefaultValue("")] [SacDescription("SupAgrmtType", "补充协议类型", "2", true, "")] - public string SupAgrmtType { get; set; } + public string? SupAgrmtType { get; set; } /// /// 签署时间 /// 长度:10 @@ -71,7 +74,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringLength(Length = 10)] [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] [DefaultValue("")] - [SacDescription("SigningDate", "签署时间", "10", true, "校验规则:必须是yyyy-MM-dd;")] + [SacDescription("SigningDate", "签署时间", "10", true, "校验规则:必须是YYYY-MM-DD;")] public string SigningDate { get; set; } /// /// 补充协议备注 @@ -82,7 +85,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] [SacDescription("SupAgrmtRemark", "补充协议备注", "1024", false, "上述所有字段未能包含的信息;")] - public string SupAgrmtRemark { get; set; } + public string? SupAgrmtRemark { get; set; } + /// + /// 补充协议附件 + /// 长度:1024 + /// 必填:否 + /// 说明:上述所有字段未能包含的信息 + /// + [XmlIgnore] + public string SupAgrmtAtt { get; set; } + /// + /// 补充协议附件 /// /// 补充协议附件 /// 长度: @@ -90,14 +103,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明: /// [XmlElement] + [NotMapped] [SacDescription("SupAgrmtAttTuple", "补充协议附件", "", true, "")] - public List SupAgrmtAttTuple { get; set; } + public List? SupAgrmtAttTuple { get; set; } } /// /// 补充协议附件 /// - public class SupAgrmtAttModel + public class SupAgrmtAttModel : ReportSubBaseModel { /// /// 补充协议附件 @@ -108,6 +122,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringEndsWith(EndsWithString = ".pdf")] [DefaultValue("")] [SacDescription("SupAgrmtAtt", "补充协议附件", "", true, "校验规则:只支持PDF格式;")] - public string SupAgrmtAtt { get; set; } + public string? SupAgrmtAtt { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationAttModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationAttModel.cs deleted file mode 100644 index b958d902..00000000 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationAttModel.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.ComponentModel; -using System.Xml.Serialization; -using YLErp.Modules.SuperviseReportModule.SAC.Common; -using static YLErp.DBModels.Consts.ConsReport; - -namespace YLErp.Modules.SuperviseReportModule.SAC.Model -{ - /// - /// 互换交易确认书附件 - /// - public class SwapConfirmationAttModel : ReportBaseModel - { - /// - /// 交易确认书编号(双方约定) - /// 长度:100 - /// 必填:是 - /// 说明:双方约定 - /// - [CheckStringMaxLength(MaxLength = 100)] - [DefaultValue("")] - [SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")] - public string ConfirmationNo { get; set; } - /// - /// 操作标识 - /// 长度:1 - /// 必填:是 - /// 说明: - /// - [XmlIgnore] - [SacDescription("OperationType", "操作标识", "1", true, "")] - public OptFlagsEnum OperationType { get; set; } - /// - /// 交易确认书附件 - /// 长度: - /// 必填:是 - /// 说明:多附件; - /// - [CheckIEnumerableTMinCount(MinCount = 1)] - [XmlElement] - [SacDescription("ConfirmationFilesTuple", "交易确认书附件", "", true, "多附件;")] - public List ConfirmationFilesTuple { get; set; } - } - - public class ConfirmationFilesTupleModel - { - /// - /// 交易确认书附件 - /// 长度:100 - /// 必填:是 - /// 说明:校验规则:只支持PDF格式 - /// - [CheckStringEndsWith(EndsWithString = ".pdf")] - [DefaultValue("")] - [SacDescription("ConfirmationFiles", "交易确认书附件", "100", true, "校验规则:只支持PDF格式;")] - public string ConfirmationFiles { get; set; } - } -} \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationModel.cs index 92f81f9e..af73c72e 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapConfirmationModel.cs @@ -1,4 +1,6 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +10,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 互换交易确认书 /// + [Table("A1005_SwapConfirmation")] public class SwapConfirmationModel : ReportBaseModel { /// @@ -17,6 +20,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明: /// [XmlIgnore] + [SacDescription("PaymentMethod", "支付方式", "2", true, "")] public string PaymentMethod { get; set; } /// /// 操作标识 @@ -64,7 +68,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 交易确认书编号(双方约定) /// 长度:100 /// 必填:是 - /// 说明:双方约定; + /// 说明:双方约定 /// [CheckStringMaxLength(MaxLength = 100)] [DefaultValue("")] @@ -74,11 +78,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 交易确认书类型 /// 长度:2 /// 必填:是 - /// 说明: + /// 说明:校验规则:首次提交时填0,补正时填1 /// [CheckStringInMap(Map = new[] { "0", "1" })] [DefaultValue("")] - [SacDescription("ConfirmationType", "交易确认书类型", "2", true, "")] + [SacDescription("ConfirmationType", "交易确认书类型", "2", true, "校验规则:首次提交时填0,补正时填1;")] public string ConfirmationType { get; set; } /// /// 填报方角色 @@ -104,34 +108,34 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 起始日 /// 长度:10 /// 必填:是 - /// 说明:校验规则:1 起始日不能大于到期日日期;2 必须是yyyy-MM-dd + /// 说明:校验规则:1 起始日不能大于到期日日期;2 必须是YYYY-MM-DD /// [CheckStringMaxLength(MaxLength = 10)] [CheckStringIsDateTimeFormat] [DefaultValue("")] - [SacDescription("StartDate", "起始日", "10", true, "校验规则:\r\n1 起始日不能大于到期日日期;\r\n2 必须是yyyy-MM-dd;")] + [SacDescription("StartDate", "起始日", "10", true, "校验规则:\r\n1 起始日不能大于到期日日期;\r\n2 必须是YYYY-MM-DD;")] public string StartDate { get; set; } /// /// 到期日 /// 长度:10 /// 必填:是 - /// 说明:指定的进行结算金额收付的日期. 校验规则:1 到期日不能小于起始日日期;2 必须是yyyy-MM-dd;3 补正时,如果该交易还有未被废除的存续期记录(包括展期\终止数据),到期日字段不能修改; + /// 说明:指定的进行结算金额收付的日期. 校验规则:1 到期日不能小于起始日日期;2 必须是YYYY-MM-DD; /// [CheckStringMaxLength(MaxLength = 10)] [CheckStringIsDateTimeFormat] [DefaultValue("")] - [SacDescription("DueDate", "到期日", "10", true, "指定的进行结算金额收付的日期.\r\n校验规则:\r\n1 到期日不能小于起始日日期;\r\n2 必须是yyyy-MM-dd;\r\n3 补正时,如果该交易还有未被废除的存续期记录(包括展期、终止数据),到期日字段不能修改;")] + [SacDescription("DueDate", "到期日", "10", true, "指定的进行结算金额收付的日期.\r\n校验规则:\r\n1 到期日不能小于起始日日期;\r\n2 必须是YYYY-MM-DD;")] public string DueDate { get; set; } /// /// 结算日 /// 长度:10 /// 必填:否 - /// 说明:交易双方在交易有效约定中指定的进行结算金额收付的日期;校验规则:1 必须是yyyy-MM-dd; + /// 说明:校验规则:1 必须是YYYY-MM-DD; /// [CheckStringMaxLength(MaxLength = 10, Required = false)] [CheckStringIsDateTimeFormat(Required = false)] [DefaultValue("")] - [SacDescription("SettlementDate", "结算日", "10", false, "交易双方在交易有效约定中指定的进行结算金额收付的日期;\r\n校验规则:\r\n1 必须是yyyy-MM-dd;")] + [SacDescription("SettlementDate", "结算日", "10", false, "校验规则:\r\n1 必须是YYYY-MM-DD;")] public string SettlementDate { get; set; } /// /// 结算货币 @@ -144,7 +148,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("Currency", "结算货币", "2", true, "使用货币通用代码(大写);")] public string Currency { get; set; } /// - /// 名义本金额(人民币、元) + /// 名义本金(元) /// 长度:36,2 /// 必填:是 /// 说明:校验规则:1 必须两位小数以内;2 补正时,如果该交易还有未被废除的存续期记录(包括展期\终止数据),名义本金额(人民币)字段不能修改; @@ -152,7 +156,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, MinValue = 0)] [DefaultValue("")] - [SacDescription("NotinalPrincipleAmt", "名义本金额(人民币、元)", "36,2", true, "校验规则:\r\n1 必须两位小数以内;\r\n2 补正时,如果该交易还有未被废除的存续期记录(包括展期、终止数据),名义本金额(人民币)字段不能修改;\r\n名义本金为标的期初价格乘以数量乘以乘数;\r\n多空组合填写多头名义本金与空头名义本金孰高;")] + [SacDescription("NotinalPrincipleAmt", "名义本金(元)", "36,2", true, "校验规则:\r\n1 必须两位小数以内;\r\n2 补正时,如果该交易还有未被废除的存续期记录(包括展期、终止数据),名义本金额(人民币)字段不能修改;")] public string NotinalPrincipleAmt { get; set; } /// /// 清算机构 @@ -181,7 +185,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 说明:交易场所选"99:其他交易场所"时,必填 /// [CheckConditionStringValue(ConditionName = nameof(TradingPlace), ConditionValue = "99", CheckHandleNameArr = new[] { "A" })] - [CheckStringMinLength(MinLength = 1, CheckHandleName = "A")] + [CheckStringMaxLength(MaxLength = 200, CheckHandleName = "A")] [DefaultValue("")] [SacDescription("TradingPlaceOther", "交易场所(其他)", "200", false, "交易场所选99:其他交易场所时,必填;")] public string TradingPlaceOther { get; set; } @@ -209,6 +213,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 费用端支付 /// [XmlElement] + [NotMapped] [SacDescription("CostPaymentTuple", "费用端支付", "", false, "")] public List CostPaymentTuple { get; set; } /// @@ -232,26 +237,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringInMap(Map = new[] { "0", "1", "2", "3" }, CheckHandleName = "A")] [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PerformanceCollProvider", "履约担保品提供方", "2", false, "检验规则履约担保类型为部分担保或全额担保时必填;")] + [SacDescription("PerformanceCollProvider", "履约担保品提供方", "2", false, "检验规则:履约担保类型为部分担保或全额担保时必填;")] public string PerformanceCollProvider { get; set; } /// /// 担保品收取方是否可使用担保品 /// 长度:5 /// 必填:否 - /// 说明:检验规则:履约担保类型为部分担保,全额担保时必填; + /// 说明:检验规则:履约担保类型为"部分担保"或"全额担保"时必填; /// [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] [CheckStringInMap(Map = new[] { "true", "false" }, CheckHandleName = "A")] [CheckStringLength(Length = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("PartyUseColl", "担保品收取方是否可使用担保品", "5", false, "检验规则:履约担保类型为部分担保,全额担保时必填;")] + [SacDescription("PartyUseColl", "担保品收取方是否可使用担保品", "5", false, "检验规则:履约担保类型为部分担保或全额担保时必填;")] public string PartyUseColl { get; set; } /// /// 担保品使用说明 /// 长度:1024 /// 必填:否 - /// 说明:检验规则:当担保品收取方是否可使用担保品选择是时必填; + /// 说明:检验规则:当"担保品收取方是否可使用担保品"选择"是"时必填; /// [CheckConditionStringValue(ConditionName = nameof(PartyUseColl), ConditionValue = "true", CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNEQValue(ConditionName = nameof(PartyUseColl), ConditionValue = "true", CheckHandleNameArr = new[] { "B" })] @@ -264,7 +269,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 是否计算担保品价值产生利息 /// 长度:5 /// 必填:否 - /// 说明:检验规则:当"履约担保类型"为"部分担保"\"全额担保"时必填 + /// 说明:检验规则:当"履约担保类型"为"部分担保"、"全额担保"时必填 /// [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] @@ -277,11 +282,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 履约担保品初始比率(%) /// 长度:5,2 /// 必填:是 - /// 说明:校验规则:1 当"履约保障类型"选择"部分担保"或"全额担保"时必填;2 大于等于0的数字,最多2位小数,该值为100%时,填写100.00 + /// 说明:校验规则:大于等于0的数字,最多2位小数,该值为100%时,填写100.00 /// - [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0)] + [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MinValue = 0)] [DefaultValue("")] - [SacDescription("PerformanceCollInitialRatio", "履约担保品初始比率(%)", "5,2", true, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 大于等于0的数字,最多2位小数,该值为100%时,填写100.00;")] + [SacDescription("PerformanceCollInitialRatio", "履约担保品初始比率(%)", "5,2", true, "校验规则:大于等于0的数字,最多2位小数,该值为100%时,填写100.00;")] public string PerformanceCollInitialRatio { get; set; } /// /// 履约担保品追保比率(%) @@ -291,8 +296,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, CheckHandleName = "A")] - [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, Required = false, CheckHandleName = "B")] + [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MinValue = 0, CheckHandleName = "A")] + [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MinValue = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("PerformanceCollAddtlRatio", "履约担保品追保比率(%)", "5,2", false, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 大于等于0的数字,最多2位小数,该值为100%时,填写100.00;")] public string PerformanceCollAddtlRatio { get; set; } @@ -304,8 +309,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringNotInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "B" })] - [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, CheckHandleName = "A")] - [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MaxValue = 100, MinValue = 0, Required = false, CheckHandleName = "B")] + [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MinValue = 0, CheckHandleName = "A")] + [CheckStringIntMaxLength(BeforePointMaxLength = 3, AfterPointMaxLength = 2, MinValue = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] [SacDescription("PerformanceCollOffsetRatio", "履约担保品平仓比率(%)", "5,2", false, "校验规则:\r\n1 当履约保障类型选择部分担保或全额担保时必填;\r\n2 大于等于0的数字,最多2位小数,该值为100%时,填写100.00;")] public string PerformanceCollOffsetRatio { get; set; } @@ -347,6 +352,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckConditionStringInMap(ConditionName = nameof(PerformanceGuaranteeType), ConditionMap = new[] { "1", "2" }, CheckHandleNameArr = new[] { "A" })] [CheckIEnumerableTMinCount(CheckHandleName = "A", MinCount = 1)] [XmlElement] + [NotMapped] [SacDescription("PerformanceCollTuple", "履约担保品", "", false, "数组结构,支持新增多条;\r\n校验规则:字段信息详见收益互换交易确认书【履约担保品】。检验规则:当“履约担保类型”为“部分担保”或“全额担保”时必填;")] public List PerformanceCollTuple { get; set; } /// @@ -373,31 +379,31 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 标的个数 /// 长度:2 /// 必填:是 - /// 说明: 多标的时,权益收益\浮动利率收益固定利率收益信息需新增多个 + /// 说明: 多标的时,权益收益、浮动利率收益、固定利率收益信息需新增多个 /// [CheckStringInMap(Map = new[] { "0", "1" })] [DefaultValue("")] - [SacDescription("PtyAUndrlygAssetNo", "标的个数", "2", true, "多标的时,权益收益、浮动利率收益固定利率收益信息需新增多个;")] + [SacDescription("PtyAUndrlygAssetNo", "标的个数", "2", true, "多标的时,权益收益、浮动利率收益、固定利率收益信息需新增多个;")] public string PtyAUndrlygAssetNo { get; set; } /// /// 收益计算说明 /// 长度:1024 /// 必填:是 - /// 说明:甲方支付乙方,详细说明收益计算方式; + /// 说明:详细说明收益计算方式 /// [CheckStringMaxLength(MaxLength = 1024)] [DefaultValue("")] - [SacDescription("PtyAPrOfitCalculationInfo", "收益计算说明", "1024", true, "甲方支付乙方,详细说明收益计算方式;")] + [SacDescription("PtyAPrOfitCalculationInfo", "收益计算说明", "1024", true, "详细说明收益计算方式;")] public string PtyAPrOfitCalculationInfo { get; set; } /// /// 收益备注 /// 长度:1024 /// 必填:否 - /// 说明:甲方支付乙方,填写上述字段或交易确认书中不能包含的信息; + /// 说明:填写上述字段或交易确认书中不能包含的信息 /// [CheckStringMaxLength(MaxLength = 1024, Required = false)] [DefaultValue("")] - [SacDescription("PtyAProfitRemark", "收益备注", "1024", false, "甲方支付乙方,填写上述字段或交易确认书中不能包含的信息;")] + [SacDescription("PtyAProfitRemark", "收益备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")] public string PtyAProfitRemark { get; set; } /// /// 甲方代签产品名称 @@ -451,6 +457,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("PytBPdctCode", "乙方交易对手码(产品)", "20", false, "校验规则:如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;")] public string PytBPdctCode { get; set; } + //TODO: 2.3互换上线时取消注释 + ///// + ///// 是否为跨境交易 + ///// 长度:5 + ///// 必填:是 + ///// 说明: + ///// + //[CheckStringInMap(Map = new[] { "true", "false" })] + //[DefaultValue("")] + //[SacDescription("CrossBorderTransactions", "是否为跨境交易", "5", true, "")] + //public string CrossBorderTransactions { get; set; } /// /// 空白1 /// @@ -468,7 +485,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 履约担保品详情 /// - public class SwapPerformanceGuaranteeAttModel + [Table("A1005_SwapPerformanceGuaranteeAtt")] + public class SwapPerformanceGuaranteeAttModel : ReportSubBaseModel { /// /// 履约担保品类型 @@ -510,12 +528,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("Remarks", "备注", "1024", false, "")] public string Remarks { get; set; } + + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号", "100", false, "")] + public string ConfirmationNo { get; set; } } /// /// 收益互换交易费用端支付 /// - public class PaymentMethodModel + [Table("A1005_PaymentMethod")] + public class PaymentMethodModel : ReportSubBaseModel { /// /// 支付方式 @@ -612,5 +636,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("Blank2", "空白2", "", false, "")] public string Blank2 { get; set; } + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号", "100", false, "")] + public string ConfirmationNo { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapDurationManagementModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapDurationManagementModel.cs index 04c22f7a..b117dbe1 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapDurationManagementModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapDurationManagementModel.cs @@ -1,4 +1,6 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +10,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 收益互换交易存续期管理 /// + [Table("A1006_SwapDurationManagement")] public class SwapDurationManagementModel : ReportBaseModel { /// @@ -57,12 +60,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 存续期操作类型 /// 长度:2 /// 必填:是 - /// 说明:当"收益互换交易类型"为"多空组合"时,可选"调仓" + /// 说明:当"收益互换交易类型"为"多空组合"时,可选"调仓" /// [CheckConditionStringValue(ConditionName = nameof(SwapType), ConditionValue = "2", CheckHandleNameArr = new[] { "A", "C" })] [CheckConditionStringNEQValue(ConditionName = nameof(SwapType), ConditionValue = "2", CheckHandleNameArr = new[] { "B", "C" })] - [CheckStringInMap(Map = new[] { "01", "04" }, CheckHandleName = "A")] - [CheckStringInMap(Map = new[] { "01", "02", "03" }, CheckHandleName = "B")] + [CheckStringInMap(Map = new[] { "1", "4" }, CheckHandleName = "A")] + [CheckStringInMap(Map = new[] { "1", "2", "3" }, CheckHandleName = "B")] [CheckStringIntMaxLength(MaxValue = 4, MinValue = 1, BeforePointMaxLength = 2, CheckHandleName = "C")] [DefaultValue("")] [SacDescription("DurationOperationType", "存续期操作类型", "2", true, "当收益互换交易类型为多空组合时,可选调仓;")] @@ -131,7 +134,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// 当"存续期操作类型"选择"调仓"时,可增可减 /// /// - [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03", "04" }, CheckHandleNameArr = new[] { "A" })] + [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "04" }, CheckHandleNameArr = new[] { "A" })] [CheckConditionStringInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03" }, CheckHandleNameArr = new[] { "B" })] [CheckConditionStringNotInMap(ConditionName = nameof(DurationOperationType), ConditionMap = new[] { "02", "03", "04" }, CheckHandleNameArr = new[] { "C" })] [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, CheckHandleName = "A")] @@ -170,14 +173,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [SacDescription("AmountPaidThisTime", "本次支付金额(元)", "36,2", false, "当存续期操作类型选择终止、违约终止、调仓时,必填;\r\n支付为正,收取为负;")] public string AmountPaidThisTime { get; set; } /// - /// 预付金比例(%) + /// 保证金比例(%) /// 长度:8,2 /// 必填:是 - /// 说明:为预付金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者 + /// 说明:为保证金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者 /// [CheckStringIntLength(BeforePointMaxLength = 8, AfterPointLength = 2)] [DefaultValue("")] - [SacDescription("MarginRatio", "预付金比例(%)", "8,2", true, "为预付金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者;")] + [SacDescription("MarginRatio", "保证金比例(%)", "8,2", true, "为保证金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者;")] public string MarginRatio { get; set; } /// /// 合约持仓明细 @@ -189,6 +192,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckConditionIntInRange(ConditionName = nameof(Balance), MinValue = 0, MaxValue = 0, CheckHandleNameArr = new[] { "B" })] [CheckIEnumerableTMaxCount(CheckHandleName = "A", MaxCount = 0)] [CheckIEnumerableTMaxCount(CheckHandleName = "B", MaxCount = 0)] + [NotMapped] [SacDescription("CurrentPositionDetails", "合约持仓明细", "", false, "校验规则:当存量名义本金(元)为0时,非必填;\r\n展期数据不允许添加合约持仓明细;")] public List CurrentPositionDetails { get; set; } /// @@ -216,7 +220,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 合约持仓明细 /// - public class CurrentPositionDetailModel + [Table("A1006_CurrentPositionDetail")] + public class CurrentPositionDetailModel : ReportSubBaseModel { /// /// 挂钩标的编码 @@ -320,5 +325,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("Blank2", "空白2", "", false, "")] public string Blank2 { get; set; } + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号", "100", false, "")] + public string ConfirmationNo { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapEquityPaymentModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapEquityPaymentModel.cs index a5917a43..162fafff 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapEquityPaymentModel.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/SwapEquityPaymentModel.cs @@ -1,4 +1,8 @@ -using System.ComponentModel; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml; +using System.Xml.Schema; using System.Xml.Serialization; using YLErp.Modules.SuperviseReportModule.SAC.Common; using static YLErp.DBModels.Consts.ConsReport; @@ -8,6 +12,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 收益互换交易权益端支付 /// + [Table("A1016_SwapEquityPayment")] public class SwapEquityPaymentModel : ReportBaseModel { /// @@ -27,13 +32,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringMaxLength(MaxLength = 100)] [DefaultValue("")] - [SacDescription("ConfirmationNo", "交易确认书", "100", true, "双方约定;")] + [SacDescription("ConfirmationNo", "交易确认书(双方约定)", "100", true, "双方约定;")] public string ConfirmationNo { get; set; } /// /// 权益端支付 /// [XmlElement] [CheckIEnumerableTMinCount(MinCount = 1)] + [NotMapped] [SacDescription("SwapEquityPaymentTuple", "权益端支付", "", false, "")] public List SwapEquityPaymentTuple { get; set; } /// @@ -50,7 +56,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringLengthInMap(Map = new[] { 4, 5 }, Required = false)] [SacDescription("DurationEventNO", "操作事件编号", "6", false, "首次随交易确认书上报时,不填;\r\n存续期发生相关事件时,必填;\r\n同一笔交易确认书下应当保证唯一性,并按照事件发生顺序进行编号,起始编号为0000.\r\n如一笔交易下依次发生展期、调仓、终止事件,编号应当分别为0000、0001、0002,\r\n场外业务报告系统返回编号分别为E0000、R0001、T0002;")] - public new string DurationEventNO { get; set; } + public new string? DurationEventNO { get; set; } /// /// 空白1 /// @@ -68,7 +74,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// /// 权益端支付 /// - public class SwapEquityPaymentTupleModel + [Table("A1016_SwapEquityPaymentTuple")] + public class SwapEquityPaymentTupleModel : ReportSubBaseModel { /// /// 支付方式 @@ -106,7 +113,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringIsDateTimeFormat] [DefaultValue("")] - [SacDescription("OpenandClosingDate", "标的开/平仓日期", "2", true, "yyyy-MM-dd;")] + [SacDescription("OpenandClosingDate", "标的开/平仓日期", "10", true, "yyyy-MM-dd;")] public string OpenandClosingDate { get; set; } /// /// 标的小类 @@ -197,7 +204,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, MinValue = 0, CheckHandleName = "A")] [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, MinValue = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("LNotinalPrincipleAmt", "多头名义本金", "36,2", false, "标的数量*合约乘数*标的价格;\r\n当支付方式选择权益收益(多头)、浮动利率收益、权益收益多空组合时,必填;")] + [SacDescription("LNotinalPrincipleAmt", "多头名义本金(元)", "36,2", false, "标的数量*合约乘数*标的价格;\r\n当支付方式选择权益收益(多头)、浮动利率收益、权益收益多空组合时,必填;")] public string LNotinalPrincipleAmt { get; set; } /// /// 空头名义本金(元) @@ -210,7 +217,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, MaxValue = 0, CheckHandleName = "A")] [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, MaxValue = 0, Required = false, CheckHandleName = "B")] [DefaultValue("")] - [SacDescription("SNotinalPrincipleAmt", "空头名义本金", "36,2", false, "-(标的数量*合约乘数* 标的价格)\r\n当支付方式选择权益收益(空头)、浮动利率收益、权益收益多空组合时,必填;")] + [SacDescription("SNotinalPrincipleAmt", "空头名义本金(元)", "36,2", false, "-(标的数量*合约乘数* 标的价格)\r\n当支付方式选择权益收益(空头)、浮动利率收益、权益收益多空组合时,必填;")] public string SNotinalPrincipleAmt { get; set; } /// /// 利率(%) @@ -220,7 +227,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model /// [CheckStringIntLength(BeforePointMaxLength = 8, AfterPointLength = 2, MinValue = 0, Required = false)] [DefaultValue("")] - [SacDescription("InterestRate", "利率", "8,2", false, "校验规则:大于等于0的两位小数,如5.12;")] + [SacDescription("InterestRate", "利率(%)", "8,2", false, "校验规则:大于等于0的两位小数,如5.12;")] public string InterestRate { get; set; } /// /// 空白1 @@ -234,5 +241,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model [DefaultValue("")] [SacDescription("Blank2", "空白2", "", false, "")] public string Blank2 { get; set; } + [XmlIgnore] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号", "100", false, "")] + public string ConfirmationNo { get; set; } } } \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ValuationInformationModel.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ValuationInformationModel.cs new file mode 100644 index 00000000..837745d2 --- /dev/null +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Model/ValuationInformationModel.cs @@ -0,0 +1,240 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; +using YLErp.Modules.SuperviseReportModule.SAC.Common; +using static YLErp.DBModels.Consts.ConsReport; + +namespace YLErp.Modules.SuperviseReportModule.SAC.Model +{ + /// + /// 场外期权合约估值信息 + /// + [Table("A1018_ValuationInformation")] + public class ValuationInformationModel : ReportBaseModel + { + /// + /// 操作标识 + /// 长度:1 + /// 必填:是 + /// 说明: + /// + [XmlIgnore] + [SacDescription("OperationType", "操作标识", "1", true, "")] + public OptFlagsEnum OperationType { get; set; } + + /// + /// 交易确认书编号(双方约定) + /// 长度:100 + /// 必填:是 + /// 说明:双方约定 + /// + [CheckStringMaxLength(MaxLength = 100)] + [DefaultValue("")] + [SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")] + public string ConfirmationNo { get; set; } + + /// + /// 估值日期 + /// 长度:10 + /// 必填:是 + /// 说明: + /// + [CheckStringLength(Length = 10)] + [CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")] + [DefaultValue("")] + [SacDescription("ValuationDate", "估值日期", "10", true, "")] + public string ValuationDate { get; set; } + + /// + /// 存量名义本金(元) + /// 长度:36,2 + /// 必填:是 + /// 说明:两位小数;大于等于0的数字 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, MinValue = 0)] + [DefaultValue("")] + [SacDescription("Balance", "存量名义本金(元)", "36,2", true, "大于等于0的数字;")] + public string Balance { get; set; } + + /// + /// 保证金比例(%) + /// 长度:8,2 + /// 必填:否 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 8, AfterPointMaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("MarginRatio", "保证金比例(%)", "8,2", false, "")] + public string MarginRatio { get; set; } + + /// + /// 期权估值 + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)] + [DefaultValue("")] + [SacDescription("OptionValuation", "期权估值", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string OptionValuation { get; set; } + + /// + /// Delta + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("Delta", "Delta", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string Delta { get; set; } + + /// + /// Gamma + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("Gamma", "Gamma", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string Gamma { get; set; } + + /// + /// Vega + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("Vega", "Vega", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string Vega { get; set; } + + /// + /// Theta + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("Theta", "Theta", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string Theta { get; set; } + + /// + /// Rho + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("Rho", "Rho", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string Rho { get; set; } + + /// + /// RhoQ + /// 长度:36,2 + /// 必填:否 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("RhoQ", "RhoQ", "36,2", false, "")] + public string RhoQ { get; set; } + + /// + /// DeltaCash + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("DeltaCash", "DeltaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string DeltaCash { get; set; } + + /// + /// GammaCash + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("GammaCash", "GammaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string GammaCash { get; set; } + + /// + /// VegaCash + /// 长度:36,2 + /// 必填:是 + /// 说明:期权生效后,每个交易日更新,直至期权终止 + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)] + [DefaultValue("")] + [SacDescription("VegaCash", "VegaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")] + public string VegaCash { get; set; } + + /// + /// ThetaCash + /// 长度:36,2 + /// 必填:否 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("ThetaCash", "ThetaCash", "36,2", false, "")] + public string ThetaCash { get; set; } + + /// + /// RhoCash + /// 长度:36,2 + /// 必填:否 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("RhoCash", "RhoCash", "36,2", false, "")] + public string RhoCash { get; set; } + + /// + /// RhoQCash + /// 长度:36,2 + /// 必填:否 + /// 说明: + /// + [CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)] + [DefaultValue("")] + [SacDescription("RhoQCash", "RhoQCash", "36,2", false, "")] + public string RhoQCash { get; set; } + + /// + /// 空白1 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank1", "空白1", "", false, "")] + public string Blank1 { get; set; } + + /// + /// 空白2 + /// 长度: + /// 必填:否 + /// 说明: + /// + [XmlIgnore] + [DefaultValue("")] + [SacDescription("Blank2", "空白2", "", false, "")] + public string Blank2 { get; set; } + } +} \ No newline at end of file diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ContractNumberProcessService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ContractNumberProcessService.cs index 13f3815e..f5f701ec 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ContractNumberProcessService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ContractNumberProcessService.cs @@ -1,4 +1,4 @@ -using System.Data; +using DocumentFormat.OpenXml.Bibliography; using YLErp.DBModels.Enums; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; @@ -19,44 +19,46 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1015; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ContractNumberProcess; + List noteList = new List(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - model.ContractNumberProcess = new ContractNumberProcessModel(); - model.ContractNumberProcess.MasterAgrmtTuple = new List(); - model.ContractNumberProcess.SupAgrmtTuple = new List(); - model.ContractNumberProcess.OptionConfirmationTuple = new List(); - model.ContractNumberProcess.SwapConfirmationTuple = new List(); - HashSet masterAgrmtTupleId = new HashSet(); - HashSet masterAgrmtTupleNo = new HashSet(); - HashSet supAgrmtTupleId = new HashSet(); - HashSet supAgrmtTupleNo = new HashSet(); - HashSet confirmationTupleId = new HashSet(); - HashSet confirmationTupleNo = new HashSet(); + var model = new BodyModel + { + ContractNumberProcess = new ContractNumberProcessModel + { + MasterAgrmtTuple = new List(), + SupAgrmtTuple = new List(), + OptionConfirmationTuple = new List(), + SwapConfirmationTuple = new List() + } + }; + var masterAgrmtTupleId = new HashSet(); + var masterAgrmtTupleNo = new HashSet(); + var supAgrmtTupleId = new HashSet(); + var supAgrmtTupleNo = new HashSet(); + var confirmationTupleId = new HashSet(); + var confirmationTupleNo = new HashSet(); string id = "", no = ""; if (_excelDataSource != null && _excelDataSource.Tables.Contains("双方约定编号数据明细")) { - DataTable dt = _excelDataSource.Tables["双方约定编号数据明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["双方约定编号数据明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -137,27 +139,44 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { model.ContractNumberProcess.SwapConfirmationTuple.Add(new ChangeOptionConfirmationModel()); } + ReportService.EditContractNumber(DbContextFactory.GetYLDbContext(), model.ContractNumberProcess, out _); + var note = new SACReportNotes(); + note.IsValid = true; + note.InfoCache = $"{{\"Tag\":\"\"}}"; + note.ExceId = model.ContractNumberProcess.ExceID; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = BusiDataType.ToString(); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.changeStatus = false; + noteList.Add(note); } return model; } protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model.ContractNumberProcess != null) { - List listRoot = new List(); - CheckHelper helper = new CheckHelper(); - CheckHelper masterAgrmtHelper = new CheckHelper(); - CheckHelper supAgrmtHelper = new CheckHelper(); - CheckHelper optionConfirmationHelper = new CheckHelper(); + var listRoot = new List(); + var helper = new CheckHelper(); + var masterAgrmtHelper = new CheckHelper(); + var supAgrmtHelper = new CheckHelper(); + var optionConfirmationHelper = new CheckHelper(); helper.ExecuteCheck(model.ContractNumberProcess, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.ContractNumberProcess.MasterAgrmtTuple != null) { - for (int i = 0; i < model.ContractNumberProcess.MasterAgrmtTuple.Count; i++) + for (var i = 0; i < model.ContractNumberProcess.MasterAgrmtTuple.Count; i++) { var listItem = new List(); var item = model.ContractNumberProcess.MasterAgrmtTuple[i]; @@ -167,15 +186,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("MasterAgrmtTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("MasterAgrmtTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.ContractNumberProcess.SupAgrmtTuple != null) { - for (int i = 0; i < model.ContractNumberProcess.SupAgrmtTuple.Count; i++) + for (var i = 0; i < model.ContractNumberProcess.SupAgrmtTuple.Count; i++) { var listItem = new List(); var item = model.ContractNumberProcess.SupAgrmtTuple[i]; @@ -185,15 +206,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("SupAgrmtTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("SupAgrmtTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.ContractNumberProcess.OptionConfirmationTuple != null) { - for (int i = 0; i < model.ContractNumberProcess.OptionConfirmationTuple.Count; i++) + for (var i = 0; i < model.ContractNumberProcess.OptionConfirmationTuple.Count; i++) { var listItem = new List(); var item = model.ContractNumberProcess.OptionConfirmationTuple[i]; @@ -203,15 +226,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("OptionConfirmationTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("OptionConfirmationTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.ContractNumberProcess.SwapConfirmationTuple != null) { - for (int i = 0; i < model.ContractNumberProcess.SwapConfirmationTuple.Count; i++) + for (var i = 0; i < model.ContractNumberProcess.SwapConfirmationTuple.Count; i++) { var listItem = new List(); var item = model.ContractNumberProcess.SwapConfirmationTuple[i]; @@ -221,21 +246,42 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("SwapConfirmationTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("SwapConfirmationTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("ContractNumberProcess"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("ContractNumberProcess") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } checkStatus = result.Count > 0; return result; } + + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //这个报告只有新增,不存在后续报送,所以InfoTag中只有报告类型,不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + + public override bool BeforeOfGenerated(out string errMsg) + { + errMsg = ""; + for (int i = 0; i < noteList.Count; i++) + { + base.SaveReportNotes(noteList[i]); + } + return true; + } + } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportBaseService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportBaseService.cs index 70c70cd5..0d14d7a1 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportBaseService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportBaseService.cs @@ -1,4 +1,6 @@ -using Oracle.ManagedDataAccess.Client; +using BaseOUDAL; +using NPOI.OpenXmlFormats.Dml.Diagram; +using Oracle.ManagedDataAccess.Client; using System.Data; using System.Diagnostics; using System.Text; @@ -45,12 +47,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// /// 子系统报送文件目录 /// - protected List xmlAttachmentList = new List(); + protected List xmlAttachmentList = new(); /// /// /// - protected TempFilesService tempFilesService = null; + protected TempFilesService? tempFilesService = null; protected ReportBaseService(OptUserInfo optUser) : base(optUser) { @@ -66,6 +68,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected abstract DataFlagsEnum BusiDataType { get; } + protected virtual string CacheKey => $"{BusiDataType}"; + protected abstract SuperviseReportTypeEnum ReportType { get; } /// /// 支持的操作类型 @@ -78,7 +82,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// protected OptFlagsEnum _operationType { get; private set; } - private YLContext _writeDb = null; + private YLContext? _writeDb = null; public YLContext WriteDb { get @@ -102,29 +106,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public ReportRootModel Execute(ReportInfo req, OptFlagsEnum operationType) { - LogFactory.GetLogger("Executeone").Info($"PS.Config.ErpElement.SAC_ReportDataSource111:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); - _reqInfo = req; + + LogFactory.GetLogger("Executeone").Info($"PS.Config.ErpElement.SAC_ReportDataSource:" + _reqInfo.DataSource.ToString()); _operationType = operationType; - ReportRootModel root = new ReportRootModel(); + var root = new ReportRootModel(); try { root.Annex = new List(); - LogFactory.GetLogger("Execute22").Info($"PS.Config.ErpElement.SAC_ReportDataSource111:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); loadExcelDataSource(); - LogFactory.GetLogger("Execute22").Info($"PS.Config.ErpElement.SAC_ReportDataSource111:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); - - LogFactory.GetLogger("Execute111").Info($"PS.Config.ErpElement.SAC_ReportDataSource111:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.KingstarView) == SAC_ReportDataSourceEnum.KingstarView) - { - LogFactory.GetLogger("Execute111").Info($"PS.Config.ErpElement.SAC_ReportDataSource222:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); - loadViewDataSource(); - } root.Header = GenerateHeader(); FileTag = root.FileTag; - root.Body = GenerateBody(out bool noData, out List fileList); + root.Body = GenerateBody(out var noData, out var fileList); if (noData) { return null; } root.Annex.AddRange(fileList); @@ -168,13 +163,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private HeaderModel GenerateHeader() { - HeaderModel model = new HeaderModel(); - model.SenderCode = _reqInfo.SenderCode; - model.ReceiverCode = _reqInfo.ReceiverCode; - model.SendDate = _reqInfo.ReportDate.ToString("yyyy-MM-dd"); - model.FileNumber = FileNumber.ToString("0000"); - model.BusiDataType = BusiDataType; - model.OperationType = _operationType.ToString(); + var model = new HeaderModel + { + SenderCode = _reqInfo.SenderCode, + ReceiverCode = _reqInfo.ReceiverCode, + SendDate = _reqInfo.ReportDate.ToString("yyyy-MM-dd"), + FileNumber = FileNumber.ToString("0000"), + BusiDataType = BusiDataType, + OperationType = _operationType.ToString() + }; return model; } @@ -193,7 +190,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service errMsg = "接收方编号不应为空"; return false; } - if (req.ReportDate == default(DateTime)) + if (req.ReportDate == default) { errMsg = "报送日期不应为空"; return false; @@ -206,7 +203,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service SacInfo errMsg = null; if (model != null) { - List listRoot = new List(); + var listRoot = new List(); var headerItem = CheckHeaderValue(model?.Header, out _); if (headerItem != null) { @@ -215,8 +212,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var bodyItem = CheckBodyValue(model?.Body, out _); if (bodyItem.Count > 0) { - var item = new SacInfo("Body"); - item.SubMaps = bodyItem; + var item = new SacInfo("Body") + { + SubMaps = bodyItem + }; listRoot.Add(item); } model.XmlStr = XmlHelper.Serializable(model, true); @@ -234,8 +233,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (listRoot.Count > 0) { - errMsg = new SacInfo("Root"); - errMsg.SubMaps = new List(listRoot); + errMsg = new SacInfo("Root") + { + SubMaps = new List(listRoot) + }; errMsg.formatFieldDescription(); } } @@ -246,16 +247,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private SacInfo CheckHeaderValue(HeaderModel model, out bool checkStatus) { SacInfo errMsg = null; - List listRoot = new List(); - CheckHelper helper = new CheckHelper(); + var listRoot = new List(); + var helper = new CheckHelper(); helper.ExecuteCheck(model, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (listRoot.Count > 0) { - errMsg = new SacInfo("Header"); - errMsg.SubMaps = new List(listRoot); + errMsg = new SacInfo("Header") + { + SubMaps = new List(listRoot) + }; } checkStatus = errMsg == null; return errMsg; @@ -263,29 +266,48 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected void SaveReportNotes(SACReportNotes sacReportNotes) { - sacReportNotes.DataId = sacReportNotes.DataId ?? ""; + sacReportNotes.DataId ??= ""; WriteDb.sac_report_notes.Add(sacReportNotes); } + /// + /// 初始化报告记录 + /// + /// + /// + protected IEnumerable InitReportNotes(SuperviseReportTypeEnum reportType) + { + return DbContext.sac_report_notes.AsNoTracking().Where(O => O.ReportType == reportType).ToList(); + } + /// /// 获取报送记录 /// /// 报告标识 - /// 是否忽略无效的交易 + /// 是否需要无效的记录 /// - protected List GetReportNotes(string infoTag, bool ignoreInValid = false) + protected List GetReportNotes(string infoTag, bool needInValid = false, IEnumerable dataSource = null) { - var query = DbContext.sac_report_notes.AsNoTracking().Where(O => O.InfoTag.Contains(infoTag) && O.ReportResponse); - if (!ignoreInValid) + IQueryable query; + if (dataSource == null) + { + query = DbContext.sac_report_notes.AsNoTracking(); + } + else + { + query = dataSource.AsQueryable(); + } + query = query.Where(O => O.InfoTag.Contains(infoTag) && O.ReportResponse); + if (!needInValid) { query = query.Where(O => O.IsValid); } return query.OrderByDescending(O => O.OptTime).ToList(); } - protected List GetReportNotes(SuperviseReportTypeEnum reportType, string infoTag, bool ignoreInValid = false) + protected List GetReportNotes(SuperviseReportTypeEnum reportType, string infoTag, bool needInValid = false, IEnumerable dataSource = null) { - return GetReportNotes(infoTag, ignoreInValid).Where(O => O.ReportType == reportType).ToList(); + return GetReportNotes(infoTag, needInValid, dataSource).Where(O => O.ReportType == reportType).ToList(); } /// @@ -304,8 +326,45 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return transactionConfirmationNumber; } + /// + /// 检查生成内容是否合规 + /// + /// + /// + /// protected abstract List CheckBodyValue(BodyModel model, out bool checkStatus); + /// + /// 修改InfoTag中的编号 + /// + /// 原始InfoTag + /// 要修改的编号 + /// + /// 修改后的InfoTag + /// + protected abstract string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode); + + /// + /// 修改InfoTag中的编号 + /// + /// 原始InfoTag + /// 要修改的编号 + /// + /// 修改后的InfoTag + public string ChangeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + if (string.IsNullOrEmpty(infoTag)) + { + throw new ArgumentException($"“{nameof(infoTag)}”不能为 null 或空。", nameof(infoTag)); + } + + if (string.IsNullOrEmpty(newCode)) + { + throw new ArgumentException($"“{nameof(newCode)}”不能为 null 或空。", nameof(newCode)); + } + return _changeCodeOfInfoTag(infoTag, newCode, out originalCode); + } + /// /// 全部报表生成成功后执行 /// @@ -372,6 +431,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service case SuperviseReportTypeEnum.SAC_ConfirmationAtt: service = new ReportSwapConfirmationAttService(optUser); break; + case SuperviseReportTypeEnum.SAC_OptionConfirmationAtt: + service = new ReportOptionConfirmationAttService(optUser); + break; + case SuperviseReportTypeEnum.SAC_ValuationInformation: + service = new ReportValuationInformationService(optUser); + break; default: throw new ServiceException("报表未实现"); } @@ -384,31 +449,48 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { return ""; } - string directory = $"/App_Docs/Download/Report/"; - string absDirectory = OtcAppContext.MapPath(directory); + var directory = $"/App_Docs/Download/Report/"; + var absDirectory = OtcAppContext.MapPath(directory); checkDirectory(absDirectory); - string tempFile = Path.Combine(absDirectory, "Temp", res.FileTag); + var tempFile = Path.Combine(absDirectory, "Temp", res.FileTag); checkDirectory(tempFile, true); - string attachmentPath = Path.Combine(tempFile, "ATTACHMENT"); + var attachmentPath = Path.Combine(tempFile, "ATTACHMENT"); checkDirectory(attachmentPath); foreach (var item in res.Infos) { File.WriteAllText(Path.Combine(tempFile, item.FileTag + ".xml"), item.XmlStr); - for (int i = 0; i < item.Annex.Count; i++) + for (var i = 0; i < item.Annex.Count; i++) { if (string.IsNullOrWhiteSpace(item.Annex[i])) { continue; } - string annexPath = item.Annex[i]; + var annexPath = item.Annex[i]; + LogFactory.GetLogger().Info($"附件路径:{annexPath}"); if (annexPath.StartsWith("\\") || annexPath.StartsWith("/") || !Path.IsPathRooted(annexPath)) { annexPath = OtcAppContext.MapPath(item.Annex[i]); + if (!OperatingSystem.IsWindows()) + { + //修复linux环境下绝对路径MapPath处理结果会增加系统根目录的问题; + if (!File.Exists(annexPath)) + { + annexPath = item.Annex[i]; + } + } + LogFactory.GetLogger().Info($"附件物理路径:{annexPath}"); } - string annexFileName = Path.GetFileName(annexPath); + var annexFileName = Path.GetFileName(annexPath); try { - File.Copy(annexPath, Path.Combine(attachmentPath, annexFileName)); + var destFileName = Path.Combine(attachmentPath, annexFileName); + //国元固收从金仕达获取的交易确认书附件会有多笔交易指向同一附件的情况,做特殊处理. + if (PS.Config.Company == Configuration.CompanyEnum.国元固收 && File.Exists(destFileName)) + { + continue; + } + LogFactory.GetLogger().Info($"附件目标路径:{destFileName}"); + File.Copy(annexPath, destFileName); } catch (Exception ex) { @@ -418,7 +500,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } var zipFile = res.FileTag + ".zip"; - string outFile = Path.Combine(OtcAppContext.MapPath(directory), zipFile); + var outFile = Path.Combine(OtcAppContext.MapPath(directory), zipFile); ZipHelper.ZipDirectory(tempFile, outFile); return Path.Combine(directory, zipFile); } @@ -431,14 +513,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private static SacInfo ValidationXSD(string xmlStr, string xsdPath) { SacInfo result = null; - List listRoot = new List(); - XmlSchemaSet schema = new XmlSchemaSet(); + var listRoot = new List(); + var schema = new XmlSchemaSet(); schema.Add("", xsdPath); - XmlReader reader = XmlReader.Create(new StringReader(xmlStr)); - XDocument doc = XDocument.Load(reader); + var reader = XmlReader.Create(new StringReader(xmlStr)); + var doc = XDocument.Load(reader); doc.Validate(schema, (obj, e) => { - string msg = Regex.Replace(e.Message, @"元素[^,]+,", ""); + var msg = Regex.Replace(e.Message, @"元素[^,]+,", ""); msg = Regex.Replace(msg, @"\s-\s[\D]+约束失败。", "").Replace("“", "").Replace("”", ""); var name = ""; try @@ -451,8 +533,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listRoot.Count > 0) { - result = new SacInfo("Body"); - result.SubMaps = new List(listRoot); + result = new SacInfo("Body") + { + SubMaps = new List(listRoot) + }; } return result; } @@ -478,10 +562,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// protected string GetSACUndrlygAssetDtldTypeMap(ExpandoDictionary undrlygAssetDtldTypeMap, string underlyingInstrumentType, string commodityCode) { - string result; var desc = ConsGlobal.InstrumentType.GetDesc(underlyingInstrumentType); - if (!undrlygAssetDtldTypeMap.TryGetValue(desc, out result)) + if (!undrlygAssetDtldTypeMap.TryGetValue(desc, out var result)) { switch (desc) { @@ -523,7 +606,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// protected string GetDataSetValue(DataTable dt, int rowIndex, int colIndex) { - string result = ""; + var result = ""; if (dt != null) { if (dt.Rows.Count <= rowIndex @@ -543,18 +626,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// /// /// - protected string GetDataSetValue(DataTable dt, int rowIndex, string colName) + protected string GetDataSetValue(DataRow row, string colName) { - string result = ""; - if (dt != null) + var result = ""; + try { - if (!dt.Columns.Contains(colName)) - { - LogFactory.GetLogger("GetDataSetValue").Info($"{dt.TableName} 不存在[{colName}]列数据"); - //throw new ServiceException($"{dt.TableName} 不存在[{colName}]列数据"); - return ""; - } - result = dt.Rows[rowIndex][colName].ToString().Trim(); + result = row[colName].ToString().Trim(); + } + catch (Exception) + { + LogFactory.GetLogger("GetDataSetValue").Info($"{row.Table.TableName} 不存在[{colName}]列数据"); + result = ""; } return result; } @@ -566,17 +648,34 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// /// /// - protected double GetDataSetValueToDouble(DataTable dt, int rowIndex, string colName) + protected double GetDataSetValueToDouble(DataRow row, string colName) { - double result = 0; - var str = GetDataSetValue(dt, rowIndex, colName); - if (str == null || !double.TryParse(str, out result)) + var str = GetDataSetValue(row, colName); + if (str == null || !double.TryParse(str, out var result)) { result = 0; } return result; } + + /// + /// 从_excelDataSource中获取汇总信息 + /// + /// + /// + /// + /// + protected double? GetDataSetValueToDoubleOrNull(DataTable dt, int rowIndex, int colIndex) + { + var str = GetDataSetValue(dt, rowIndex, colIndex); + if (str == null || !double.TryParse(str, out var result)) + { + return null; + } + return result; + } + /// /// 从_excelDataSource中获取指定信息 /// @@ -586,9 +685,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// protected double GetDataSetValueToDouble(DataTable dt, int rowIndex, int colIndex) { - double result = 0; var str = GetDataSetValue(dt, rowIndex, colIndex); - if (str == null || !double.TryParse(str, out result)) + if (str == null || !double.TryParse(str, out var result)) { result = 0; } @@ -597,8 +695,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected void loadExcelDataSource() { - if (((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template || - BusiDataType == DataFlagsEnum.A1011 || + if ((_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template) || + //BusiDataType == DataFlagsEnum.A1011 || BusiDataType == DataFlagsEnum.A1012 || BusiDataType == DataFlagsEnum.A1013) && !string.IsNullOrWhiteSpace(_excelDataSourcePath)) @@ -609,12 +707,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return; } _excelDataSourceRootPath = $"{Path.GetDirectoryName(rootPath)}\\{Path.GetFileNameWithoutExtension(rootPath)}\\"; - string path = $"{_excelDataSourceRootPath}{_excelDataSourcePath}"; + var path = $"{_excelDataSourceRootPath}{_excelDataSourcePath}"; LogFactory.GetLogger("loadExcelDataSource").Info($"查找数据源目录:{path}"); path = OtcAppContext.MapPath(path); if (System.IO.Directory.Exists(path)) { - string filePath = System.IO.Directory.GetFiles(path, _excelDataSourceFileName).FirstOrDefault(); + var filePath = System.IO.Directory.GetFiles(path, _excelDataSourceFileName).FirstOrDefault(); LogFactory.GetLogger("loadExcelDataSource").Info($"查找数据源文件:{filePath}"); if (!string.IsNullOrWhiteSpace(filePath)) { @@ -702,23 +800,34 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string GetDataReaderValue(OracleDataReader dr, string fieldName) { - string result = ""; - if (dr == null) return result; + var result = ""; + if (dr == null) + { + return result; + } + result = dr[fieldName] == DBNull.Value ? "" : dr[fieldName].ToString(); return result; } - private void SetOneColumnData(OracleDataReader dr, DataRow row, string fieldName) + private string SetOneColumnData(OracleDataReader dr, DataRow row, string fieldName) { - SetOneColumnData(dr, row, fieldName, ""); + return SetOneColumnData(dr, row, fieldName, ""); } - private void SetOneColumnData(OracleDataReader dr, DataRow row, string fieldName, string toFileName = "") + private string SetOneColumnData(OracleDataReader dr, DataRow row, string fieldName, string toFileName = "") + { + var value = GetDataReaderValue(dr, fieldName); + return SetOneColumnData(value, row, fieldName, toFileName); + } + + private string SetOneColumnData(string value, DataRow row, string fieldName, string toFileName = "") { if (string.IsNullOrEmpty(toFileName)) - row[fieldName] = GetDataReaderValue(dr, fieldName); + row[fieldName] = value; else - row[toFileName] = GetDataReaderValue(dr, fieldName); + row[toFileName] = value; + return value; } #region 交易确认书视图数据读取 @@ -733,10 +842,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service try { LogFactory.GetLogger("GetSwapConfirm").Info("进入GetSwapConfirm"); - string schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; + var schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; var dtSwapConfirm = CreateSwapConfirmDataTable(); - var dtSwapCollateral = CreateSwapCollateralDataTable(); - var dtPaymentMethod = CreatePaymentMethodDataTable(); LogFactory.GetLogger("GetSwapConfirm").Info("创建完3个DataTable结构"); var sqlStr = new StringBuilder(); @@ -756,13 +863,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } CreateSwapConfirmNewRow(dtSwapConfirm, dr); }); + if (dtSwapConfirm.Rows.Count > 0) + { + sqlStr.Clear(); + sqlStr.Append("SELECT collateral.*"); + sqlStr.Append($"FROM {schema}v_swap_collateral_A1005 collateral "); + sqlStr.Append($"WHERE collateral.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); - sqlStr.Clear(); - sqlStr.Append("SELECT collateral.*"); - sqlStr.Append($"FROM {schema}v_swap_collateral_A1005 collateral "); - sqlStr.Append($"WHERE collateral.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); + var dtSwapCollateral = CreateSwapCollateralDataTable(); + var dict = new Dictionary>(); - db.ExecuteSql(sqlStr.ToString(), dr => + db.ExecuteSql(sqlStr.ToString(), dr => { try { @@ -772,15 +883,19 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { LogFactory.GetLogger("GetSwapConfirm ExecuteSql CreateSwapPerformanceGuaranteeAttNewRow").Error(ex); } - CreateSwapCollateralNewRow(dtSwapCollateral, dr); + CreateSwapCollateralNewRow(dtSwapCollateral, dr, dict, setIndexDict); }); + dtSwapCollateral.ExtendedProperties["Index"] = dict; - sqlStr.Clear(); - sqlStr.Append("SELECT feepayment.*"); - sqlStr.Append($"FROM {schema}v_swap_fee_payment_A1005 feepayment "); - sqlStr.Append($"WHERE feepayment.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); + dict = new Dictionary>(); + sqlStr.Clear(); + sqlStr.Append("SELECT feepayment.*"); + sqlStr.Append($"FROM {schema}v_swap_fee_payment_A1005 feepayment "); + sqlStr.Append($"WHERE feepayment.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); - db.ExecuteSql(sqlStr.ToString(), dr => + var dtPaymentMethod = CreatePaymentMethodDataTable(); + + db.ExecuteSql(sqlStr.ToString(), dr => { try { @@ -790,14 +905,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { LogFactory.GetLogger("GetSwapConfirm ExecuteSql CreatePaymentMethodNewRow").Error(ex); } - CreatePaymentMethodNewRow(dtPaymentMethod, dr); + CreatePaymentMethodNewRow(dtPaymentMethod, dr, dict, setIndexDict); }); - LogFactory.GetLogger("GetSwapConfirm").Info("dtSwapConfirm Data:" + dtSwapConfirm.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapConfirm); - LogFactory.GetLogger("GetSwapConfirm").Info("CreateSwapCollateralNewRow Data:" + dtSwapCollateral.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapCollateral); - LogFactory.GetLogger("GetSwapConfirm").Info("dtPaymentMethod Data:" + dtPaymentMethod.ToStringContent()); - _viewDataSource.Tables.Add(dtPaymentMethod); + dtPaymentMethod.ExtendedProperties["Index"] = dict; + + _viewDataSource.Tables.Add(dtSwapConfirm); + _viewDataSource.Tables.Add(dtSwapCollateral); + _viewDataSource.Tables.Add(dtPaymentMethod); + LogFactory.GetLogger("GetSwapConfirm ExecuteSql dtSwapConfirm").Info($"dtSwapConfirm:{dtSwapConfirm.Rows.Count}"); + LogFactory.GetLogger("GetSwapConfirm ExecuteSql dtSwapCollateral").Info($"dtSwapCollateral:{dtSwapCollateral.Rows.Count}"); + LogFactory.GetLogger("GetSwapConfirm ExecuteSql dtPaymentMethod").Info($"dtPaymentMethod:{dtPaymentMethod.Rows.Count}"); + } LogFactory.GetLogger("GetSwapConfirm").Info("成功执行完离开GetSwapConfirm"); } catch (Exception ex) @@ -806,10 +924,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } - private void CreatePaymentMethodNewRow(DataTable dtPaymentMethod, OracleDataReader dr) + /// + /// 增加确认书-费用端支付记录 + /// + /// + /// + /// + /// + private void CreatePaymentMethodNewRow( + DataTable dtPaymentMethod, + OracleDataReader dr, + Dictionary> indexDict, + Action>, DataRow, string> action) { var newRow = dtPaymentMethod.NewRow(); - SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); + var no = SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); SetOneColumnData(dr, newRow, "PAYMENTMETHOD"); SetOneColumnData(dr, newRow, "PAYER"); SetOneColumnData(dr, newRow, "PAYMENTFREQ"); @@ -820,25 +949,51 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service SetOneColumnData(dr, newRow, "BLANK1", "BLANK1"); SetOneColumnData(dr, newRow, "BLANK2", "BLANK2"); dtPaymentMethod.Rows.Add(newRow); + action(indexDict, newRow, no); } - private void CreateSwapCollateralNewRow(DataTable dtSwapPerformanceGuaranteeAtt, OracleDataReader dr) + /// + /// 增加确认书-履约担保品记录 + /// + /// + /// + /// + /// + private void CreateSwapCollateralNewRow( + DataTable dtSwapPerformanceGuaranteeAtt, + OracleDataReader dr, + Dictionary> indexDict, + Action>, DataRow, string> action) { var newRow = dtSwapPerformanceGuaranteeAtt.NewRow(); - SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); + var no = SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); SetOneColumnData(dr, newRow, "PERFORMANCECOLLTYPE"); SetOneColumnData(dr, newRow, "PERFORMANCECOLLRANGE"); SetOneColumnData(dr, newRow, "MULTICONFIRMATIONID"); SetOneColumnData(dr, newRow, "REMARKS", "REMARKS"); dtSwapPerformanceGuaranteeAtt.Rows.Add(newRow); + action(indexDict, newRow, no); } + private static void setIndexDict(Dictionary> indexDict, DataRow row, string no) + { + if (!indexDict.ContainsKey(no)) + { + indexDict[no] = new List(); + } + indexDict[no].Add(row); + } + + /// + /// 增加确认书记录 + /// + /// + /// private void CreateSwapConfirmNewRow(DataTable dtSwapConfirm, OracleDataReader dr) { - LogFactory.GetLogger("CreateSwapConfirmNewRow").Info("进入CreateSwapConfirmNewRow"); var confirmationNo = GetDataReaderValue(dr, "CONFIRMATIONNO"); - var rows = dtSwapConfirm.Select("CONFIRMATIONNO='" + confirmationNo + "'"); - if (rows != null && rows.Count() > 0) return;//存在了就不用再加了 + var row = dtSwapConfirm.Rows.Find(confirmationNo); + if (row != null) return;//存在了就不用再加了 var newRow = dtSwapConfirm.NewRow(); @@ -889,12 +1044,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapConfirm.Rows.Add(newRow); LogFactory.GetLogger("CreateSwapConfirmNewRow").Info("退出CreateSwapConfirmNewRow"); } + + /// + /// 创建确认书表格 + /// + /// private DataTable CreateSwapConfirmDataTable() { var dtSwapConfirm = new DataTable("交易确认书"); dtSwapConfirm.Columns.Add("MASTERAGRMTNO"); dtSwapConfirm.Columns.Add("SUPAGRMNO"); - dtSwapConfirm.Columns.Add("CONFIRMATIONNO"); + var primaryKey = dtSwapConfirm.Columns.Add("CONFIRMATIONNO"); dtSwapConfirm.Columns.Add("FILLPARTY"); dtSwapConfirm.Columns.Add("SWAPTYPE"); dtSwapConfirm.Columns.Add("STARTDATE"); @@ -931,9 +1091,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapConfirm.Columns.Add("BLANK2"); dtSwapConfirm.Columns.Add("SUBMIT_STATUS"); dtSwapConfirm.Columns.Add("OPERATIONTYPE"); + + dtSwapConfirm.PrimaryKey = new DataColumn[] { primaryKey }; return dtSwapConfirm; } + /// + /// 创建确认书-履约担保品表格 + /// + /// private DataTable CreateSwapCollateralDataTable() { var dtSwapPerformanceGuaranteeAtt = new DataTable("履约担保品"); @@ -942,9 +1108,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapPerformanceGuaranteeAtt.Columns.Add("PERFORMANCECOLLRANGE"); dtSwapPerformanceGuaranteeAtt.Columns.Add("MULTICONFIRMATIONID"); dtSwapPerformanceGuaranteeAtt.Columns.Add("REMARKS"); + return dtSwapPerformanceGuaranteeAtt; } + /// + /// 创建确认书-费用端支付表格 + /// + /// private DataTable CreatePaymentMethodDataTable() { var dtPaymentMethod = new DataTable("费用端支付"); @@ -958,6 +1129,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtPaymentMethod.Columns.Add("BASEPOINT"); dtPaymentMethod.Columns.Add("BLANK1"); dtPaymentMethod.Columns.Add("BLANK2"); + return dtPaymentMethod; } @@ -975,11 +1147,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { try { - string schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; + var schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; LogFactory.GetLogger("GetSwapLifeCycle").Info("进入GetSwapLifeCycle"); var dtSwapLifeCycle = CreateSwapLifeCycleDataTable(); - var dtSwapLifeCyclePosDt = CreateSwapLifeCyclePosDtDataTable(); - LogFactory.GetLogger("GetSwapLifeCycle").Info("创建完2个DataTable结构"); var sqlStr = new StringBuilder(); sqlStr.Append("SELECT lifecycle.* "); sqlStr.Append($" FROM {schema}v_swap_lifecycle_A1006 lifecycle "); @@ -1001,29 +1171,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service CreateSwapLifeCycleNewRow(dtSwapLifeCycle, dr); }); - sqlStr.Clear(); - sqlStr.Append("SELECT posdt.* "); - sqlStr.Append($" FROM {schema}v_swap_lifecycle_pos_dt_A1006 posdt "); - sqlStr.Append($"WHERE posdt.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); - - LogFactory.GetLogger("GetSwapLifeCycle").Info($"sqlStr:{sqlStr}"); - - db.ExecuteSql(sqlStr.ToString(), dr => + if (dtSwapLifeCycle.Rows.Count > 0) { - try + sqlStr.Clear(); + sqlStr.Append("SELECT posdt.* "); + sqlStr.Append($" FROM {schema}v_swap_lifecycle_pos_dt_A1006 posdt "); + sqlStr.Append($"WHERE posdt.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'"); + + LogFactory.GetLogger("dtSwapLifeCyclePosDt").Info($"sqlStr:{sqlStr}"); + + var dtSwapLifeCyclePosDt = CreateSwapLifeCyclePosDtDataTable(); + var dict = new Dictionary>(); + + db.ExecuteSql(sqlStr.ToString(), dr => { - LogFactory.GetLogger("GetSwapLifeCycle ExecuteSql").Info("RowData:" + dr.ToStringContent()); - } - catch (Exception ex) - { - LogFactory.GetLogger("GetSwapLifeCycle ExecuteSql").Error(ex); - } - CreateSwapLifeCyclePosDtNewRow(dtSwapLifeCyclePosDt, dr); - }); - LogFactory.GetLogger("GetSwapLifeCycle").Info("dtSwapLifeCycle Data:" + dtSwapLifeCycle.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapLifeCycle); - LogFactory.GetLogger("GetSwapLifeCycle").Info("dtSwapLifeCyclePosDt Data:" + dtSwapLifeCyclePosDt.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapLifeCyclePosDt); + try + { + LogFactory.GetLogger("dtSwapLifeCyclePosDt ExecuteSql").Info("RowData:" + dr.ToStringContent()); + } + catch (Exception ex) + { + LogFactory.GetLogger("dtSwapLifeCyclePosDt ExecuteSql").Error(ex); + } + CreateSwapLifeCyclePosDtNewRow(dtSwapLifeCyclePosDt, dr, dict, setIndexDict); + }); + dtSwapLifeCyclePosDt.ExtendedProperties["Index"] = dict; + + _viewDataSource.Tables.Add(dtSwapLifeCycle); + _viewDataSource.Tables.Add(dtSwapLifeCyclePosDt); + LogFactory.GetLogger("dtSwapLifeCycle ExecuteSql dtSwapLifeCycle").Info($"dtSwapLifeCycle:{dtSwapLifeCycle.Rows.Count}"); + LogFactory.GetLogger("dtSwapLifeCycle ExecuteSql dtSwapLifeCyclePosDt").Info($"dtSwapLifeCyclePosDt:{dtSwapLifeCyclePosDt.Rows.Count}"); + LogFactory.GetLogger("dtSwapLifeCycle Index dtSwapLifeCyclePosDt").Info($"Index:{dict.Count}"); + } } catch (Exception ex) { @@ -1031,17 +1210,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } + /// + /// 增加存续期管理记录 + /// + /// + /// private void CreateSwapLifeCycleNewRow(DataTable dtSwapLifeCycle, OracleDataReader dr) { var confirmationNo = GetDataReaderValue(dr, "CONFIRMATIONNO"); - var rows = dtSwapLifeCycle.Select("CONFIRMATIONNO='" + confirmationNo + "'"); - if (rows != null && rows.Count() > 0) return;//存在了就不用再加了 + var row = dtSwapLifeCycle.Rows.Find(confirmationNo); + if (row != null) return;//存在了就不用再加了 var newRow = dtSwapLifeCycle.NewRow(); SetOneColumnData(dr, newRow, "BIZID"); SetOneColumnData(dr, newRow, "GUID"); SetOneColumnData(dr, newRow, "DURATIONEVENTNO"); - SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); + SetOneColumnData(confirmationNo, newRow, "CONFIRMATIONNO"); SetOneColumnData(dr, newRow, "DURATIONOPERATIONTYPE"); SetOneColumnData(dr, newRow, "DURATIONOPERATIONDATE"); SetOneColumnData(dr, newRow, "RENEWALDATE"); @@ -1061,11 +1245,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapLifeCycle.Rows.Add(newRow); } - private void CreateSwapLifeCyclePosDtNewRow(DataTable dtSwapLifeCyclePosDt, OracleDataReader dr) + /// + /// 增加持仓明细记录 + /// + /// + /// + /// + /// + private void CreateSwapLifeCyclePosDtNewRow( + DataTable dtSwapLifeCyclePosDt, + OracleDataReader dr, + Dictionary> indexDict, + Action>, DataRow, string> action) { var newRow = dtSwapLifeCyclePosDt.NewRow(); SetOneColumnData(dr, newRow, "GUID", "GUID"); - SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); + var no = SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); SetOneColumnData(dr, newRow, "BUSIDATE"); //SetOneColumnData(dr, newRow, "DURATIONOPERATIONTYPE"); SetOneColumnData(dr, newRow, "UNDRLYGASSETCODE"); @@ -1080,17 +1275,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service SetOneColumnData(dr, newRow, "BLANK1", "BLANK1"); SetOneColumnData(dr, newRow, "BLANK2", "BLANK2"); SetOneColumnData(dr, newRow, "DURATIONEVENTNO", "DURATIONEVENTNO"); + action(indexDict, newRow, no); dtSwapLifeCyclePosDt.Rows.Add(newRow); } + /// + /// 创建存续期管理表格 + /// + /// private DataTable CreateSwapLifeCycleDataTable() { var dtSwapLifeCycle = new DataTable("互换交易存续期管理"); dtSwapLifeCycle.Columns.Add("BIZID"); dtSwapLifeCycle.Columns.Add("GUID"); dtSwapLifeCycle.Columns.Add("DURATIONEVENTNO"); - dtSwapLifeCycle.Columns.Add("CONFIRMATIONNO"); + var primaryKey = dtSwapLifeCycle.Columns.Add("CONFIRMATIONNO"); dtSwapLifeCycle.Columns.Add("DURATIONOPERATIONTYPE"); dtSwapLifeCycle.Columns.Add("DURATIONOPERATIONDATE"); dtSwapLifeCycle.Columns.Add("RENEWALDATE"); @@ -1107,9 +1307,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapLifeCycle.Columns.Add("SUBMIT_STATUS"); dtSwapLifeCycle.Columns.Add("OPERATIONTYPE"); dtSwapLifeCycle.Columns.Add("BUSIDATE"); + + dtSwapLifeCycle.PrimaryKey = new DataColumn[] { primaryKey }; + return dtSwapLifeCycle; } + /// + /// 创建存续期管理-合约持仓明细表格 + /// + /// private DataTable CreateSwapLifeCyclePosDtDataTable() { var dtSwapLifeCyclePosDt = new DataTable("合约持仓明细"); @@ -1146,11 +1353,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { try { - string schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; + var schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; LogFactory.GetLogger("GetSwapequityPayment").Info("进入GetSwapequityPayment"); var dtSwapEquityPayment = CreateSwapEquityPaymentDataTable(); - var dtSwapEquityPaymentTP = CreateSwapEquityPaymentTPDataTable(); - LogFactory.GetLogger("GetSwapequityPayment").Info("创建完2个DataTable结构"); var sqlStr = new StringBuilder(); sqlStr.Append("SELECT quitypayment.* "); sqlStr.Append($"FROM {schema}v_swap_equity_payment_A1016 quitypayment "); @@ -1173,30 +1378,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service CreateSwapEquityPaymentNewRow(dtSwapEquityPayment, dr); }); - sqlStr.Clear(); - sqlStr.Append("SELECT equityaymenttp.* "); - sqlStr.Append($"FROM {schema}v_swap_equity_payment_tp_A1016 equityaymenttp "); - sqlStr.Append($"WHERE equityaymenttp.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'");//一对多分组 - - LogFactory.GetLogger("GetSwapequityPayment").Info($"sqlStr:{sqlStr}"); - - db.ExecuteSql(sqlStr.ToString(), dr => + if (dtSwapEquityPayment.Rows.Count > 0) { - try - { - LogFactory.GetLogger("GetSwapequityPayment ExecuteSql").Info("RowData:" + dr.ToStringContent()); - } - catch (Exception ex) - { - LogFactory.GetLogger("GetSwapequityPayment ExecuteSql").Error(ex); - } + sqlStr.Clear(); + sqlStr.Append("SELECT equityaymenttp.* "); + sqlStr.Append($"FROM {schema}v_swap_equity_payment_tp_A1016 equityaymenttp "); + sqlStr.Append($"WHERE equityaymenttp.BUSIDATE='{reportDate.ToString("yyyy-MM-dd")}'");//一对多分组 - CreateSwapEquityPaymentPtNewRow(dtSwapEquityPaymentTP, dr); - }); - LogFactory.GetLogger("GetSwapequityPayment").Info("dtSwapEquityPayment Data:" + dtSwapEquityPayment.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapEquityPayment); - LogFactory.GetLogger("GetSwapequityPayment").Info("dtSwapEquityPaymentTP Data:" + dtSwapEquityPaymentTP.ToStringContent()); - _viewDataSource.Tables.Add(dtSwapEquityPaymentTP); + LogFactory.GetLogger("dtSwapEquityPaymentTP").Info($"sqlStr:{sqlStr}"); + + var dtSwapEquityPaymentTP = CreateSwapEquityPaymentTPDataTable(); + var dict = new Dictionary>(); + + db.ExecuteSql(sqlStr.ToString(), dr => + { + try + { + LogFactory.GetLogger("dtSwapEquityPaymentTP ExecuteSql").Info("RowData:" + dr.ToStringContent()); + } + catch (Exception ex) + { + LogFactory.GetLogger("dtSwapEquityPaymentTP ExecuteSql").Error(ex); + } + + CreateSwapEquityPaymentPtNewRow(dtSwapEquityPaymentTP, dr, dict, setIndexDict); + }); + dtSwapEquityPaymentTP.ExtendedProperties["Index"] = dict; + + _viewDataSource.Tables.Add(dtSwapEquityPayment); + _viewDataSource.Tables.Add(dtSwapEquityPaymentTP); + LogFactory.GetLogger("dtSwapEquityPayment ExecuteSql dtSwapEquityPayment").Info($"dtSwapLifeCycle:{dtSwapEquityPayment.Rows.Count}"); + LogFactory.GetLogger("dtSwapEquityPayment ExecuteSql dtSwapEquityPaymentTP").Info($"dtSwapLifeCyclePosDt:{dtSwapEquityPaymentTP.Rows.Count}"); + LogFactory.GetLogger("dtSwapEquityPayment Index dtSwapEquityPayment").Info($"Index:{dict.Count}"); + } } catch (Exception ex) { @@ -1204,10 +1418,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } - private void CreateSwapEquityPaymentPtNewRow(DataTable dtSwapEquityPaymentPt, OracleDataReader dr) + /// + /// 增加权益端支付明细记录 + /// + /// + /// + /// + /// + private void CreateSwapEquityPaymentPtNewRow( + DataTable dtSwapEquityPaymentPt, + OracleDataReader dr, + Dictionary> indexDict, + Action>, DataRow, string> action) { var newRow = dtSwapEquityPaymentPt.NewRow(); - SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); + var no = SetOneColumnData(dr, newRow, "CONFIRMATIONNO"); SetOneColumnData(dr, newRow, "BUSIDATE"); SetOneColumnData(dr, newRow, "PAYMENTMETHOD"); SetOneColumnData(dr, newRow, "PAYER"); @@ -1228,16 +1453,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service SetOneColumnData(dr, newRow, "BLANK1"); SetOneColumnData(dr, newRow, "BLANK2"); SetOneColumnData(dr, newRow, "DURATIONEVENTNO"); + action(indexDict, newRow, no); dtSwapEquityPaymentPt.Rows.Add(newRow); } + /// + /// 增加权益端支付记录 + /// + /// + /// private void CreateSwapEquityPaymentNewRow(DataTable dtSwapEquityPayment, OracleDataReader dr) { var confirmationNo = GetDataReaderValue(dr, "CONFIRMATIONNO"); - var rows = dtSwapEquityPayment.Select("CONFIRMATIONNO='" + confirmationNo + "'"); - if (rows != null && rows.Count() > 0) return;//存在了就不用再加了 + var row = dtSwapEquityPayment.Rows.Find(confirmationNo); + if (row != null) return;//存在了就不用再加了 var newRow = dtSwapEquityPayment.NewRow(); @@ -1253,6 +1484,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service dtSwapEquityPayment.Rows.Add(newRow); } + /// + /// 创建权益端支付明细表格 + /// + /// private DataTable CreateSwapEquityPaymentTPDataTable() { var dtSwapEquityPaymentPt = new DataTable("权益端支付"); @@ -1280,18 +1515,24 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return dtSwapEquityPaymentPt; } + /// + /// 创建权益端支付表格 + /// + /// private DataTable CreateSwapEquityPaymentDataTable() { var dtSwapEquityPayment = new DataTable("互换交易权益端支付"); dtSwapEquityPayment.Columns.Add("BIZID"); dtSwapEquityPayment.Columns.Add("BUSIDATE"); - dtSwapEquityPayment.Columns.Add("CONFIRMATIONNO"); + var primaryKey = dtSwapEquityPayment.Columns.Add("CONFIRMATIONNO"); dtSwapEquityPayment.Columns.Add("DURATIONEVENTNO"); dtSwapEquityPayment.Columns.Add("SUBMIT_STATUS"); dtSwapEquityPayment.Columns.Add("OPERATIONTYPE"); dtSwapEquityPayment.Columns.Add("BLANK1"); dtSwapEquityPayment.Columns.Add("BLANK2"); + dtSwapEquityPayment.PrimaryKey = new DataColumn[] { primaryKey }; + return dtSwapEquityPayment; } @@ -1307,7 +1548,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { try { - string schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; + var schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; LogFactory.GetLogger("GetSwapConfirmationAtt").Info("进入GetSwapConfirmationAtt"); var dtSwapConfirmationAtt = CreateSwapConfirmationAttDataTable(); LogFactory.GetLogger("GetSwapConfirmationAtt").Info("创建完1个DataTable结构"); @@ -1329,7 +1570,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } CreatConfirmationAttNewRow(dtSwapConfirmationAtt, dr); }); - LogFactory.GetLogger("GetSwapConfirmationAtt").Info("dtSwapConfirmationAtt Data:" + dtSwapConfirmationAtt.ToStringContent()); _viewDataSource.Tables.Add(dtSwapConfirmationAtt); } catch (Exception ex) @@ -1372,9 +1612,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var subSystemOutboxPath = PS.Config.ErpElement.SAC_SubSystemOutboxPath; LogFactory.GetLogger("loadSubsystemDataSource").Info($"subSystemOutboxPath:" + subSystemOutboxPath); - if (string.IsNullOrEmpty(subSystemOutboxPath) || !Directory.Exists(subSystemOutboxPath)) return list; + if (string.IsNullOrEmpty(subSystemOutboxPath) || !Directory.Exists(subSystemOutboxPath)) + { + return list; + } - LogFactory.GetLogger("loadSubsystemDataSource").Info($"开始执行1"); + LogFactory.GetLogger("loadSubsystemDataSource").Info($"目录存在:{subSystemOutboxPath}"); var dateDir = _reqInfo.ReportDate.ToString("yyyyMMdd"); @@ -1382,13 +1625,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var folder = new DirectoryInfo(subSystemOutboxPath); var files = folder.GetFiles("*.zip"); LogFactory.GetLogger("loadSubsystemDataSource").Info($"zip文件个数:" + files.Count()); - if (files == null || files.Count() == 0) return list; + if (files == null || files.Count() == 0) + { + return list; + } + foreach (var file in files) { - LogFactory.GetLogger("loadSubsystemDataSource").Info($"2:"); + LogFactory.GetLogger("loadSubsystemDataSource").Info($"准备读取{file.Name}"); //zip压缩文件名包含报送日期才需要读取解析 - if (!file.Name.Contains("_" + dateDir + "_")) continue; - LogFactory.GetLogger("loadSubsystemDataSource").Info($"3:"); + if (!file.Name.Contains("_" + dateDir + "_")) + { + continue; + } + + LogFactory.GetLogger("loadSubsystemDataSource").Info($"文件名中包含{dateDir}"); //获取文件不包含扩展名的文件名 var tag = Path.GetFileNameWithoutExtension(file.FullName); //待解压的包含路径的完整文件名 @@ -1407,7 +1658,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("loadSubsystemDataSource").Info($"解压成功:targetName:" + targetName + ",tDir:" + tDir); } - LogFactory.GetLogger("loadSubsystemDataSource").Info($"4"); //存在说明已经解压过了 //解压后文件的附件根目录 var fileAttachmentDir = Path.Combine(subSystemOutboxPath, tag, "ATTACHMENT"); @@ -1422,11 +1672,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("loadSubsystemDataSource").Info($"reportFilesCount:" + reportFiles.Count()); foreach (var reportFile in reportFiles) { - LogFactory.GetLogger("loadSubsystemDataSource").Info($"6:"); + LogFactory.GetLogger("loadSubsystemDataSource").Info($"准备解析:{reportFile.FullName}"); //读取xml文件,并反序列化成对象 var xml = File.ReadAllText(reportFile.FullName); var model = XmlHelper.Deserialize(xml); - if (model.Body == null) continue; + if (model.Body == null) + { + continue; + } //记录xml报告文件,等读取完后,需要删掉 xmlAttachmentList.Add(reportFile.FullName); @@ -1443,7 +1696,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1468,7 +1724,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1493,7 +1752,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1519,7 +1781,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1544,7 +1809,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1569,7 +1837,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1595,7 +1866,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1621,7 +1895,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1647,7 +1924,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var flist = new List(); //调用委托构造notes数据 var ret = callback(x as T, flist, tag); - if (!ret) continue; + if (!ret) + { + continue; + } //把返回的附件文件名加上完整路径添加到附件集合待后边删除 flist.ForEach(attchment => { @@ -1665,6 +1945,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service case DataFlagsEnum.A1017: foreach (var x in model.Body.ConfirmationAtt) { + if (string.IsNullOrWhiteSpace(x.ConfirmationFilesTuple.FirstOrDefault()?.ConfirmationFiles)) + { + continue; + } x.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType, true); //子系统的数据忽略字段检查 x.IgnoreCheck = true; @@ -1687,6 +1971,63 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service list.Add(x as T); }; break; + case DataFlagsEnum.A1018: + foreach (var x in model.Body.ValuationInformation) + { + x.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType, true); + //子系统的数据忽略字段检查 + x.IgnoreCheck = true; + //通过调用委托返回业务的附件文件名数据 + var flist = new List(); + //调用委托构造notes数据 + var ret = callback(x as T, flist, tag); + if (!ret) continue; + //把返回的附件文件名加上完整路径添加到附件集合待后边删除 + flist.ForEach(attchment => + { + var path = Path.Combine(fileAttachmentDir, attchment); + //把附件添加到报告附件列表,为了生成报告 + fileList.Add(path); + //把附件添加到附件列表中,以便后边删除 + xmlAttachmentList.Add(path); + }); + + //添加数据到数据集合当中 + list.Add(x as T); + }; + break; + case DataFlagsEnum.A1019: + foreach (var x in model.Body.ConfirmationAtt) + { + if (string.IsNullOrWhiteSpace(x.ConfirmationFilesTuple.FirstOrDefault()?.ConfirmationAtt)) + { + continue; + } + x.OperationType = (OptFlagsEnum)Enum.Parse(typeof(OptFlagsEnum), model.Header.OperationType, true); + //子系统的数据忽略字段检查 + x.IgnoreCheck = true; + //通过调用委托返回业务的附件文件名数据 + var flist = new List(); + //调用委托构造notes数据 + var ret = callback(x as T, flist, tag); + if (!ret) + { + continue; + } + //把返回的附件文件名加上完整路径添加到附件集合待后边删除 + flist.ForEach(attchment => + { + var path = Path.Combine(fileAttachmentDir, attchment); + //把附件添加到报告附件列表,为了生成报告 + fileList.Add(path); + //把附件添加到附件列表中,以便后边删除 + xmlAttachmentList.Add(path); + }); + + //添加数据到数据集合当中 + list.Add(x as T); + }; + break; default: break; } @@ -1700,14 +2041,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// /// /// - protected string formatExceID() + protected string formatExceID(IEnumerable dataSource = null) { var exceId = ""; + IQueryable query; + if (dataSource != null) + { + query = dataSource.AsQueryable(); + } + else + { + query = DbContext.sac_report_notes; + } do { exceId = $"{_reqInfo.SenderCode}{_reqInfo.ReceiverCode}{_reqInfo.ReportDate.ToString("yyyyMMdd")}{MaxExceIndex.ToString("00000000")}"; MaxExceIndex = MaxExceIndex + 1; - } while (DbContext.sac_report_notes.Any(O => O.ExceId == exceId)); + } while (query.Any(O => O.ExceId == exceId)); return exceId; } @@ -1778,5 +2128,67 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var path = $"{configPath}/data/{viewAttFileName}"; return path; } + + /// + /// 从DataTable中获取索引字典 + /// + /// + /// + protected Dictionary> readIndexDict(string tableName) + { + Dictionary> result = null; + if (_viewDataSource != null && _viewDataSource.Tables.Contains(tableName)) + { + DataTable dt = _viewDataSource.Tables[tableName]; + if (dt.ExtendedProperties["Index"] is Dictionary> dict) + { + result = dict; + LogFactory.GetLogger("Index").Info($"取出索引:{dict.Count}"); + } + } + + return result; + } + + protected string formatUnderlyingCode(string underlyingCode, List dictItemMap, string name, string defaultValue = "") + { + if (underlyingCode == null || underlyingCode.Contains(".")) + { + return underlyingCode; + } + if (name == null || dictItemMap == null) { return defaultValue; } + var obj = dictItemMap.FirstOrDefault(O => O.Name == name); + var suffix = (obj == null ? defaultValue : obj.ShortName); + if (suffix.IsNullOrWhiteSpace()) + { + return underlyingCode; + } + return $"{underlyingCode}.{suffix}"; + } + + /// + /// 获取普通互换客户方向多空 山证金衍 逻辑 + /// + /// + /// + /// + /// + public string GetClientSideLongShort(bool isPayFloat, string getLongShort, string payLongShort) + { + string getPayStr = isPayFloat ? ("支付" + payLongShort) : ("收取" + getLongShort); + switch (getPayStr) + { + case "收取多头": + return "空头"; + case "收取空头": + return "多头"; + case "支付多头": + return "多头"; + case "支付空头": + return "空头"; + default: + return ""; + } + } } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportEventReportService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportEventReportService.cs index d48f7010..d5982fd2 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportEventReportService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportEventReportService.cs @@ -15,25 +15,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1009; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_EventReport; - List noteList = new List(); + + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -63,7 +61,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service errMsg = "重大事件报告非新增报送时,对应的业务编码不应为空"; return false; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(req.EventReportDate?.ToString("yyyy-MM-dd"))).Where(O => O.ReportDate == req.EventReportDate).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(req.EventReportDate?.ToString("yyyy-MM-dd"))).Where(O => O.ReportDate == req.EventReportDate).FirstOrDefault(); if (note == null) { errMsg = $"{req.EventReportDate?.ToString("yyyy-MM-dd")}不存在报送成功的重大事项报告记录,请重新选择"; @@ -72,7 +70,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (req.EventReportStatus == OptFlagsEnum.U) { var fileIds = tempFilesService.QueryTempFile(req.ReportDate, "重大事项报告").Select(O => O.id.ToString()).ToArray(); - string[] fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (!fileIds.Except(fileIdArr).Any()) { errMsg = $"{req.ReportDate.ToString("yyyy-MM-dd")}已上传重大事项报告附件都已报送成功,不需要再次报送"; @@ -103,9 +101,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList = new List(); noData = false; var noteKey = formatInfoTag(_reqInfo.ReportDate.ToString("yyyy-MM-dd")); - BodyModel model = new BodyModel(); - model.EventReport = new EventReportModel(); - SACReportNotes note = base.GetReportNotes(ReportType, noteKey).FirstOrDefault(); + var model = new BodyModel + { + EventReport = new EventReportModel() + }; + var note = base.GetReportNotes(ReportType, noteKey).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -161,8 +161,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { ReportStatus.AddCacheInfo(noteKey, item.fileName); } - var info = new EventReportDetailModel(); - info.EventReport = item.fileName; + var info = new EventReportDetailModel + { + EventReport = item.fileName + }; if (model.EventReport.EventReportTuple == null) { model.EventReport.EventReportTuple = new List(); @@ -173,7 +175,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } model.EventReport.DetailedDescription = _reqInfo.EventReportDesc; } - noData = (!(model.EventReport.EventReportTuple?.Count > 0)); + noData = !(model.EventReport.EventReportTuple?.Count > 0); if (!noData) { note.id = 0; @@ -197,19 +199,19 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model.EventReport != null) { - List listRoot = new List(); - CheckHelper helper = new CheckHelper(); - CheckHelper attHelper = new CheckHelper(); + var listRoot = new List(); + var helper = new CheckHelper(); + var attHelper = new CheckHelper(); helper.ExecuteCheck(model.EventReport, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.EventReport.EventReportTuple != null) { - for (int i = 0; i < model.EventReport.EventReportTuple.Count; i++) + for (var i = 0; i < model.EventReport.EventReportTuple.Count; i++) { var listItem = new List(); var item = model.EventReport.EventReportTuple[i]; @@ -219,16 +221,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("EventReportTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("EventReportTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("EventReport"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("EventReport") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -238,7 +244,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(string tag, bool suffixType = false) { - string result = $"{BusiDataType}_{tag}_"; + var result = $"{BusiDataType}_{tag}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -246,10 +252,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtProductService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtProductService.cs index 76192987..70dd9bac 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtProductService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtProductService.cs @@ -23,168 +23,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1002; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_MasterAgrmtProduct; - List noteList = new List(); + + readonly List noteList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { - dataList = GetMasterAgrmtProductModel(ref fileList); - } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - using (var baseDb = DbContextFactory.GetClientDbContext(null)) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var fileObjList = (from c in baseDb.client - join cf in baseDb.client_file - on c.id equals cf.ClientId - where c.ProcessStatus == "已开户" && cf.HasSent == false && cf.IsValid && - cf.FileTypeName == ConsGlobal.ClientFileType.AllographProduct && cf.OptState == _operationType && - ((c.ProcessOptDate >= _reqInfo.ReportDate && c.ProcessOptDate < nextDate && cf.OptDate < nextDate) ||//如果这一天开户,则把这一天之前(含这一天)的所有文件都报送了 - (cf.OptDate >= _reqInfo.ReportDate && cf.OptDate < nextDate && c.ProcessOptDate < _reqInfo.ReportDate))//如果这一天不是开户日期,则只在报送日期大于开户日期时,报送当日修改的文件 - && cf.ApprovalOrder < 1 - select new - { - cf.id, - cf.ClientId, - cf.OptState, - cf.ProtocolNumber, - cf.MainProtocolNumber, - cf.SignDate, - cf.FilePath, - cf.FileName, - c.Name, - c.ClientType, - c.Number, - c.ParentId, - }).ToArray(); - var clientIds = fileObjList.Select(O => O.ClientId); - var ct = baseDb.contactype.Where(O => O.ContactType == "产品投资经理").FirstOrDefault(); - ExpandoDictionary clientdutyDict = null; - if (ct != null) - { - clientdutyDict = new ExpandoDictionary( - (from cd in baseDb.clientduty.Where(t => t.ApprovalOrder < 1) - where clientIds.Contains(cd.ClientId ?? 0) && (cd.DeadLine == null || cd.DeadLine >= _reqInfo.ReportDate) - select cd) - .ToList() - .Where(O => O.ContactTypeIdsInt.Contains(ct.id)).GroupBy(O => O.ClientId ?? 0) - .ToDictionary(K => K.Key, V => V.FirstOrDefault())); - } - var cacheKey = $"{BusiDataType}"; - var service = new ClientQueryService(UserInfo); - foreach (var item in fileObjList) - { - if (item.ClientType != "产品") { continue; } - var info = new MasterAgrmtProductModel(); - info.ClientType = item.ClientType; - info.MasterAgrmtNo = item.MainProtocolNumber; - info.OperationType = item.OptState; - info.ProductName = service.GetProductName(item.ClientId); - if (string.IsNullOrWhiteSpace(info.ProductName)) - { - info.ProductName = item.Name; - } - info.CounterpartyCodeProducts = item.Number; - info.ManagerName = clientdutyDict == null ? null : clientdutyDict[item.ClientId]?.ContactName; - info.InvestmentManagerContactNumber = clientdutyDict == null ? null : clientdutyDict[item.ClientId]?.PhoneNumber; - info.TrusteeAgency = service.GetTrusteeAgency(item.ClientId);// ?? DataCacheProvider.GetClientDataSource().GetData(item.ParentId)?.Name; - info.TheDateTable = item.SignDate?.ToString("yyyy-MM-dd"); - info.SuchProducts = item.FileName; - var cacheValue = info.MasterAgrmtNo + "_" + info.ProductName; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{info.ProductName}\",\"Source\":\"System\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.ProductNo = note.BizId; - } - note.id = 0; - info.ExceID = base.formatExceID(); - note.DataId = item.id.ToString(); - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.changeStatus = false; - if (!ReportStatus.CheckFileLength(item.FilePath)) - { - break; - } - else - { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - } - dataList.Add(info); - fileList.Add(item.FilePath); - note.ExceId = info.ExceID; - noteList.Add(note); - } - } + dataList.AddRange(GetMasterAgrmtProductModelFromExcel(ref fileList)); } var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.MasterAgrmtProduct = dataList; @@ -193,7 +63,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(MasterAgrmtProductModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -244,16 +114,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - - private List GetMasterAgrmtProductModel(ref List fileList) + private List GetMasterAgrmtProductModelFromExcel(ref List fileList) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("主协议关联产品列表")) { - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["主协议关联产品列表"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["主协议关联产品列表"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -263,12 +131,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][1]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -278,25 +152,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - MasterAgrmtProductModel model = new MasterAgrmtProductModel(); - - model.ClientType = "产品"; - model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); - model.OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U; - model.ProductName = GetDataSetValue(dt, i, 2); - model.CounterpartyCodeProducts = GetDataSetValue(dt, i, 3); - model.ManagerName = GetDataSetValue(dt, i, 4); - model.InvestmentManagerContactNumber = GetDataSetValue(dt, i, 5); - model.TrusteeAgency = GetDataSetValue(dt, i, 6); - model.TheDateTable = GetDataSetValue(dt, i, 7); - model.SuchProducts = GetDataSetValue(dt, i, 8); + var model = new MasterAgrmtProductModel + { + ClientType = "产品", + MasterAgrmtNo = GetDataSetValue(dt, i, 0), + OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U, + ProductName = GetDataSetValue(dt, i, 2), + CounterpartyCodeProducts = GetDataSetValue(dt, i, 3), + ManagerName = GetDataSetValue(dt, i, 4), + InvestmentManagerContactNumber = GetDataSetValue(dt, i, 5), + TrusteeAgency = GetDataSetValue(dt, i, 6), + TheDateTable = GetDataSetValue(dt, i, 7), + SuchProducts = GetDataSetValue(dt, i, 8) + }; var cacheValue = model.MasterAgrmtNo + "_" + model.ProductName; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -332,14 +207,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (!string.IsNullOrWhiteSpace(model.SuchProducts)) { - string path = Path.Combine(sourcePath, model.SuchProducts); + var path = Path.Combine(sourcePath, model.SuchProducts); if (!ReportStatus.CheckFileLength(path)) { break; } else { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); } note.id = 0; model.ExceID = base.formatExceID(); @@ -366,23 +241,30 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.MasterAgrmtProduct != null) { - List listRoot = new List(); - CheckHelper helper = new Common.CheckHelper(); - for (int i = 0; i < model.MasterAgrmtProduct.Count; i++) + var helper = new Common.CheckHelper(); + for (var i = 0; i < model.MasterAgrmtProduct.Count; i++) { + var listRoot = new List(); var item = model.MasterAgrmtProduct[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (listRoot.Count > 0) { - var errMsg = new SacInfo("MasterAgrmtProduct", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("MasterAgrmtProduct", i) + { + FieldValue = item.ProductName, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -408,7 +290,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } @@ -423,12 +305,24 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } private string formatInfoTag(MasterAgrmtProductModel model, bool suffixType = false) { - string result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.ProductName.Replace("_", "-")}_"; + var result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.ProductName.Replace("_", "-")}_"; if (suffixType) { result = $"{result}{_operationType}"; } return result; } + + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 4) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[2]; + arr[2] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtService.cs index 6d0e7c18..91d4b54c 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportMasterAgrmtService.cs @@ -1,7 +1,9 @@ -using System.Data; +using BaseOUDAL; +using System.Data; using YLErp.Commons; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Helpers; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; using static YLErp.DBModels.Consts.ConsReport; @@ -23,60 +25,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1001; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_MasterAgrmt; - List noteList = new List(); + + readonly List noteList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetMasterAgrmtModelFromExcel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - try - { - LogFactory.GetLogger("GenerateBody").Info($"System:1111x"); - var resultList = GetMasterAgrmtModelFromDb(ref fileList); - if (resultList != null && resultList.Count() > 0) - { - LogFactory.GetLogger("GenerateBody").Info($"ok"); - dataList.AddRange(resultList); - } - - LogFactory.GetLogger("GenerateBody").Info($"System:2222x"); - } - catch (Exception ex) - { - LogFactory.GetLogger("GenerateBody").Info($"System:1111x系统异常:" + ex.ToString()); - } - } - - - LogFactory.GetLogger("GenerateBody").Info($"System:11112"); var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } + noData = dataList.Count == 0; model.MasterAgrmt = dataList; return model; @@ -84,7 +65,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(MasterAgrmtModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -136,186 +117,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - private IEnumerable GetMasterAgrmtModelFromDb(ref List fileList) - { - var dataList = new List(); - using (var baseDb = DbContextFactory.GetClientDbContext(null)) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var fileObjList = (from c in baseDb.client - join cf in baseDb.client_file - on c.id equals cf.ClientId - where c.ProcessStatus == "已开户" && cf.HasSent == false && cf.IsValid && - cf.FileTypeName == ConsGlobal.ClientFileType.MainProtocol && cf.OptState == _operationType && - ((c.ProcessOptDate >= _reqInfo.ReportDate && c.ProcessOptDate < nextDate && cf.OptDate < nextDate) ||//如果这一天开户,则把这一天之前(含这一天)的所有文件都报送了 - (cf.OptDate >= _reqInfo.ReportDate && cf.OptDate < nextDate && c.ProcessOptDate < _reqInfo.ReportDate))//如果这一天不是开户日期,则只在报送日期大于开户日期时,报送当日修改的文件 - && cf.ApprovalOrder < 1 - select new - { - cf.id, - cf.ClientId, - cf.OptState, - cf.ProtocolNumber, - cf.SignDate, - cf.SignType, - cf.ReportorRole, - cf.FilePath, - cf.FileName, - cf.FileDesc, - c.Name, - c.CounterpartyCode, - c.Number, - c.ProperClientClass, - c.CustomerNature1, - c.NFICode, - c.RegisteredCapital, - c.ClientType - }).ToArray(); - var clientIds = fileObjList.Select(O => O.ClientId); - var ct = baseDb.contactype.Where(O => O.ContactType == "联系人").FirstOrDefault(); - ExpandoDictionary clientdutyDict = null; - if (ct != null) - { - clientdutyDict = new ExpandoDictionary( - (from cd in baseDb.clientduty.Where(t => t.ApprovalOrder < 1) - where clientIds.Contains(cd.ClientId ?? 0) && (cd.DeadLine == null || cd.DeadLine >= _reqInfo.ReportDate) - select cd) - .ToList() - .Where(O => O.ContactTypeIdsInt.Contains(ct.id)).GroupBy(O => O.ClientId ?? 0) - .ToDictionary(K => K.Key, V => V.FirstOrDefault())); - } - LogFactory.GetLogger("ReportMasterAgrmtService").Error("查询到: " + fileObjList.Length.ToString()); - var cacheKey = $"{BusiDataType}"; - foreach (var item in fileObjList) - { - var cacheValue = item.ProtocolNumber; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - LogFactory.GetLogger("ReportMasterAgrmtService").Error("有重复编号跳过 " + item.ProtocolNumber); - continue; - } - try - { - var info = new MasterAgrmtModel(); - info.OperationType = item.OptState; - info.MasterAgrmtNo = item.ProtocolNumber; - info.SigningDate = item.SignDate?.ToString("yyyy-MM-dd"); - info.MasterAgrmtVer = ConsReport.MasterAgrmtVerMap[item.SignType ?? ""]; - info.FillParty = ConsReport.FillPartyMap[item.ReportorRole ?? ""]; - info.NameOfCounterparty = item.Name; - info.CounterpartyCode = item.Number; - info.ProCounterparty = item.ProperClientClass != null && item.ProperClientClass.Contains("专业") ? ProCounterpartyMap["专业"] : ProCounterpartyMap["非专业"]; - info.CounterpartyType = CounterpartyTypeMap[item.CustomerNature1 ?? ""]; - if ((info.CounterpartyType == CounterpartyTypeMap["境外金融机构"] || info.CounterpartyType == CounterpartyTypeMap["境外非金融机构"])) - { - info.LEI = item.CounterpartyCode; - } - else - { - info.CODS = item.CounterpartyCode; - } - if (item.CustomerNature1 != null && item.CustomerNature1.Contains("非金融机构")) - { - info.NFICode = item.NFICode; - } - info.CounterpartyRegdCptl = item.RegisteredCapital; - info.MasterAgrmtAtt = item.FileName; - info.MasterAgrmtRemark = item.FileDesc; - if (clientdutyDict != null && clientdutyDict.ContainsKey(item.ClientId)) - { - info.CounterpartyInformationTuple = new List(); - CounterpartyInfomationModel userInfo = new CounterpartyInfomationModel(); - userInfo.Name = clientdutyDict[item.ClientId]?.ContactName; - userInfo.Title = clientdutyDict[item.ClientId] == null ? null : "联系人"; - userInfo.Email = clientdutyDict[item.ClientId]?.Email; - userInfo.Telephone = clientdutyDict[item.ClientId]?.PhoneNumber; - //userInfo.Mobile = clientdutyDict[item.ClientId]?.PhoneNumber; - info.CounterpartyInformationTuple.Add(userInfo); - } - info.CounterpartyIdentity = item.ClientType == "机构" ? CounterpartyIdentityMap["自营"] : CounterpartyIdentityMap["产品管理人"]; - - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{info.MasterAgrmtNo}\",\"Source\":\"System\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - LogFactory.GetLogger("ReportMasterAgrmtService").Error("未找到历史报送信息跳过 " + formatInfoTag(info)); - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.MasterAgrmtID = note.BizId; - } - if (!ReportStatus.CheckFileLength(item.FilePath)) - { - break; - } - else - { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - } - info.ExceID = base.formatExceID(); - dataList.Add(info); - fileList.Add(item.FilePath); - note.id = 0; - note.DataId = item.id.ToString(); - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - catch (Exception ex) - { - LogFactory.GetLogger("ReportMasterAgrmtService").Error(ex); - LogFactory.GetLogger("ReportMasterAgrmtService").Error(item.ToJson()); - throw; - } - } - } - return dataList; - } - private List GetMasterAgrmtModelFromExcel(ref List fileList) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("主协议")) { - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["主协议"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["主协议"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -325,12 +134,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][3]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -340,14 +155,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - MasterAgrmtModel model = generiterInfoFromExcel(dt, i, optType); + var model = generiterInfoFromExcel(dt, i, optType); model.CounterpartyInformationTuple = GetCounterpartyInfomationModelFromExcel(model.MasterAgrmtNo); - string cacheValue = model.MasterAgrmtNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + var cacheValue = model.MasterAgrmtNo; + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -385,14 +200,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (!string.IsNullOrWhiteSpace(model.MasterAgrmtAtt)) { model.ExceID = base.formatExceID(); - string path = Path.Combine(sourcePath, model.MasterAgrmtAtt); + var path = Path.Combine(sourcePath, model.MasterAgrmtAtt); if (!ReportStatus.CheckFileLength(path)) { break; } else { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); } result.Add(model); fileList.Add(path); @@ -418,29 +233,31 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private MasterAgrmtModel generiterInfoFromExcel(DataTable dt, int i, OptFlagsEnum optType) { - var model = new MasterAgrmtModel(); - model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); - model.SigningDate = GetDataSetValue(dt, i, 1); - model.MasterAgrmtVer = ConsReport.MasterAgrmtVerMap[GetDataSetValue(dt, i, 2)]; - model.OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U; - model.FillParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 4)]; - model.NameOfCounterparty = GetDataSetValue(dt, i, 5); - model.CODS = GetDataSetValue(dt, i, 6); - model.CounterpartyCode = GetDataSetValue(dt, i, 7); - model.LEI = GetDataSetValue(dt, i, 8); - model.ProCounterparty = ConsReport.ProCounterpartyMap[GetDataSetValue(dt, i, 9)]; - model.CounterpartyType = ConsReport.CounterpartyTypeMap[GetDataSetValue(dt, i, 10)]; - model.NFICode = GetDataSetValue(dt, i, 11); - model.CounterpartyRegdCptl = GetDataSetValue(dt, i, 12); - model.MasterAgrmtRemark = GetDataSetValue(dt, i, 13); - model.MasterAgrmtAtt = GetDataSetValue(dt, i, 14); - model.CounterpartyIdentity = ConsReport.CounterpartyIdentityMap[GetDataSetValue(dt, i, 15)]; + var model = new MasterAgrmtModel + { + MasterAgrmtNo = GetDataSetValue(dt, i, 0), + SigningDate = GetDataSetValue(dt, i, 1), + MasterAgrmtVer = ConsReport.MasterAgrmtVerMap[GetDataSetValue(dt, i, 2)], + OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U, + FillParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 4)], + NameOfCounterparty = GetDataSetValue(dt, i, 5), + CODS = GetDataSetValue(dt, i, 6), + CounterpartyCode = GetDataSetValue(dt, i, 7), + LEI = GetDataSetValue(dt, i, 8), + ProCounterparty = ConsReport.ProCounterpartyMap[GetDataSetValue(dt, i, 9)], + CounterpartyType = ConsReport.CounterpartyTypeMap[GetDataSetValue(dt, i, 10)], + NFICode = GetDataSetValue(dt, i, 11), + CounterpartyRegdCptl = GetDataSetValue(dt, i, 12), + MasterAgrmtRemark = GetDataSetValue(dt, i, 13), + MasterAgrmtAtt = GetDataSetValue(dt, i, 14), + CounterpartyIdentity = ConsReport.CounterpartyIdentityMap[GetDataSetValue(dt, i, 15)] + }; return model; } private string formatInfoTag(MasterAgrmtModel model, bool suffixType = false) { - string result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_"; + var result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -448,31 +265,44 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 3) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + private List GetCounterpartyInfomationModelFromExcel(string masterAgrmtNo) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("填报方业务代表明细")) { - DataTable dt = _excelDataSource.Tables["填报方业务代表明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["填报方业务代表明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != masterAgrmtNo) + if (dt.Rows[i][0]?.ToString().Trim() != masterAgrmtNo) { continue; } - CounterpartyInfomationModel model = new CounterpartyInfomationModel(); - - model.Name = GetDataSetValue(dt, i, 1); - model.Title = GetDataSetValue(dt, i, 2); - model.Telephone = GetDataSetValue(dt, i, 3); - model.Mobile = GetDataSetValue(dt, i, 4); - model.Email = GetDataSetValue(dt, i, 5); + var model = new CounterpartyInfomationModel + { + Name = GetDataSetValue(dt, i, 1), + Title = GetDataSetValue(dt, i, 2), + Telephone = GetDataSetValue(dt, i, 3), + Mobile = GetDataSetValue(dt, i, 4), + Email = GetDataSetValue(dt, i, 5) + }; result.Add(model); } @@ -482,23 +312,27 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.MasterAgrmt != null) { - CheckHelper helper = new Common.CheckHelper(); - CheckHelper infoHelper = new Common.CheckHelper(); - for (int i = 0; i < model.MasterAgrmt.Count; i++) + var helper = new Common.CheckHelper(); + var infoHelper = new Common.CheckHelper(); + for (var i = 0; i < model.MasterAgrmt.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.MasterAgrmt[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (item.CounterpartyInformationTuple != null) { - for (int j = 0; j < item.CounterpartyInformationTuple.Count; j++) + for (var j = 0; j < item.CounterpartyInformationTuple.Count; j++) { var listItem = new List(); var tuple = item.CounterpartyInformationTuple[j]; @@ -508,16 +342,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("CounterpartyInformationTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("CounterpartyInformationTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("MasterAgrmt", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("MasterAgrmt", i) + { + FieldValue = item.MasterAgrmtNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -542,7 +381,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger().Error(e); }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationAttService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationAttService.cs new file mode 100644 index 00000000..e29762b7 --- /dev/null +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationAttService.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static YLErp.DBModels.Consts.ConsReport; +using YLErp.BLL; +using YLErp.DBModels.Consts; +using YLErp.DBModels.Enums; +using YLErp.DBModels; +using YLErp.Modules.SuperviseReportModule.SAC.Common; +using YLErp.Modules.SuperviseReportModule.SAC.Model; +using System.Data; +using System.IO; +using NPOI.SS.Formula.Functions; +using YLErp.Helpers; + +namespace YLErp.Modules.SuperviseReportModule.SAC.Service +{ + class ReportOptionConfirmationAttService : ReportBaseService + { + public ReportOptionConfirmationAttService(OptUserInfo optUser) : base(optUser) + { + } + + protected override string _excelDataSourcePath => "交易相关\\"; + + protected override string _excelDataSourceFileName => "import_OptionConfirmationAtt_template.xlsx"; + + protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1019; + + private List _validOperationType = null; + public override List ValidOperationType + { + get + { + if (_validOperationType == null) + { + _validOperationType = new List() { + OptFlagsEnum.A, + OptFlagsEnum.U, + OptFlagsEnum.D, + }; + } + return _validOperationType; + } + } + + protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OptionConfirmationAtt; + List noteList = new List(); + + protected override BodyModel GenerateBody(out bool noData, out List fileList) + { + fileList = new List(); + BodyModel model = new BodyModel(); + List dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) + { + dataList = GetOptionConfirmationAttModel(out fileList); + } + var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); + if (subsystemDataList != null && subsystemDataList.Count > 0) + dataList.AddRange(subsystemDataList); + + noData = dataList.Count == 0; + model.ConfirmationAtt = dataList; + return model; + } + + public bool AddSubsystemNote(ConfirmationAttModel model, List fileList, string tag) + { + SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + if (note == null) + { + note = new SACReportNotes() + { + InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Subsystem\",\"SubFileTag\":\"{tag}\",\"ExceID\":\"{model.ExceID}\"}}", + IsValid = true, + }; + } + else + { + switch (model.OperationType) + { + case OptFlagsEnum.A: + return false;//新增数据已报送,跳过 + case OptFlagsEnum.U: + //多次U的时候,每次用最新的tag来赋值SubFileTag + note.InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Subsystem\",\"SubFileTag\":\"{tag}\",\"ExceID\":\"{model.ExceID}\"}}"; + note.IsValid = true; + break; + case OptFlagsEnum.D: + note.IsValid = false; + break; + case OptFlagsEnum.NONE: + default: + throw new ServiceException("未知操作类型"); + } + } + + if (model.ConfirmationFilesTuple != null && model.ConfirmationFilesTuple.Count > 0) + { + fileList.AddRange(model.ConfirmationFilesTuple.Select(x => x.ConfirmationAtt)); + } + model.ExceID = base.formatExceID(); + note.ExceId = model.ExceID; + note.id = 0; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = formatInfoTag(model, true); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.changeStatus = false; + noteList.Add(note); + return true; + } + + private List GetOptionConfirmationAttModel(out List fileList) + { + fileList = new List(); + List result = new List(); + if (_excelDataSource != null && _excelDataSource.Tables.Contains("场外期权确认书附件明细")) + { + DataTable dt = _excelDataSource.Tables["场外期权确认书附件明细"]; + string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + for (int i = 1; i < dt.Rows.Count; i++) + { + if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) + { + //第一列空白说明数据结束了; + break; + } + var optType = OptFlagsEnum.NONE; + switch (dt.Rows[i][1]?.ToString()) + { + case "0": + case "A": + case "首次": + optType = OptFlagsEnum.A; + break; + case "1": + case "U": + case "变更": + optType = OptFlagsEnum.U; + break; + case "2": + case "D": + case "废止": + optType = OptFlagsEnum.D; + break; + } + if (optType != _operationType) + { + continue; + } + + ConfirmationAttModel model = new ConfirmationAttModel(); + + model.ConfirmationNo = GetDataSetValue(dt, i, 0); + model.OperationType = optType; + var cacheValue = (model.ConfirmationNo ?? "").ToString(); + if (cacheValue.IsNullOrWhiteSpace()) + { + continue; + } + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) + { + continue; + } + model.ConfirmationFilesTuple = new List(); + var files = GetDataSetValue(dt, i, 2).Split(','); + foreach (var f in files) + { + if (!string.IsNullOrWhiteSpace(f)) + { + var path = Path.Combine(sourcePath, f); + if (!ReportStatus.CheckFileLength(path)) + { + break; + } + fileList.Add(path); + model.ConfirmationFilesTuple.Add(new ConfirmationFilesTupleModel() { IsSwap = "false", ConfirmationAtt = f }); + } + } + List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); + var note = notes.LastOrDefault(O => O.InfoCache.Contains(cacheValue)); + if (note == null && _operationType == OptFlagsEnum.A) + { + note = new SACReportNotes() + { + IsValid = true, + }; + } + else + { + if (note == null) + { + continue; + } + switch (_operationType) + { + case OptFlagsEnum.A: + continue;//新增数据已报送,跳过 + case OptFlagsEnum.U: + note.IsValid = true; + break; + case OptFlagsEnum.D: + note.IsValid = false; + break; + case OptFlagsEnum.NONE: + default: + throw new ServiceException("未知操作类型"); + } + } + + if (_operationType != OptFlagsEnum.A) + { + model.BizID = note.BizId; + } + model.ExceID = base.formatExceID(); + result.Add(model); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); + note.InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Template\"}}"; + note.id = 0; + note.ExceId = model.ExceID; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = formatInfoTag(model, true); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.DataId = ""; + note.changeStatus = false; + noteList.Add(note); + } + } + return result; + } + + private string formatInfoTag(ConfirmationAttModel model, bool suffixType = false) + { + string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_成交_确认书_"; + if (suffixType) + { + result = $"{result}{_operationType}"; + } + return result; + } + + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 5) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) + { + List result = new List(); + if (model?.ConfirmationAtt != null) + { + CheckHelper helper = new CheckHelper(); + CheckHelper attHelper = new CheckHelper(); + for (int i = 0; i < model.ConfirmationAtt.Count; i++) + { + List listRoot = new List(); + var item = model.ConfirmationAtt[i]; + helper.ExecuteCheck(item, (name, value, msg) => + { + listRoot.Add(new SacInfo(name, value, msg)); + }); + if (item.ConfirmationFilesTuple != null) + { + for (int j = 0; j < item.ConfirmationFilesTuple.Count; j++) + { + var att = item.ConfirmationFilesTuple[j]; + attHelper.ExecuteCheck(att, (name, value, msg) => + { + listRoot.Add(new SacInfo(name, value, msg)); + }); + } + } + if (listRoot.Count > 0) + { + var errMsg = new SacInfo("OptionConfirmationAtt", i); + errMsg.FieldValue = item.ConfirmationNo; + errMsg.SubMaps = new List(listRoot); + result.Add(errMsg); + } + } + } + checkStatus = result.Count > 0; + return result; + } + + public override bool BeforeOfGenerated(out string errMsg) + { + errMsg = ""; + for (int i = 0; i < noteList.Count; i++) + { + base.SaveReportNotes(noteList[i]); + } + return true; + } + } +} diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationService.cs index 171224a1..a1a8e686 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionConfirmationService.cs @@ -1,16 +1,27 @@ -using BaseOUDAL; +using BaseOUDAL; +using NPOI.SS.Formula.Functions; +using Qdp.Foundation.Implementations; +using Qdp.Pricing.Base.Utilities; +using Qdp.Pricing.Library.Base.Utilities; using System.Data; +using System.Net; using System.Text.RegularExpressions; using YLErp.BLL; +using YLErp.Commons; +using YLErp.Configuration; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Helpers; using YLErp.Modules.EodModule; +using YLErp.Modules.StructureModule; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; +using YLErp.QdpModule; using static YLErp.DBModels.Consts.ConsReport; namespace YLErp.Modules.SuperviseReportModule.SAC.Service { + //交易确认书-期权交易确认书 class ReportOptionConfirmationService : ReportBaseService { public ReportOptionConfirmationService(OptUserInfo optUser) : base(optUser) @@ -23,514 +34,40 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1004; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OptionConfirmation; - List noteList = new List(); + + readonly List noteList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); noData = true; - BodyModel model = new BodyModel(); - LogFactory.GetLogger("loadSubsystemDataSource").Error($"x1:"); - var cacheKey = $"{BusiDataType}"; - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetOptionConfirmationModelFromExcel(ref fileList); } - LogFactory.GetLogger("loadSubsystemDataSource").Error($"x2:"); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var nextDataDate = _reqInfo.DataDate.AddDays(1); - using (var db = new YLContext()) - { - var codeList = ReportStatus.GetCacheInfo(cacheKey); - var query = (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r - on tc.id equals tr.TradeCashId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - where - ((_operationType == OptFlagsEnum.A && t.TradeDate >= _reqInfo.DataDate && t.TradeDate < nextDataDate)//新增时使用交易日期判断 - || (_operationType != OptFlagsEnum.A && tc.OptDate >= _reqInfo.ReportDate && tc.OptDate < nextDate))//补正和废止时使用操作日期判断 - && (_operationType == OptFlagsEnum.D || (t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid)) - && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType != "收益互换" - && tc.Action == "系统操作-期权费" && t.ParentTradeId == 0 - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.OriginalNotional, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - tr.ContractCode, - td.Paths, - td.StampDocumentFileName, - t.TradePrice, - t.PremiumRate, - t.QuoteCurrency, - t.SettlementCurrency - }).OrderBy(O => O.OptDate).ToArray().Where(O => !codeList.Contains(O.id + "")).ToArray(); - - List ids = query.Select(O => O.id).ToList(); - List delIds = new List(); - if (_operationType == OptFlagsEnum.D) - { - delIds = DbContext.TradeAuditLog.Where(O => ids.Contains(O.TradeId) && O.OptDate >= _reqInfo.ReportDate && O.OptDate < nextDate && O.OptType == "删除交易").Select(O => O.TradeId).ToList(); - } - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - Dictionary reportDescDic = DbContext.AppConfig.Where(O => O.PGroup == ConsAppConfig.ReportDescOption).ToDictionary(K => K.PName, V => V.PValue); - foreach (var item in query.ToArray()) - { - var cacheValue = item.id.ToString(); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - //如果存在重复数据,则始终用较新的数据 - OptionConfirmationModel info = new OptionConfirmationModel(); - - info.TradeId = item.id.ToString(); - info.ConfirmationNo = item.ContractCode; - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - info.OperationType = OptFlagsEnum.A; - note = new SACReportNotes() - { - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - if (!note.changeStatus) - { - continue;//交易没有被修改过,跳过 - } - info.OperationType = OptFlagsEnum.U; - note.IsValid = true; - break; - case OptFlagsEnum.D: - if (!delIds.Contains(item.id)) - { - continue;//交易没有被删除,跳过 - } - info.OperationType = OptFlagsEnum.D; - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != _operationType) - { - continue; - } - if (info.OperationType != OptFlagsEnum.D && (!item.tradeValid || !item.tradecashValid || !item.tradeContractRValid)) - {//非废止报送中,应跳过所有存在无效数据的数据 - continue; - } - if (metaDic.ContainsKey(item.id)) - { - var metaInfo = metaDic[item.id]; - info.MasterAgrmtNo = metaInfo.ContainsKey(ConsTradeMetaKey.MainProtocolCode) ? metaInfo[ConsTradeMetaKey.MainProtocolCode] : ""; - info.SupAgrmtNo = metaInfo.ContainsKey(ConsTradeMetaKey.SupProtocolCode) ? metaInfo[ConsTradeMetaKey.SupProtocolCode] : ""; - info.ClearingAgency = metaInfo.ContainsKey(ConsTradeMetaKey.ClearingAgency) ? ClearingAgencyMap[metaInfo[ConsTradeMetaKey.ClearingAgency]] : ""; - info.TradingPlace = metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) ? TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] : ""; - if (info.TradingPlace == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - var rate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(item.QuoteCurrency, "CNY", _reqInfo.DataDate); - if (info.OperationType != OptFlagsEnum.A) - { - info.ConfirmationID = note.BizId;//确认书编号; - } - info.ConfirmationType = ReportTypeMap[info.OperationType == OptFlagsEnum.A ? "首次" : "变更"]; - info.FillParty = FillPartyMap["甲方"]; - info.OptionSeller = item.BuySell == "卖出" ? OptionTraderMap["填报方"] : OptionTraderMap["对手方"]; - info.OptionDirection = OptionDirectionMap[item.OptionType]; - string defaultDesc = reportDescDic.ContainsKey("默认") ? reportDescDic["默认"] : ""; - info.ProfitCalculationInfo = reportDescDic.ContainsKey(item.TradeType) && !string.IsNullOrWhiteSpace(reportDescDic[item.TradeType]) ? reportDescDic[item.TradeType] : defaultDesc; - info.ExercisePriceOne = ((item.IsMoneynessOption == "是" ? item.Strike : item.Strike / item.SpotPrice) * 100)?.ToString("0.00"); - string tradeType = item.TradeType; - if (tradeType.Contains("价差")) - { - tradeType = "价差期权"; - } - double? strike = null; - switch (tradeType) - { - case "香草期权": - info.OptionStructureType = OptionStructureTypeMap["香草"]; - break; - case "二元期权": - info.OptionStructureType = OptionStructureTypeMap["二元"]; - break; - case "价差期权": - info.OptionStructureType = OptionStructureTypeMap["价差"]; - break; - case "障碍期权": - info.OptionStructureType = OptionStructureTypeMap["障碍"]; - break; - case "双鲨期权": - info.OptionStructureType = OptionStructureTypeMap["鲨鱼鳍"]; - var sharkfin = DbContext.trade_double_sharkfin_option.Where(O => O.TradeId == item.id).Select(O => new { O.StrikeHigh, O.StrikeLow }).FirstOrDefault(); - info.ExercisePriceOne = ((item.IsMoneynessOption == "是" ? sharkfin.StrikeLow : sharkfin.StrikeLow / item.SpotPrice) * 100)?.ToString("0.00"); - info.ExercisePriceTwo = ((item.IsMoneynessOption == "是" ? sharkfin.StrikeHigh : sharkfin.StrikeHigh / item.SpotPrice) * 100)?.ToString("0.00"); - break; - case "区间累积期权": - info.OptionStructureType = OptionStructureTypeMap["区间累计"]; - break; - case "凤凰期权": - info.OptionStructureType = OptionStructureTypeMap["AutoCallable"]; - var autocall = DbContext.trade_autocall.Where(O => O.TradeId == item.id).FirstOrDefault(); - if (autocall.KIPayoffType != KIPayoffTypeEnum.None) - { - strike = autocall.SpreadStrike ?? autocall.SpreadStrike1; - } - if (strike != null) - { - info.ExercisePriceTwo = ((item.IsMoneynessOption == "是" ? strike : strike / item.SpotPrice) * 100)?.ToString("0.00"); - } - break; - case "雪球期权": - info.OptionStructureType = OptionStructureTypeMap["AutoCallable"]; - var snowball = DbContext.trade_snowball.Where(O => O.TradeId == item.id).FirstOrDefault(); - if (snowball.KIPayoffType != KIPayoffTypeEnum.None) - { - strike = snowball.SpreadStrikeAtMaturity ?? snowball.SpreadStrikeAtMaturity1; - } - else if (snowball.KOPayoffType != KOPayoffTypeEnum.Rebate) - { - strike = snowball.SpreadStrikeAtKO ?? snowball.SpreadStrikeAtKO1; - } - if (strike != null) - { - info.ExercisePriceTwo = ((item.IsMoneynessOption == "是" ? strike : strike / item.SpotPrice) * 100)?.ToString("0.00"); - } - break; - default: - info.OptionStructureType = OptionStructureTypeMap["其他"]; - info.OptionStructure = item.TradeType; - break; - } - if (string.IsNullOrWhiteSpace(info.ExercisePriceOne) && !string.IsNullOrWhiteSpace(info.ExercisePriceTwo)) - { - info.ExercisePriceOne = info.ExercisePriceTwo; - info.ExercisePriceTwo = null; - } - if (string.IsNullOrWhiteSpace(info.ExercisePriceTwo)) - { - info.ExercisePriceTwo = null; - } - info.ExerciseApproach = ExerciseApproachMap[item.ExerciseMode == "American" ? "美式" : "欧式"]; - info.StartDate = item.TradeDate?.ToString("yyyy-MM-dd"); - info.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd"); - info.SettlementDate = item.SettlementDate?.ToString("yyyy-MM-dd"); - info.OptionPremium = (item.PremiumRate * 100)?.ToString("0.00"); - var currency = item.SettlementCurrency == "CNH" ? "CNY" : item.SettlementCurrency ?? "CNY"; - info.Currency = ((int)(CurrencyEnum)Enum.Parse(typeof(CurrencyEnum), currency)).ToString();// ((int)CurrencyEnum.CNY).ToString(); - info.NotinalPrincipleAmt = (item.OriginalStockEqvNotional * rate)?.ToString("0.00"); - info.BusinessModelType = BusinessModelTypeMap["传统型期权"]; - //系统中的交易修改时必须回退,所以报送不存在修改时还存在有效的存续期记录的情况; - //Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); - //if (info.OperationType == OptFlagsEnum.U) - //{ - // if (reportCacheDic.ContainsKey("DueDate") && !reportCacheDic["DueDate"].StartsWith(info.DueDate) && !info.DueDate.StartsWith(reportCacheDic["DueDate"])) - // { - // throw new ServiceException("补正时,如果该交易还存在有效的存续期记录,到期日字段不能修改"); - // } - // if (reportCacheDic.ContainsKey("NotinalPrincipleAmt") && reportCacheDic["NotinalPrincipleAmt"] != info.NotinalPrincipleAmt && reportCacheDic["NotinalPrincipleAmt"] != item.OriginalStockEqvNotional?.ToString("0")) - // { - // throw new ServiceException("补正时,如果该交易还存在有效的存续期记录,名义本金额(人民币)字段不能修改"); - // } - //} - - info.ConfirmationAttTuple = new List(); - ConfirmationAttModel confirmationInfo = new ConfirmationAttModel(); - string path = item.StampDocumentFileName ?? item.Paths; - if (!(path.StartsWith("\\") || path.StartsWith("/"))) - { - path = "\\" + path; - } - var absolutePath = OtcAppContext.MapPath(path); - absolutePath = Path.ChangeExtension(absolutePath, "pdf"); - confirmationInfo.ConfirmationAtt = Path.GetFileName(absolutePath); - info.ConfirmationAttTuple.Add(confirmationInfo); - - var um = DataCacheProvider.GetUnderlyingDataSource().GetData(item.UnderlyingCode); - switch (um.UnderlyingInstrumentType) - { - case ConsGlobal.InstrumentType.Stock: - case ConsGlobal.InstrumentType.StockIndex: - case ConsGlobal.InstrumentType.NewOtcStock: - case ConsGlobal.InstrumentType.HKStock: - case ConsGlobal.InstrumentType.HKStockIndex: - case ConsGlobal.InstrumentType.AbroadStock: - case ConsGlobal.InstrumentType.AbroadStockIndex: - info.UndrlygAssetType = UndrlygAssetTypeMap["权益类"]; - break; - case ConsGlobal.InstrumentType.StockIF: - case ConsGlobal.InstrumentType.CommodityFutures: - case ConsGlobal.InstrumentType.GoldFutures: - case ConsGlobal.InstrumentType.TBFutures: - case ConsGlobal.InstrumentType.OtherFutures: - case ConsGlobal.InstrumentType.AbroadFutures: - case ConsGlobal.InstrumentType.CommoditySpot: - case ConsGlobal.InstrumentType.GoldSpot: - case ConsGlobal.InstrumentType.OtherSpot: - case ConsGlobal.InstrumentType.AbroadSpot: - info.UndrlygAssetType = UndrlygAssetTypeMap["大宗商品"]; - break; - case ConsGlobal.InstrumentType.ExRate: - info.UndrlygAssetType = UndrlygAssetTypeMap["汇率"]; - break; - case ConsGlobal.InstrumentType.Shibor: - case ConsGlobal.InstrumentType.OtherRate: - break; - default: - info.UndrlygAssetType = UndrlygAssetTypeMap["其他"]; - break; - } - - info.UndrlygAssetNo = um.CommodityCode == "组合标的" ? UndrlygAssetNoMap["组合标的"] : UndrlygAssetNoMap["单一标的"]; - #region 标的信息 - - info.UndrlygAssetTuple = new List(); - List sCodeList = null; - if (um.CommodityCode == "组合标的") - { - sCodeList = DataCacheProvider.GetUnderlyingDataSource().GetSyntheticUnderlying(item.UnderlyingCode).GetUnderlyingCodes().ToList(); - } - else - { - sCodeList = new List() { um.UnderlyingCode }; - } - for (int i = 0; i < sCodeList.Count; i++) - { - var codeInfo = DataCacheProvider.GetUnderlyingDataSource().GetData(sCodeList[i]); - UndrlygAssetModel undrlygAsset = new UndrlygAssetModel(); - undrlygAsset.UndrlygAssetCode = Regex.Replace(codeInfo.UnderlyingCode, @"\..+", ""); - undrlygAsset.UndrlygAssetName = codeInfo.UnderlyingName; - undrlygAsset.UndrlygAssetAmt = item.OriginalNotional?.ToString(); - switch (codeInfo.MarketCode) - { - case "SHFE": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["上海期货交易所"]; - break; - case "DCE": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["大连商品交易所"]; - break; - case "CZC": - case "CZCE": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["郑州商品期货交易所"]; - break; - case "CFFEX": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["中国金融期货交易所"]; - break; - case "INE": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["上海国际能源交易中心"]; - break; - case "SGE": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["上海黄金交易所"]; - break; - case "SH": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["上海证券交易所"]; - break; - case "SZ": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["深圳证券交易所"]; - break; - case "CFETS": - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["外汇交易中心"]; - break; - default: - undrlygAsset.UndrlygAssetTradgPlc = UndrlygAssetTradgPlceMap["其他"]; - break; - } - - if (UndrlygAssetDtldTypeMap.TryGetValue(ConsGlobal.InstrumentType.GetDesc(codeInfo.UnderlyingInstrumentType), out var AssetDtldType)) - { - undrlygAsset.UndrlygAssetDtldType = AssetDtldType; - } - else - { - undrlygAsset.UndrlygAssetDtldType = UndrlygAssetDtldTypeMap["其他标的"]; - } - - info.UndrlygAssetTuple.Add(undrlygAsset); - } - - #endregion - #region 履约担保 - - var files = db.trade_file.Where(O => O.TradeId == item.id).ToArray(); - info.PerformanceGuaranteeType = item.MarginType == MarginTypeEnum.NONE ? PerformanceGuaranteeMap["无履约担保"] : PerformanceGuaranteeMap["部分担保"]; - if (item.MarginType != MarginTypeEnum.NONE) - { - info.PerformanceCollProvider = PerformanceCollProviderMap["乙方"]; - info.PartyUseColl = ConsReport.BoolMap[valuedateBLL.SystemDate.PartyUseColl || PS.Config.Company == Configuration.CompanyEnum.东莞 ? "是" : "否"];//todo:读取用户输入 - info.CollInstruction = valuedateBLL.SystemDate.CollInstruction;//todo:读取用户输入 - info.CalculateCollInterest = BoolMap["否"]; - info.PerformanceCollInitialRatio = "0";//((item.InitialMargin / item.OriginalStockEqvNotional * 100) ?? 0).ToString("0.00"); - info.PerformanceCollAddtlRatio = "0"; - info.PerformanceCollOffsetRatio = "0"; - var file_PerformanceGuarante = files.FirstOrDefault(O => O.Path.ToLower().EndsWith("履约保证书.pdf")); - if (!string.IsNullOrWhiteSpace(file_PerformanceGuarante?.Path)) - { - string fileName = Path.GetFileName(file_PerformanceGuarante?.Path); - path = file_PerformanceGuarante?.Path; - info.PerformanceGuaranteeAtt = fileName; - info.PerformanceGuaranteeRemark = file_PerformanceGuarante?.Description; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - } - info.PerformanceCollTuple = new List(); - info.PerformanceCollTuple.Add(new PerformanceGuaranteeAttModel() - { - PerformanceCollType = PerformanceCollTypeMap["现金"], - PerformanceCollRange = /*item.MarginType == MarginTypeEnum.DEFAULT ? PerformanceCollRangeMap["本笔交易对应主协议框架下的所有交易"] :*/ PerformanceCollRangeMap["仅本笔交易"] - }); - } - - #endregion - - var file_ComplianceOpinion = files.FirstOrDefault(O => O.Path.ToLower().EndsWith("合规意见书.pdf")); - if (!string.IsNullOrWhiteSpace(file_ComplianceOpinion?.Path)) - { - string fileName = Path.GetFileName(file_ComplianceOpinion?.Path); - path = file_ComplianceOpinion?.Path; - info.ComplianceOpinion = fileName; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - } - info.ValidNotinalPrincipleAmt = (item.StockEqvNotionalReal * rate).ToString("0.00"); - var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId); - if (client.ClientType == "产品") - { - using (var baseDb = new ClientDBContext()) - { - if (PS.Config.Company == Configuration.CompanyEnum.中金) - { - info.FillParty = FillPartyMap["甲方"]; - info.PtyBPdctName = client.Abbreviation ?? ""; - info.PytBPdctCode = client.ProductNumber ?? ""; - } - else - { - //var clientFile = baseDb.client_file.Where(O => ((O.FileTypeName == ConsGlobal.ClientFileType.MainProtocol && O.ProtocolNumber == info.MasterAgrmtNo) || (O.FileTypeName == ConsGlobal.ClientFileType.AllographProduct && O.MainProtocolNumber == info.MasterAgrmtNo)) && O.ClientId == client.id && O.IsValid).AsEnumerable().GroupBy(O => O.FileTypeName).ToDictionary(K => K.Key, V => V.FirstOrDefault()); - //if (!clientFile.ContainsKey(ConsGlobal.ClientFileType.MainProtocol)) - //{ - // throw new ServiceException($"{client.Name} 主协议文件不存在,生成失败!"); - //} - ////下面这行注释掉是因为目前系统报送互换时只处理了报送方是甲方的情况,假如报送方为乙方,则所有涉及支付方向的参数都应该对调,期权为了逻辑保持一直,所以暂时一起注释掉; - ////info.FillParty = FillPartyMap[clientFile[ConsGlobal.ClientFileType.MainProtocol].ReportorRole]; - //var productFile = clientFile.ContainsKey(ConsGlobal.ClientFileType.AllographProduct) ? clientFile[ConsGlobal.ClientFileType.AllographProduct] : null; - if (info.FillParty == FillPartyMap["甲方"]) - { - info.PtyBPdctName = client.Name ?? ""; - info.PytBPdctCode = client.Number ?? ""; - } - else - { - info.PtyAPdctName = client.Name ?? ""; - info.PytAPdctCode = client.Number ?? ""; - } - } - } - } - info.ExceID = base.formatExceID(); - if (!ReportStatus.CheckFileLength(absolutePath)) - { - break; - } - fileList.Add(absolutePath); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.InfoCache = $"{{\"NotinalPrincipleAmt\":\"{info.NotinalPrincipleAmt}\",\"DueDate\":\"{info.DueDate}\",\"Tag\":\"{info.ConfirmationNo}\",\"Source\":\"System\"}}"; - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.ReportResponse = false; - note.RetCode = ""; - note.RetMsg = ""; - note.DataId = item.tcId.ToString(); - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - LogFactory.GetLogger("loadSubsystemDataSource").Error($"x3:"); - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); - LogFactory.GetLogger("loadSubsystemDataSource").Error($"x4:"); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); - + } fileList = fileList.Distinct().ToList(); noData = dataList.Count == 0; @@ -540,7 +77,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(OptionConfirmationModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -579,10 +116,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList.Add(model.PerformanceGuaranteeAtt); } - if (model.ConfirmationAttTuple != null && model.ConfirmationAttTuple.Count > 0) - { - fileList.AddRange(model.ConfirmationAttTuple.Select(x => x.ConfirmationAtt)); - } + //if (model.ConfirmationAttTuple != null && model.ConfirmationAttTuple.Count > 0) + //{ + // fileList.AddRange(model.ConfirmationAttTuple.Select(x => x.ConfirmationAtt)); + //} model.ExceID = base.formatExceID(); note.id = 0; @@ -604,42 +141,41 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private List GetOptionConfirmationModelFromExcel(ref List fileList) { - List result = new List(); - string path = ""; - if (_excelDataSource != null) - { - LogFactory.GetLogger("loadSubsystemDataSource").Info($"xrrrr:"); - if (_excelDataSource.Tables != null) - LogFactory.GetLogger("loadSubsystemDataSource").Info($"ggg:"); - if (_excelDataSource.Tables == null) - LogFactory.GetLogger("loadSubsystemDataSource").Info($"ghh:"); - } - - + var result = new List(); + var path = ""; if (_excelDataSource != null && _excelDataSource.Tables.Contains("期权交易确认书明细")) { - LogFactory.GetLogger("loadSubsystemDataSource").Info($"x111:"); - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["期权交易确认书明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["期权交易确认书明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } + + OptionConfirmationModel model = new OptionConfirmationModel(); + + model.ConfirmationNo = GetDataSetValue(dt, i, 2); var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][3]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; + ReportStatus.AddCacheInfo($"{DataFlagsEnum.A1018}_D", model.ConfirmationNo); break; } if (optType != _operationType) @@ -647,12 +183,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - OptionConfirmationModel model = new OptionConfirmationModel(); - model.OperationType = optType; model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); model.SupAgrmtNo = GetDataSetValue(dt, i, 1); - model.ConfirmationNo = GetDataSetValue(dt, i, 2); model.ConfirmationType = ConsReport.ReportTypeMap[optType == OptFlagsEnum.A ? "首次" : "变更"]; model.FillParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 4)]; model.OptionSeller = ConsReport.OptionTraderMap[GetDataSetValue(dt, i, 5)]; @@ -664,49 +197,66 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.DueDate = GetDataSetValue(dt, i, 11); model.SettlementDate = GetDataSetValue(dt, i, 12); model.OptionPremium = GetDataSetValue(dt, i, 13); - if (!Enum.TryParse(GetDataSetValue(dt, i, 14), out CurrencyEnum currency)) + model.AnnualizedDays = GetDataSetValue(dt, i, 14); + model.PricingVolatility = GetDataSetValueToDoubleOrNull(dt, i, 15)?.ToString("0.00"); + model.RiskFreeInterestRates = GetDataSetValueToDoubleOrNull(dt, i, 16)?.ToString("0.00"); + var currencyStr = GetDataSetValue(dt, i, 17); + currencyStr = currencyStr == "其他" ? "Other" : currencyStr; + if (!Enum.TryParse(currencyStr, out CurrencyEnum currency)) { - currency = CurrencyEnum.CNY; + model.Currency = null; } - model.Currency = ((int)currency).ToString(); - model.NotinalPrincipleAmt = GetDataSetValue(dt, i, 15); - model.ClearingAgency = ConsReport.ClearingAgencyMap[GetDataSetValue(dt, i, 16)]; - model.TradingPlace = ConsReport.TradingPlaceMap[GetDataSetValue(dt, i, 17)]; - model.BusinessModelType = ConsReport.BusinessModelTypeMap[GetDataSetValue(dt, i, 18)]; - model.ConfirmationRemark = GetDataSetValue(dt, i, 20); - model.UndrlygAssetType = ConsReport.UndrlygAssetTypeMap[GetDataSetValue(dt, i, 21)]; - model.UndrlygAssetNo = ConsReport.UndrlygAssetNoMap[GetDataSetValue(dt, i, 22)]; - model.ProfitCalculationInfo = GetDataSetValue(dt, i, 23); - model.ProfitRemark = GetDataSetValue(dt, i, 24); - model.PerformanceGuaranteeType = ConsReport.PerformanceGuaranteeMap[GetDataSetValue(dt, i, 25)]; - model.PerformanceCollProvider = ConsReport.PerformanceCollProviderMap[GetDataSetValue(dt, i, 26)]; - model.PartyUseColl = ConsReport.BoolMap[GetDataSetValue(dt, i, 27)]; - model.CollInstruction = GetDataSetValue(dt, i, 28); - model.CalculateCollInterest = ConsReport.BoolMap[GetDataSetValue(dt, i, 29)]; - model.PerformanceCollInitialRatio = GetDataSetValue(dt, i, 30); - model.PerformanceCollAddtlRatio = GetDataSetValue(dt, i, 31); - model.PerformanceCollOffsetRatio = GetDataSetValue(dt, i, 32); - model.PerformanceGuaranteeRemark = GetDataSetValue(dt, i, 33); - model.PerformanceGuaranteeAtt = GetDataSetValue(dt, i, 34); - model.Remark = GetDataSetValue(dt, i, 35); - model.ValidNotinalPrincipleAmt = GetDataSetValue(dt, i, 36); - model.ComplianceOpinion = GetDataSetValue(dt, i, 37); - model.ExercisePriceOne = GetDataSetValue(dt, i, 38); - model.ExercisePriceTwo = GetDataSetValue(dt, i, 39); - model.PtyAPdctName = GetDataSetValue(dt, i, 40); - model.PytAPdctCode = GetDataSetValue(dt, i, 41); - model.PtyBPdctName = GetDataSetValue(dt, i, 42); - model.PytBPdctCode = GetDataSetValue(dt, i, 43); + else + { + model.Currency = ((int)currency).ToString(); - var notinalPrincipleAmt = GetDataSetValueToDouble(dt, i, 15); + } + model.NotinalPrincipleAmt = GetDataSetValueToDoubleOrNull(dt, i, 18)?.ToString("0.00"); + model.ClearingAgency = ConsReport.ClearingAgencyMap[GetDataSetValue(dt, i, 19)]; + model.TradingPlace = ConsReport.TradingPlaceMap[GetDataSetValue(dt, i, 20)]; + model.TradingPlaceOther = GetDataSetValue(dt, i, 21); + //model.BusinessModelType = ConsReport.BusinessModelTypeMap[GetDataSetValue(dt, i, 18)]; + model.ConfirmationRemark = GetDataSetValue(dt, i, 22); + model.UndrlygAssetType = ConsReport.UndrlygAssetTypeMap[GetDataSetValue(dt, i, 23)]; + model.UndrlygAssetNo = ConsReport.UndrlygAssetNoMap[GetDataSetValue(dt, i, 24)]; + model.ProfitCalculationInfo = GetDataSetValue(dt, i, 25); + model.ProfitRemark = GetDataSetValue(dt, i, 26); + model.PerformanceGuaranteeType = ConsReport.PerformanceGuaranteeMap[GetDataSetValue(dt, i, 27)]; + model.PerformanceCollProvider = ConsReport.PerformanceCollProviderMap[GetDataSetValue(dt, i, 28)]; + model.PartyUseColl = ConsReport.BoolMap[GetDataSetValue(dt, i, 29)]; + model.CollInstruction = GetDataSetValue(dt, i, 30); + model.CalculateCollInterest = ConsReport.BoolMap[GetDataSetValue(dt, i, 31)]; + model.PerformanceCollInitialRatio = GetDataSetValue(dt, i, 32); + model.PerformanceCollInitialRatioCash = GetDataSetValue(dt, i, 33); + model.PerformanceCollAddtlRatio = GetDataSetValue(dt, i, 34); + model.PerformanceCollOffsetRatio = GetDataSetValue(dt, i, 35); + model.MaintainGuaranteeRatio = GetDataSetValue(dt, i, 36); + model.PerformanceGuaranteeRemark = GetDataSetValue(dt, i, 37); + model.PerformanceGuaranteeAtt = GetDataSetValue(dt, i, 38); + model.Remark = GetDataSetValue(dt, i, 39); + model.ValidNotinalPrincipleAmt = GetDataSetValueToDoubleOrNull(dt, i, 40)?.ToString("0.00"); + model.ComplianceOpinion = GetDataSetValue(dt, i, 41); + model.PtyAPdctName = GetDataSetValue(dt, i, 42); + model.PytAPdctCode = GetDataSetValue(dt, i, 43); + model.PtyBPdctName = GetDataSetValue(dt, i, 44); + model.PytBPdctCode = GetDataSetValue(dt, i, 45); + model.CrossBorderTransactions = BoolMap[GetDataSetValue(dt, i, 46)]; + model.Blank1 = GetDataSetValue(dt, i, 47); + model.Blank2 = GetDataSetValue(dt, i, 48); - var cacheValue = model.ConfirmationNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + var notinalPrincipleAmt = GetDataSetValueToDouble(dt, i, 18); + + var cacheValue = (model.ConfirmationNo ?? "").ToString(); + if (cacheValue.IsNullOrWhiteSpace()) + { + continue; + } + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -736,7 +286,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (_operationType == OptFlagsEnum.U) { - Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); + var reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); var settleList = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionTermination, formatInfoTag(model, false, true)); if (settleList.Count > 0) { @@ -756,27 +306,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.ConfirmationID = note.BizId;//确认书编号; } - string[] confirmationAttTuple = GetDataSetValue(dt, i, 19).Split(','); - foreach (var item in confirmationAttTuple) - { - if (string.IsNullOrWhiteSpace(item)) - { - continue; - } - if (model.ConfirmationAttTuple == null) - { - model.ConfirmationAttTuple = new List(); - } - model.ConfirmationAttTuple.Add(new ConfirmationAttModel() { ConfirmationAtt = item }); - path = Path.Combine(sourcePath, item); - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - } - model.UndrlygAssetTuple = GetUndrlygAssetModel(model.ConfirmationNo); - model.PerformanceCollTuple = GetPerformanceGuaranteeAttModel(model.ConfirmationNo); + //var confirmationAttTuple = GetDataSetValue(dt, i, 19).Split(','); + //foreach (var item in confirmationAttTuple) + //{ + // if (string.IsNullOrWhiteSpace(item)) + // { + // continue; + // } + // model.ConfirmationAttTuple ??= new List(); + // model.ConfirmationAttTuple.Add(new ConfirmationAttModel() { ConfirmationAtt = item }); + // path = Path.Combine(sourcePath, item); + // if (!ReportStatus.CheckFileLength(path)) + // { + // break; + // } + // fileList.Add(path); + //} + model.UndrlygAssetTuple = GetUndrlygAssetModel(model.ConfirmationNo, model.UndrlygAssetNo, model.UndrlygAssetType); + model.PerformanceCollTuple = GetPerformanceGuaranteeAttModel(model.ConfirmationNo, model.PerformanceGuaranteeType); + + SetOptionStructureModelFromExcel(model); path = Path.Combine(sourcePath, model.PerformanceGuaranteeAtt); if (!string.IsNullOrWhiteSpace(model.PerformanceGuaranteeAtt)) { @@ -797,7 +346,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } model.ExceID = base.formatExceID(); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.InfoCache = $"{{\"NotinalPrincipleAmt\":\"{model.NotinalPrincipleAmt}\",\"DueDate\":\"{model.DueDate}\",\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Template\"}}"; note.ExceId = model.ExceID; @@ -818,29 +367,33 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - private List GetPerformanceGuaranteeAttModel(string masterAgrmtNo) + private List GetPerformanceGuaranteeAttModel(string masterAgrmtNo, string performanceGuaranteeType) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("履约担保品详情明细")) { - DataTable dt = _excelDataSource.Tables["履约担保品详情明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["履约担保品详情明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != masterAgrmtNo) + if (dt.Rows[i][0]?.ToString().Trim() != masterAgrmtNo) { continue; } - PerformanceGuaranteeAttModel model = new PerformanceGuaranteeAttModel(); - - model.PerformanceCollType = ConsReport.PerformanceCollTypeMap[GetDataSetValue(dt, i, 1)]; - model.PerformanceCollRange = ConsReport.PerformanceCollRangeMap[GetDataSetValue(dt, i, 2)]; - model.MultiConfirmationID = GetDataSetValue(dt, i, 3); + var model = new PerformanceGuaranteeAttModel + { + PerformanceGuaranteeType = performanceGuaranteeType, + ConfirmationNo = GetDataSetValue(dt, i, 0), + PerformanceCollType = ConsReport.PerformanceCollTypeMap[GetDataSetValue(dt, i, 1)], + PerformanceCollRange = ConsReport.PerformanceCollRangeMap[GetDataSetValue(dt, i, 2)], + MultiConfirmationID = GetDataSetValue(dt, i, 3), + Remarks = GetDataSetValue(dt, i, 4) + }; result.Add(model); } @@ -848,12 +401,95 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - private List GetUndrlygAssetModel(string masterAgrmtNo) + private List GetUndrlygAssetModel(string masterAgrmtNo, string undrlygAssetNo, string undrlygAssetType) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("标的详情明细")) { - DataTable dt = _excelDataSource.Tables["标的详情明细"]; + var dt = _excelDataSource.Tables["标的详情明细"]; + for (var i = 1; i < dt.Rows.Count; i++) + { + if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) + { + //第一列空白说明数据结束了; + break; + } + if (dt.Rows[i][0]?.ToString().Trim() != masterAgrmtNo) + { + continue; + } + + var model = new UndrlygAssetModel + { + ConfirmationNo = GetDataSetValue(dt, i, 0), + UndrlygAssetDtldType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 1)], + UndrlygAssetName = GetDataSetValue(dt, i, 2), + UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 3), + UndrlygAssetCode = GetDataSetValue(dt, i, 4), + UndrlygAssetAmt = GetDataSetValue(dt, i, 5) + }; + model.ContractMultiplier = GetDataSetValueToDoubleOrNull(dt, i, 6)?.ToString() ?? ""; + + model.UndrlygAssetNo = undrlygAssetNo; + model.MultiOrderOptionType = MultiOrderOptionTypeMap[GetDataSetValue(dt, i, 7)]; + + model.UndrlygAssetNotinalPrincipleAmtRMB = GetDataSetValueToDoubleOrNull(dt, i, 8)?.ToString(); + model.OpeningPrice = GetDataSetValueToDoubleOrNull(dt, i, 9)?.ToString(); + + model.UndrlygAssetType = undrlygAssetType; + + var currencyStr = GetDataSetValue(dt, i, 10); + currencyStr = currencyStr == "其他" ? "Other" : currencyStr; + if (!Enum.TryParse(currencyStr, out CurrencyEnum currency)) + { + model.OpeningPriceCurrency = ""; + } + else + { + model.OpeningPriceCurrency = ((int)currency).ToString(); + } + + model.Blank1 = GetDataSetValue(dt, i, 11); + model.Blank2 = GetDataSetValue(dt, i, 12); + + result.Add(model); + } + } + return result; + } + + private void SetOptionStructureModelFromExcel(OptionConfirmationModel model) + { + var tbName = ""; + + switch (model.OptionStructureType) + { + case "0": + tbName = "期权结构类型详情(香草及其组合)"; + break; + case "1": + tbName = "期权结构类型详情(二元及其组合)"; + break; + case "2": + tbName = "期权结构类型详情(障碍及其组合)"; + break; + case "3": + tbName = "期权结构类型详情(自动赎回)"; + break; + case "4": + tbName = "期权结构类型详情(区间累计)"; + break; + case "5": + tbName = "期权结构类型详情(安全气囊)"; + break; + case "99": + tbName = "期权结构类型详情(其他)"; + break; + } + + if (_excelDataSource != null && _excelDataSource.Tables.Contains(tbName)) + { + DataTable dt = _excelDataSource.Tables[tbName]; for (int i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) @@ -861,28 +497,147 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != masterAgrmtNo) + if (dt.Rows[i][0]?.ToString().Trim() != model.ConfirmationNo) { continue; } - UndrlygAssetModel model = new UndrlygAssetModel(); - - model.UndrlygAssetDtldType = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 1)]; - model.UndrlygAssetName = GetDataSetValue(dt, i, 2); - model.UndrlygAssetTradgPlc = ConsReport.UndrlygAssetTradgPlceMap[GetDataSetValue(dt, i, 3)]; - model.UndrlygAssetCode = GetDataSetValue(dt, i, 4); - model.UndrlygAssetAmt = GetDataSetValue(dt, i, 5); - - result.Add(model); + switch (model.OptionStructureType) + { + case "0": + model.VanillaOptionStructureSubclass = VanillaOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.VanillaStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.VanillaStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.VanillaStrikePriceCoefficientThree = GetDataSetValue(dt, i, 4); + model.VanillaStrikePriceCoefficientFour = GetDataSetValue(dt, i, 5); + model.VanillaEngagementRateOne = GetDataSetValue(dt, i, 6); + model.VanillaEngagementRateTwo = GetDataSetValue(dt, i, 7); + model.VanillaEngagementRateThree = GetDataSetValue(dt, i, 8); + model.VanillaEngagementRateFour = GetDataSetValue(dt, i, 9); + model.VanillaBackCoverYield = GetDataSetValue(dt, i, 10); + model.VanillaCappingYield = GetDataSetValue(dt, i, 11); + model.VanillaBlank1 = GetDataSetValue(dt, i, 12); + model.VanillaBlank2 = GetDataSetValue(dt, i, 13); + break; + case "1": + model.DigitalOptionStructureSubclass = DigitalOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.DigitalStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.DigitalStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.DigitalStrikePriceCoefficientThree = GetDataSetValue(dt, i, 4); + model.DigitalEngagementRateOne = GetDataSetValue(dt, i, 5); + model.DigitalEngagementRateTwo = GetDataSetValue(dt, i, 6); + model.DigitalEngagementRateThree = GetDataSetValue(dt, i, 7); + model.DigitalYieldOneNonAnnualized = GetDataSetValue(dt, i, 8); + model.DigitalYieldTwoNonAnnualized = GetDataSetValue(dt, i, 9); + model.DigitalYieldThreeNonAnnualized = GetDataSetValue(dt, i, 10); + model.DigitalYieldFourNonAnnualized = GetDataSetValue(dt, i, 11); + model.DigitalBlank1 = GetDataSetValue(dt, i, 12); + model.DigitalBlank2 = GetDataSetValue(dt, i, 13); + break; + case "2": + model.BarrierOptionStructureSubclass = BarrierOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.BarrierStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.BarrierStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.BarrierEngagementRateOne = GetDataSetValue(dt, i, 4); + model.BarrierEngagementRateTwo = GetDataSetValue(dt, i, 5); + model.BarrierKnockInPriceCoefficient = GetDataSetValue(dt, i, 6); + model.BarrierKnockOutPriceCoefficientOne = GetDataSetValue(dt, i, 7); + model.BarrierKnockOutYieldOneNonAnnualized = GetDataSetValue(dt, i, 8); + model.BarrierKnockOutPriceCoefficientTwo = GetDataSetValue(dt, i, 9); + model.BarrierKnockOutYieldTwoNonAnnualized = GetDataSetValue(dt, i, 10); + model.BarrierObservationType = BarrierObservationTypeMap[GetDataSetValue(dt, i, 11)]; + model.BarrierBackCoverYield = GetDataSetValue(dt, i, 12); + model.BarrierUnknockedYield = GetDataSetValue(dt, i, 13); + model.BarrierBlank1 = GetDataSetValue(dt, i, 14); + model.BarrierBlank2 = GetDataSetValue(dt, i, 15); + break; + case "3": + model.AutoCallableOptionStructureSubclass = AutoCallableOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.AutoCallableEngagementRate = GetDataSetValueToDouble(dt, i, 2).ToString(); + model.AutoCallableStrikePriceCoefficient = GetDataSetValue(dt, i, 3); + model.AutoCallableKnockOutPriceCoefficient = AddBrackets(GetDataSetValue(dt, i, 4)); + model.AutoCallableKnockOutYieldAnnualized = AddBrackets(GetDataSetValue(dt, i, 5)); + model.AutoCallableKnockOutObservationDay = AddBrackets(GetDataSetValue(dt, i, 6)); + model.AutoCallableKnockOutSettlementDay = AddBrackets(GetDataSetValue(dt, i, 7)); + model.AutoCallableKnockInPriceCoefficient = AddBrackets(GetDataSetValue(dt, i, 8)); + model.AutoCallableKnockInObservationDay = AddBrackets(GetDataSetValue(dt, i, 9)); + model.AutoCallableDividendYieldAnnualized = GetDataSetValue(dt, i, 10); + model.AutoCallableMinimumYieldAnnualized = GetDataSetValue(dt, i, 11); + model.AutoCallableMinimumPrincipalProtectionRatio = GetDataSetValueToDouble(dt, i, 12).ToString(); + model.AutoCallableWhetherDiscountedWarehouseType = + AutoCallableWhetherDiscountedWarehouseTypeMap[GetDataSetValue(dt, i, 13)]; + model.AutoCallableWhetherRevenueEnhancedType = + AutoCallableWhetherRevenueEnhancedTypeMap[GetDataSetValue(dt, i, 14)]; + model.AutoCallableWhetherFixedCouponNote = + AutoCallableWhetherRevenueEnhancedTypeMap[GetDataSetValue(dt, i, 15)]; + model.AutoCallableWhetherKnockInPriceCoefficientIsVariable = + AutoCallableWhetherKnockInPriceCoefficientIsVariableMap[GetDataSetValue(dt, i, 16)]; + model.AutoCallableWhetherKnockOutPriceCoefficientIsVariable = + AutoCallableWhetherKnockOutPriceCoefficientIsVariableMap[GetDataSetValue(dt, i, 17)]; + model.AutoCallableWhetherKnockOutYieldIsVariable = + AutoCallableWhetherKnockOutYieldIsVariableMap[GetDataSetValue(dt, i, 18)]; + model.AutoCallableWhetherDividendYieldIsVariable = + AutoCallableWhetherDividendYieldIsVariableMap[GetDataSetValue(dt, i, 19)]; + model.AutoCallableBlank1 = GetDataSetValue(dt, i, 20); + model.AutoCallableBlank2 = GetDataSetValue(dt, i, 21); + break; + case "4": + model.RangeAccrualOptionStructureSubclass = + RangeAccrualOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.RangeAccrualStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.RangeAccrualStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.RangeAccrualStrikePriceCoefficientThree = GetDataSetValue(dt, i, 4); + model.RangeAccrualStrikePriceCoefficientFour = GetDataSetValue(dt, i, 5); + model.RangeAccrualEngagementRate = GetDataSetValue(dt, i, 6); + model.RangeAccrualOneNonAnnualized = GetDataSetValue(dt, i, 7); + model.RangeAccrualTwoNonAnnualized = GetDataSetValue(dt, i, 8); + model.RangeAccrualThreeNonAnnualized = GetDataSetValue(dt, i, 9); + model.RangeAccrualFourNonAnnualized = GetDataSetValue(dt, i, 10); + //model.RangeAccrualMinimumYieldAnnualized = GetDataSetValue(dt, i, 11); + model.RangeAccrualBlank1 = GetDataSetValue(dt, i, 11); + model.RangeAccrualBlank2 = GetDataSetValue(dt, i, 12); + break; + case "5": + model.AirbagOptionStructureSubclass = + AirbagOptionStructureSubclassMap[GetDataSetValue(dt, i, 1)]; + model.AirbagStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.AirbagStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.AirbagStrikePriceCoefficientThree = GetDataSetValue(dt, i, 4); + model.AirbagStrikePriceCoefficientFour = GetDataSetValue(dt, i, 5); + model.AirbagEngagementRateOne = GetDataSetValue(dt, i, 6); + model.AirbagEngagementRateTwo = GetDataSetValue(dt, i, 7); + model.AirbagEngagementRateThree = GetDataSetValue(dt, i, 8); + model.AirbagKnockInPriceCoefficient = GetDataSetValue(dt, i, 9); + model.AirbagBackCoverYield = GetDataSetValue(dt, i, 10); + model.AirbagCappingYield = GetDataSetValue(dt, i, 11); + model.AirbagBlank1 = GetDataSetValue(dt, i, 12); + model.AirbagBlank2 = GetDataSetValue(dt, i, 13); + break; + case "99": + model.OthersOptionStructureSubclass = GetDataSetValue(dt, i, 1); + model.OthersStrikePriceCoefficientOne = GetDataSetValue(dt, i, 2); + model.OthersStrikePriceCoefficientTwo = GetDataSetValue(dt, i, 3); + model.OthersStrikePriceCoefficientThree = GetDataSetValue(dt, i, 4); + model.OthersStrikePriceCoefficientFour = GetDataSetValue(dt, i, 5); + model.OthersEngagementRateOne = GetDataSetValue(dt, i, 6); + model.OthersEngagementRateTwo = GetDataSetValue(dt, i, 7); + model.OthersEngagementRateThree = GetDataSetValue(dt, i, 8); + model.OthersEngagementRateFour = GetDataSetValue(dt, i, 9); + model.OthersBarrierPricesCoefficientOne = GetDataSetValue(dt, i, 10); + model.OthersBarrierPricesCoefficientTwo = GetDataSetValue(dt, i, 11); + model.OthersBackCoverYield = GetDataSetValue(dt, i, 12); + model.OthersCappingYield = GetDataSetValue(dt, i, 13); + model.OthersBlank1 = GetDataSetValue(dt, i, 14); + model.OthersBlank2 = GetDataSetValue(dt, i, 15); + break; + } } } - return result; } private string formatInfoTag(OptionConfirmationModel model, bool suffixType = false, bool isSettlement = false) { - string result = $"{(isSettlement ? "" : BusiDataType.ToString())}_{model.ConfirmationNo.Replace("_", "-")}_{(isSettlement ? "" : "成交_")}"; + var result = $"{(isSettlement ? "" : BusiDataType.ToString())}_{model.ConfirmationNo.Replace("_", "-")}_{(isSettlement ? "" : "成交_")}"; if (suffixType) { result = $"{result}{_operationType}"; @@ -890,45 +645,43 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 4) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.OptionConfirmation != null) { - CheckHelper helper = new Common.CheckHelper(); - CheckHelper cAttHelper = new Common.CheckHelper(); - CheckHelper undrlygHelper = new Common.CheckHelper(); - CheckHelper pAttHelper = new Common.CheckHelper(); - for (int i = 0; i < model.OptionConfirmation.Count; i++) + var helper = new Common.CheckHelper(); + //var cAttHelper = new Common.CheckHelper(); + var undrlygHelper = new Common.CheckHelper(); + var pAttHelper = new Common.CheckHelper(); + for (var i = 0; i < model.OptionConfirmation.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.OptionConfirmation[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); - if (item.ConfirmationAttTuple != null) - { - for (int j = 0; j < item.ConfirmationAttTuple.Count; j++) - { - var listItem = new List(); - var attItem = item.ConfirmationAttTuple[j]; - cAttHelper.ExecuteCheck(attItem, (name, value, msg) => - { - listItem.Add(new SacInfo(name, value, msg)); - }); - if (listItem.Count > 0) - { - var temp = new SacInfo("ConfirmationAttTuple", j); - temp.SubMaps = new List(listItem); - listRoot.Add(temp); - } - } - } if (item.UndrlygAssetTuple != null) { - for (int j = 0; j < item.UndrlygAssetTuple.Count; j++) + for (var j = 0; j < item.UndrlygAssetTuple.Count; j++) { var listItem = new List(); var undrlygItem = item.UndrlygAssetTuple[j]; @@ -938,15 +691,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("UndrlygAssetTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("UndrlygAssetTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (item.PerformanceCollTuple != null) { - for (int j = 0; j < item.PerformanceCollTuple.Count; j++) + for (var j = 0; j < item.PerformanceCollTuple.Count; j++) { var listItem = new List(); var pItem = item.PerformanceCollTuple[j]; @@ -956,16 +711,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("PerformanceCollTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("PerformanceCollTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("OptionConfirmation", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("OptionConfirmation", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -988,11 +748,30 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger().Error(e); }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } return true; } + + //写一个方法,判断字符串前面是否存在括号,如果不存在,就在前面加上括号,后面同理 + private string AddBrackets(string str) + { + if (str.IsNullOrWhiteSpace()) + { + return str; + } + string result = str; + if (!str.StartsWith("(")) + { + result = "(" + result; + } + if (!str.EndsWith(")")) + { + result += ")"; + } + return result; + } } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionTerminationService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionTerminationService.cs index edc0c7cc..c2f56ed3 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionTerminationService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOptionTerminationService.cs @@ -1,8 +1,14 @@ -using System.Data; +using FluentFTP.Helpers; +using MoreLinq; +using NPOI.SS.Formula.Functions; +using System.Data; +using System.Linq; using System.Text.RegularExpressions; using YLErp.BLL; +using YLErp.Commons; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Helpers; using YLErp.Modules.EodModule; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; @@ -10,6 +16,7 @@ using static YLErp.DBModels.Consts.ConsReport; namespace YLErp.Modules.SuperviseReportModule.SAC.Service { + //交易存续期管理 class ReportOptionTerminationService : ReportBaseService { public ReportOptionTerminationService(OptUserInfo optUser) : base(optUser) @@ -22,53 +29,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1007; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, - OptFlagsEnum.U, OptFlagsEnum.D, + OptFlagsEnum.U, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OptionTermination; - List noteList = new List(); - private List _cacheCodeList = new List(); + + readonly List noteList = new(); + private readonly List _cacheCodeList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { - dataList = GetOptionTerminationFromExcel(); + dataList = GetOptionTerminationModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var cacheKey = $"{BusiDataType}"; - var nextDate = _reqInfo.ReportDate.AddDays(1); - var actions = new List() { "系统操作-平仓费", "系统操作-行权费" }; - using (var db = new YLContext()) - { - dataList.AddRange(GetOptionTerminationExtensionTimeFromDb(db, cacheKey, nextDate)); - - dataList.AddRange(GetOptionTerminationSettlementFromDb(db, cacheKey, nextDate)); - } - } - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); - + } noData = dataList.Count == 0; model.OptionTermination = dataList; @@ -78,7 +71,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(OptionTerminationModel model, List fileList, string tag) { var isExtensionTime = model.DurationOperationType == ConsReport.OperationTypeMap["展期"]; - DateTime date = DateTime.MinValue; + var date = DateTime.MinValue; if (isExtensionTime) { DateTime.TryParse(model.RenewalDate, out date); @@ -88,14 +81,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime.TryParse(model.ExpirationDate, out date); } var extensionTimeInfo = model.DurationOperationType == ConsReport.OperationTypeMap["展期"] ? "-" : ""; - List notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_{_operationType}", true);//添加了operationType,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_{_operationType}", true);//添加了operationType,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 //永远查找现有成功报送了结的新增记录,而不是修改; var note = notes.LastOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(model, extensionTimeInfo: extensionTimeInfo)) && O.InfoCache.Contains(date.ToString("yyyy-MM-dd"))); if (note == null) { if (isExtensionTime) { - string oldDateStr = ""; + var oldDateStr = ""; var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1004_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; if (DateTime.TryParse(oldDateStr, out var oldDate)) @@ -127,7 +120,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service //多次U的时候,每次用最新的tag来赋值SubFileTag if (isExtensionTime) { - string oldDateStr = ""; + var oldDateStr = ""; var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1004_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; if (DateTime.TryParse(oldDateStr, out var oldDate)) @@ -169,374 +162,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - /// - /// 从数据库获取展期记录 - /// - /// - /// - /// - /// - private List GetOptionTerminationExtensionTimeFromDb(YLContext db, string cacheKey, DateTime nextDate) - { - List dataList = new List(); - var extensionTimeList = (from et in db.ExtensionTime - join t in db.trade - on et.TradeId equals t.id - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - where - et.OptDate >= _reqInfo.ReportDate && - et.OptDate < nextDate && - t.TradeType != "收益互换" && - tr.IsValid - select new - { - et.id, - et.TradeId, - et.OldMaturityDate, - et.NewMaturityDate, - et.IsValid, - et.OptDate, - tr.ContractCode, - t.StockEqvNotional - }).ToArray(); - - List ids = extensionTimeList.Select(O => O.TradeId).ToList(); - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - foreach (var item in extensionTimeList) - { - var cacheValue = item.id.ToString(); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - if (metaDic.ContainsKey(item.TradeId)) - { - var metaInfo = metaDic[item.TradeId]; - if (metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) && TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - var info = new OptionTerminationModel(); - - info.TradeId = item.TradeId.ToString(); - info.ConfirmationNo = item.ContractCode; - List notes = base.GetReportNotes(ReportType, $"_{info.ConfirmationNo.Replace("_", "-")}_", true); - var note = notes.FirstOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(info, extensionTimeInfo: item.id.ToString()))); - if (!item.IsValid) - {//当前信息是无效的,报送过就是废止,否则就不需要报 - if (note != null) - { - info.OperationType = OptFlagsEnum.D; - } - else - { - continue; - } - } - else - {//当前信息是有效的,报送过,就是修改,否则就是新增 - if (note == null) - { - info.OperationType = OptFlagsEnum.A; - } - else - { - if (!note.changeStatus) - { - continue; - } - info.OperationType = OptFlagsEnum.U; - } - } - if (info.OperationType != _operationType) - { - continue; - } - switch (info.OperationType) - { - case OptFlagsEnum.A: - note = new SACReportNotes() - { - IsValid = true, - }; - break; - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId; - } - var infoCache = JsonHelper.Deserialize>(note?.InfoCache) ?? new Dictionary(); - var oldMaturityDate = infoCache.TryGetValue("NewMaturityDate", out var date) ? DateTime.Parse(date) : item.OldMaturityDate; - var newMaturityDate = item.NewMaturityDate; - if (info.OperationType == OptFlagsEnum.D) - { - oldMaturityDate = infoCache.TryGetValue("OldMaturityDate", out date) ? DateTime.Parse(date) : item.OldMaturityDate; - newMaturityDate = infoCache.TryGetValue("NewMaturityDate", out date) ? DateTime.Parse(date) : item.NewMaturityDate; - } - else - { - if (newMaturityDate <= oldMaturityDate) - { - throw new ServiceException($"确认书编号:{item.ContractCode}\r\n新展期日:{newMaturityDate.ToString("yyyy-MM-dd")}\r\n原到期日:{oldMaturityDate.ToString("yyyy-MM-dd")}\r\n新展期日应大于原到期日"); - } - } - //info.ExpirationDate = item.OldMaturityDate.ToString("yyyy-MM-dd"); - info.DurationOperationType = OperationTypeMap["展期"]; - info.RenewalDate = newMaturityDate.ToString("yyyy-MM-dd"); - info.Balance = Math.Max(item.StockEqvNotional, 0).ToString("0.00"); - info.ExceID = base.formatExceID(); - - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.ExceId = info.ExceID; - note.InfoCache = $"{{\"Tag\":\"{info.ConfirmationNo}\",\"OldMaturityDate\":\"{oldMaturityDate.ToString("yyyy-MM-dd")}\",\"NewMaturityDate\":\"{newMaturityDate.ToString("yyyy-MM-dd")}\",\"Source\":\"System\"}}"; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true, item.id.ToString()); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - return dataList; - } - /// - /// 从数据库获取结算信息 - /// - /// - /// - /// - /// - private IEnumerable GetOptionTerminationSettlementFromDb(YLContext db, string cacheKey, DateTime nextDate) - { - List dataList = new List(); - var actions = new List() { "系统操作-平仓费", "系统操作-行权费" }; - //当天有回退记录的资金记录 - var query = (from t in db.trade - join log in db.TradeAuditLog on t.id equals log.TradeId - join tc in db.trade_cash on t.id equals tc.TradeId - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - where log.OptDate >= _reqInfo.ReportDate && log.OptDate < nextDate && log.OptType == "交易回退" && t.ParentTradeId == 0 && - actions.Contains(tc.Action) && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType != "收益互换" && tr.IsValid - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - tc.ValueDate, - tc.Notional, - tc.UnwindNotional, - tc.Amount, - t.OriginalNotional, - tr.ContractCode, - t.QuoteCurrency, - t.SettlementCurrency - }).Union//当天有了结的资金记录 - (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - where tc.ValueDate == _reqInfo.DataDate && - t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid && - /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType != "收益互换" && - actions.Contains(tc.Action) - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - tc.ValueDate, - tc.Notional, - tc.UnwindNotional, - tc.Amount, - t.OriginalNotional, - tr.ContractCode, - t.QuoteCurrency, - t.SettlementCurrency - }).ToArray().GroupBy(O => new { O.id, O.ValueDate }).ToDictionary(K => K.Key, V => V.ToList()); - List ids = query.Keys.Select(O => O.id).ToList(); - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - foreach (var item in query) - { - string cacheValue = item.Key.id.ToString() + item.Key.ValueDate.ToString("yyyy-MM-dd"); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - if (metaDic.ContainsKey(item.Key.id)) - { - var metaInfo = metaDic[item.Key.id]; - if (metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) && TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - var info = new OptionTerminationModel(); - - info.TradeId = item.Key.id.ToString(); - var validItem = item.Value.FirstOrDefault(O => O.tradecashValid); - var invalidItem = item.Value.FirstOrDefault(O => !O.tradecashValid); - var obj = invalidItem ?? validItem; - info.ExpirationDate = obj.ValueDate.ToString("yyyy-MM-dd"); - info.ConfirmationNo = obj.ContractCode; - List notes = base.GetReportNotes(ReportType, $"_{info.ConfirmationNo.Replace("_", "-")}_", true); - var note = notes.FirstOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(info)) && O.InfoCache.Contains(info.ExpirationDate)); - if (validItem == null && invalidItem != null) - {//有效资金记录不存在,无效资金记录存在时,当天报送过就是废止,否则就不需要报 - obj = invalidItem; - if (note != null) - { - info.OperationType = OptFlagsEnum.D; - } - else - { - continue; - } - } - else - {//有效资金记录存在时,当天报送过,就是修改,否则就是新增 - obj = validItem; - if (note == null) - { - info.OperationType = OptFlagsEnum.A; - } - else - { - if (!note.changeStatus) - { - continue; - } - info.OperationType = OptFlagsEnum.U; - } - } - - if (info.OperationType != _operationType) - { - continue; - } - switch (info.OperationType) - { - case OptFlagsEnum.A: - note = new SACReportNotes() - { - IsValid = true, - }; - break; - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId; - } - info.ExpirationDate = obj.ValueDate.ToString("yyyy-MM-dd"); - info.DurationOperationType = OperationTypeMap["终止"]; - var quoteRate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(obj.QuoteCurrency, "CNY", obj.ValueDate); - var settlementRate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(obj.SettlementCurrency, "CNY", obj.ValueDate); - var currentStockEqvNotional = Math.Round(Math.Min((obj.UnwindNotional / obj.OriginalNotional * obj.OriginalStockEqvNotional) ?? 0, obj.OriginalStockEqvNotional ?? 0) * quoteRate, 2); - var latestStockEqvNotional = Math.Round(Math.Min((obj.Notional / obj.OriginalNotional * obj.OriginalStockEqvNotional) ?? 0, obj.OriginalStockEqvNotional ?? 0) * quoteRate, 2); - //是否全部了结 - var isComplete = Math.Abs(obj.Notional - (obj.UnwindNotional ?? 0)) < 1e-4; - if (isComplete) - { - var tcArr = DbContext.trade_cash.Where(O => O.TradeId == obj.id && O.ValueDate < obj.ValueDate && actions.Contains(O.Action)).ToArray(); - var originalStockEqvNotional = obj.OriginalStockEqvNotional ?? 0; - currentStockEqvNotional = originalStockEqvNotional - tcArr.Sum(O => Math.Round(Math.Min((O.UnwindNotional / obj.OriginalNotional * originalStockEqvNotional) ?? 0, originalStockEqvNotional) * quoteRate, 2)); - latestStockEqvNotional = currentStockEqvNotional; - } - info.TerminationAmount = currentStockEqvNotional.ToString("0.00"); - info.Balance = Math.Max((latestStockEqvNotional - currentStockEqvNotional), 0).ToString("0.00"); - info.AmountPaidThisTime = (obj.Amount * settlementRate).ToString(); - info.ExceID = base.formatExceID(); - - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.InfoCache = $"{{\"Tag\":\"{info.ConfirmationNo}\",\"ValueDate\":\"{info.ExpirationDate}\",\"Source\":\"System\"}}"; - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - return dataList; - } /// /// 格式化报送标签,用于关联报表和业务信息 /// @@ -546,25 +171,50 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private string formatInfoTag(OptionTerminationModel model, bool suffixType = false, string extensionTimeInfo = "") { - string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_{(string.IsNullOrWhiteSpace(extensionTimeInfo) ? "了结" : ($"_{extensionTimeInfo}_展期"))}_"; + var operationTag = ""; + if (model.DurationOperationType == ConsReport.OperationTypeMap["敲入"] || model.DurationOperationType == ConsReport.OperationTypeMap["敲出"]) + { + operationTag = $"_{model.DurationOperationType}"; + } + string result = $"{formatInfoTagStr(model)}{operationTag}_{model.DurationEventNO}_"; if (suffixType) { result = $"{result}{_operationType}"; } return result; } + + private string formatInfoTagStr(OptionTerminationModel model, string extensionTimeInfo = "") + { + string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_{(string.IsNullOrWhiteSpace(extensionTimeInfo) ? "了结" : ($"_{extensionTimeInfo}_展期"))}"; + return result; + } + + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 5 && arr.Length != 6) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + /// /// 从Excel获取结算信息 /// /// - private List GetOptionTerminationFromExcel() + private List GetOptionTerminationModel(ref List fileList) { - List result = new List(); + var result = new List(); + string path = ""; if (_excelDataSource != null && _excelDataSource.Tables.Contains("期权交易存续期明细")) { - var cacheKey = $"{BusiDataType}"; - DataTable dt = _excelDataSource.Tables["期权交易存续期明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["期权交易存续期明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -572,14 +222,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } var optType = OptFlagsEnum.NONE; - switch (dt.Rows[i][1]?.ToString()) + switch (dt.Rows[i][2]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -589,63 +245,55 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - OptionTerminationModel model = new OptionTerminationModel(); - - model.ConfirmationNo = GetDataSetValue(dt, i, 0); - model.OperationType = optType; - model.ExpirationDate = GetDataSetValue(dt, i, 2); - model.DefaultingParty = ConsReport.OptionTraderMap[GetDataSetValue(dt, i, 3)]; - model.DefaultEvent = GetDataSetValue(dt, i, 4); - model.RenewalDate = GetDataSetValue(dt, i, 5); - model.DurationOperationType = ConsReport.OperationTypeMap[GetDataSetValue(dt, i, 6)]; - model.TerminationAmount = GetDataSetValue(dt, i, 7); - model.Balance = GetDataSetValue(dt, i, 8); - model.AmountPaidThisTime = GetDataSetValue(dt, i, 9); - - var isExtensionTime = model.DurationOperationType == ConsReport.OperationTypeMap["展期"]; - DateTime date = DateTime.MinValue; - if (isExtensionTime) + DateTime.TryParse(GetDataSetValue(dt, i, 4), out DateTime expirationDate); + var model = new OptionTerminationModel { - DateTime.TryParse(model.RenewalDate, out date); - } - else + DurationEventNO = GetDataSetValue(dt, i, 0), + ConfirmationNo = GetDataSetValue(dt, i, 1), + OperationType = optType, + DurationOperationType = ConsReport.OperationTypeMap[GetDataSetValue(dt, i, 3)], + ExpirationDate = expirationDate == DateTime.MinValue ? null : expirationDate.ToString("yyyy-MM-dd"), + RenewalDate = GetDataSetValue(dt, i, 5), + }; + model.DefaultingParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 6)]; + model.DefaultEvent = GetDataSetValue(dt, i, 7); + model.TerminationAmount = GetDataSetValue(dt, i, 8); + model.Balance = GetDataSetValueToDoubleOrNull(dt, i, 9)?.ToString("0.00"); + model.AmountPaidThisTime = GetDataSetValue(dt, i, 10); + model.ClosedTransactionsRealRateReturn = GetDataSetValue(dt, i, 11); + // model.TerminationAmount = GetDataSetValueToDouble(dt, i, 8).ToString("0.00"); + // model.Balance = GetDataSetValueToDouble(dt, i, 9).ToString("0.00"); + // model.AmountPaidThisTime = GetDataSetValueToDouble(dt, i, 10).ToString("0.00"); + // model.ClosedTransactionsRealRateReturn = GetDataSetValueToDouble(dt, i, 11).ToString("0.00"); + model.OptionDurationManagementAtt = GetDataSetValue(dt, i, 12); + var eventStatus = ""; + switch (model.DurationOperationType) { - DateTime.TryParse(model.ExpirationDate, out date); + case "05": + eventStatus = "01"; + break; + case "06": + eventStatus = "02"; + break; } - var cacheValue = model.ConfirmationNo + date.ToString("yyyy-MM-dd"); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + model.BarrierEventStatus = eventStatus; + model.Blank1 = GetDataSetValue(dt, i, 14); + model.Blank2 = GetDataSetValue(dt, i, 15); + + DateTime.TryParse(model.ExpirationDate, out DateTime date); + var cacheValue = $"{model.ConfirmationNo}_{model.DurationEventNO}_"; + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - var extensionTimeInfo = model.DurationOperationType == ConsReport.OperationTypeMap["展期"] ? "-" : ""; - List notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_", true); - //永远查找现有成功报送了结的新增记录,而不是修改; - var note = notes.LastOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(model, extensionTimeInfo: extensionTimeInfo)) && O.InfoCache.Contains(date.ToString("yyyy-MM-dd"))); + List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); + var note = notes.LastOrDefault(O => O.InfoCache.Contains(date.ToString("yyyy-MM-dd"))); if (note == null && _operationType == OptFlagsEnum.A) { - if (isExtensionTime) + note = new SACReportNotes() { - string oldDateStr = ""; - var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1004_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); - oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; - if (DateTime.TryParse(oldDateStr, out var oldDate)) - { - oldDateStr = $",\"OldMaturityDate\":\"{oldDate.ToString("yyyy-MM-dd")}\""; - } - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\"{oldDateStr},\"NewMaturityDate\":\"{date.ToString("yyyy-MM-dd")}\",\"Source\":\"Template\"}}", - IsValid = true, - }; - } - else - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"ValueDate\":\"{date.ToString("yyyy-MM-dd")}\",\"Source\":\"Template\"}}", - IsValid = true, - }; - } + IsValid = true, + }; } else { @@ -667,22 +315,31 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service default: throw new ServiceException("未知操作类型"); } - note.InfoCache = Regex.Replace(note.InfoCache, "(?<=NewMaturityDate\":\")[^\"]+ (?= \")", date.ToString("yyyy-MM-dd")); } if (model.OperationType != OptFlagsEnum.A) { model.BizID = note.BizId;//确认书编号; } + path = Path.Combine(sourcePath, model.OptionDurationManagementAtt); + if (!string.IsNullOrWhiteSpace(model.OptionDurationManagementAtt)) + { + if (!ReportStatus.CheckFileLength(path)) + { + break; + } + fileList.Add(path); + } model.ExceID = base.formatExceID(); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); + note.InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"ValueDate\":\"{date.ToString("yyyy-MM-dd")}\",\"DurationEventNO\":\"{model.DurationEventNO}\"}}"; note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; note.FileTag = FileTag; note.ReportType = ReportType; note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(model, true, extensionTimeInfo); + note.InfoTag = formatInfoTag(model, true); note.OptTime = note.CreateTime; note.RetCode = ""; note.RetMsg = ""; @@ -698,13 +355,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.OptionTermination != null) { - CheckHelper helper = new Common.CheckHelper(); - for (int i = 0; i < model.OptionTermination.Count; i++) + var helper = new Common.CheckHelper(); + for (var i = 0; i < model.OptionTermination.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.OptionTermination[i]; helper.ExecuteCheck(item, (name, value, msg) => { @@ -712,8 +369,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listRoot.Count > 0) { - var errMsg = new SacInfo("OptionTermination", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("OptionTermination", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -736,7 +396,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger().Error(e); }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOtherReportService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOtherReportService.cs index 76eb8d8e..c0af87f8 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOtherReportService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportOtherReportService.cs @@ -15,25 +15,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1010; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OtherReport; - List noteList = new List(); + + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -63,7 +61,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service errMsg = "其他事项报告非新增报送时,对应的业务编码不应为空"; return false; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(req.OtherReportDate?.ToString("yyyy-MM-dd"))).Where(O => O.ReportDate == req.OtherReportDate).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(req.OtherReportDate?.ToString("yyyy-MM-dd"))).Where(O => O.ReportDate == req.OtherReportDate).FirstOrDefault(); if (note == null) { errMsg = $"{req.OtherReportDate?.ToString("yyyy-MM-dd")}不存在报送成功的其他事项报告记录,请重新选择"; @@ -72,7 +70,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (req.OtherReportStatus == OptFlagsEnum.U) { var fileIds = tempFilesService.QueryTempFile(req.ReportDate, "其他事项报告").Select(O => O.id.ToString()).ToArray(); - string[] fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (!fileIds.Except(fileIdArr).Any()) { errMsg = $"{req.ReportDate.ToString("yyyy-MM-dd")}已上传其他事项报告附件都已报送成功,不需要再次报送"; @@ -103,9 +101,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList = new List(); noData = false; var noteKey = formatInfoTag(_reqInfo.ReportDate.ToString("yyyy-MM-dd")); - BodyModel model = new BodyModel(); - model.OtherReport = new OtherReportModel(); - SACReportNotes note = base.GetReportNotes(ReportType, noteKey).FirstOrDefault(); + var model = new BodyModel + { + OtherReport = new OtherReportModel() + }; + var note = base.GetReportNotes(ReportType, noteKey).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -161,8 +161,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { ReportStatus.AddCacheInfo(noteKey, item.fileName); } - var info = new OtherReportFileDetailModel(); - info.OtherReportFile = item.fileName; + var info = new OtherReportFileDetailModel + { + OtherReportFile = item.fileName + }; if (model.OtherReport.OtherReportFileTuple == null) { model.OtherReport.OtherReportFileTuple = new List(); @@ -174,8 +176,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.OtherReport.DetailedDescription = _reqInfo.OtherReportDesc; } model.OtherReport.ExceID = base.formatExceID(); - List notes = base.GetReportNotes(ReportType, noteKey); - noData = (!(model.OtherReport.OtherReportFileTuple?.Count > 0)); + var notes = base.GetReportNotes(ReportType, noteKey); + noData = !(model.OtherReport.OtherReportFileTuple?.Count > 0); if (!noData) { note.id = 0; @@ -198,19 +200,19 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.OtherReport != null) { - List listRoot = new List(); - CheckHelper helper = new CheckHelper(); - CheckHelper detailHelper = new CheckHelper(); + var listRoot = new List(); + var helper = new CheckHelper(); + var detailHelper = new CheckHelper(); helper.ExecuteCheck(model.OtherReport, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.OtherReport.OtherReportFileTuple != null) { - for (int i = 0; i < model.OtherReport.OtherReportFileTuple.Count; i++) + for (var i = 0; i < model.OtherReport.OtherReportFileTuple.Count; i++) { var listItem = new List(); var item = model.OtherReport.OtherReportFileTuple[i]; @@ -220,16 +222,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("OtherReportFileTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("OtherReportFileTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("OtherReport"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("OtherReport") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -239,7 +245,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(string tag, bool suffixType = false) { - string result = $"{BusiDataType}_{tag}_"; + var result = $"{BusiDataType}_{tag}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -247,10 +253,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPerformanceGuaranteeAgrmtService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPerformanceGuaranteeAgrmtService.cs index 52ae67fd..773ea660 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPerformanceGuaranteeAgrmtService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPerformanceGuaranteeAgrmtService.cs @@ -19,151 +19,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1008; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt; - List noteList = new List(); + + readonly List noteList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetPerformanceGuaranteeAgrmtModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var cacheKey = $"{BusiDataType}"; - using (var baseDb = DbContextFactory.GetClientDbContext(null)) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var fileObjList = (from c in baseDb.client - join cf in baseDb.client_file - on c.id equals cf.ClientId - where c.ProcessStatus == "已开户" && cf.HasSent == false && cf.IsValid && - cf.FileTypeName == ConsGlobal.ClientFileType.DateMargin && cf.OptState == _operationType && - ((c.ProcessOptDate >= _reqInfo.ReportDate && c.ProcessOptDate < nextDate && cf.OptDate < nextDate) ||//如果这一天开户,则把这一天之前(含这一天)的所有文件都报送了 - (cf.OptDate >= _reqInfo.ReportDate && cf.OptDate < nextDate && c.ProcessOptDate < _reqInfo.ReportDate))//如果这一天不是开户日期,则只在报送日期大于开户日期时,报送当日修改的文件 - && cf.ApprovalOrder < 1 - select new - { - cf.id, - cf.ProtocolNumber, - cf.MainProtocolNumber, - cf.FilePath, - cf.FileName, - cf.SignDate, - }).ToArray(); - var codes = fileObjList.Select(O => O.MainProtocolNumber); - ExpandoDictionary protocolFileDict = null; - if (codes.Count() > 0) - { - protocolFileDict = new ExpandoDictionary( - baseDb.client_file - .Where(O => O.ApprovalOrder < 1 && O.FileTypeName == ConsGlobal.ClientFileType.EnhanceProtocol && codes.Contains(O.ProtocolNumber) && O.IsValid) - .AsEnumerable() - .GroupBy(O => O.ProtocolNumber) - .ToDictionary(K => K.Key, V => V.FirstOrDefault()) - ); - } - foreach (var item in fileObjList) - { - var info = new PerformanceGuaranteeAgrmtModel(); - info.OperationType = _operationType; - info.MasterAgrmtNo = protocolFileDict[item.MainProtocolNumber ?? ""]?.MainProtocolNumber; - info.SupAgrmtNo = protocolFileDict[item.MainProtocolNumber ?? ""]?.ProtocolNumber; - info.PerformanceGuaranteeAgrmt = item.FileName; - info.SigningDate = item.SignDate?.ToString("yyyy-MM-dd"); - var cacheValue = info.MasterAgrmtNo + "_" + info.SupAgrmtNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{info.PerformanceGuaranteeAgrmt}\",\"Source\":\"System\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.PerformanceGuaranteeAgrmtID = note.BizId; - } - info.ExceID = base.formatExceID(); - if (!ReportStatus.CheckFileLength(item.FilePath)) - { - break; - } - else - { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - } - dataList.Add(info); - fileList.Add(item.FilePath); - note.id = 0; - note.DataId = item.id.ToString(); - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.PerformanceGuaranteeAgrmt = dataList; @@ -172,7 +59,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(PerformanceGuaranteeAgrmtModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model,true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -200,7 +87,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service throw new ServiceException("未知操作类型"); } } - + if (!string.IsNullOrEmpty(model.PerformanceGuaranteeAgrmt)) { fileList.Add(model.PerformanceGuaranteeAgrmt); @@ -225,7 +112,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(PerformanceGuaranteeAgrmtModel model, bool suffixType = false) { - string result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.SupAgrmtNo.Replace("_", "-")}_"; + var result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.SupAgrmtNo.Replace("_", "-")}_{model.PerformanceGuaranteeAgrmt.Replace("_", "-")}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -233,15 +120,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + originalCode = ""; + return infoTag; + } + private List GetPerformanceGuaranteeAgrmtModel(ref List fileList) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("履约保证书明细")) { - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["履约保证书明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["履约保证书明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -251,12 +143,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][2]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -266,20 +164,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - PerformanceGuaranteeAgrmtModel model = new PerformanceGuaranteeAgrmtModel(); - - model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); - model.SupAgrmtNo = GetDataSetValue(dt, i, 1); - model.OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U; - model.PerformanceGuaranteeAgrmt = GetDataSetValue(dt, i, 3); - model.SigningDate = GetDataSetValue(dt, i, 4); - var cacheValue = model.MasterAgrmtNo + "_" + model.SupAgrmtNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + var model = new PerformanceGuaranteeAgrmtModel + { + MasterAgrmtNo = GetDataSetValue(dt, i, 0), + SupAgrmtNo = GetDataSetValue(dt, i, 1), + OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U, + PerformanceGuaranteeAgrmt = GetDataSetValue(dt, i, 3), + SigningDate = GetDataSetValue(dt, i, 4) + }; + var cacheValue = model.MasterAgrmtNo + "_" + model.SupAgrmtNo + "_" + model.PerformanceGuaranteeAgrmt; + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -316,14 +215,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (!string.IsNullOrWhiteSpace(model.PerformanceGuaranteeAgrmt)) { model.ExceID = base.formatExceID(); - string path = Path.Combine(sourcePath, model.PerformanceGuaranteeAgrmt); + var path = Path.Combine(sourcePath, model.PerformanceGuaranteeAgrmt); if (!ReportStatus.CheckFileLength(path)) { break; } else { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); } result.Add(model); fileList.Add(path); @@ -349,23 +248,30 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model.PerformanceGuaranteeAgrmt != null) { - CheckHelper helper = new Common.CheckHelper(); - for (int i = 0; i < model.PerformanceGuaranteeAgrmt.Count; i++) + var helper = new Common.CheckHelper(); + for (var i = 0; i < model.PerformanceGuaranteeAgrmt.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.PerformanceGuaranteeAgrmt[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (listRoot.Count > 0) { - var errMsg = new SacInfo("PerformanceGuaranteeAgrmt", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("PerformanceGuaranteeAgrmt", i) + { + FieldValue = item.MasterAgrmtNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -391,7 +297,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportISDAService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportISDAService.cs index a9d411bb..83424816 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportISDAService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportISDAService.cs @@ -20,19 +20,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1013; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } @@ -40,7 +37,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime minDate = DateTime.MinValue; DateTime maxDate = DateTime.MinValue; protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportISDA; - List noteList = new List(); + + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -59,7 +57,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service case OptFlagsEnum.D: minDate = req.ISDAReportDate.Value.Date.AddDays(-req.ISDAReportDate.Value.Day).AddDays(1); maxDate = req.ISDAReportDate.Value.Date.AddMonths(1).AddDays(-req.ISDAReportDate.Value.Day); - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(req.ISDAReportDate.Value.ToString("yyyy-MM"))).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(req.ISDAReportDate.Value.ToString("yyyy-MM"))).FirstOrDefault(); if (note == null) { errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}不存在报送成功的ISDA定期报告记录,请重新选择"; @@ -86,16 +84,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { fileList = new List(); noData = true; - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; + var model = new BodyModel(); var cacheValue = formatInfoTag(_reqInfo.ISDAReportDate.Value.ToString("yyyy-MM")); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { return model; } - model.PeriodicReportISDA = new PeriodicReportISDAModel(); - model.PeriodicReportISDA.OperationType = _operationType; - SACReportNotes note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); + model.PeriodicReportISDA = new PeriodicReportISDAModel + { + OperationType = _operationType + }; + var note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -128,7 +127,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (_excelDataSource != null) { - DataTable dt = _excelDataSource.Tables["业务统计"]; + var dt = _excelDataSource.Tables["业务统计"]; model.PeriodicReportISDA.Year = _reqInfo.ISDAReportDate.Value.Year.ToString("0000"); model.PeriodicReportISDA.Month = _reqInfo.ISDAReportDate.Value.Month.ToString("0"); model.PeriodicReportISDA.OperationType = _operationType; @@ -151,7 +150,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.PeriodicReportISDA.ExceID = base.formatExceID(); } - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); noData = string.IsNullOrWhiteSpace(model.PeriodicReportISDA?.MainAgreementLastMonthAccumulatedThisYear); if (!noData) { @@ -486,24 +485,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetIncreaseBusinessDetailsThisMonthTuple() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("本月新增业务明细")) { - DataTable dt = _excelDataSource.Tables["本月新增业务明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["本月新增业务明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { - string colHead = dt.Rows[i][0]?.ToString(); + var colHead = dt.Rows[i][0]?.ToString(); if (string.IsNullOrWhiteSpace(colHead) || colHead.Contains("合计")) { //第一列空白说明数据结束了; break; } - ISDAIncreaseBusinessDetailsThisMonthModel model = new ISDAIncreaseBusinessDetailsThisMonthModel(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(); - model.NameOfCounterparty = GetDataSetValue(dt, i, 2).ToString(); - model.NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3).ToString(); - model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4); - model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5); + var model = new ISDAIncreaseBusinessDetailsThisMonthModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(), + NameOfCounterparty = GetDataSetValue(dt, i, 2).ToString(), + NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3).ToString(), + TradeConfirmationNumber = GetDataSetValue(dt, i, 4), + TransactionConfirmationNumber = GetDataSetValue(dt, i, 5) + }; if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace()) { model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber); @@ -516,7 +517,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.InvestmentTargetType = ConsReport.UndrlygAssetTypeMap[GetDataSetValue(dt, i, 11).ToString()]; model.UndrlygAssetName = GetDataSetValue(dt, i, 12).ToString(); model.UndrlygAssetCode = GetDataSetValue(dt, i, 13).ToString(); - model.OptionObjectSecondClass = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 14).ToString()]; + model.OptionObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 14).ToString()]; model.SwapObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15).ToString()]; model.NonAnnualOptionFee = GetDataSetValue(dt, i, 16).ToString(); model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 17).ToString()]; @@ -532,24 +533,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetInventoryBusinessDetailsAtTheEndOfThisMonthTuple() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("本月末存量业务明细")) { - DataTable dt = _excelDataSource.Tables["本月末存量业务明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["本月末存量业务明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { - string colHead = dt.Rows[i][0]?.ToString(); + var colHead = dt.Rows[i][0]?.ToString(); if (string.IsNullOrWhiteSpace(colHead) || colHead.Contains("合计")) { //第一列空白说明数据结束了; break; } - ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel model = new ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(); - model.NameOfCounterparty = GetDataSetValue(dt, i, 2).ToString(); - model.NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3).ToString(); - model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4); - model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5); + var model = new ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(), + NameOfCounterparty = GetDataSetValue(dt, i, 2).ToString(), + NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3).ToString(), + TradeConfirmationNumber = GetDataSetValue(dt, i, 4), + TransactionConfirmationNumber = GetDataSetValue(dt, i, 5) + }; if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace()) { model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber); @@ -563,7 +566,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.UndrlygAssetName = GetDataSetValue(dt, i, 12).ToString(); model.UndrlygAssetCode = GetDataSetValue(dt, i, 13).ToString(); model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 14).ToString(); - model.OptionObjectSecondClass = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15).ToString()]; + model.OptionObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15).ToString()]; model.SwapObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 16).ToString()]; model.NonAnnualOptionFee = GetDataSetValue(dt, i, 17).ToString(); model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 18).ToString()]; @@ -583,30 +586,32 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetTargetCaseAndHedgeTuple() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("标的情况与对冲")) { - DataTable dt = _excelDataSource.Tables["标的情况与对冲"]; - for (int i = 2; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["标的情况与对冲"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - ISDATargetCaseAndHedgeModel model = new ISDATargetCaseAndHedgeModel(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(); - model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 2).ToString()]; - model.InvestmentTargetType = ConsReport.HedgeSACUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 3).ToString()]; - model.InvestmentTarget = GetDataSetValue(dt, i, 4).ToString(); - model.UnderlyingCode = GetDataSetValue(dt, i, 5).ToString(); - model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 6).ToString(); - model.BuyingImpulseVolume = GetDataSetValue(dt, i, 7).ToString(); - model.SellingImpulseVolume = GetDataSetValue(dt, i, 8).ToString(); - model.ImpulseVolume = GetDataSetValue(dt, i, 9).ToString(); - model.PositionAtTheEndOfThisMonth = GetDataSetValue(dt, i, 10).ToString(); - model.TheNumberOfPositionsHeldAtTheEndOfThisMonth = GetDataSetValue(dt, i, 11).ToString(); - model.AveragePriceAtTheEndOfTheMonth = GetDataSetValue(dt, i, 12).ToString(); + var model = new ISDATargetCaseAndHedgeModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1).ToString(), + BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 2).ToString()], + InvestmentTargetType = ConsReport.HedgeSACUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 3).ToString()], + InvestmentTarget = GetDataSetValue(dt, i, 4).ToString(), + UnderlyingCode = GetDataSetValue(dt, i, 5).ToString(), + UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 6).ToString(), + BuyingImpulseVolume = GetDataSetValue(dt, i, 7).ToString(), + SellingImpulseVolume = GetDataSetValue(dt, i, 8).ToString(), + ImpulseVolume = GetDataSetValue(dt, i, 9).ToString(), + PositionAtTheEndOfThisMonth = GetDataSetValue(dt, i, 10).ToString(), + TheNumberOfPositionsHeldAtTheEndOfThisMonth = GetDataSetValue(dt, i, 11).ToString(), + AveragePriceAtTheEndOfTheMonth = GetDataSetValue(dt, i, 12).ToString() + }; result.Add(model); } @@ -616,21 +621,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.PeriodicReportISDA != null) { - List listRoot = new List(); - CheckHelper helper = new Common.CheckHelper(); - CheckHelper detailHelper = new Common.CheckHelper(); - CheckHelper detail2Helper = new Common.CheckHelper(); - CheckHelper hedgeHelper = new Common.CheckHelper(); + var listRoot = new List(); + var helper = new Common.CheckHelper(); + var detailHelper = new Common.CheckHelper(); + var detail2Helper = new Common.CheckHelper(); + var hedgeHelper = new Common.CheckHelper(); helper.ExecuteCheck(model.PeriodicReportISDA, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.PeriodicReportISDA.IncreaseBusinessDetailsThisMonthTuple != null) { - for (int i = 0; i < model.PeriodicReportISDA.IncreaseBusinessDetailsThisMonthTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportISDA.IncreaseBusinessDetailsThisMonthTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportISDA.IncreaseBusinessDetailsThisMonthTuple[i]; @@ -640,15 +645,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportISDA.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) { - for (int i = 0; i < model.PeriodicReportISDA.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportISDA.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportISDA.InventoryBusinessDetailsAtTheEndOfThisMonthTuple[i]; @@ -658,15 +665,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportISDA.TargetCaseAndHedgeTuple != null) { - for (int i = 0; i < model.PeriodicReportISDA.TargetCaseAndHedgeTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportISDA.TargetCaseAndHedgeTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportISDA.TargetCaseAndHedgeTuple[i]; @@ -676,16 +685,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("TargetCaseAndHedgeTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("TargetCaseAndHedgeTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("PeriodicReportISDA"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("PeriodicReportISDA") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -695,7 +708,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(string tag, bool suffixType = false) { - string result = $"{BusiDataType}_{tag}_"; + var result = $"{BusiDataType}_{tag}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -703,10 +716,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportNAFMIIService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportNAFMIIService.cs index 11ee25bc..2b8e5cf1 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportNAFMIIService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportNAFMIIService.cs @@ -19,19 +19,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1012; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } @@ -39,7 +36,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime minDate = DateTime.MinValue; DateTime maxDate = DateTime.MinValue; protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII; - List noteList = new List(); + + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -58,7 +56,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service case OptFlagsEnum.D: minDate = req.NAFMIIReportDate.Value.Date.AddDays(-req.NAFMIIReportDate.Value.Day).AddDays(1); maxDate = req.NAFMIIReportDate.Value.Date.AddMonths(1).AddDays(-req.NAFMIIReportDate.Value.Day); - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(req.NAFMIIReportDate.Value.ToString("yyyy-MM"))).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(req.NAFMIIReportDate.Value.ToString("yyyy-MM"))).FirstOrDefault(); if (note == null) { errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}不存在报送成功的NAFMII定期报告记录,请重新选择"; @@ -85,16 +83,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { fileList = new List(); noData = true; - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; + var model = new BodyModel(); var cacheValue = formatInfoTag(_reqInfo.NAFMIIReportDate.Value.ToString("yyyy-MM")); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { return model; } - model.PeriodicReportNAFMII = new PeriodicReportNAFMIIModel(); - model.PeriodicReportNAFMII.OperationType = _operationType; - SACReportNotes note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); + model.PeriodicReportNAFMII = new PeriodicReportNAFMIIModel + { + OperationType = _operationType + }; + var note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -131,7 +130,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (_excelDataSource != null) { - DataTable dt = _excelDataSource.Tables["业务统计"]; + var dt = _excelDataSource.Tables["业务统计"]; model.PeriodicReportNAFMII.Year = _reqInfo.NAFMIIReportDate.Value.Year.ToString("0000"); model.PeriodicReportNAFMII.Month = _reqInfo.NAFMIIReportDate.Value.Month.ToString("0"); model.PeriodicReportNAFMII.OperationType = _operationType; @@ -145,7 +144,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.PeriodicReportNAFMII.ExceID = base.formatExceID(); } noData = string.IsNullOrWhiteSpace(model.PeriodicReportNAFMII?.MainAgreementLastMonthAccumulatedThisYear); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); if (!noData) { note.id = 0; @@ -276,31 +275,33 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetScheduleOfOtherTransactionModel() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("其他交易明细")) { - DataTable dt = _excelDataSource.Tables["其他交易明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["其他交易明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - ScheduleOfOtherTransactionModel model = new ScheduleOfOtherTransactionModel(); - model.TradingDate = GetDataSetValue(dt, i, 1).ToString(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(); - model.FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(); - model.NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(); - model.CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(); - model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 6).ToString()]; - model.CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 7).ToString()]; - model.CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 8).ToString()]; - model.NotionalPrincipalAmount = GetDataSetValue(dt, i, 9).ToString(); - model.InvestmentTargetType = ConsReport.NAFMIIUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 10).ToString()]; - model.InvestmentTarget = GetDataSetValue(dt, i, 11).ToString(); - model.StartDate = GetDataSetValue(dt, i, 12).ToString(); - model.ContractExpirationDate = GetDataSetValue(dt, i, 13).ToString(); + var model = new ScheduleOfOtherTransactionModel + { + TradingDate = GetDataSetValue(dt, i, 1).ToString(), + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(), + FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(), + NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(), + CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(), + BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 6).ToString()], + CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 7).ToString()], + CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 8).ToString()], + NotionalPrincipalAmount = GetDataSetValue(dt, i, 9).ToString(), + InvestmentTargetType = ConsReport.NAFMIIUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 10).ToString()], + InvestmentTarget = GetDataSetValue(dt, i, 11).ToString(), + StartDate = GetDataSetValue(dt, i, 12).ToString(), + ContractExpirationDate = GetDataSetValue(dt, i, 13).ToString() + }; result.Add(model); } @@ -314,40 +315,42 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetInterestRateSwapDetailModel() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("利率互换明细")) { - DataTable dt = _excelDataSource.Tables["利率互换明细"]; - for (int i = 2; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["利率互换明细"]; + for (var i = 2; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - InterestRateSwapDetailModel model = new InterestRateSwapDetailModel(); - model.TransactionDate = GetDataSetValue(dt, i, 1).ToString(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(); - model.FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(); - model.NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(); - model.CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(); - model.CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 6).ToString()]; - model.CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 7).ToString()]; - model.FixedInterestPaymentParty = GetDataSetValue(dt, i, 8).ToString(); - model.FloatingInterestPaymentParty = GetDataSetValue(dt, i, 9).ToString(); - model.NotionalPrincipalAmount = GetDataSetValue(dt, i, 10).ToString(); - model.ContractPeriod = GetDataSetValue(dt, i, 11).ToString(); - model.DalueDate = GetDataSetValue(dt, i, 12).ToString(); - model.DueDate = GetDataSetValue(dt, i, 13).ToString(); - model.FixedRate = GetDataSetValue(dt, i, 14).ToString(); - model.FixedRatePaymentCycle = GetDataSetValue(dt, i, 15).ToString(); - model.FixedInterestRateBasis = GetDataSetValue(dt, i, 16).ToString(); - model.NameOfReferenceRate = GetDataSetValue(dt, i, 17).ToString(); - model.Spreads = GetDataSetValue(dt, i, 18).ToString(); - model.FloatingRatePaymentCycle = GetDataSetValue(dt, i, 19).ToString(); - model.ResetTheFrequency = GetDataSetValue(dt, i, 20).ToString(); - model.FloatingInterestRateBasis = GetDataSetValue(dt, i, 21).ToString(); - model.FirstInterestPaymentDay = GetDataSetValue(dt, i, 22).ToString(); + var model = new InterestRateSwapDetailModel + { + TransactionDate = GetDataSetValue(dt, i, 1).ToString(), + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(), + FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(), + NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(), + CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(), + CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 6).ToString()], + CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 7).ToString()], + FixedInterestPaymentParty = GetDataSetValue(dt, i, 8).ToString(), + FloatingInterestPaymentParty = GetDataSetValue(dt, i, 9).ToString(), + NotionalPrincipalAmount = GetDataSetValue(dt, i, 10).ToString(), + ContractPeriod = GetDataSetValue(dt, i, 11).ToString(), + DalueDate = GetDataSetValue(dt, i, 12).ToString(), + DueDate = GetDataSetValue(dt, i, 13).ToString(), + FixedRate = GetDataSetValue(dt, i, 14).ToString(), + FixedRatePaymentCycle = GetDataSetValue(dt, i, 15).ToString(), + FixedInterestRateBasis = GetDataSetValue(dt, i, 16).ToString(), + NameOfReferenceRate = GetDataSetValue(dt, i, 17).ToString(), + Spreads = GetDataSetValue(dt, i, 18).ToString(), + FloatingRatePaymentCycle = GetDataSetValue(dt, i, 19).ToString(), + ResetTheFrequency = GetDataSetValue(dt, i, 20).ToString(), + FloatingInterestRateBasis = GetDataSetValue(dt, i, 21).ToString(), + FirstInterestPaymentDay = GetDataSetValue(dt, i, 22).ToString() + }; result.Add(model); } @@ -361,34 +364,36 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetInterestRateOptionDetailModel() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("利率期权明细")) { - DataTable dt = _excelDataSource.Tables["利率期权明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["利率期权明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - InterestRateOptionDetailModel model = new InterestRateOptionDetailModel(); - model.TradingDate = GetDataSetValue(dt, i, 1).ToString(); - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(); - model.FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(); - model.NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(); - model.CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(); - model.BusinessType = ConsReport.OptionTraderMap[GetDataSetValue(dt, i, 6).ToString()]; - model.OptionType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 7).ToString()]; - model.OptionPosition = ConsReport.NAFMIIOptionDirectionMap[GetDataSetValue(dt, i, 8).ToString()]; - model.CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 9).ToString()]; - model.CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 10).ToString()]; - model.NotionalPrincipalAmount = GetDataSetValue(dt, i, 11).ToString(); - model.ExcerciseInterestRate = GetDataSetValue(dt, i, 12).ToString(); - model.InvestmentTarget = ConsReport.NAFMIIInvestmentNameMap[GetDataSetValue(dt, i, 13).ToString()]; - model.DeliveryType = ConsReport.NAFMIIDeliveryTypeMap[GetDataSetValue(dt, i, 14).ToString()]; - model.StartDate = GetDataSetValue(dt, i, 15).ToString(); - model.ContractExpirationDate = GetDataSetValue(dt, i, 16).ToString(); + var model = new InterestRateOptionDetailModel + { + TradingDate = GetDataSetValue(dt, i, 1).ToString(), + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 2).ToString(), + FillInTheNameOfTheAgency = GetDataSetValue(dt, i, 3).ToString(), + NameOfCounterparty = GetDataSetValue(dt, i, 4).ToString(), + CounterpartyAllographProduct = GetDataSetValue(dt, i, 5).ToString(), + BusinessType = ConsReport.OptionTraderMap[GetDataSetValue(dt, i, 6).ToString()], + OptionType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 7).ToString()], + OptionPosition = ConsReport.NAFMIIOptionDirectionMap[GetDataSetValue(dt, i, 8).ToString()], + CounterpartyType = ConsReport.NAFMIICounterpartyTypeMap[GetDataSetValue(dt, i, 9).ToString()], + CounterpartyIsProfessionalInstitutionsOrNot = ConsReport.BoolNumberMap[GetDataSetValue(dt, i, 10).ToString()], + NotionalPrincipalAmount = GetDataSetValue(dt, i, 11).ToString(), + ExcerciseInterestRate = GetDataSetValue(dt, i, 12).ToString(), + InvestmentTarget = ConsReport.NAFMIIInvestmentNameMap[GetDataSetValue(dt, i, 13).ToString()], + DeliveryType = ConsReport.NAFMIIDeliveryTypeMap[GetDataSetValue(dt, i, 14).ToString()], + StartDate = GetDataSetValue(dt, i, 15).ToString(), + ContractExpirationDate = GetDataSetValue(dt, i, 16).ToString() + }; result.Add(model); } @@ -398,21 +403,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.PeriodicReportNAFMII != null) { - List listRoot = new List(); - CheckHelper helper = new Common.CheckHelper(); - CheckHelper swapDetailHelper = new Common.CheckHelper(); - CheckHelper optionDetailHelper = new Common.CheckHelper(); - CheckHelper transactionHelper = new Common.CheckHelper(); + var listRoot = new List(); + var helper = new Common.CheckHelper(); + var swapDetailHelper = new Common.CheckHelper(); + var optionDetailHelper = new Common.CheckHelper(); + var transactionHelper = new Common.CheckHelper(); helper.ExecuteCheck(model.PeriodicReportNAFMII, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.PeriodicReportNAFMII.InterestRateSwapDetails != null) { - for (int i = 0; i < model.PeriodicReportNAFMII.InterestRateSwapDetails.Count; i++) + for (var i = 0; i < model.PeriodicReportNAFMII.InterestRateSwapDetails.Count; i++) { var listItem = new List(); var item = model.PeriodicReportNAFMII.InterestRateSwapDetails[i]; @@ -422,15 +427,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("InterestRateSwapDetails", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("InterestRateSwapDetails", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportNAFMII.InterestRateOptionDetails != null) { - for (int i = 0; i < model.PeriodicReportNAFMII.InterestRateOptionDetails.Count; i++) + for (var i = 0; i < model.PeriodicReportNAFMII.InterestRateOptionDetails.Count; i++) { var listItem = new List(); var item = model.PeriodicReportNAFMII.InterestRateOptionDetails[i]; @@ -440,15 +447,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("InterestRateOptionDetails", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("InterestRateOptionDetails", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportNAFMII.ScheduleOfOtherTransactions != null) { - for (int i = 0; i < model.PeriodicReportNAFMII.ScheduleOfOtherTransactions.Count; i++) + for (var i = 0; i < model.PeriodicReportNAFMII.ScheduleOfOtherTransactions.Count; i++) { var listItem = new List(); var item = model.PeriodicReportNAFMII.ScheduleOfOtherTransactions[i]; @@ -458,16 +467,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("ScheduleOfOtherTransactions", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("ScheduleOfOtherTransactions", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("PeriodicReportNAFMII"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("PeriodicReportNAFMII") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -477,7 +490,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(string tag, bool suffixType = false) { - string result = $"{BusiDataType}_{tag}_"; + var result = $"{BusiDataType}_{tag}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -485,10 +498,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportQuarterService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportQuarterService.cs index d2274de7..37b67590 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportQuarterService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportQuarterService.cs @@ -15,19 +15,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override ConsReport.DataFlagsEnum BusiDataType => ConsReport.DataFlagsEnum.A1014; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } @@ -37,7 +34,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime minDate = DateTime.MinValue; DateTime maxDate = DateTime.MinValue; protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportQuarter; - List noteList = new List(); + + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -52,7 +50,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } SACReportNotes note = null; quarter = GetQuarterRange(req.PeriodicReportQuarterDate.Value, out minDate, out maxDate); - fileType = (quarter == "05" ? "半年报" : "季度报告"); + fileType = quarter == "05" ? "半年报" : "季度报告"; switch (req.PeriodicReportQuarterStatus) { case OptFlagsEnum.A: @@ -80,7 +78,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (req.PeriodicReportQuarterStatus == OptFlagsEnum.U) { var fileIds = tempFilesService.QueryTempFile(minDate, maxDate, fileType).Select(O => O.id.ToString()).ToArray(); - string[] fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + var fileIdArr = note.DataId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (!fileIds.Except(fileIdArr).Any()) { errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}已上传季度报告附件都已报送,不需要再次报送"; @@ -99,15 +97,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { fileList = new List(); noData = true; - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; + var model = new BodyModel(); var cacheValue = formatInfoTag(_reqInfo.PeriodicReportQuarterDate.Value.Year + quarter); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { return model; } model.PeriodicReportQuarter = new PeriodicReportQuarterModel(); - SACReportNotes note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault(); if (note == null) { note = new SACReportNotes() @@ -154,8 +151,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList.Clear(); break; } - var info = new DerivativesQuarterlyReportAnnexModel(); - info.DerivativesQuarterlyReportAnnex = item.fileName; + var info = new DerivativesQuarterlyReportAnnexModel + { + DerivativesQuarterlyReportAnnex = item.fileName + }; if (model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple == null) { model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple = new List(); @@ -165,10 +164,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service note.DataId += item.id + ","; } } - noData = (!(model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple?.Count > 0)); + noData = !(model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple?.Count > 0); if (!noData) { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.ExceId = model.PeriodicReportQuarter.ExceID; note.CreateTime = DateTime.Now; @@ -189,19 +188,19 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.PeriodicReportQuarter != null) { - List listRoot = new List(); - CheckHelper helper = new Common.CheckHelper(); - CheckHelper annexHelper = new Common.CheckHelper(); + var listRoot = new List(); + var helper = new Common.CheckHelper(); + var annexHelper = new Common.CheckHelper(); helper.ExecuteCheck(model.PeriodicReportQuarter, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple != null) { - for (int i = 0; i < model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportQuarter.DerivativesQuarterlyReportAnnexTuple[i]; @@ -211,16 +210,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("DerivativesQuarterlyReportAnnexTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("DerivativesQuarterlyReportAnnexTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("PeriodicReportQuarter"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("PeriodicReportQuarter") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -230,7 +233,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(string tag, bool suffixType = false) { - string result = $"{BusiDataType}_{tag}_"; + var result = $"{BusiDataType}_{tag}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -238,10 +241,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportSACService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportSACService.cs index 16f74afe..29828d0f 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportSACService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportSACService.cs @@ -1,7 +1,8 @@ -using BaseOUDAL; +using BaseOUDAL; using System.Data; using System.Linq.Expressions; using YLErp.BLL; +using YLErp.DBModels; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; using YLErp.Helpers; @@ -23,19 +24,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1011; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } @@ -44,7 +42,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime maxDate = DateTime.MinValue; protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportSAC; - readonly List noteList = new List(); + readonly List noteList = new(); public override bool CheckRequestParamer(ReportInfo req, out string errMsg) { @@ -91,9 +89,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList = new List(); noData = true; var model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; var cacheValue = formatInfoTag(_reqInfo.SACReportDate.Value.ToString("yyyy-MM")); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { return model; } @@ -124,23 +121,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service throw new ServiceException("未知操作类型"); } } - //if (((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) && ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System)) - //{ - // model.PeriodicReportSAC = GetPeriodicReportSACFromExcelAndDb(); - //} - //else if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - //{ - // model.PeriodicReportSAC = GetPeriodicReportSACFromDb(); - //} - //else if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) - //{ - // model.PeriodicReportSAC = GetPeriodicReportSACFromExcel(); - //} - model.PeriodicReportSAC = GetPeriodicReportSACFromExcel(); + // To optimize the code we can use the switch statement instead of if-else statements + switch (_reqInfo.DataSource & SAC_ReportDataSourceEnum.Template) + { + case SAC_ReportDataSourceEnum.Template: + model.PeriodicReportSAC = GetPeriodicReportSACFromExcel(); + break; + } model.PeriodicReportSAC.OperationType = _operationType; noData = string.IsNullOrWhiteSpace(model?.PeriodicReportSAC?.MainAgreementAddedThisMonth); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); if (!noData) { if (_operationType != OptFlagsEnum.A) @@ -167,902 +158,6 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return model; } - private PeriodicReportSACModel GetPeriodicReportSACFromDb() - { - var monthStart = QdpCalendarHelper.GetNonHoliday(_reqInfo.SACReportDate.Value.AddDays(-_reqInfo.SACReportDate.Value.Day + 1)); - var lastMonthEnd = QdpCalendarHelper.GetNonHolidayDefore(monthStart.AddDays(-1)); - var monthEnd = QdpCalendarHelper.GetNonHolidayDefore(monthStart.AddMonths(1).AddDays(-monthStart.Day)); - var yearStart = QdpCalendarHelper.GetNonHoliday(new DateTime(_reqInfo.SACReportDate.Value.Year, 01, 01)); - var lastYearEnd = QdpCalendarHelper.GetNonHolidayDefore(yearStart.AddDays(-1)); - var yearEnd = monthEnd; - - var model = new PeriodicReportSACModel(); - using (var baseDb = new ClientDBContext()) - { - using (var db = new YLContext()) - { - model.Year = _reqInfo.SACReportDate.Value.Year.ToString("0000"); - model.Month = _reqInfo.SACReportDate.Value.Month.ToString("0"); - - model.MainAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.MainAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.MainAgreementValidedAtEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString(); - - model.SupplementalAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.SupplementalAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.SupplementalAgreementValidedAtTheEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString(); - - model.PerformanceGuaranteeAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.PerformanceGuaranteeAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString(); - model.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString(); - - var contractCount = from tc in db.trade_cash join tr in db.trade_contract_r on tc.id equals tr.TradeCashId where tr.Type == "交易确认书" && !tc.IsDeleted && tr.IsValid select tc.ValueDate; - model.TransactionConfirmationAddedThisMonth = contractCount.Where(O => O >= monthStart && O <= monthEnd).Count().ToString(); - model.TransactionConfirmationBookAccumulatedThisYear = contractCount.Where(O => O >= yearStart && O <= yearEnd).Count().ToString(); - model.TransactionConfirmationValidedAtEndOfThisMonth = contractCount.Where(O => O <= monthEnd).Count().ToString(); - - var endAction = new List() { "系统操作-平仓费", "系统操作-行权费" }; - var selfClientInfos = baseDb.client.Where(O => O.ProcessOptDate <= monthEnd && O.ProcessStatus == "已开户" && O.ClientType == "产品").Select(O => O.id).ToList(); - var dotSelfClientInfos = baseDb.client.Where(O => O.ProcessOptDate <= monthEnd && O.ProcessStatus == "已开户" && O.ClientType != "产品").Select(O => O.id).ToList(); - var latestTradeInfos = - (from et in db.eod_trade - where et.ValueDate == monthEnd && et.TradeStatus == "确认成交" - join ep in db.eod_trade_position on new { et.TradeId, et.ValueDate } equals new { ep.TradeId, ep.ValueDate } - join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书" && O.IsValid) on et.TradeId equals tr.TradeId into tempTr - from tr in tempTr.DefaultIfEmpty() - select new - { - et = new xodTradeBase() { TradeJson = et.TradeJson }, - um, - tr, - ep.Pv, - }) - .ToArray().Select(O => new - { - O.et.trade.StockEqvNotional, - O.et.trade.TradeType, - O.um.UnderlyingInstrumentType, - O.et.trade.ClientId, - O.et.trade.StockEqvNotionalReal, - O.et.trade.StartDate, - O.et.trade.ExerciseDate, - O.et.trade.TradePrice, - O.et.trade.PremiumRate, - O.et.trade.OriginalStockEqvNotional, - ContractCode = O.tr?.ContractCode, - O.um.CommodityCode, - O.et.trade.ParticipationRate, - O.et.trade.AnnualizeFactor, - O.um.UnderlyingName, - O.um.UnderlyingCode, - O.um.MarketCode, - O.um.MarketName, - O.et.trade.PositionMarginRate, - O.et.trade.trade_swap, - O.Pv, - }).ToArray(); - var lastMonthTradeInfos = (from et in db.eod_trade join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode join ts in db.trade_span.Where(O => O.ValueDate == lastMonthEnd) on et.TradeId equals ts.TradeId where et.ValueDate == lastMonthEnd && et.TradeStatus == "确认成交" select new { et = new xodTradeBase() { TradeJson = et.TradeJson }, ts.WorstCastClientPayable, um }).ToArray().Select(O => new { O.et.trade.id, O.et.trade.StockEqvNotional, O.et.TradeType, O.um.UnderlyingInstrumentType, O.WorstCastClientPayable }).ToArray(); - var latestMonthNewTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= monthStart && O.ValueDate <= monthEnd && O.Action == "系统操作-期权费" && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode join tr in db.trade_contract_r on tc.id equals tr.TradeCashId into tempTr from tr in tempTr.DefaultIfEmpty() where tr.IsValid select new { t.id, StockEqvNotional = t.OriginalStockEqvNotional, t.TradeType, um.UnderlyingInstrumentType, t.ClientId, t.StockEqvNotionalReal, t.StartDate, t.ExerciseDate, t.TradePrice, t.PremiumRate, t.OriginalStockEqvNotional, tr.ContractCode, um.CommodityCode, um.UnderlyingName, um.UnderlyingCode, um.MarketName }).ToArray(); - var latestMonthEndTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= monthStart && O.ValueDate <= monthEnd && endAction.Contains(O.Action) && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode select new { t.id, StockEqvNotional = (tc.UnwindNotional / t.OriginalNotional * t.OriginalStockEqvNotional), t.TradeType, um.UnderlyingInstrumentType }).ToArray(); - var latestMonthTradeInfos = (from et in db.eod_trade join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode join ts in db.trade_span.Where(O => O.ValueDate == monthEnd) on et.TradeId equals ts.TradeId where et.ValueDate == monthEnd && et.TradeStatus == "确认成交" select new { et = new xodTradeBase() { TradeJson = et.TradeJson }, ts.WorstCastClientPayable, um }).ToArray().Select(O => new { O.et.trade.id, O.et.trade.StockEqvNotional, O.et.TradeType, O.um.UnderlyingInstrumentType, O.WorstCastClientPayable }).ToArray(); - var latestYearNewTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= yearStart && O.ValueDate <= yearEnd && O.Action == "系统操作-期权费" && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode select new { t.id, StockEqvNotional = t.OriginalStockEqvNotional, t.TradeType, um.UnderlyingInstrumentType }).ToArray(); - var totleStockEqvNotional = (latestTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0); - var latestNetAssets = _reqInfo.LatestNetAssets; - model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence = totleStockEqvNotional.ToString(); - model.NetCapitalAtEndOfTheMonth = latestNetAssets.ToString(); - model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital = latestNetAssets == 0 ? "0" : (totleStockEqvNotional / latestNetAssets * 100).ToString("0.00"); - model.OTCOptionHasSignedByLegalPerson = dotSelfClientInfos.Count.ToString(); - model.OTCOptionsHaveContractedProducts = selfClientInfos.Count.ToString(); - model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = baseDb.client.Where(O => O.ProcessStatus == "已开户" && O.ProcessOptDate >= monthStart && O.ProcessOptDate <= monthEnd && O.ClientType != "产品").Count().ToString(); - model.OTCOptionsForTheMonthOfTheNewAddProduct = baseDb.client.Where(O => O.ProcessStatus == "已开户" && O.ProcessOptDate >= monthStart && O.ProcessOptDate <= monthEnd && O.ClientType == "产品").Count().ToString(); - model.OTCOptionsLegalPersonInDurationForThisMouth = dotSelfClientInfos.Count.ToString(); - model.OTCOptionsProductsInDurationForThisMouth = selfClientInfos.Count.ToString(); - model.IncomeSwapHasSignedLegalPersonNumber = dotSelfClientInfos.Count.ToString(); - model.IncomeSwapHasSignedProductNumber = selfClientInfos.Count.ToString(); - model.IncomeSwapForTheMonthOfTheNewAddLegalPerson = model.OTCOptionsForTheMonthOfTheNewAddLegalPerson; - model.IncomeSwapForTheMonthOfTheNewAddProduct = model.OTCOptionsForTheMonthOfTheNewAddProduct; - model.IncomeSwapLegalPersonInDurationForThisMouth = dotSelfClientInfos.Count.ToString(); - model.IncomeSwapProductsInDurationForThisMouth = selfClientInfos.Count.ToString(); - - var tempList = new List { "StockIF", "Stock", "CommodityFutures" }; - model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsCommoditiesLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsOtherSubjectLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticStockIndexLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeCommoditiesLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeOtherSubjectLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.TotalOfLastMonthDurationScale = (lastMonthTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - - model.OTCOptionsWithinTheIndexThisMonthOfTheNewScale = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsToAddScaleDomesticStocksInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.TotalOfTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString(); - - model.OTCOptionsTerminateScaleDomesticStockIndexThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsTerminateScaleDomesticStocksInThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.TotalOfTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString(); - - model.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsWithinIndividualStocksInThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsCommoditiesInThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsOtherSubjectThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticStockIndexThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeCommoditiesThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.RevenueExchangeOtherSubjectThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - model.TotalOfThisMonthDurationScale = (latestMonthTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString(); - - model.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.IncomeSwapDomesticStockHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.TotalNewScaleInThisYear = (latestYearNewTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString(); - - model.OTCOptionsStockIndexAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsStockAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsCommoditiesAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsOtherSubjectAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.TotalNumberOfContractsAtTheEndOfLastMonth = lastMonthTradeInfos.GroupBy(O => O.id).Count().ToString(); - - model.OTCOptionsStockIndexThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsStockThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockIndexNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapCommoditiesNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapOtherSubjectNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.TotalNumberOfNewContractsInThisMonth = latestMonthNewTradeInfos.GroupBy(O => O.id).Count().ToString(); - - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.TotalNumberOfContractsTerminatedThisMonth = latestMonthEndTradeInfos.GroupBy(O => O.id).Count().ToString(); - - model.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.TotalNumberOfContractsAtTheEndOfThisMonth = latestMonthTradeInfos.GroupBy(O => O.id).Count().ToString(); - - model.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString(); - model.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString(); - model.TotalNumberOfNewContractsInThisYear = latestYearNewTradeInfos.GroupBy(O => O.id).Count().ToString(); - - var totalNominalPrincipalAmountOfSwapThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => (double?)O.StockEqvNotional) ?? 0; - var totalNominalPrincipalAmountOfSwapLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => (double?)O.StockEqvNotional) ?? 0; - model.TotalNominalPrincipalAmountOfSwapThisMonth = totalNominalPrincipalAmountOfSwapThisMonth.ToString(); - model.TotalNominalPrincipalAmountOfSwapLastMonth = totalNominalPrincipalAmountOfSwapLastMonth.ToString(); - - var theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.WorstCastClientPayable) ?? 0; - var theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.WorstCastClientPayable) ?? 0; - model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth.ToString(); - model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth.ToString(); - - model.SwapCashCollateralValueThisMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth.ToString(); - model.SwapCashCollateralValueLastMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth.ToString(); - - model.SwapSecuritiesCollateralValueThisMonth = 0.ToString(); - model.SwapSecuritiesCollateralValueLastMonthThisMonth = 0.ToString(); - - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull = 0.ToString(); - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull = 0.ToString(); - - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet = 0.ToString(); - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet = 0.ToString(); - - model.SwapNumberOfDefaultCustomersAtThisMonthThisMonth = 0.ToString(); - model.SwapNumberOfDefaultCustomersAtThisMonthLastMonth = 0.ToString(); - - model.SwapDefaultTransactionNumberAtThisMonthThisMonth = 0.ToString(); - model.SwapDefaultTransactionNumberAtThisMonthLastMonth = 0.ToString(); - - model.TotalSwapDefaultCustomerNumberInThisYearThisMonth = 0.ToString(); - model.TotalSwapDefaultCustomerNumberInThisYearLastMonth = 0.ToString(); - - model.SwapNumberOfDefaultCustomersInThisYearThisMonth = 0.ToString(); - model.SwapNumberOfDefaultCustomersInThisYearLastMonth = 0.ToString(); - - var totalNominalPrincipalAmountOfOptionThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => (double?)O.StockEqvNotional) ?? 0; - var totalNominalPrincipalAmountOfOptionLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => (double?)O.StockEqvNotional) ?? 0; - model.TotalNominalPrincipalAmountOfOptionThisMonth = totalNominalPrincipalAmountOfOptionThisMonth.ToString(); - model.TotalNominalPrincipalAmountOfOptionLastMonth = totalNominalPrincipalAmountOfOptionLastMonth.ToString(); - - var theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => O.WorstCastClientPayable) ?? 0; - var theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => O.WorstCastClientPayable) ?? 0; - model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth.ToString(); - model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth.ToString(); - - model.OptionCashCollateralValueThisMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth.ToString(); - model.OptionCashCollateralValueLastMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth.ToString(); - - model.OptionSecuritiesCollateralValueThisMonth = 0.ToString(); - model.OptionSecuritiesCollateralValueLastMonth = 0.ToString(); - - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull = 0.ToString(); - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull = 0.ToString(); - - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet = 0.ToString(); - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet = 0.ToString(); - - model.OptionNumberOfDefaultCustomersAtThisMonthThisMonth = 0.ToString(); - model.OptionNumberOfDefaultCustomersAtThisMonthLastMonth = 0.ToString(); - - model.OptionTransactionNumberAtThisMonthThisMonth = 0.ToString(); - model.OptionTransactionNumberAtThisMonthLastMonth = 0.ToString(); - - model.TotalOptionDefaultCustomerNumberInThisYearThisMonth = 0.ToString(); - model.TotalOptionDefaultCustomerNumberInThisYearLastMonth = 0.ToString(); - - model.OptionNumberOfDefaultCustomersInThisYearThisMonth = 0.ToString(); - model.OptionNumberOfDefaultCustomersInThisYearLastMonth = 0.ToString(); - - model.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth = (latestMonthTradeInfos.Sum(O => O.WorstCastClientPayable) ?? 0).ToString(); - model.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth = (lastMonthTradeInfos.Sum(O => O.WorstCastClientPayable) ?? 0).ToString(); - - model.CashBalanceAtEndOfThisMonth = _reqInfo.LatestMonthCash.ToString("0.00"); - model.CashBalanceAtEndOfLastMonth = _reqInfo.LastMonthCash.ToString("0.00"); - - var positionTradeTypes = new List() { "股票", "债券", "银行理财", "信托", "保险" }; - var latestMonthPosition = db.eod_trade_position.Where(O => O.ValueDate == monthEnd && O.ClientId == 0).Select(O => new { O.TradeType, O.Pv }); - var lastMonthPosition = db.eod_trade_position.Where(O => O.ValueDate == lastMonthEnd && O.ClientId == 0).Select(O => new { O.TradeType, O.Pv }); - model.HoldStockMarketValueAtEndOfThisMonth = (latestMonthPosition.Where(O => O.TradeType == "股票").Sum(O => (double?)O.Pv) ?? 0).ToString(); - model.HoldStockMarketValueAtEndOfLastMonth = (lastMonthPosition.Where(O => O.TradeType == "股票").Sum(O => (double?)O.Pv) ?? 0).ToString(); - - model.HoldMarketValueOfBondsAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString(); - model.HoldMarketValueOfBondsAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString(); - - model.OwnedAssetManagementProductsAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString(); - model.OwnedAssetManagementProductsAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString(); - - model.OwnedBankFinanceAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "银行理财").Sum(O => O.Pv).ToString(); - model.OwnedBankFinanceAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "银行理财").Sum(O => O.Pv).ToString(); - - model.HoldTrustProductAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "信托").Sum(O => O.Pv).ToString(); - model.HoldTrustProductAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "信托").Sum(O => O.Pv).ToString(); - - model.InsuranceProductsAreHeldAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "保险").Sum(O => O.Pv).ToString(); - model.InsuranceProductsAreHeldAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "保险").Sum(O => O.Pv).ToString(); - - model.HoldOtherProductsAtTheEndOfThisMonth = (latestMonthPosition.Where(O => !positionTradeTypes.Contains(O.TradeType)).Sum(O => (double?)O.Pv) ?? 0).ToString(); - model.HoldOtherProductsAtTheEndOfLastMonth = (lastMonthPosition.Where(O => !positionTradeTypes.Contains(O.TradeType)).Sum(O => (double?)O.Pv) ?? 0).ToString(); - - var monthEndTrades = (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - where tc.ValueDate >= monthStart && tc.ValueDate <= monthEnd && tc.Action != "系统操作-期权费" && !tc.IsDeleted && tc.ValidState != "InValid" - select new { t, tc.Amount }).ToArray(); - model.SettledSwapItemsAtThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换").GroupBy(O => O.id).Count().ToString(); - model.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.SwapIncomeCashFlow = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)(O.Amount > 0 ? O.Amount : 0)) ?? 0).ToString(); - model.SwapExpensesCashFlow = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)(O.Amount < 0 ? O.Amount : 0)) ?? 0).ToString(); - model.CashFlowCorrespondingToNetIncomeOnSwapMargin = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)O.Amount) ?? 0).ToString(); - model.SwapHedgeCost = 0.ToString(); - - var tradeTypes = new List() { "收益互换", "远期" }; - model.SettledOptionItemsAtThisMonth = latestMonthEndTradeInfos.Where(O => !tradeTypes.Contains(O.TradeType)).GroupBy(O => O.id).Count().ToString(); - model.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth = (latestMonthEndTradeInfos.Where(O => !tradeTypes.Contains(O.TradeType)).Sum(O => O.StockEqvNotional) ?? 0).ToString(); - model.OptionPremiumIncome = (monthEndTrades.Where(O => !tradeTypes.Contains(O.t.TradeType)).Sum(O => O.t.TradePrice * (O.t.BuySell == "买入" ? -1 : 1)) ?? 0).ToString(); - model.OptionHedgeCost = 0.ToString(); - - - var balanceOfSwapRealizedGainsAndLossesAtThisMonth = GetRealizedPnl(PredicateBuilder.Create(t => t.TradeType == "收益互换"), monthStart, monthEnd); - var balanceOfOptionRealizedGainsAndLossesAtThisMonth = GetRealizedPnl(PredicateBuilder.Create(t => !tradeTypes.Contains(t.TradeType)), monthStart, monthEnd); - model.BalanceOfSwapRealizedGainsAndLossesAtThisMonth = balanceOfSwapRealizedGainsAndLossesAtThisMonth.ToString(); - model.BalanceOfOptionRealizedGainsAndLossesAtThisMonth = balanceOfOptionRealizedGainsAndLossesAtThisMonth.ToString(); - - var balanceOfSwapRealizedGainsAndLossesAtThisYear = GetRealizedPnl(PredicateBuilder.Create(t => t.TradeType == "收益互换"), yearStart, yearEnd); - var balanceOfOptionRealizedGainsAndLossesAtThisYear = GetRealizedPnl(PredicateBuilder.Create(t => !tradeTypes.Contains(t.TradeType)), yearStart, yearEnd); - model.BalanceOfSwapRealizedGainsAndLossesAtThisYear = balanceOfSwapRealizedGainsAndLossesAtThisYear.ToString(); - model.BalanceOfOptionRealizedGainsAndLossesAtThisYear = balanceOfOptionRealizedGainsAndLossesAtThisYear.ToString(); - - var balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = GetPositionPnl(PredicateBuilder.Create(t => t.TradeType == "收益互换"), lastMonthEnd, monthEnd); - var balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = GetPositionPnl(PredicateBuilder.Create(t => !tradeTypes.Contains(t.TradeType)), lastMonthEnd, monthEnd); - model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth.ToString(); - model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth.ToString(); - - var balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = GetPositionPnl(PredicateBuilder.Create(t => t.TradeType == "收益互换"), lastYearEnd, yearEnd); - var balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = GetPositionPnl(PredicateBuilder.Create(t => !tradeTypes.Contains(t.TradeType)), lastYearEnd, yearEnd); - model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear.ToString(); - model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear.ToString(); - - model.BalanceOfSwapTotalGainsAndLossesAtThisMonth = (balanceOfSwapRealizedGainsAndLossesAtThisMonth + balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth).ToString(); - model.BalanceOfOptionTotalGainsAndLossesAtThisMonth = (balanceOfOptionRealizedGainsAndLossesAtThisMonth + balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth).ToString(); - - model.BalanceOfSwapTotalGainsAndLossesAtThisYear = (balanceOfSwapRealizedGainsAndLossesAtThisYear + balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear).ToString(); - model.BalanceOfOptionTotalGainsAndLossesAtThisYear = (balanceOfOptionRealizedGainsAndLossesAtThisYear + balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear).ToString(); - - model.MarginOfSubsistSwap = "0"; - model.HedgedMarketValueOfSwap = "0"; - model.LeverageRatiOfSwap = "0"; - model.MarginOfSubsistStockIndexSwap = "0"; - model.HedgedMarketValueOfStockIndexSwap = "0"; - model.LeverageRatioOfStockIndexSwap = "0"; - model.MarginOfSubsistStockSwap = "0"; - model.HedgedMarketValueOfStockSwap = "0"; - model.LeverageRatioOfStockSwap = "0"; - model.MarginandPremiumOfSubsistOption = "0"; - model.HedgedMarketValueOfOption = "0"; - model.LeverageRatioOfOption = "0"; - model.MarginandPremiumOfSubsistStockIndexOption = "0"; - model.HedgedMarketValueOfStockIndexOption = "0"; - model.LeverageRatioOfStockIndexOption = "0"; - model.MarginandPremiumOfSubsistStockOption = "0"; - model.HedgedMarketValueOfStockOption = "0"; - model.LeverageRatioOfStockOption = "0"; - - model.IncreaseBusinessDetailsThisMonthTuple = new List(); - var config = db.valuedate.FirstOrDefault(x => x.State == valuedate.当前使用); - foreach (var item in latestMonthNewTradeInfos) - { - var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId); - - var newTrade = new IncreaseBusinessDetailsThisMonthModel(); - newTrade.NameOfSecuritiesCompany = config.SuperviseMainName; - newTrade.NameOfCounterparty = client.Name; - if (client.ClientType == "产品") - { - newTrade.CounterpartyProductName = client.Name; - } - newTrade.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(item.ContractCode); - switch (item.TradeType) - { - case "收益互换": - newTrade.BusinessType = BusinessTypeMap["互换"]; - newTrade.ReturnSwapObjectSecondClass = GetSACUndrlygAssetDtldTypeMap(SwapUndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode); - break; - case "远期": - newTrade.BusinessType = BusinessTypeMap["远期"]; - break; - default: - newTrade.BusinessType = BusinessTypeMap["期权"]; - newTrade.OptionObjectSecondClass = GetSACUndrlygAssetDtldTypeMap(UndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode); - newTrade.NonAnnualOptionFee = ((item.PremiumRate ?? (item.TradePrice / item.OriginalStockEqvNotional) ?? 0) * 100).ToString("0.##"); - switch (item.TradeType) - { - case "香草期权": - newTrade.OptionType = OptionStructureTypeMap["香草"]; - break; - case "二元期权": - newTrade.OptionType = OptionStructureTypeMap["二元"]; - break; - case "价差期权": - newTrade.OptionType = OptionStructureTypeMap["价差"]; - break; - case "障碍期权": - newTrade.OptionType = OptionStructureTypeMap["障碍"]; - break; - case "双鲨期权": - newTrade.OptionType = OptionStructureTypeMap["双鲨"]; - break; - default: - newTrade.OptionType = OptionStructureTypeMap["其他"]; - break; - } - break; - } - newTrade.NotionalPrincipalAmountLNotionalPrincipalAmount = ((item.StockEqvNotional ?? 0) / 1e9).ToString("0.0000"); - //newTrade.SNotionalPrincipalAmount = ((item.StockEqvNotional ?? 0) / 1e9).ToString("0.0000");//当前版本中不存在多空组合的交易 - newTrade.StartDate = item.StartDate?.ToString("yyyy-MM-dd"); - newTrade.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd"); - newTrade.UndrlygAssetName = item.UnderlyingName; - newTrade.UndrlygAssetCode = item.UnderlyingCode; - newTrade.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(item.MarketName) ? "其他" : item.MarketName; - switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType)) - { - case "股票": - newTrade.InvestmentTargetType = UndrlygAssetTypeMap["权益类"]; - break; - case "股指期货": - case "商品期货": - case "商品现货": - newTrade.InvestmentTargetType = UndrlygAssetTypeMap["大宗商品"]; - break; - default: - newTrade.InvestmentTargetType = UndrlygAssetTypeMap["其他"]; - break; - } - model.IncreaseBusinessDetailsThisMonthTuple.Add(newTrade); - } - model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple = new List(); - foreach (var item in latestTradeInfos) - { - var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId); - - var newTrade = new InventoryBusinessDetailsAtTheEndOfThisMonthModel(); - newTrade.NameOfSecuritiesCompany = config.SuperviseMainName; - newTrade.NameOfCounterparty = client.Name; - if (client.ClientType == "产品") - { - newTrade.NameOfCounterpartyProduct = client.Name; - } - newTrade.TransactionConfirmationNumber = item.ContractCode; - switch (item.TradeType) - { - case "收益互换": - newTrade.BusinessType = BusinessTypeMap["互换"]; - newTrade.ExchangeSumInvestmentTargetType = GetSACUndrlygAssetDtldTypeMap(SwapUndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode); - break; - case "远期": - newTrade.BusinessType = BusinessTypeMap["远期"]; - break; - default: - newTrade.BusinessType = BusinessTypeMap["期权"]; - newTrade.OptionSumInvestmentTargetType = GetSACUndrlygAssetDtldTypeMap(UndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode); - newTrade.OptionFee = Math.Abs((item.PremiumRate ?? (item.TradePrice / item.OriginalStockEqvNotional) ?? 0) * 100).ToString("0.##"); - switch (item.TradeType) - { - case "香草期权": - newTrade.OptionType = OptionStructureTypeMap["香草"]; - break; - case "二元期权": - newTrade.OptionType = OptionStructureTypeMap["二元"]; - break; - case "价差期权": - newTrade.OptionType = OptionStructureTypeMap["价差"]; - break; - case "障碍期权": - newTrade.OptionType = OptionStructureTypeMap["障碍"]; - break; - case "双鲨期权": - newTrade.OptionType = OptionStructureTypeMap["双鲨"]; - break; - default: - newTrade.OptionType = OptionStructureTypeMap["其他"]; - break; - } - break; - } - newTrade.NotionalPrincipalAmountLNotionalPrincipalAmount = (item.StockEqvNotional / 1e9).ToString("0.0000"); - //newTrade.SNotionalPrincipalAmount = (item.StockEqvNotional / 1e9).ToString("0.0000");//当前版本中不存在多空组合的交易 - newTrade.StartDay = item.StartDate?.ToString("yyyy-MM-dd"); - newTrade.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd"); - newTrade.UndrlygAssetName = item.UnderlyingName; - newTrade.UndrlygAssetCode = item.UnderlyingCode; - newTrade.MaitainMarginRation = (item.PositionMarginRate * 100).ToString("0.00"); - var longShort = item.trade_swap?.GetLongShort ?? item.trade_swap?.PayLongShort; - if (longShort == "空头") - { - newTrade.ShortPositionContractValue = (item.Pv).ToString("0.00"); - } - else - { - newTrade.LongPositionContractValue = (item.Pv).ToString("0.00"); - } - newTrade.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(item.MarketName) ? "其他" : item.MarketName; - switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType)) - { - case "股票": - newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["权益类"]; - break; - case "股指期货": - case "商品期货": - case "商品现货": - newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["大宗商品"]; - break; - default: - newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["其他"]; - break; - } - model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Add(newTrade); - } - model.TargetCaseAndHedgeTuple = new List(); - var eodtradeposition = - (from ep in db.eod_trade_position - join um in db.underlying_manager on ep.UnderlyingCode equals um.UnderlyingCode - where ep.ValueDate == _reqInfo.SACReportDate.Value && ep.ClientId == 0 - select new { ep, um }) - .ToArray().GroupBy(O => O.ep.TradeType == "股票" ? O.ep.UnderlyingCode : O.um.CommodityCode) - .Select(O => new - { - O.Key, - Amount = O.Sum(B => B.ep.Amount * (B.ep.PositionType == "long" ? 1 : -1)), - Cost = O.Sum(B => B.ep.Cost * (B.ep.PositionType == "long" ? 1 : -1)), - O.FirstOrDefault()?.ep.TradeType, - O.FirstOrDefault()?.um.UnderlyingInstrumentType, - O.FirstOrDefault()?.um.CommodityCode, - O.FirstOrDefault()?.um.UnderlyingCode, - O.FirstOrDefault()?.um.MarketName, - }).ToArray(); - foreach (var item in eodtradeposition) - { - var info = new TargetCaseAndHedgeModel(); - info.NameOfSecuritiesCompany = config.SuperviseMainName; - switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType)) - { - case "股票": - info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["权益类"]; - break; - case "股指期货": - case "商品期货": - case "商品现货": - info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["大宗商品"]; - break; - default: - info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["其他"]; - break; - } - switch (item.TradeType) - { - case "收益互换": - info.BusinessType = BusinessTypeMap["互换"]; - break; - default: - info.BusinessType = BusinessTypeMap["期权"]; - break; - } - info.SumInvestmentTargetName = item.Key; - info.UndrlygAssetCode = item.UnderlyingCode; - info.UndrlygAssetTradgPlc = item.MarketName; - info.BuyingImpulseVolume = "0"; - info.SellingImpulseVolume = "0"; - info.ImpulseVolume = "0"; - info.PositionAtTheEndOfThisMonth = item.Cost.ToString(); - info.TheNumberOfPositionsHeldAtTheEndOfThisMonth = item.Amount.ToString(); - info.AveragePriceAtTheEndOfTheMonth = (item.Cost / item.Amount).ToString(); - model.TargetCaseAndHedgeTuple.Add(info); - } - } - } - return model; - } - - private PeriodicReportSACModel GetPeriodicReportSACFromExcelAndDb() - { - var dbInfo = GetPeriodicReportSACFromDb(); - var excelInfo = GetPeriodicReportSACFromExcel(); - var model = new PeriodicReportSACModel(); - model.Year = _reqInfo.SACReportDate.Value.Year.ToString("0000"); - model.Month = _reqInfo.SACReportDate.Value.Month.ToString("0"); - - model.MainAgreementAddedThisMonth = Sum(dbInfo.MainAgreementAddedThisMonth, excelInfo.MainAgreementAddedThisMonth); - model.MainAgreementAccumulatedThisYear = Sum(dbInfo.MainAgreementAccumulatedThisYear, excelInfo.MainAgreementAccumulatedThisYear); - model.MainAgreementValidedAtEndOfThisMonth = Sum(dbInfo.MainAgreementValidedAtEndOfThisMonth, excelInfo.MainAgreementValidedAtEndOfThisMonth); - model.SupplementalAgreementAddedThisMonth = Sum(dbInfo.SupplementalAgreementAddedThisMonth, excelInfo.SupplementalAgreementAddedThisMonth); - model.SupplementalAgreementAccumulatedThisYear = Sum(dbInfo.SupplementalAgreementAccumulatedThisYear, excelInfo.SupplementalAgreementAccumulatedThisYear); - model.SupplementalAgreementValidedAtTheEndOfThisMonth = Sum(dbInfo.SupplementalAgreementValidedAtTheEndOfThisMonth, excelInfo.SupplementalAgreementValidedAtTheEndOfThisMonth); - model.PerformanceGuaranteeAgreementAddedThisMonth = Sum(dbInfo.PerformanceGuaranteeAgreementAddedThisMonth, excelInfo.PerformanceGuaranteeAgreementAddedThisMonth); - model.PerformanceGuaranteeAgreementAccumulatedThisYear = Sum(dbInfo.PerformanceGuaranteeAgreementAccumulatedThisYear, excelInfo.PerformanceGuaranteeAgreementAccumulatedThisYear); - model.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = Sum(dbInfo.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth, excelInfo.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth); - model.TransactionConfirmationAddedThisMonth = Sum(dbInfo.TransactionConfirmationAddedThisMonth, excelInfo.TransactionConfirmationAddedThisMonth); - model.TransactionConfirmationBookAccumulatedThisYear = Sum(dbInfo.TransactionConfirmationBookAccumulatedThisYear, excelInfo.TransactionConfirmationBookAccumulatedThisYear); - model.TransactionConfirmationValidedAtEndOfThisMonth = Sum(dbInfo.TransactionConfirmationValidedAtEndOfThisMonth, excelInfo.TransactionConfirmationValidedAtEndOfThisMonth); - - model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence = Sum(dbInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence, excelInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence); - model.NetCapitalAtEndOfTheMonth = Sum(dbInfo.NetCapitalAtEndOfTheMonth, excelInfo.NetCapitalAtEndOfTheMonth); - model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital = Sum(dbInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital, excelInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital); - - model.OTCOptionHasSignedByLegalPerson = Sum(dbInfo.OTCOptionHasSignedByLegalPerson, excelInfo.OTCOptionHasSignedByLegalPerson); - model.OTCOptionsHaveContractedProducts = Sum(dbInfo.OTCOptionsHaveContractedProducts, excelInfo.OTCOptionsHaveContractedProducts); - model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = Sum(dbInfo.OTCOptionsForTheMonthOfTheNewAddLegalPerson, excelInfo.OTCOptionsForTheMonthOfTheNewAddLegalPerson); - model.OTCOptionsForTheMonthOfTheNewAddProduct = Sum(dbInfo.OTCOptionsForTheMonthOfTheNewAddProduct, excelInfo.OTCOptionsForTheMonthOfTheNewAddProduct); - model.OTCOptionsLegalPersonInDurationForThisMouth = Sum(dbInfo.OTCOptionsLegalPersonInDurationForThisMouth, excelInfo.OTCOptionsLegalPersonInDurationForThisMouth); - model.OTCOptionsProductsInDurationForThisMouth = Sum(dbInfo.OTCOptionsProductsInDurationForThisMouth, excelInfo.OTCOptionsProductsInDurationForThisMouth); - - model.IncomeSwapHasSignedLegalPersonNumber = Sum(dbInfo.IncomeSwapHasSignedLegalPersonNumber, excelInfo.IncomeSwapHasSignedLegalPersonNumber); - model.IncomeSwapHasSignedProductNumber = Sum(dbInfo.IncomeSwapHasSignedProductNumber, excelInfo.IncomeSwapHasSignedProductNumber); - model.IncomeSwapForTheMonthOfTheNewAddLegalPerson = Sum(dbInfo.IncomeSwapForTheMonthOfTheNewAddLegalPerson, excelInfo.IncomeSwapForTheMonthOfTheNewAddLegalPerson); - model.IncomeSwapForTheMonthOfTheNewAddProduct = Sum(dbInfo.IncomeSwapForTheMonthOfTheNewAddProduct, excelInfo.IncomeSwapForTheMonthOfTheNewAddProduct); - model.IncomeSwapLegalPersonInDurationForThisMouth = Sum(dbInfo.IncomeSwapLegalPersonInDurationForThisMouth, excelInfo.IncomeSwapLegalPersonInDurationForThisMouth); - model.IncomeSwapProductsInDurationForThisMouth = Sum(dbInfo.IncomeSwapProductsInDurationForThisMouth, excelInfo.IncomeSwapProductsInDurationForThisMouth); - - model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = Sum(dbInfo.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale, excelInfo.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale); - model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = Sum(dbInfo.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale, excelInfo.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale); - model.OTCOptionsCommoditiesLastMonthDurationScale = Sum(dbInfo.OTCOptionsCommoditiesLastMonthDurationScale, excelInfo.OTCOptionsCommoditiesLastMonthDurationScale); - model.OTCOptionsOtherSubjectLastMonthDurationScale = Sum(dbInfo.OTCOptionsOtherSubjectLastMonthDurationScale, excelInfo.OTCOptionsOtherSubjectLastMonthDurationScale); - model.RevenueExchangeDomesticStockIndexLastMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticStockIndexLastMonthDurationScale, excelInfo.RevenueExchangeDomesticStockIndexLastMonthDurationScale); - model.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale, excelInfo.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale); - model.RevenueExchangeCommoditiesLastMonthDurationScale = Sum(dbInfo.RevenueExchangeCommoditiesLastMonthDurationScale, excelInfo.RevenueExchangeCommoditiesLastMonthDurationScale); - model.RevenueExchangeOtherSubjectLastMonthDurationScale = Sum(dbInfo.RevenueExchangeOtherSubjectLastMonthDurationScale, excelInfo.RevenueExchangeOtherSubjectLastMonthDurationScale); - model.TotalOfLastMonthDurationScale = Sum(dbInfo.TotalOfLastMonthDurationScale, excelInfo.TotalOfLastMonthDurationScale); - - model.OTCOptionsWithinTheIndexThisMonthOfTheNewScale = Sum(dbInfo.OTCOptionsWithinTheIndexThisMonthOfTheNewScale, excelInfo.OTCOptionsWithinTheIndexThisMonthOfTheNewScale); - model.OTCOptionsToAddScaleDomesticStocksInThisMonth = Sum(dbInfo.OTCOptionsToAddScaleDomesticStocksInThisMonth, excelInfo.OTCOptionsToAddScaleDomesticStocksInThisMonth); - model.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth, excelInfo.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth); - model.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth, excelInfo.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth); - model.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth); - model.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth); - model.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth); - model.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth); - model.TotalOfTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.TotalOfTheNewSizeOfTheIncreaseInThisMonth, excelInfo.TotalOfTheNewSizeOfTheIncreaseInThisMonth); - - model.OTCOptionsTerminateScaleDomesticStockIndexThisMonth = Sum(dbInfo.OTCOptionsTerminateScaleDomesticStockIndexThisMonth, excelInfo.OTCOptionsTerminateScaleDomesticStockIndexThisMonth); - model.OTCOptionsTerminateScaleDomesticStocksInThisMonth = Sum(dbInfo.OTCOptionsTerminateScaleDomesticStocksInThisMonth, excelInfo.OTCOptionsTerminateScaleDomesticStocksInThisMonth); - model.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth = Sum(dbInfo.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth, excelInfo.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth); - model.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth = Sum(dbInfo.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth, excelInfo.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth); - model.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth); - model.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth); - model.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth); - model.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth); - model.TotalOfTerminationOfTheScaleOfThisMonth = Sum(dbInfo.TotalOfTerminationOfTheScaleOfThisMonth, excelInfo.TotalOfTerminationOfTheScaleOfThisMonth); - - model.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale = Sum(dbInfo.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale, excelInfo.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale); - model.OTCOptionsWithinIndividualStocksInThisMonthDurationScale = Sum(dbInfo.OTCOptionsWithinIndividualStocksInThisMonthDurationScale, excelInfo.OTCOptionsWithinIndividualStocksInThisMonthDurationScale); - model.OTCOptionsCommoditiesInThisMonthDurationScale = Sum(dbInfo.OTCOptionsCommoditiesInThisMonthDurationScale, excelInfo.OTCOptionsCommoditiesInThisMonthDurationScale); - model.OTCOptionsOtherSubjectThisMonthDurationScale = Sum(dbInfo.OTCOptionsOtherSubjectThisMonthDurationScale, excelInfo.OTCOptionsOtherSubjectThisMonthDurationScale); - model.RevenueExchangeDomesticStockIndexThisMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticStockIndexThisMonthDurationScale, excelInfo.RevenueExchangeDomesticStockIndexThisMonthDurationScale); - model.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale, excelInfo.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale); - model.RevenueExchangeCommoditiesThisMonthDurationScale = Sum(dbInfo.RevenueExchangeCommoditiesThisMonthDurationScale, excelInfo.RevenueExchangeCommoditiesThisMonthDurationScale); - model.RevenueExchangeOtherSubjectThisMonthDurationScale = Sum(dbInfo.RevenueExchangeOtherSubjectThisMonthDurationScale, excelInfo.RevenueExchangeOtherSubjectThisMonthDurationScale); - model.TotalOfThisMonthDurationScale = Sum(dbInfo.TotalOfThisMonthDurationScale, excelInfo.TotalOfThisMonthDurationScale); - - model.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory); - model.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory); - model.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory); - model.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory); - model.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear); - model.IncomeSwapDomesticStockHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapDomesticStockHasAddedNewScaleInThisYear, excelInfo.IncomeSwapDomesticStockHasAddedNewScaleInThisYear); - model.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear); - model.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear); - model.TotalNewScaleInThisYear = Sum(dbInfo.TotalNewScaleInThisYear, excelInfo.TotalNewScaleInThisYear); - - model.OTCOptionsStockIndexAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsStockIndexAtTheEndOfLastMonth, excelInfo.OTCOptionsStockIndexAtTheEndOfLastMonth); - model.OTCOptionsStockAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsStockAtTheEndOfLastMonth, excelInfo.OTCOptionsStockAtTheEndOfLastMonth); - model.OTCOptionsCommoditiesAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsCommoditiesAtTheEndOfLastMonth, excelInfo.OTCOptionsCommoditiesAtTheEndOfLastMonth); - model.OTCOptionsOtherSubjectAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsOtherSubjectAtTheEndOfLastMonth, excelInfo.OTCOptionsOtherSubjectAtTheEndOfLastMonth); - model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth); - model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth); - model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth); - model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth); - model.TotalNumberOfContractsAtTheEndOfLastMonth = Sum(dbInfo.TotalNumberOfContractsAtTheEndOfLastMonth, excelInfo.TotalNumberOfContractsAtTheEndOfLastMonth); - - model.OTCOptionsStockIndexThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsStockIndexThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsStockIndexThisMonthNewDomesticContractNumber); - model.OTCOptionsStockThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsStockThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsStockThisMonthNewDomesticContractNumber); - model.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber); - model.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber); - model.IncomeSwapDomesticStockIndexNewContractInThisMonth = Sum(dbInfo.IncomeSwapDomesticStockIndexNewContractInThisMonth, excelInfo.IncomeSwapDomesticStockIndexNewContractInThisMonth); - model.IncomeSwapDomesticStockNewContractInThisMonth = Sum(dbInfo.IncomeSwapDomesticStockNewContractInThisMonth, excelInfo.IncomeSwapDomesticStockNewContractInThisMonth); - model.IncomeSwapCommoditiesNewContractInThisMonth = Sum(dbInfo.IncomeSwapCommoditiesNewContractInThisMonth, excelInfo.IncomeSwapCommoditiesNewContractInThisMonth); - model.IncomeSwapOtherSubjectNewContractInThisMonth = Sum(dbInfo.IncomeSwapOtherSubjectNewContractInThisMonth, excelInfo.IncomeSwapOtherSubjectNewContractInThisMonth); - model.TotalNumberOfNewContractsInThisMonth = Sum(dbInfo.TotalNumberOfNewContractsInThisMonth, excelInfo.TotalNumberOfNewContractsInThisMonth); - - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber); - model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber); - model.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth); - model.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth); - model.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth); - model.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth); - model.TotalNumberOfContractsTerminatedThisMonth = Sum(dbInfo.TotalNumberOfContractsTerminatedThisMonth, excelInfo.TotalNumberOfContractsTerminatedThisMonth); - - model.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth); - model.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth); - model.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth); - model.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth); - model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth); - model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth); - model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth); - model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth); - model.TotalNumberOfContractsAtTheEndOfThisMonth = Sum(dbInfo.TotalNumberOfContractsAtTheEndOfThisMonth, excelInfo.TotalNumberOfContractsAtTheEndOfThisMonth); - - model.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear); - model.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear); - model.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear); - model.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear); - model.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear); - model.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear); - model.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear); - model.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear); - model.TotalNumberOfNewContractsInThisYear = Sum(dbInfo.TotalNumberOfNewContractsInThisYear, excelInfo.TotalNumberOfNewContractsInThisYear); - - model.MarginOfSubsistSwap = Sum(dbInfo.MarginOfSubsistSwap, excelInfo.MarginOfSubsistSwap); - model.HedgedMarketValueOfSwap = Sum(dbInfo.HedgedMarketValueOfSwap, excelInfo.HedgedMarketValueOfSwap); - model.LeverageRatiOfSwap = Sum(dbInfo.LeverageRatiOfSwap, excelInfo.LeverageRatiOfSwap); - model.MarginOfSubsistStockIndexSwap = Sum(dbInfo.MarginOfSubsistStockIndexSwap, excelInfo.MarginOfSubsistStockIndexSwap); - model.HedgedMarketValueOfStockIndexSwap = Sum(dbInfo.HedgedMarketValueOfStockIndexSwap, excelInfo.HedgedMarketValueOfStockIndexSwap); - model.LeverageRatioOfStockIndexSwap = Sum(dbInfo.LeverageRatioOfStockIndexSwap, excelInfo.LeverageRatioOfStockIndexSwap); - model.MarginOfSubsistStockSwap = Sum(dbInfo.MarginOfSubsistStockSwap, excelInfo.MarginOfSubsistStockSwap); - model.HedgedMarketValueOfStockSwap = Sum(dbInfo.HedgedMarketValueOfStockSwap, excelInfo.HedgedMarketValueOfStockSwap); - model.LeverageRatioOfStockSwap = Sum(dbInfo.LeverageRatioOfStockSwap, excelInfo.LeverageRatioOfStockSwap); - model.MarginandPremiumOfSubsistOption = Sum(dbInfo.MarginandPremiumOfSubsistOption, excelInfo.MarginandPremiumOfSubsistOption); - model.HedgedMarketValueOfOption = Sum(dbInfo.HedgedMarketValueOfOption, excelInfo.HedgedMarketValueOfOption); - model.LeverageRatioOfOption = Sum(dbInfo.LeverageRatioOfOption, excelInfo.LeverageRatioOfOption); - model.MarginandPremiumOfSubsistStockIndexOption = Sum(dbInfo.MarginandPremiumOfSubsistStockIndexOption, excelInfo.MarginandPremiumOfSubsistStockIndexOption); - model.HedgedMarketValueOfStockIndexOption = Sum(dbInfo.HedgedMarketValueOfStockIndexOption, excelInfo.HedgedMarketValueOfStockIndexOption); - model.LeverageRatioOfStockIndexOption = Sum(dbInfo.LeverageRatioOfStockIndexOption, excelInfo.LeverageRatioOfStockIndexOption); - model.MarginandPremiumOfSubsistStockOption = Sum(dbInfo.MarginandPremiumOfSubsistStockOption, excelInfo.MarginandPremiumOfSubsistStockOption); - model.HedgedMarketValueOfStockOption = Sum(dbInfo.HedgedMarketValueOfStockOption, excelInfo.HedgedMarketValueOfStockOption); - model.LeverageRatioOfStockOption = Sum(dbInfo.LeverageRatioOfStockOption, excelInfo.LeverageRatioOfStockOption); - - model.TotalNominalPrincipalAmountOfSwapThisMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfSwapThisMonth, excelInfo.TotalNominalPrincipalAmountOfSwapThisMonth); - model.TotalNominalPrincipalAmountOfSwapLastMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfSwapLastMonth, excelInfo.TotalNominalPrincipalAmountOfSwapLastMonth); - - model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = Sum(dbInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth, excelInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth); - model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = Sum(dbInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth, excelInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth); - - model.SwapCashCollateralValueThisMonth = Sum(dbInfo.SwapCashCollateralValueThisMonth, excelInfo.SwapCashCollateralValueThisMonth); - model.SwapCashCollateralValueLastMonth = Sum(dbInfo.SwapCashCollateralValueLastMonth, excelInfo.SwapCashCollateralValueLastMonth); - - model.SwapSecuritiesCollateralValueThisMonth = Sum(dbInfo.SwapSecuritiesCollateralValueThisMonth, excelInfo.SwapSecuritiesCollateralValueThisMonth); - model.SwapSecuritiesCollateralValueLastMonthThisMonth = Sum(dbInfo.SwapSecuritiesCollateralValueLastMonthThisMonth, excelInfo.SwapSecuritiesCollateralValueLastMonthThisMonth); - - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull); - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull); - - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet); - model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet); - - model.SwapNumberOfDefaultCustomersAtThisMonthThisMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersAtThisMonthThisMonth, excelInfo.SwapNumberOfDefaultCustomersAtThisMonthThisMonth); - model.SwapNumberOfDefaultCustomersAtThisMonthLastMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersAtThisMonthLastMonth, excelInfo.SwapNumberOfDefaultCustomersAtThisMonthLastMonth); - - model.SwapDefaultTransactionNumberAtThisMonthThisMonth = Sum(dbInfo.SwapDefaultTransactionNumberAtThisMonthThisMonth, excelInfo.SwapDefaultTransactionNumberAtThisMonthThisMonth); - model.SwapDefaultTransactionNumberAtThisMonthLastMonth = Sum(dbInfo.SwapDefaultTransactionNumberAtThisMonthLastMonth, excelInfo.SwapDefaultTransactionNumberAtThisMonthLastMonth); - - model.TotalSwapDefaultCustomerNumberInThisYearThisMonth = Sum(dbInfo.TotalSwapDefaultCustomerNumberInThisYearThisMonth, excelInfo.TotalSwapDefaultCustomerNumberInThisYearThisMonth); - model.TotalSwapDefaultCustomerNumberInThisYearLastMonth = Sum(dbInfo.TotalSwapDefaultCustomerNumberInThisYearLastMonth, excelInfo.TotalSwapDefaultCustomerNumberInThisYearLastMonth); - - model.SwapNumberOfDefaultCustomersInThisYearThisMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersInThisYearThisMonth, excelInfo.SwapNumberOfDefaultCustomersInThisYearThisMonth); - model.SwapNumberOfDefaultCustomersInThisYearLastMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersInThisYearLastMonth, excelInfo.SwapNumberOfDefaultCustomersInThisYearLastMonth); - - model.TotalNominalPrincipalAmountOfOptionThisMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfOptionThisMonth, excelInfo.TotalNominalPrincipalAmountOfOptionThisMonth); - model.TotalNominalPrincipalAmountOfOptionLastMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfOptionLastMonth, excelInfo.TotalNominalPrincipalAmountOfOptionLastMonth); - - model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = Sum(dbInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth, excelInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth); - model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = Sum(dbInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth, excelInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth); - - model.OptionCashCollateralValueThisMonth = Sum(dbInfo.OptionCashCollateralValueThisMonth, excelInfo.OptionCashCollateralValueThisMonth); - model.OptionCashCollateralValueLastMonth = Sum(dbInfo.OptionCashCollateralValueLastMonth, excelInfo.OptionCashCollateralValueLastMonth); - - model.OptionSecuritiesCollateralValueThisMonth = Sum(dbInfo.OptionSecuritiesCollateralValueThisMonth, excelInfo.OptionSecuritiesCollateralValueThisMonth); - model.OptionSecuritiesCollateralValueLastMonth = Sum(dbInfo.OptionSecuritiesCollateralValueLastMonth, excelInfo.OptionSecuritiesCollateralValueLastMonth); - - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull); - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull); - - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet); - model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet); - - model.OptionNumberOfDefaultCustomersAtThisMonthThisMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersAtThisMonthThisMonth, excelInfo.OptionNumberOfDefaultCustomersAtThisMonthThisMonth); - model.OptionNumberOfDefaultCustomersAtThisMonthLastMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersAtThisMonthLastMonth, excelInfo.OptionNumberOfDefaultCustomersAtThisMonthLastMonth); - - model.OptionTransactionNumberAtThisMonthThisMonth = Sum(dbInfo.OptionTransactionNumberAtThisMonthThisMonth, excelInfo.OptionTransactionNumberAtThisMonthThisMonth); - model.OptionTransactionNumberAtThisMonthLastMonth = Sum(dbInfo.OptionTransactionNumberAtThisMonthLastMonth, excelInfo.OptionTransactionNumberAtThisMonthLastMonth); - - model.TotalOptionDefaultCustomerNumberInThisYearThisMonth = Sum(dbInfo.TotalOptionDefaultCustomerNumberInThisYearThisMonth, excelInfo.TotalOptionDefaultCustomerNumberInThisYearThisMonth); - model.TotalOptionDefaultCustomerNumberInThisYearLastMonth = Sum(dbInfo.TotalOptionDefaultCustomerNumberInThisYearLastMonth, excelInfo.TotalOptionDefaultCustomerNumberInThisYearLastMonth); - - model.OptionNumberOfDefaultCustomersInThisYearThisMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersInThisYearThisMonth, excelInfo.OptionNumberOfDefaultCustomersInThisYearThisMonth); - model.OptionNumberOfDefaultCustomersInThisYearLastMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersInThisYearLastMonth, excelInfo.OptionNumberOfDefaultCustomersInThisYearLastMonth); - - model.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth = Sum(dbInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth, excelInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth); - model.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth = Sum(dbInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth, excelInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth); - - model.CashBalanceAtEndOfThisMonth = Sum(dbInfo.CashBalanceAtEndOfThisMonth, excelInfo.CashBalanceAtEndOfThisMonth); - model.CashBalanceAtEndOfLastMonth = Sum(dbInfo.CashBalanceAtEndOfLastMonth, excelInfo.CashBalanceAtEndOfLastMonth); - - model.HoldStockMarketValueAtEndOfThisMonth = Sum(dbInfo.HoldStockMarketValueAtEndOfThisMonth, excelInfo.HoldStockMarketValueAtEndOfThisMonth); - model.HoldStockMarketValueAtEndOfLastMonth = Sum(dbInfo.HoldStockMarketValueAtEndOfLastMonth, excelInfo.HoldStockMarketValueAtEndOfLastMonth); - - model.HoldMarketValueOfBondsAtTheEndOfThisMonth = Sum(dbInfo.HoldMarketValueOfBondsAtTheEndOfThisMonth, excelInfo.HoldMarketValueOfBondsAtTheEndOfThisMonth); - model.HoldMarketValueOfBondsAtTheEndOfLastMonth = Sum(dbInfo.HoldMarketValueOfBondsAtTheEndOfLastMonth, excelInfo.HoldMarketValueOfBondsAtTheEndOfLastMonth); - - model.OwnedAssetManagementProductsAtTheEndOfThisMonth = Sum(dbInfo.OwnedAssetManagementProductsAtTheEndOfThisMonth, excelInfo.OwnedAssetManagementProductsAtTheEndOfThisMonth); - model.OwnedAssetManagementProductsAtTheEndOfLastMonth = Sum(dbInfo.OwnedAssetManagementProductsAtTheEndOfLastMonth, excelInfo.OwnedAssetManagementProductsAtTheEndOfLastMonth); - - model.OwnedBankFinanceAtTheEndOfThisMonth = Sum(dbInfo.OwnedBankFinanceAtTheEndOfThisMonth, excelInfo.OwnedBankFinanceAtTheEndOfThisMonth); - model.OwnedBankFinanceAtTheEndOfLastMonth = Sum(dbInfo.OwnedBankFinanceAtTheEndOfLastMonth, excelInfo.OwnedBankFinanceAtTheEndOfLastMonth); - - model.HoldTrustProductAtTheEndOfThisMonth = Sum(dbInfo.HoldTrustProductAtTheEndOfThisMonth, excelInfo.HoldTrustProductAtTheEndOfThisMonth); - model.HoldTrustProductAtTheEndOfLastMonth = Sum(dbInfo.HoldTrustProductAtTheEndOfLastMonth, excelInfo.HoldTrustProductAtTheEndOfLastMonth); - - model.InsuranceProductsAreHeldAtTheEndOfThisMonth = Sum(dbInfo.InsuranceProductsAreHeldAtTheEndOfThisMonth, excelInfo.InsuranceProductsAreHeldAtTheEndOfThisMonth); - model.InsuranceProductsAreHeldAtTheEndOfLastMonth = Sum(dbInfo.InsuranceProductsAreHeldAtTheEndOfLastMonth, excelInfo.InsuranceProductsAreHeldAtTheEndOfLastMonth); - - model.HoldOtherProductsAtTheEndOfThisMonth = Sum(dbInfo.HoldOtherProductsAtTheEndOfThisMonth, excelInfo.HoldOtherProductsAtTheEndOfThisMonth); - model.HoldOtherProductsAtTheEndOfLastMonth = Sum(dbInfo.HoldOtherProductsAtTheEndOfLastMonth, excelInfo.HoldOtherProductsAtTheEndOfLastMonth); - - model.SettledSwapItemsAtThisMonth = Sum(dbInfo.SettledSwapItemsAtThisMonth, excelInfo.SettledSwapItemsAtThisMonth); - model.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth = Sum(dbInfo.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth, excelInfo.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth); - model.SwapIncomeCashFlow = Sum(dbInfo.SwapIncomeCashFlow, excelInfo.SwapIncomeCashFlow); - model.SwapExpensesCashFlow = Sum(dbInfo.SwapExpensesCashFlow, excelInfo.SwapExpensesCashFlow); - model.CashFlowCorrespondingToNetIncomeOnSwapMargin = Sum(dbInfo.CashFlowCorrespondingToNetIncomeOnSwapMargin, excelInfo.CashFlowCorrespondingToNetIncomeOnSwapMargin); - model.SwapHedgeCost = Sum(dbInfo.SwapHedgeCost, excelInfo.SwapHedgeCost); - - model.SettledOptionItemsAtThisMonth = Sum(dbInfo.SettledOptionItemsAtThisMonth, excelInfo.SettledOptionItemsAtThisMonth); - model.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth = Sum(dbInfo.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth, excelInfo.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth); - model.OptionPremiumIncome = Sum(dbInfo.OptionPremiumIncome, excelInfo.OptionPremiumIncome); - model.OptionHedgeCost = Sum(dbInfo.OptionHedgeCost, excelInfo.OptionHedgeCost); - - model.BalanceOfSwapRealizedGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfSwapRealizedGainsAndLossesAtThisMonth, excelInfo.BalanceOfSwapRealizedGainsAndLossesAtThisMonth); - model.BalanceOfOptionRealizedGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfOptionRealizedGainsAndLossesAtThisMonth, excelInfo.BalanceOfOptionRealizedGainsAndLossesAtThisMonth); - - model.BalanceOfSwapRealizedGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfSwapRealizedGainsAndLossesAtThisYear, excelInfo.BalanceOfSwapRealizedGainsAndLossesAtThisYear); - model.BalanceOfOptionRealizedGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfOptionRealizedGainsAndLossesAtThisYear, excelInfo.BalanceOfOptionRealizedGainsAndLossesAtThisYear); - - model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = Sum(dbInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth, excelInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth); - model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = Sum(dbInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth, excelInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth); - - model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = Sum(dbInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear, excelInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear); - model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = Sum(dbInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear, excelInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear); - - model.BalanceOfSwapTotalGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfSwapTotalGainsAndLossesAtThisMonth, excelInfo.BalanceOfSwapTotalGainsAndLossesAtThisMonth); - model.BalanceOfOptionTotalGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfOptionTotalGainsAndLossesAtThisMonth, excelInfo.BalanceOfOptionTotalGainsAndLossesAtThisMonth); - - model.BalanceOfSwapTotalGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfSwapTotalGainsAndLossesAtThisYear, excelInfo.BalanceOfSwapTotalGainsAndLossesAtThisYear); - model.BalanceOfOptionTotalGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfOptionTotalGainsAndLossesAtThisYear, excelInfo.BalanceOfOptionTotalGainsAndLossesAtThisYear); - - model.IncreaseBusinessDetailsThisMonthTuple = new List(); - if (dbInfo.IncreaseBusinessDetailsThisMonthTuple != null) - { - model.IncreaseBusinessDetailsThisMonthTuple.AddRange(dbInfo.IncreaseBusinessDetailsThisMonthTuple); - } - if (excelInfo.IncreaseBusinessDetailsThisMonthTuple != null) - { - model.IncreaseBusinessDetailsThisMonthTuple.AddRange(excelInfo.IncreaseBusinessDetailsThisMonthTuple); - } - - model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple = new List(); - if (dbInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) - { - model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.AddRange(dbInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple); - } - if (excelInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) - { - model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.AddRange(excelInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple); - } - - model.TargetCaseAndHedgeTuple = new List(); - if (dbInfo.TargetCaseAndHedgeTuple != null) - { - model.TargetCaseAndHedgeTuple.AddRange(dbInfo.TargetCaseAndHedgeTuple); - } - if (excelInfo.TargetCaseAndHedgeTuple != null) - { - model.TargetCaseAndHedgeTuple.AddRange(excelInfo.TargetCaseAndHedgeTuple); - } - - return model; - } - - private string Sum(string param1, string param2) - { - var status1 = double.TryParse(param1, out var v1); - var status2 = double.TryParse(param2, out var v2); - if (status1 || status2) - { - return (v1 + v2).ToString(); - } - return ""; - } - private PeriodicReportSACModel GetPeriodicReportSACFromExcel() { var model = new PeriodicReportSACModel(); @@ -1234,7 +329,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private void GetClientInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol) { - int row = startRow + 0; + var row = startRow + 0; model.OTCOptionHasSignedByLegalPerson = GetDataSetValueToDouble(dt, row, startCol + 0).ToString(); model.OTCOptionsHaveContractedProducts = GetDataSetValueToDouble(dt, row, startCol + 1).ToString(); model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = GetDataSetValueToDouble(dt, row, startCol + 2).ToString(); @@ -1258,7 +353,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private void GetExchangeInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol) { - int row = startRow + 0; + var row = startRow + 0; model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = GetDataSetValueToDouble(dt, row, startCol + 0).ToString(); model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 1).ToString(); model.OTCOptionsCommoditiesLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 2).ToString(); @@ -1517,10 +612,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.PeriodicReportSAC != null) { - List listRoot = new List(); + var listRoot = new List(); var helper = new Common.CheckHelper(); var detailHelper = new Common.CheckHelper(); var detailAtHelper = new Common.CheckHelper(); @@ -1531,7 +626,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple != null) { - for (int i = 0; i < model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple[i]; @@ -1541,15 +636,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null) { - for (int i = 0; i < model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple[i]; @@ -1559,15 +656,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (model.PeriodicReportSAC.TargetCaseAndHedgeTuple != null) { - for (int i = 0; i < model.PeriodicReportSAC.TargetCaseAndHedgeTuple.Count; i++) + for (var i = 0; i < model.PeriodicReportSAC.TargetCaseAndHedgeTuple.Count; i++) { var listItem = new List(); var item = model.PeriodicReportSAC.TargetCaseAndHedgeTuple[i]; @@ -1577,16 +676,20 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("TargetCaseAndHedgeTuple", i); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("TargetCaseAndHedgeTuple", i) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("PeriodicReportSAC"); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("PeriodicReportSAC") + { + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -1603,7 +706,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private double GetRealizedPnl(Expression> expression, DateTime startDate, DateTime endDate) { - var latestMonthIncomeQuery = from tc in DbContext.trade_cash join t in DbContext.trade.Where(expression) on tc.TradeId equals t.id where tc.ValueDate >= startDate && tc.ValueDate <= endDate && tc.ValidState != "InValid" && !tc.IsDeleted group tc by tc.TradeId into tcInfo select new { tcInfo.Key, Amount = tcInfo.Sum(O => (double?)O.Amount) }; + var latestMonthIncomeQuery = from tc in DbContext.trade_cash join t in DbContext.trade.Where(O => O.TradeType != "结构化交易").Where(expression) on tc.TradeId equals t.id where tc.ValueDate >= startDate && tc.ValueDate <= endDate && tc.ValidState != "InValid" && !tc.IsDeleted group tc by tc.TradeId into tcInfo select new { tcInfo.Key, Amount = tcInfo.Sum(O => (double?)O.Amount) }; var latestMonthIds = latestMonthIncomeQuery.Select(O => O.Key); var latestMonthIncome = latestMonthIncomeQuery.Sum(O => O.Amount) ?? 0; var lastMonthIncome = (from tc in DbContext.trade_cash where tc.ValueDate < startDate && latestMonthIds.Contains(tc.TradeId) && tc.ValidState != "InValid" && !tc.IsDeleted select tc.Amount).Sum(O => (double?)O) ?? 0; @@ -1619,7 +722,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private double GetPositionPnl(Expression> expression, DateTime lastEndDate, DateTime endDate) { - var swapLatestMonthIncomeQuery = from ep in DbContext.eod_trade_position join t in DbContext.trade.Where(expression) on ep.TradeId equals t.id where ep.ValueDate == endDate && ep.TradeId > 0 && ep.ClientId > 0 select new { ep.TradeId, ep.PositionPnL }; + var swapLatestMonthIncomeQuery = from ep in DbContext.eod_trade_position join t in DbContext.trade.Where(O => O.TradeType != "结构化交易").Where(expression) on ep.TradeId equals t.id where ep.ValueDate == endDate && ep.TradeId > 0 && ep.ClientId > 0 select new { ep.TradeId, ep.PositionPnL }; var swapLatestMonthIds = swapLatestMonthIncomeQuery.Select(O => O.TradeId); var swapLatestMonthIncome = swapLatestMonthIncomeQuery.Sum(O => (double?)O.PositionPnL) ?? 0; var swapLastMonthIncome = (from ep in DbContext.eod_trade_position where ep.ValueDate == lastEndDate && swapLatestMonthIds.Contains(ep.TradeId) select ep.PositionPnL).Sum(O => (double?)O) ?? 0; @@ -1644,13 +747,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } - var model = new IncreaseBusinessDetailsThisMonthModel(); - - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1); - model.NameOfCounterparty = GetDataSetValue(dt, i, 2); - model.CounterpartyProductName = GetDataSetValue(dt, i, 3); - model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4); - model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5); + var model = new IncreaseBusinessDetailsThisMonthModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1), + NameOfCounterparty = GetDataSetValue(dt, i, 2), + CounterpartyProductName = GetDataSetValue(dt, i, 3), + TradeConfirmationNumber = GetDataSetValue(dt, i, 4), + TransactionConfirmationNumber = GetDataSetValue(dt, i, 5) + }; if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace()) { model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber); @@ -1664,7 +768,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.UndrlygAssetName = GetDataSetValue(dt, i, 12); model.UndrlygAssetCode = GetDataSetValue(dt, i, 13); model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 14); - model.OptionObjectSecondClass = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)]; + model.OptionObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)]; model.ReturnSwapObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 16)]; model.NonAnnualOptionFee = GetDataSetValue(dt, i, 17); model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 18)]; @@ -1693,13 +797,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } - var model = new InventoryBusinessDetailsAtTheEndOfThisMonthModel(); - - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1); - model.NameOfCounterparty = GetDataSetValue(dt, i, 2); - model.NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3); - model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4); - model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5); + var model = new InventoryBusinessDetailsAtTheEndOfThisMonthModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1), + NameOfCounterparty = GetDataSetValue(dt, i, 2), + NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3), + TradeConfirmationNumber = GetDataSetValue(dt, i, 4), + TransactionConfirmationNumber = GetDataSetValue(dt, i, 5) + }; if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace()) { model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber); @@ -1713,7 +818,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.UndrlygAssetName = GetDataSetValue(dt, i, 12); model.UndrlygAssetCode = GetDataSetValue(dt, i, 13); model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 14); - model.OptionSumInvestmentTargetType = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)]; + model.OptionSumInvestmentTargetType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)]; model.ExchangeSumInvestmentTargetType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 16)]; model.OptionFee = GetDataSetValue(dt, i, 17); model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 18)]; @@ -1746,20 +851,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } - var model = new TargetCaseAndHedgeModel(); - - model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1); - model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 2)]; - model.SumInvestmentTargetType = ConsReport.HedgeSACUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 3)]; - model.SumInvestmentTargetName = GetDataSetValue(dt, i, 4); - model.UndrlygAssetCode = GetDataSetValue(dt, i, 5); - model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 6); - model.BuyingImpulseVolume = GetDataSetValue(dt, i, 7); - model.SellingImpulseVolume = GetDataSetValue(dt, i, 8); - model.ImpulseVolume = GetDataSetValue(dt, i, 9); - model.PositionAtTheEndOfThisMonth = GetDataSetValue(dt, i, 10); - model.TheNumberOfPositionsHeldAtTheEndOfThisMonth = GetDataSetValue(dt, i, 11); - model.AveragePriceAtTheEndOfTheMonth = GetDataSetValue(dt, i, 12); + var model = new TargetCaseAndHedgeModel + { + NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1), + BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 2)], + SumInvestmentTargetType = ConsReport.HedgeSACUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 3)], + SumInvestmentTargetName = GetDataSetValue(dt, i, 4), + UndrlygAssetCode = GetDataSetValue(dt, i, 5), + UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 6), + BuyingImpulseVolume = GetDataSetValue(dt, i, 7), + SellingImpulseVolume = GetDataSetValue(dt, i, 8), + ImpulseVolume = GetDataSetValue(dt, i, 9), + PositionAtTheEndOfThisMonth = GetDataSetValue(dt, i, 10), + TheNumberOfPositionsHeldAtTheEndOfThisMonth = GetDataSetValue(dt, i, 11), + AveragePriceAtTheEndOfTheMonth = GetDataSetValue(dt, i, 12) + }; result.Add(model); } @@ -1777,6 +883,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + //定期报告中不存在编号,也就不存在修改编号的情况; + throw new NotImplementedException(); + } + public override bool BeforeOfGenerated(out string errMsg) { errMsg = ""; diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportService.cs index c0377027..eee1e5ed 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportService.cs @@ -1,6 +1,11 @@ -using System.Data; +using NPOI.SS.Formula.Functions; +using OfficeOpenXml.Drawing.Slicer.Style; +using System; +using System.Data; +using System.Text; using System.Text.RegularExpressions; using System.Xml; +using System.Xml.Serialization; using YieldChain.Helpers; using YLErp.BLL; using YLErp.Commons; @@ -9,7 +14,11 @@ using YLErp.Helpers; using YLErp.Modules.ClientModule; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; +using YLErp.Office; +using YLErp.Office.ExcelModule; +using static YLErp.Commons.ExcelHelper; using static YLErp.DBModels.Consts.ConsReport; +using ExcelHelper = YLErp.Commons.ExcelHelper; namespace YLErp.Modules.SuperviseReportModule.SAC.Service { @@ -19,14 +28,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { } + /// /// 生成报送文件锁 /// - private static AutoResetEvent generateSuperviseLock = new AutoResetEvent(true); + private static readonly AutoResetEvent generateSuperviseLock = new(true); /// /// 操作报送文件锁 /// - private static AutoResetEvent optionSuperviseLock = new AutoResetEvent(true); + private static readonly AutoResetEvent optionSuperviseLock = new(true); #region 生成报送文件 @@ -37,22 +47,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// public List Execute(ReportInfo req) { - LogFactory.GetLogger("Execute").Info($"7"); if (req.ReportTypes == null || req.ReportTypes.Count == 0) { throw new ServiceException("请选择要报送的类型"); } - LogFactory.GetLogger("Execute").Info($"8"); - List reportList = new List(); + var reportList = new List(); var useBreak = false; try { - LogFactory.GetLogger("Execute").Info($"9"); generateSuperviseLock.WaitOne(); - ReportStatusModel reportStatus = new ReportStatusModel(); + var reportStatus = new ReportStatusModel(); do { - LogFactory.GetLogger("Execute").Info($"10"); reportStatus.ResetCurrentLength(); //放开存在未报送报告时,阻塞其他报告生成的限制,可能引起的业务中先后顺序的问题(比如一定要先新增后修改的问题)需要客户自己判断; //var report = DbContext.supervise_report.Where(O => O.ReportType == SuperviseReportTypeEnum.SAC && O.ReportReponseStatus <= ReportSentStatus.SENDING).FirstOrDefault(); @@ -60,26 +66,25 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service //{ // throw new ServiceException($"{UserBLL.GetById((int)report.optUserId)?.Name} 名下存在未发送或发送中的记录,请稍后操作"); //} - LogFactory.GetLogger("Execute").Info($"10"); - Dictionary serviceDict = new Dictionary(); + var serviceDict = new Dictionary(); req.ReportTypes.Sort(); foreach (var item in req.ReportTypes) { - SuperviseReportTypeEnum type = (SuperviseReportTypeEnum)item; + var type = (SuperviseReportTypeEnum)item; var service = ReportBaseService.ReportFactory(OptUser, type); - if (!service.CheckRequestParamer(req, out string errMsg)) + if (!service.CheckRequestParamer(req, out var errMsg)) { throw new ServiceException(errMsg); } serviceDict[item] = service; } - LogFactory.GetLogger("Execute").Info($"11"); ReportBaseService.MaxExceIndex = queryCurrentExceIndex(); - List checkMsgArr = new List(); - ReportResponse res = new ReportResponse(); - res.Infos = new List(); - res.Index = queryCurrentFileIndex(req.ReportDate); - LogFactory.GetLogger("Execute").Info($"12"); + var checkMsgArr = new List(); + var res = new ReportResponse + { + Infos = new List(), + Index = queryCurrentFileIndex(req.ReportDate) + }; foreach (var service in serviceDict) { try @@ -128,9 +133,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { foreach (var item in service.Value.ValidOperationType) { - LogFactory.GetLogger("Execute").Info($"OperationType:" + item.ToString()); model = service.Value.Execute(req, item); - LogFactory.GetLogger("Execute").Info($"OperationType1:" + item.ToString()); res.Infos.Add(model); checkMsgArr.Add(service.Value.CheckValue(model, out _)); } @@ -156,11 +159,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (checkMsgArr.Any(O => O != null)) { - var exception = new ServiceException("数据校验未通过"); - exception.Tag = checkMsgArr.Where(O => O != null).ToList(); + var Tag = new ExceptionExtensionInfo + { + Tag = checkMsgArr.Where(O => O != null).ToList(), + }; + //生成文件会报错,暂时先不开放这个功能 + var savePath = $"~/App_Docs/Download/Report/Output/{OptUser.UserId}/报送文件_{DateTime.Now.ToString("yyyyMMddHHmmss")}.zip"; + GenerateUploadZipFile(res, savePath); + Tag.ErrFilePath = savePath; + var exception = new ServiceException("数据校验未通过") + { + Tag = Tag + }; throw exception; } - string zipPath = ""; + var zipPath = ""; try { optionSuperviseLock.WaitOne(); @@ -172,12 +185,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } foreach (var item in serviceDict) { - if (!item.Value.BeforeOfGenerated(out string errMsg)) + if (!item.Value.BeforeOfGenerated(out var errMsg)) { throw new ServiceException(errMsg); } } - DBModels.SuperviseReport reportInfo = new DBModels.SuperviseReport() + var reportInfo = new DBModels.SuperviseReport() { ReportType = SuperviseReportTypeEnum.SAC, ReportDate = req.ReportDate, @@ -222,7 +235,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private int queryCurrentExceIndex() { var exceId = DbContext.sac_report_notes.OrderByDescending(O => O.ExceId).Select(O => O.ExceId).FirstOrDefault(); - int index = 1; + var index = 1; if (!string.IsNullOrWhiteSpace(exceId)) { exceId = Regex.Match(exceId, @"\d{8}$").Value; @@ -239,9 +252,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private int queryCurrentFileIndex(DateTime date) { var fileId = DbContext.supervise_report.Where(O => O.ReportDate == date && O.ReportType == SuperviseReportTypeEnum.SAC).OrderByDescending(O => O.FileTag).Select(O => O.FileTag).FirstOrDefault(); - int index = 1; + var index = 1; if (!string.IsNullOrWhiteSpace(fileId)) { + if (fileId.EndsWith("_checked")) + { + fileId = fileId.Replace("_checked", ""); + } fileId = Regex.Match(fileId, @"\d{4}$").Value; index = int.Parse(fileId) + 1; } @@ -274,7 +291,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { return Return.Fail("文件不存在"); } - string targetPath = PS.Config.ErpElement.SAC_FDEPOutboxPath ?? ""; + var targetPath = PS.Config.ErpElement.SAC_FDEPOutboxPath ?? ""; if (string.IsNullOrWhiteSpace(targetPath) && string.IsNullOrWhiteSpace(PS.Config.ErpElement.SAC_RemotePath_Outbox)) { return Return.Fail("发件箱地址不存在"); @@ -301,7 +318,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { if (PS.Config.ErpElement.SAC_RemotePath_Outbox.ToLower().StartsWith("ftp")) { - ftpHelper = new FtpHelper(PS.Config.ErpElement.SAC_RemotePath_Outbox, PS.Config.ErpElement.SAC_RemoteUser, PS.Config.ErpElement.SAC_RemotePassword, PS.Config.ErpElement.SAC_FtpUsePassive, 3000, PS.Config.ErpElement.SAC_EnableSsl); + ftpHelper = new FtpHelper(PS.Config.ErpElement.SAC_RemotePath_Outbox, PS.Config.ErpElement.SAC_RemoteUser, PS.Config.ErpElement.SAC_RemotePassword, PS.Config.ErpElement.SAC_FtpUsePassive, 30000, PS.Config.ErpElement.SAC_EnableSsl); } else { @@ -321,7 +338,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } else { - if (ftpHelper.UploadFile(absPath, targetPath, out string msg)) + if (ftpHelper.UploadFile(absPath, targetPath, out var msg)) { File.Create(absPath + ".ok").Close(); ftpHelper.UploadFile(absPath + ".ok", targetPath, out msg); @@ -369,7 +386,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { try { - var xmlFileTag = (fileTag ?? "").Replace("YSP_", ""); + var xmlFileTag = fileTag.Replace("YSP_", ""); var query = DbContext.supervise_report.Where(O => O.FileTag.StartsWith(fileTag) || O.FileTag.StartsWith(xmlFileTag)); var tags = query.Select(O => O.FileTag); DbContext.supervise_report.RemoveRange(query); @@ -385,10 +402,41 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } + /// + /// 修改了结报送记录的状态 + /// + /// + /// + /// + public static void ChangeSettleReportStatus(YLContext db, int tradeId, DateTime reportStartDate) + { + var codeList = db.trade_contract_r.Where(O => O.TradeId == tradeId && O.Type == "交易确认书").Select(O => O.ContractCode).ToList(); + foreach (var code in codeList) + { + var notes = (from note in db.sac_report_notes + where + note.IsValid + && note.InfoTag.Contains("_" + code.Replace("_", "-") + "_了结") + && note.ReportDate >= reportStartDate + && !note.changeStatus + select note); + foreach (var item in notes) + { + var dict = JsonHelper.Deserialize>(item.InfoCache); + if (dict.TryGetValue("ValueDate", out var dateStr) && + DateTime.TryParse(dateStr, out var date) && date < reportStartDate) + { + continue; + } + item.changeStatus = true; + } + } + } + #region 处理报送响应文件 - private static readonly HashSet _responseFileNames = new HashSet(); - private static readonly HashSet _errFileNames = new HashSet(); + private static readonly HashSet _responseFileNames = new(); + private static readonly HashSet _errFileNames = new(); private const string responseDir = "/App_Docs/Download/ReportResponse/"; private const string tempDir = "/App_Docs/Download/ReportResponse/Temp/"; private static bool runStatus = false; @@ -409,14 +457,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (PS.Config.ErpElement.SAC_RemotePath.ToLower().StartsWith("ftp")) { - ftpHelper = new FtpHelper(PS.Config.ErpElement.SAC_RemotePath, PS.Config.ErpElement.SAC_RemoteUser, PS.Config.ErpElement.SAC_RemotePassword, PS.Config.ErpElement.SAC_FtpUsePassive, 3000, PS.Config.ErpElement.SAC_EnableSsl); + ftpHelper = new FtpHelper(PS.Config.ErpElement.SAC_RemotePath, PS.Config.ErpElement.SAC_RemoteUser, PS.Config.ErpElement.SAC_RemotePassword, PS.Config.ErpElement.SAC_FtpUsePassive, 30000, PS.Config.ErpElement.SAC_EnableSsl); } else { identityScope = new IdentityScope(PS.Config.ErpElement.SAC_RemoteUser, PS.Config.ErpElement.SAC_RemotePath, PS.Config.ErpElement.SAC_RemotePassword); } } - string path = PS.Config.ErpElement.SAC_FDEPInboxPath ?? ""; + var path = PS.Config.ErpElement.SAC_FDEPInboxPath ?? ""; if (string.IsNullOrWhiteSpace(path) && string.IsNullOrWhiteSpace(PS.Config.ErpElement.SAC_RemotePath)) { return; } if (path.ToLower().Contains("{yyyy}")) @@ -433,30 +481,43 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (ftpHelper == null ? !Directory.Exists(path) : !ftpHelper.ExistDirectorie(path)) { - return; + if (ftpHelper != null) + { + try + { + ftpHelper.GetDirectories(path); + } + catch + { + return; + } + } + else + { + return; + } } - - string[] fileNames = ftpHelper == null ? Directory.GetFiles(path) : ftpHelper.GetDirectories(path); + var fileNames = ftpHelper == null ? Directory.GetFiles(path) : ftpHelper.GetDirectories(path); var fileNameArr = fileNames.Except(_responseFileNames).Except(_errFileNames).ToArray(); - string resDir = OtcAppContext.MapPath(responseDir); + var resDir = OtcAppContext.MapPath(responseDir); if (!Directory.Exists(resDir)) { Directory.CreateDirectory(resDir); } - string tDir = OtcAppContext.MapPath(tempDir); + var tDir = OtcAppContext.MapPath(tempDir); if (!Directory.Exists(tDir)) { Directory.CreateDirectory(tDir); } - string targetName = ""; - string msg = ""; + var targetName = ""; + var msg = ""; foreach (var item in fileNameArr) { targetName = Path.Combine(resDir, Path.GetFileName(item)); var extensionName = Path.GetExtension(targetName); - if (extensionName.ToLower() != ".zip" || File.Exists(targetName)) + if (extensionName.ToLower() != ".zip" || !Regex.IsMatch(targetName, @"OTC_\w{6}_\w{6}_YSP_20\d{6}_\d{4}") || File.Exists(targetName)) { _responseFileNames.Add(item); continue; @@ -513,173 +574,174 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private static void setTimeOutReportResponse() { - using (var db = DbContextFactory.GetYLDbContext()) + using var db = DbContextFactory.GetYLDbContext(); + var time = DateTime.Now.AddMinutes(-10); + var timeOutQuery = db.supervise_report.Where(O => O.ReportReponseStatus == ReportSentStatus.SENDING && O.optDate < time); + foreach (var item in timeOutQuery) { - var time = DateTime.Now.AddMinutes(-10); - var timeOutQuery = db.supervise_report.Where(O => O.ReportReponseStatus == ReportSentStatus.SENDING && O.optDate < time); - foreach (var item in timeOutQuery) - { - item.ReportReponseStatus = ReportSentStatus.ERROR; - item.ReportReponseCode = "-000001"; - item.ReportReponseMessage = "超时"; - } - db.SaveChanges(); + item.ReportReponseStatus = ReportSentStatus.ERROR; + item.ReportReponseCode = "-000001"; + item.ReportReponseMessage = "协会尚未返回结果,等待中..."; } + db.SaveChanges(); } private static void saveReportResponse(string path, string zipPath) { var files = Directory.EnumerateFiles(path); - using (var db = DbContextFactory.GetYLDbContext()) + using var db = DbContextFactory.GetYLDbContext(); + var status = new List(); + var fileTagList = new List(); + foreach (var item in files) { - List status = new List(); - List fileTagList = new List(); - foreach (var item in files) + LogFactory.GetLogger("ListensResponse").Info($"处理文件:{item}"); + var tag = Path.GetFileNameWithoutExtension(item); + var arr = tag.Split('_').ToList(); + if (arr.Count < 6) { - LogFactory.GetLogger("ListensResponse").Info($"处理文件:{item}"); - var tag = Path.GetFileNameWithoutExtension(item); - var arr = tag.Split('_').ToList(); - if (arr.Count < 6) + continue; + } + if (arr.Count == 6) + { + arr.Insert(3, "YSP"); + } + var temp = arr[1]; + arr[1] = arr[2]; + arr[2] = temp; + arr.RemoveAt(arr.Count - 1); + tag = string.Join("_", arr); + var tag2 = string.Join("_", arr) + "_checked"; + fileTagList.Add(tag); + fileTagList.Add(tag2); + LogFactory.GetLogger("ListensResponse").Info($"生成tag:{tag}"); + var reportInfo = db.supervise_report.Where(O => O.FileTag == tag || O.FileTag == tag2).FirstOrDefault(); + if (reportInfo == null) + { + continue; + } + LogFactory.GetLogger("ListensResponse").Info($"找到文件记录:{reportInfo.id}"); + var xml = File.ReadAllText(item); + var model = XmlHelper.Deserialize(xml); + reportInfo.ReportReponseCode = model.Header.RetCode; + reportInfo.ReportReponseMessage = model.Header.RetMsg; + reportInfo.ReportReponseStatus = reportInfo.ReportReponseCode == "000000" && (reportInfo.ReportType != SuperviseReportTypeEnum.SAC || status.All(O => O)) ? ReportSentStatus.SUCCESS : ReportSentStatus.ERROR; + reportInfo.optDate = DateTime.Now; + status.Add(reportInfo.ReportReponseCode == "000000"); + if (reportInfo.ReportType == SuperviseReportTypeEnum.SAC) + { + LogFactory.GetLogger("ListensResponse").Info($"修改压缩文件记录:{reportInfo.id}"); + reportInfo.ReportReponsePath = zipPath; + } + else + { + if (model.Body == null) { continue; } - if (arr.Count == 6) - { - arr.Insert(3, "YSP"); - } - var temp = arr[1]; - arr[1] = arr[2]; - arr[2] = temp; - arr.RemoveAt(arr.Count - 1); - tag = string.Join("_", arr); - fileTagList.Add(tag); - LogFactory.GetLogger("ListensResponse").Info($"生成tag:{tag}"); - var reportInfo = db.supervise_report.Where(O => O.FileTag == tag).FirstOrDefault(); - if (reportInfo == null) - { - continue; - } - LogFactory.GetLogger("ListensResponse").Info($"找到文件记录:{reportInfo.id}"); - var xml = File.ReadAllText(item); - ReportRootModel model = XmlHelper.Deserialize(xml); - reportInfo.ReportReponseCode = model.Header.RetCode; - reportInfo.ReportReponseMessage = model.Header.RetMsg; - reportInfo.ReportReponseStatus = reportInfo.ReportReponseCode == "000000" && (reportInfo.ReportType != SuperviseReportTypeEnum.SAC || status.All(O => O)) ? ReportSentStatus.SUCCESS : ReportSentStatus.ERROR; - reportInfo.optDate = DateTime.Now; - status.Add(reportInfo.ReportReponseCode == "000000"); - if (reportInfo.ReportType == SuperviseReportTypeEnum.SAC) - { - LogFactory.GetLogger("ListensResponse").Info($"修改压缩文件记录:{reportInfo.id}"); - reportInfo.ReportReponsePath = zipPath; - } - else - { - if (model.Body == null) - { - continue; - } - var kingstarViewResponseSqlList = new List(); + var kingstarViewResponseSqlList = new List(); - switch (reportInfo.ReportType) - { - case SuperviseReportTypeEnum.SAC_MasterAgrmt: - setSacNotes(db, model.Body.MasterAgrmt, model.Header); - break; - case SuperviseReportTypeEnum.SAC_MasterAgrmtProduct: - setSacNotes(db, model.Body.MasterAgrmtProduct, model.Header); - break; - case SuperviseReportTypeEnum.SAC_SupAgrmt: - setSacNotes(db, model.Body.SupAgrmt, model.Header); - break; - case SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt: - setSacNotes(db, model.Body.PerformanceGuaranteeAgrmt, model.Header); - break; - case SuperviseReportTypeEnum.SAC_OptionConfirmation: - setSacNotes(db, model.Body.OptionConfirmation, model.Header); - break; - case SuperviseReportTypeEnum.SAC_SwapConfirmation: - setSacNotes(db, model.Body.SwapConfirmation, model.Header); - LogFactory.GetLogger("kingstarViewResponse").Info($"开始业务:SwapConfirmation"); - CreateKingstarViewResponseSql(db, kingstarViewResponseSqlList, model.Body.SwapConfirmation); - LogFactory.GetLogger("kingstarViewResponse").Info($"结束业务:SwapConfirmation"); - break; - case SuperviseReportTypeEnum.SAC_OptionTermination: - model.Body.OptionTermination.ForEach(O => { ((ReportBaseModel)O).BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); - setSacNotes(db, model.Body.OptionTermination, model.Header); - break; - case SuperviseReportTypeEnum.SAC_SwapDurationManagement: - model.Body.SwapDurationManagement.ForEach(O => { ((ReportBaseModel)O).BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); - setSacNotes(db, model.Body.SwapDurationManagement, model.Header); - LogFactory.GetLogger("kingstarViewResponse").Info($"开始业务:SwapDurationManagement"); - CreateKingstarViewResponseSql(db, kingstarViewResponseSqlList, model.Body.SwapDurationManagement); - LogFactory.GetLogger("kingstarViewResponse").Info($"结束业务:SwapDurationManagement"); - break; - case SuperviseReportTypeEnum.SAC_PeriodicReportSAC: - ((ReportBaseModel)model.Body.PeriodicReportSAC).BizID = model.Body.PeriodicReportSAC.BizID; - ((ReportBaseModel)model.Body.PeriodicReportSAC).DurationEventNO = model.Body.PeriodicReportSAC.DurationEventNO; - setSacNotes(db, model.Body.PeriodicReportSAC, model.Header); - break; - case SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII: - ((ReportBaseModel)model.Body.PeriodicReportNAFMII).BizID = model.Body.PeriodicReportNAFMII.BizID; - ((ReportBaseModel)model.Body.PeriodicReportNAFMII).DurationEventNO = model.Body.PeriodicReportNAFMII.DurationEventNO; - setSacNotes(db, model.Body.PeriodicReportNAFMII, model.Header); - break; - case SuperviseReportTypeEnum.SAC_PeriodicReportISDA: - ((ReportBaseModel)model.Body.PeriodicReportISDA).BizID = model.Body.PeriodicReportISDA.BizID; - ((ReportBaseModel)model.Body.PeriodicReportISDA).DurationEventNO = model.Body.PeriodicReportISDA.DurationEventNO; - setSacNotes(db, model.Body.PeriodicReportISDA, model.Header); - break; - case SuperviseReportTypeEnum.SAC_EventReport: - ((ReportBaseModel)model.Body.EventReport).BizID = model.Body.EventReport.BizID; - ((ReportBaseModel)model.Body.EventReport).DurationEventNO = model.Body.EventReport.DurationEventNO; - setSacNotes(db, model.Body.EventReport, model.Header); - break; - case SuperviseReportTypeEnum.SAC_OtherReport: - ((ReportBaseModel)model.Body.OtherReport).BizID = model.Body.OtherReport.BizID; - ((ReportBaseModel)model.Body.OtherReport).DurationEventNO = model.Body.OtherReport.DurationEventNO; - setSacNotes(db, model.Body.OtherReport, model.Header); - break; - case SuperviseReportTypeEnum.SAC_PeriodicReportQuarter: - ((ReportBaseModel)model.Body.PeriodicReportQuarter).BizID = model.Body.PeriodicReportQuarter.BizID; - ((ReportBaseModel)model.Body.PeriodicReportQuarter).DurationEventNO = model.Body.PeriodicReportQuarter.DurationEventNO; - setSacNotes(db, model.Body.PeriodicReportQuarter, model.Header); - break; - case SuperviseReportTypeEnum.SAC_ContractNumberProcess: - ((ReportBaseModel)model.Body.ContractNumberProcess).BizID = model.Body.ContractNumberProcess.BizID; - ((ReportBaseModel)model.Body.ContractNumberProcess).DurationEventNO = model.Body.ContractNumberProcess.DurationEventNO; - setSacNotes(db, model.Body.ContractNumberProcess, model.Header); - break; - case SuperviseReportTypeEnum.SAC_SwapEquityPayment: - model.Body.SwapEquityPayment.ForEach(O => { ((ReportBaseModel)O).BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); - setSacNotes(db, model.Body.SwapEquityPayment, model.Header); - LogFactory.GetLogger("kingstarViewResponse").Info($"开始业务:SwapEquityPayment"); - CreateKingstarViewResponseSql(db, kingstarViewResponseSqlList, model.Body.SwapEquityPayment); - LogFactory.GetLogger("kingstarViewResponse").Info($"结束业务:SwapEquityPayment"); - break; - case SuperviseReportTypeEnum.SAC_ConfirmationAtt: - model.Body.ConfirmationAtt.ForEach(O => { ((ReportBaseModel)O).BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); - setSacNotes(db, model.Body.ConfirmationAtt, model.Header); - //金仕达视图 - LogFactory.GetLogger("kingstarViewResponse").Info($"开始业务:ConfirmationAtt"); - CreateKingstarViewResponseSql(db, kingstarViewResponseSqlList, model.Body.ConfirmationAtt); - LogFactory.GetLogger("kingstarViewResponse").Info($"结束业务:ConfirmationAtt"); - break; - default: - break; - } - if (kingstarViewResponseSqlList.Count > 0) - { KingstarViewResponse(kingstarViewResponseSqlList); } + switch (reportInfo.ReportType) + { + case SuperviseReportTypeEnum.SAC_MasterAgrmt: + setSacNotes(db, model.Body.MasterAgrmt, model.Header); + break; + case SuperviseReportTypeEnum.SAC_MasterAgrmtProduct: + setSacNotes(db, model.Body.MasterAgrmtProduct, model.Header); + break; + case SuperviseReportTypeEnum.SAC_SupAgrmt: + setSacNotes(db, model.Body.SupAgrmt, model.Header); + break; + case SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt: + setSacNotes(db, model.Body.PerformanceGuaranteeAgrmt, model.Header); + break; + case SuperviseReportTypeEnum.SAC_OptionConfirmation: + setSacNotes(db, model.Body.OptionConfirmation, model.Header); + break; + case SuperviseReportTypeEnum.SAC_SwapConfirmation: + setSacNotes(db, model.Body.SwapConfirmation, model.Header); + break; + case SuperviseReportTypeEnum.SAC_OptionTermination: + model.Body.OptionTermination.ForEach(O => { ((ReportBaseModel)O).BizID = O.BizID; O.DurationEventNO = O.DurationEventNO; }); + setSacNotes(db, model.Body.OptionTermination, model.Header); + break; + case SuperviseReportTypeEnum.SAC_SwapDurationManagement: + model.Body.SwapDurationManagement.ForEach(O => { O.BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); + setSacNotes(db, model.Body.SwapDurationManagement, model.Header); + break; + case SuperviseReportTypeEnum.SAC_PeriodicReportSAC: + ((ReportBaseModel)model.Body.PeriodicReportSAC).BizID = model.Body.PeriodicReportSAC.BizID; + model.Body.PeriodicReportSAC.DurationEventNO = model.Body.PeriodicReportSAC.DurationEventNO; + setSacNotes(db, model.Body.PeriodicReportSAC, model.Header); + break; + case SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII: + ((ReportBaseModel)model.Body.PeriodicReportNAFMII).BizID = model.Body.PeriodicReportNAFMII.BizID; + model.Body.PeriodicReportNAFMII.DurationEventNO = model.Body.PeriodicReportNAFMII.DurationEventNO; + setSacNotes(db, model.Body.PeriodicReportNAFMII, model.Header); + break; + case SuperviseReportTypeEnum.SAC_PeriodicReportISDA: + ((ReportBaseModel)model.Body.PeriodicReportISDA).BizID = model.Body.PeriodicReportISDA.BizID; + model.Body.PeriodicReportISDA.DurationEventNO = model.Body.PeriodicReportISDA.DurationEventNO; + setSacNotes(db, model.Body.PeriodicReportISDA, model.Header); + break; + case SuperviseReportTypeEnum.SAC_EventReport: + ((ReportBaseModel)model.Body.EventReport).BizID = model.Body.EventReport.BizID; + model.Body.EventReport.DurationEventNO = model.Body.EventReport.DurationEventNO; + setSacNotes(db, model.Body.EventReport, model.Header); + break; + case SuperviseReportTypeEnum.SAC_OtherReport: + ((ReportBaseModel)model.Body.OtherReport).BizID = model.Body.OtherReport.BizID; + model.Body.OtherReport.DurationEventNO = model.Body.OtherReport.DurationEventNO; + setSacNotes(db, model.Body.OtherReport, model.Header); + break; + case SuperviseReportTypeEnum.SAC_PeriodicReportQuarter: + ((ReportBaseModel)model.Body.PeriodicReportQuarter).BizID = model.Body.PeriodicReportQuarter.BizID; + model.Body.PeriodicReportQuarter.DurationEventNO = model.Body.PeriodicReportQuarter.DurationEventNO; + setSacNotes(db, model.Body.PeriodicReportQuarter, model.Header); + break; + case SuperviseReportTypeEnum.SAC_ContractNumberProcess: + if (model.Body.ContractNumberProcess == null && model.Body.MasterAgrmt != null) + { + model.Body.ContractNumberProcess = new ContractNumberProcessModel(); + model.Body.ContractNumberProcess.BizID = model.Body.MasterAgrmt.First().BizID; + model.Body.ContractNumberProcess.RetMsg = model.Body.MasterAgrmt.First().RetMsg; + model.Body.ContractNumberProcess.RetCode = model.Body.MasterAgrmt.First().RetCode; + model.Body.ContractNumberProcess.ExceID = model.Body.MasterAgrmt.First().ExceID; + } + model.Body.ContractNumberProcess.BizID = model.Body.ContractNumberProcess.BizID; + setSacNotes(db, model.Body.ContractNumberProcess, model.Header); + break; + case SuperviseReportTypeEnum.SAC_SwapEquityPayment: + model.Body.SwapEquityPayment.ForEach(O => { O.BizID = O.BizID; ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; }); + setSacNotes(db, model.Body.SwapEquityPayment, model.Header); + break; + case SuperviseReportTypeEnum.SAC_ConfirmationAtt: + case SuperviseReportTypeEnum.SAC_OptionConfirmationAtt: + model.Body.ConfirmationAtt.ForEach(O => { O.BizID = O.BizID; O.DurationEventNO = O.DurationEventNO; }); + setSacNotes(db, model.Body.ConfirmationAtt, model.Header); + break; + case SuperviseReportTypeEnum.SAC_ValuationInformation: + model.Body.ValuationInformation.ForEach(O => + { + ((ReportBaseModel)O).BizID = O.BizID; + ((ReportBaseModel)O).DurationEventNO = O.DurationEventNO; + }); + setSacNotes(db, model.Body.ValuationInformation, model.Header); + break; + default: + break; } - db.SaveChanges(); + if (kingstarViewResponseSqlList.Count > 0) + { KingstarViewResponse(kingstarViewResponseSqlList); } } + db.SaveChanges(); + } - var subSystemInboxPath = PS.Config.ClientElement.SAC_SubSystemInboxPath; - LogFactory.GetLogger("ListensResponse").Info($"开始x1111subSystemInboxPath:{subSystemInboxPath}"); - LogFactory.GetLogger("ListensResponse").Info($"Path:{path}"); - if (!string.IsNullOrEmpty(subSystemInboxPath)) - { - ResponseSubsystem(db, path, subSystemInboxPath, fileTagList); - } + var subSystemInboxPath = PS.Config.ClientElement.SAC_SubSystemInboxPath; + LogFactory.GetLogger("ListensResponse").Info($"开始subSystemInboxPath:{subSystemInboxPath}"); + LogFactory.GetLogger("ListensResponse").Info($"Path:{path}"); + if (!string.IsNullOrEmpty(subSystemInboxPath)) + { + ResponseSubsystem(db, path, subSystemInboxPath, fileTagList); } } @@ -700,7 +762,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("ListensResponse").Info($"fileTagList:{string.Join(",", fileTagList)}"); var responseRootDir = OtcAppContext.MapPath(responseSubsystemDir); if (!Directory.Exists(responseRootDir)) + { Directory.CreateDirectory(responseRootDir); + } + LogFactory.GetLogger("ListensResponse").Info($"responseRootDir:{responseRootDir}"); var noteList = db.sac_report_notes.Where(O => fileTagList.Contains(O.FileTag) && O.InfoCache.Contains("Subsystem")).Select(O => O.InfoCache).ToArray().Select(O => Regex.Match(O, @"(?<=SubFileTag)[^,]+(?=,)").Value).ToHashSet(); LogFactory.GetLogger("ListensResponse").Info($"noteListCount:{noteList.Count()}"); @@ -726,9 +791,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("ListensResponse").Info($"targetName:{targetName}"); LogFactory.GetLogger("ListensResponse").Info($"fileName:{fileName}"); File.Copy(fileName, targetName); - LogFactory.GetLogger("ListensResponse").Info($"okxxxx"); } - string[] tempFileNames = Directory.GetFiles(resDir); + var tempFileNames = Directory.GetFiles(resDir); var totalFilePath = ""; var groupFileDic = new Dictionary>(); foreach (var fileItem in tempFileNames) @@ -754,7 +818,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var tag = Path.GetFileNameWithoutExtension(fileItem); LogFactory.GetLogger("ListensResponse").Info("fileItem:" + fileItem); LogFactory.GetLogger("ListensResponse").Info("tag.Length" + tag.Length); - if (tag.Length >= 41) smallFileCount++; + if (tag.Length >= 41) + { + smallFileCount++; + } } if (smallFileCount == 0) { @@ -767,9 +834,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("ListensResponse").Info($"smallFileCount!=0"); var newFileName = RenameTotalXmlFileName(resDir, totalFilePath, filetag); UpdateTotalXmlFileNumber(newFileName, filetag); - LogFactory.GetLogger("ListensResponse").Info("yyyyyzzzz"); CreateSubsystemResponse(resDir, subSystemInboxPath, filetag); - LogFactory.GetLogger("ListensResponse").Info("sssz"); } } } @@ -782,7 +847,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var totalTag = Path.GetFileNameWithoutExtension(totalFilePath); var newFileName = Path.Combine(resDir, CovertResponseTag(filetag) + totalTag.Substring(31) + ".xml"); - FileInfo fi = new FileInfo(totalFilePath); + var fi = new FileInfo(totalFilePath); fi.MoveTo(newFileName); //File.Move(totalFilePath, newFileName); @@ -794,10 +859,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { var oldFileTag = Path.GetFileNameWithoutExtension(xmlFile);//OTC_123654_000899_YSP_20220714_0007 var newFileName = Path.Combine(resDir, CovertResponseTag(filetag) + oldFileTag.Substring(31) + ".xml"); - FileInfo fi = new FileInfo(xmlFile); + var fi = new FileInfo(xmlFile); fi.MoveTo(newFileName); if (xmlFile != newFileName) + { File.Delete(xmlFile); + } + LogFactory.GetLogger("ListensResponse").Info($"move:{xmlFile} to {newFileName}"); //RenameFile(xmlFile, newFileName); } @@ -816,13 +884,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service arr[2] = temp; var tag = string.Join("_", arr); if (removeYsp) + { tag = tag.Replace("_YSP", ""); + } + return tag; } private static void ClearResDirContent(string resDir) { - string[] fileList = Directory.GetFiles(resDir); + var fileList = Directory.GetFiles(resDir); foreach (var file in fileList) { File.Delete(file); @@ -870,7 +941,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var layerName = "/Root/Body"; var bodyNode = xmldoc.SelectSingleNode(layerName); var bodyChildlist = bodyNode.ChildNodes; - int totalCount = bodyChildlist.Count; + var totalCount = bodyChildlist.Count; var tag = ""; for (var i = 0; i < totalCount; i++) { @@ -904,8 +975,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - var source = ""; - if (!infoCacheDict.TryGetValue("Source", out source) || string.IsNullOrEmpty(source) || source != "Subsystem") + if (!infoCacheDict.TryGetValue("Source", out var source) || string.IsNullOrEmpty(source) || source != "Subsystem") { bodyNode.RemoveChild(bodyChildNode); i--; @@ -913,8 +983,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - var oldExcelId = ""; - if (!infoCacheDict.TryGetValue("ExceID", out oldExcelId) || string.IsNullOrEmpty(oldExcelId)) + if (!infoCacheDict.TryGetValue("ExceID", out var oldExcelId) || string.IsNullOrEmpty(oldExcelId)) { bodyNode.RemoveChild(bodyChildNode); i--; @@ -946,7 +1015,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public static void CreateKingstarViewResponseSql(YLContext db, List kingstarViewResponseList, IEnumerable model) { - string schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; + var schema = PS.Config.ErpElement.KingstarViewTableSchema.IsNullOrWhiteSpace() ? "" : $"\"{PS.Config.ErpElement.KingstarViewTableSchema}\"."; var exceIds = model.Select(O => O.ExceID); LogFactory.GetLogger("kingstarViewResponse").Info($"exceIds:{string.Join(",", exceIds)}"); var dict = db.sac_report_notes.Where(O => exceIds.Contains(O.ExceId)).ToDictionary(K => K.ExceId, V => V); @@ -954,11 +1023,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service foreach (var item in model) { LogFactory.GetLogger("kingstarViewResponse").Info($"开始excelId:{item.ExceID}"); - if (!dict.ContainsKey(item.ExceID)) continue; + if (!dict.ContainsKey(item.ExceID)) + { + continue; + } var note = dict[item.ExceID]; var infoCacheDict = JsonHelper.Deserialize>(note.InfoCache); - if (infoCacheDict["Source"] != "KingstarView") continue; + if (infoCacheDict["Source"] != "KingstarView") + { + continue; + } var curDate = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); var batchDate = DateTime.Now.ToString("yyyyMMdd"); @@ -982,7 +1057,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } - infoCacheDict.TryGetValue("Tag", out string bizzID); + infoCacheDict.TryGetValue("Tag", out var bizzID); var rptID = item.BizID; var sqlMapping = $"INSERT INTO {schema}TRANS_RPT_MAPPING(BIZZ_ID,RPT_ID,BIZZ_TYPE,CREATED_DATETIME,PUSH_TIME,EVENT_DATE,EVENT_NO)VALUES('{bizzID}','{rptID}','{bizzType}',to_date('{curDate}', 'yyyy-mm-dd hh24:mi:ss'),to_date('{curTime}', 'yyyy-mm-dd hh24:mi:ss'),to_date('{curDate}', 'yyyy-mm-dd hh24:mi:ss'),'{eventNo}')"; LogFactory.GetLogger("kingstarViewResponse").Info($"sqlMapping:{sqlMapping}"); @@ -1014,7 +1089,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { var exceIds = model.Select(O => O.ExceID); var dict = db.sac_report_notes.Where(O => exceIds.Contains(O.ExceId)).ToDictionary(K => K.ExceId, V => V); - List sendFileId = new List(); + var sendFileId = new List(); foreach (var item in model) { if (!dict.ContainsKey(item.ExceID)) @@ -1031,17 +1106,19 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service LogFactory.GetLogger("ListensResponse").Info($"更新文件明细:{note.ToJson()}"); if (note.ReportResponse) { - Dictionary infoCacheDict = JsonHelper.Deserialize>(note.InfoCache); - infoCacheDict["DurationEventNO"] = item.DurationEventNO ?? ""; - note.InfoCache = infoCacheDict.ToJson(); + var infoCacheDict = JsonHelper.Deserialize>(note.InfoCache); + if (infoCacheDict != null) + { + infoCacheDict["DurationEventNO"] = item.DurationEventNO ?? ""; + note.InfoCache = infoCacheDict.ToJson(); + } if (note.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt || note.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmtProduct || note.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt || note.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt) { - int dataId = 0; LogFactory.GetLogger("ListensResponse").Info($"客户协议相关明细:{note.DataId}"); - if (int.TryParse(note.DataId, out dataId)) + if (int.TryParse(note.DataId, out var dataId)) { sendFileId.Add(dataId); } @@ -1052,7 +1129,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { EditTradeDueDate(db, note); - }//如果是废止报告,要把该报告对应的所有新增和修改的报告状态修改为无效 + } + else if (note.ReportType == SuperviseReportTypeEnum.SAC_ContractNumberProcess) + { + var obj = JsonHelper.Deserialize(note.BizId); + EditContractNumber(db, obj, out var protocolNumberDict); + EditProtocolNumberSentStatus(protocolNumberDict); + } + //如果是废止报告,要把该报告对应的所有新增和修改的报告状态修改为无效 if (note.InfoTag.EndsWith("_D")) { ValidSacNote(db, note); @@ -1067,6 +1151,253 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } + /// + /// 修改协议文件报送状态 + /// + /// + private static void EditProtocolNumberSentStatus(Dictionary> protocolNumberDict) + { + if (protocolNumberDict.Count < 0) + { + var clientDb = DbContextFactory.GetClientDbContext(OptUserInfo.SystemUser); + if (protocolNumberDict.ContainsKey(SuperviseReportTypeEnum.SAC_MasterAgrmt)) + { + var list = protocolNumberDict[SuperviseReportTypeEnum.SAC_MasterAgrmt]; + var changeList = clientDb.client_file.Where(O => O.HasSent && O.FileTypeName == ConsGlobal.ClientFileType.MainProtocol && list.Contains(O.ProtocolNumber)); + foreach (var changeObj in changeList) + { + changeObj.HasSent = false; + } + } + if (protocolNumberDict.ContainsKey(SuperviseReportTypeEnum.SAC_SupAgrmt)) + { + var list = protocolNumberDict[SuperviseReportTypeEnum.SAC_SupAgrmt]; + var changeList = clientDb.client_file.Where(O => O.HasSent && O.FileTypeName == ConsGlobal.ClientFileType.EnhanceProtocol && list.Contains(O.ProtocolNumber)); + foreach (var changeObj in changeList) + { + changeObj.HasSent = false; + } + } + clientDb.SaveChanges(); + } + } + + /// + /// 修改双方约定编号 + /// + /// + /// + /// + public static void EditContractNumber(YLContext db, ContractNumberProcessModel obj, out Dictionary> protocolNumberDict) + { + var dict = new Dictionary(); + obj.OptionConfirmationTuple.ForEach(O => + { + if (O.ConfirmationID.IsNullOrWhiteSpace() || O.ConfirmationNo.IsNullOrWhiteSpace()) + { + return; + } + dict[O.ConfirmationID] = O.ConfirmationNo; + }); + obj.SwapConfirmationTuple.ForEach(O => + { + if (O.ConfirmationID.IsNullOrWhiteSpace() || O.ConfirmationNo.IsNullOrWhiteSpace()) + { + return; + } + dict[O.ConfirmationID] = O.ConfirmationNo; + }); + obj.MasterAgrmtTuple.ForEach(O => + { + if (O.MasterAgrmtID.IsNullOrWhiteSpace() || O.MasterAgrmtNo.IsNullOrWhiteSpace()) + { + return; + } + dict[O.MasterAgrmtID] = O.MasterAgrmtNo; + }); + obj.SupAgrmtTuple.ForEach(O => + { + if (O.SupAgrmtID.IsNullOrWhiteSpace() || O.SupAgrmtNo.IsNullOrWhiteSpace()) + { + return; + } + dict[O.SupAgrmtID] = O.SupAgrmtNo; + }); + EditContractNumber(db, dict, out protocolNumberDict); + } + + private static void EditContractNumber(YLContext db, Dictionary dict, out Dictionary> protocolNumberDict) + { + protocolNumberDict = new Dictionary>(); + var infoTagList = new HashSet(); + var keys = dict.Keys; + var objs = db.sac_report_notes.Where(O => O.IsValid && keys.Contains(O.BizId)); + var serviceDict = new Dictionary(); + foreach (var item in objs) + { + var reportType = item.ReportType; + if (!serviceDict.ContainsKey(reportType)) + { + serviceDict[reportType] = ReportBaseService.ReportFactory(OptUserInfo.SystemUser, reportType); + } + var newCode = dict[item.BizId]; + item.InfoTag = serviceDict[reportType].ChangeCodeOfInfoTag(item.InfoTag, newCode, out var originalCode); + if (reportType == SuperviseReportTypeEnum.SAC_MasterAgrmt + || reportType == SuperviseReportTypeEnum.SAC_SupAgrmt) + { + if (!protocolNumberDict.ContainsKey(reportType)) + { + protocolNumberDict[reportType] = new List(); + } + protocolNumberDict[reportType].Add(originalCode); + } + infoTagList.Add(item.InfoTag); + } + var tempList = DbContextFactory.GetYLDbContext().sac_report_notes.Where(O => infoTagList.Contains(O.InfoTag)); + if (tempList.Any()) + { + throw new ServiceException("修改后的InfoTag存在重复"); + } + } + + public static void EditContractNumber(Stream inputStream) + { + var serviceDict = new Dictionary(); + var colConfig = new DataColumnModel[3]; + colConfig[0] = new DataColumnModel("数据类型", nameof(InnerContractNumberModel.NumberType)); + colConfig[1] = new DataColumnModel("原双方约定", nameof(InnerContractNumberModel.OriginalCode)); + colConfig[2] = new DataColumnModel("新双方约定", nameof(InnerContractNumberModel.NewCode)); + var dict = new ExcelHelper().ExcelToListT(colConfig, inputStream); + if (!dict.ContainsKey("Sheet1")) + { + throw new ServiceException("模板错误"); + } + var db = DbContextFactory.GetYLDbContext(); + var temp_List = dict["Sheet1"]; + checkContractNumber(temp_List); + + var list = new List(); + foreach (var item in temp_List) + { + if (item.NumberType.IsNullOrWhiteSpace() + || item.OriginalCode.IsNullOrWhiteSpace() + || item.NewCode.IsNullOrWhiteSpace()) + { + break; + } + list.Add(item); + var reportType = SuperviseReportTypeEnum.SAC; + switch (item.NumberType) + { + case "主协议编号": + reportType = SuperviseReportTypeEnum.SAC_MasterAgrmt; + break; + case "补充协议编号": + reportType = SuperviseReportTypeEnum.SAC_SupAgrmt; + break; + case "代签产品名称": + reportType = SuperviseReportTypeEnum.SAC_MasterAgrmtProduct; + break; + case "期权交易确认书编号": + reportType = SuperviseReportTypeEnum.SAC_OptionConfirmation; + break; + case "互换交易确认书编号": + reportType = SuperviseReportTypeEnum.SAC_SwapConfirmation; + break; + default: + continue; + } + var originCode = $"_{item.OriginalCode.Replace("_", "-")}_"; + var bizDict = + db.sac_report_notes + .Where(O => + O.ReportType == reportType + && O.IsValid + && O.ReportResponse + && O.InfoTag.Contains(originCode)) + .ToArray().GroupBy(O => O.BizId) + .ToDictionary(K => K.Key, V => V.FirstOrDefault().InfoTag); + foreach (var bizId in bizDict) + { + if ((reportType == SuperviseReportTypeEnum.SAC_SupAgrmt + || reportType == SuperviseReportTypeEnum.SAC_MasterAgrmtProduct) + && !Regex.IsMatch(bizId.Value, originCode + @"\w$")) + { + continue; + } + item.BizId = bizId.Key;//同一个编号只会有一条记录,不应该存在多条; + break; + } + } + var errArr = list.Where(O => O.BizId.IsNullOrWhiteSpace()).Select(O => O.OriginalCode); + if (errArr.Any()) + { + throw new ServiceException($"下列原编号未找到对应记录:\r\n{string.Join(",", errArr)}\r\n请确认后重新操作"); + } + var bizIdList = list.ToDictionary(K => K.BizId, V => V.NewCode); + EditContractNumber(db, bizIdList, out var protocolNumberDict); + EditProtocolNumberSentStatus(protocolNumberDict); + db.SaveChanges(); + } + + /// + /// 检查传入的双方约定编号是否重复 + /// + /// + /// + private static void checkContractNumber(List temp_List) + { + // 检查重复 数据类型 [0]原编号;[1]新编号; + var dict = new Dictionary[]>(); + var originCode = new List(); + var targetCode = new List(); + foreach (var item in temp_List) + { + if (item.NumberType.IsNullOrWhiteSpace() + || item.OriginalCode.IsNullOrWhiteSpace() + || item.NewCode.IsNullOrWhiteSpace()) + { + break; + } + var numberType = item.NumberType; + if (item.NumberType == "期权交易确认书编号") + { + numberType = "确认书编号"; + } + else if (item.NumberType == "互换交易确认书编号") + { + numberType = "确认书编号"; + } + if (!dict.ContainsKey(numberType)) + { + dict[numberType] = new HashSet[2]; + dict[numberType][0] = new HashSet(); + dict[numberType][1] = new HashSet(); + } + if (!dict[numberType][0].Add(item.OriginalCode)) + { + originCode.Add(item.OriginalCode); + } + if (!dict[numberType][1].Add(item.NewCode)) + { + targetCode.Add(item.NewCode); + } + } + var sb = new StringBuilder(); + if (originCode.Any()) + { + sb.AppendLine($"原编号存在重复:\r\n{string.Join(",", originCode)}"); + } + if (targetCode.Any()) + { + sb.AppendLine($"新编号存在重复:\r\n{string.Join(",", targetCode)}"); + } + if (sb.Length > 0) + { + throw new ServiceException(sb.ToString()); + } + } + /// /// 修改交易报告记录中的到期日 /// @@ -1104,8 +1435,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private static void ValidSacNote(YLContext db, SACReportNotes note) { - Dictionary infoCacheDict = JsonHelper.Deserialize>(note.InfoCache); - if (!infoCacheDict.TryGetValue("Tag", out string tag)) + var infoCacheDict = JsonHelper.Deserialize>(note.InfoCache); + if (!infoCacheDict.TryGetValue("Tag", out var tag)) { tag = " "; } @@ -1122,14 +1453,29 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service || O.ReportType == SuperviseReportTypeEnum.SAC_SwapDurationManagement || O.ReportType == SuperviseReportTypeEnum.SAC_SwapEquityPayment || O.InfoCache.Contains(tag)) && - O.InfoTag.Contains(infoTag)).ToArray(); + O.InfoTag.Contains(infoTag)).ToList(); + if (note.ReportType == SuperviseReportTypeEnum.SAC_SwapDurationManagement) + { + if (!infoCacheDict.TryGetValue("DurationEventNO", out string durationeventno)) + { + durationeventno = " "; + } + durationeventno = $"\"DurationEventNO\":\"{durationeventno}\""; + infoTag = $"A1016_{note.InfoTag.Split('_')[1]}_"; + arr.AddRange(db.sac_report_notes + .Where(O => + O.IsValid && + O.ReportType == SuperviseReportTypeEnum.SAC_SwapEquityPayment && + O.InfoTag.StartsWith(infoTag) && + O.InfoCache.Contains(durationeventno)).ToList()); + } foreach (var item1 in arr) { if (!note.InfoTag.Contains("_展期_") && (item1.ReportType == SuperviseReportTypeEnum.SAC_OptionTermination || item1.ReportType == SuperviseReportTypeEnum.SAC_SwapDurationManagement)) { - Dictionary dict2 = JsonHelper.Deserialize>(item1.InfoCache); + var dict2 = JsonHelper.Deserialize>(item1.InfoCache); if (!infoCacheDict.ContainsKey("ValueDate") || !dict2.ContainsKey("ValueDate") || infoCacheDict["ValueDate"] != dict2["ValueDate"]) { @@ -1139,6 +1485,26 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service item1.IsValid = false; } } + public class InnerContractNumberModel + { + /// + /// 编号类型 + /// + public string NumberType { get; set; } + /// + /// 原编号 + /// + public string OriginalCode { get; set; } + /// + /// 新编号 + /// + public string NewCode { get; set; } + /// + /// BizId + /// 协会唯一编号 + /// + public string BizId { get; set; } + } #endregion @@ -1164,22 +1530,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// public ReturnInfo QueryReportInfo(DateTime reportDate) { - DateTime lastMonthEnd = reportDate.AddDays(-reportDate.Day); + var lastMonthEnd = reportDate.AddDays(-reportDate.Day); var superviseReport = DbContext.supervise_report .Where(O => O.ReportDate <= reportDate) .OrderByDescending(O => O.ReportDate) .ThenByDescending(O => O.optDate) .FirstOrDefault(); - if (PS.Config.Company == Configuration.CompanyEnum.中金 && superviseReport == null) + + var info = new ReportInfo { - superviseReport = DbContext.supervise_report - .OrderByDescending(O => O.ReportDate) - .ThenByDescending(O => O.optDate) - .FirstOrDefault(); - } - ReportInfo info = new ReportInfo(); - info.ReportDate = reportDate; + ReportDate = reportDate + }; if (superviseReport != null) { info.SenderCode = superviseReport.SenderCode; @@ -1206,31 +1568,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public List> QueryDetails(int id) { var tag = DbContext.supervise_report.Where(O => O.id == id).Select(O => O.FileTag).FirstOrDefault(); - tag = (tag ?? "").Replace("YSP_", ""); - var reports = (from report in DbContext.supervise_report.Where(O => O.FileTag.StartsWith(tag)) - join notes in DbContext.sac_report_notes on report.FileTag equals notes.FileTag + tag = (tag ?? "").Replace("YSP_", "").Replace("_checked", ""); + var reportList_temp = DbContext.supervise_report.Where(O => O.FileTag.StartsWith(tag)).ToList(); + var fileTagList_temp = reportList_temp.Select(O => O.FileTag).ToList(); + var noteList_temp = DbContext.sac_report_notes.Where(O => fileTagList_temp.Contains(O.FileTag)).ToList(); + + var reports = (from report in reportList_temp + join notes in noteList_temp on report.FileTag equals notes.FileTag select new { report, notes }).ToArray().GroupBy(O => O.report.FileTag) .ToDictionary(K => K.First().report, V => V.Select(O => O.notes).Distinct().ToList()); - List> result = new List>(); + var result = new List>(); foreach (var item in reports) { - Dictionary dict = new Dictionary(); - dict["FileTag"] = item.Key.FileTag; - dict["FileType"] = EnumHelper.GetDescriptionByName(item.Key.ReportType); - dict["ExceId"] = "-"; - dict["BizID"] = "-"; - dict["RetCode"] = item.Key.ReportReponseCode; - dict["RetMsg"] = item.Key.ReportReponseMessage; + var dict = new Dictionary + { + ["FileTag"] = item.Key.FileTag, + ["FileType"] = EnumHelper.GetDescriptionByName(item.Key.ReportType), + ["ExceId"] = "-", + ["BizID"] = "-", + ["RetCode"] = item.Key.ReportReponseCode, + ["RetMsg"] = item.Key.ReportReponseMessage + }; result.Add(dict); foreach (var note in item.Value) { - dict = new Dictionary(); - dict["FileTag"] = note.InfoCache; - dict["FileType"] = "-"; - dict["ExceId"] = note.ExceId; - dict["BizID"] = note.BizId; - dict["RetCode"] = note.RetCode; - dict["RetMsg"] = note.RetMsg; + dict = new Dictionary + { + ["FileTag"] = note.InfoCache, + ["FileType"] = "-", + ["ExceId"] = note.ExceId, + ["BizID"] = note.BizId, + ["RetCode"] = note.RetCode, + ["RetMsg"] = note.RetMsg + }; result.Add(dict); } } @@ -1242,12 +1612,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// /// /// - public Dictionary> QueryReportDesc(List pGroups = null) + public Dictionary> QueryReportDesc(List? pGroups = null) { - if (pGroups == null) - { - pGroups = new List(); - } + pGroups ??= new List(); if (pGroups.Count == 0) { pGroups.Add(DBModels.Consts.ConsAppConfig.ReportDescOption); @@ -1271,7 +1638,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// public int SaveReportDesc(Dictionary> obj) { - List pGroups = new List { + var pGroups = new List { DBModels.Consts.ConsAppConfig.ReportDescOption, DBModels.Consts.ConsAppConfig.ReportDescSwap }; @@ -1304,343 +1671,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// public List GetSupervisePreview(string fileTag, string fileType) { -#if DEBUG - - { - //var requestPath = OtcAppContext.MapPath("/App_Docs/Download/Report"); - //var ds = Directory.GetFiles(requestPath, "*.zip"); - //foreach (var item in ds) - //{ - // var filename = Path.GetFileNameWithoutExtension(item); - // string[] farr = filename.Split('_'); - // var datetime = DateTime.ParseExact(farr[3], "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); - // var pathStr = ZipHelper.unZipFile(item, Path.GetDirectoryName(item), out string msg); - // if (msg != "解压失败") - // { - // bool status = false; - // var fs = Directory.GetFiles(pathStr, "*.xml"); - // SuperviseReport dbreport = null; - // List list = new List(); - // foreach (var fname in fs) - // { - // var xml = File.ReadAllText(fname); - // var obj = XmlHelper.Deserialize(xml); - // var filetag = Path.GetFileNameWithoutExtension(fname); - // var reportType = SuperviseReportTypeEnum.SAC; - // farr = filetag.Split('_'); - // var dataFlag = (DataFlagsEnum)Enum.Parse(typeof(DataFlagsEnum), farr[5]); - // if ((int)dataFlag >= 4 && (int)dataFlag <= 7) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag + 1; - // } - // else if ((int)dataFlag == 8) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag - 4; - // } - // else if ((int)dataFlag >= 9 && (int)dataFlag <= 10) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag + 3; - // } - // else if ((int)dataFlag >= 11 && (int)dataFlag <= 13) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag - 2; - // } - // else - // { - // reportType = (SuperviseReportTypeEnum)dataFlag; - // } - - // List modeList = null; - // switch (reportType) - // { - // case SuperviseReportTypeEnum.SAC_MasterAgrmt: - // modeList = obj.Body.MasterAgrmt.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_MasterAgrmtProduct: - // modeList = obj.Body.MasterAgrmtProduct.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SupAgrmt: - // modeList = obj.Body.SupAgrmt.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt: - // modeList = obj.Body.PerformanceGuaranteeAgrmt.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_OptionConfirmation: - // modeList = obj.Body.OptionConfirmation.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SwapConfirmation: - // modeList = obj.Body.SwapConfirmation.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_OptionTermination: - // modeList = obj.Body.OptionTermination.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SwapTermination: - // modeList = obj.Body.SwapTermination.Cast().ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportSAC: - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportSAC }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII: - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportNAFMII }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportISDA: - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportISDA }; - // break; - // case SuperviseReportTypeEnum.SAC_EventReport: - // modeList = new List() { (ReportBaseModel)obj.Body.EventReport }; - // break; - // case SuperviseReportTypeEnum.SAC_OtherReport: - // modeList = new List() { (ReportBaseModel)obj.Body.OtherReport }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportQuarter: - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportQuarter }; - // break; - // case SuperviseReportTypeEnum.SAC_ContractNumberProcess: - // modeList = new List() { (ReportBaseModel)obj.Body.ContractNumberProcess }; - // break; - // default: - // break; - // } - // foreach (var mitem in modeList) - // { - // if (string.IsNullOrEmpty(mitem.ExceID)) - // { - // status = false; - // continue; - // } - // status = true; - // var notes = DbContext.sac_report_notes.Where(O => O.ExceId == mitem.ExceID).FirstOrDefault(); - // if (notes == null) - // { - // var dbnotes = new SACReportNotes() - // { - // FileTag = filetag, - // ReportType = reportType, - // InfoTag = "", - // ReportDate = datetime, - // ExceId = mitem.ExceID ?? "", - // BizId = "", - // changeStatus = false, - // InfoCache = "", - // ReportResponse = false, - // RetCode = "", - // RetMsg = "", - // DataId = "", - // IsValid = true, - // CreateTime = DateTime.Now, - // OptTime = DateTime.Now - // }; - // DbContext.sac_report_notes.Add(dbnotes); - // } - // } - // if (status) - // { - // dbreport = DbContext.supervise_report.Where(O => O.FileTag == fname).FirstOrDefault(); - // if (dbreport == null) - // { - // var dbre = new SuperviseReport() - // { - // ReportType = reportType, - // ReportDate = datetime, - // SenderCode = farr[1], - // ReceiverCode = farr[2], - // LastMonthCash = 0, - // LatestMonthCash = 0, - // LatestNetAssets = 0, - // EventReportStatus = 0, - // OtherReportStatus = 0, - // FileTag = filetag, - // FilePath = "", - // ReportReponseStatus = ReportSentStatus.SENDING, - // ReportReponseCode = "", - // ReportReponseMessage = "", - // ReportReponsePath = "", - // optDate = DateTime.Now, - // optUserId = UserId - // }; - // list.Add(dbre); - // } - // } - // } - // if (status) - // { - // dbreport = DbContext.supervise_report.Where(O => O.FileTag == item).FirstOrDefault(); - // if (dbreport == null) - // { - // var dbre = new SuperviseReport() - // { - // ReportType = SuperviseReportTypeEnum.SAC, - // ReportDate = datetime, - // SenderCode = farr[1], - // ReceiverCode = farr[2], - // LastMonthCash = 0, - // LatestMonthCash = 0, - // LatestNetAssets = 0, - // EventReportStatus = 0, - // OtherReportStatus = 0, - // FileTag = filename, - // FilePath = "/App_Docs/Download/Report/" + Path.GetFileName(item), - // ReportReponseStatus = ReportSentStatus.SENDING, - // ReportReponseCode = "", - // ReportReponseMessage = "", - // ReportReponsePath = "", - // optDate = DateTime.Now, - // optUserId = UserId - // }; - // list.Add(dbre); - // DbContext.supervise_report.AddRange(list); - // DbContext.SaveChanges(); - // list.Clear(); - // } - // } - // } - //} - } - { - //var requestPath = OtcAppContext.MapPath("/App_Docs/Download/ReportResponse"); - //var ds = Directory.GetFiles(requestPath, "*.zip"); - //foreach (var item in ds) - //{ - // var filename = Path.GetFileNameWithoutExtension(item); - // string[] farr = filename.Split('_'); - // string temp = farr[1]; - // farr[1] = farr[2]; - // farr[2] = temp; - // filename = string.Join("_", farr); - // var datetime = DateTime.ParseExact(farr[3], "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); - // var pathStr = ZipHelper.unZipFile(item, Path.GetDirectoryName(item), out string msg); - // if (msg != "解压失败") - // { - // var fs = Directory.GetFiles(pathStr, "*.xml"); - // SuperviseReport dbreport = null; - - // foreach (var fname in fs) - // { - // var filetag = Path.GetFileNameWithoutExtension(fname); - // farr = filetag.Split('_'); - // temp = farr[1]; - // farr[1] = farr[2]; - // farr[2] = temp; - // filetag = string.Join("_", farr).Replace("_R", ""); - - // var xml = File.ReadAllText(fname); - // var obj = XmlHelper.Deserialize(xml); - // if (obj.Header.RetCode == "000000") - // { - // var reportType = SuperviseReportTypeEnum.SAC; - // if (farr[5] != "R") - // { - // var dataFlag = (DataFlagsEnum)Enum.Parse(typeof(DataFlagsEnum), farr[5]); - // if ((int)dataFlag >= 4 && (int)dataFlag <= 7) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag + 1; - // } - // else if ((int)dataFlag == 8) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag - 4; - // } - // else if ((int)dataFlag >= 9 && (int)dataFlag <= 10) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag + 3; - // } - // else if ((int)dataFlag >= 11 && (int)dataFlag <= 13) - // { - // reportType = (SuperviseReportTypeEnum)dataFlag - 2; - // } - // else - // { - // reportType = (SuperviseReportTypeEnum)dataFlag; - // } - // List modeList = null; - // switch (reportType) - // { - // case SuperviseReportTypeEnum.SAC_MasterAgrmt: - // modeList = obj.Body.MasterAgrmt.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_MasterAgrmtProduct: - // modeList = obj.Body.MasterAgrmtProduct.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SupAgrmt: - // modeList = obj.Body.SupAgrmt.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt: - // modeList = obj.Body.PerformanceGuaranteeAgrmt.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_OptionConfirmation: - // modeList = obj.Body.OptionConfirmation.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SwapConfirmation: - // modeList = obj.Body.SwapConfirmation.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_OptionTermination: - // modeList = obj.Body.OptionTermination.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_SwapTermination: - // modeList = obj.Body.SwapTermination.Select(O => { var tt = ((ReportBaseModel)O); tt.BizID = O.BizID; return tt; }).ToList(); - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportSAC: - // ((ReportBaseModel)obj.Body.PeriodicReportSAC).BizID = obj.Body.PeriodicReportSAC.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportSAC }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII: - // ((ReportBaseModel)obj.Body.PeriodicReportNAFMII).BizID = obj.Body.PeriodicReportNAFMII.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportNAFMII }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportISDA: - // ((ReportBaseModel)obj.Body.PeriodicReportISDA).BizID = obj.Body.PeriodicReportISDA.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportISDA }; - // break; - // case SuperviseReportTypeEnum.SAC_EventReport: - // ((ReportBaseModel)obj.Body.EventReport).BizID = obj.Body.EventReport.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.EventReport }; - // break; - // case SuperviseReportTypeEnum.SAC_OtherReport: - // ((ReportBaseModel)obj.Body.OtherReport).BizID = obj.Body.OtherReport.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.OtherReport }; - // break; - // case SuperviseReportTypeEnum.SAC_PeriodicReportQuarter: - // ((ReportBaseModel)obj.Body.PeriodicReportQuarter).BizID = obj.Body.PeriodicReportQuarter.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.PeriodicReportQuarter }; - // break; - // case SuperviseReportTypeEnum.SAC_ContractNumberProcess: - // ((ReportBaseModel)obj.Body.ContractNumberProcess).BizID = obj.Body.ContractNumberProcess.BizID; - // modeList = new List() { (ReportBaseModel)obj.Body.ContractNumberProcess }; - // break; - // default: - // break; - // } - // foreach (var mitem in modeList) - // { - // var notes = DbContext.sac_report_notes.Where(O => O.ExceId == mitem.ExceID).FirstOrDefault(); - // if (notes == null) - // { - // continue; - // } - // notes.BizId = mitem.BizID; - // notes.ReportResponse = mitem.RetCode == "000000"; - // notes.RetCode = mitem.RetCode; - // notes.RetMsg = mitem.RetMsg; - // }; - // } - // } - // dbreport = DbContext.supervise_report.Where(O => O.FileTag == filetag).FirstOrDefault(); - // if (dbreport != null) - // { - // dbreport.ReportReponseStatus = obj.Header.RetCode == "000000" ? ReportSentStatus.SUCCESS : ReportSentStatus.ERROR; - // dbreport.ReportReponseCode = obj.Header.RetCode; - // dbreport.ReportReponseMessage = obj.Header.RetMsg; - // dbreport.ReportReponsePath = obj.Header.BusiDataType == DataFlagsEnum.NONE ? "/App_Docs/Download/Report/" + Path.GetFileName(item) : ""; - // } - // } - // } - // DbContext.SaveChanges(); - //} - } - -#endif - - List result = new List(); - string[] arr = fileTag.Split('_');//OTC_151089_000899_20210104_0002_A1008_A + var result = new List(); + var arr = fileTag.Split('_');//OTC_151089_000899_20210104_0002_A1008_A var rootPath = OtcAppContext.MapPath("/App_Docs/Download/"); var pathName = string.Empty; var xmlPath = string.Empty; @@ -1652,6 +1684,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service rootPath = Path.Combine(rootPath, "Report");//zip文件目录 zipPath = Path.Combine(rootPath, pathName + ".zip");//zip文件路径 if (!File.Exists(zipPath)) + { + pathName = $"{arr[0]}_{arr[1]}_{arr[2]}_YSP_{arr[3]}_{arr[4]}_checked"; //目录名 + zipPath = Path.Combine(rootPath, pathName + ".zip"); //zip文件路径 + } + if (!File.Exists(zipPath)) { pathName = $"{arr[0]}_{arr[1]}_{arr[2]}_{arr[3]}_{arr[4]}";//目录名 zipPath = Path.Combine(rootPath, pathName + ".zip");//zip文件路径 @@ -1683,7 +1720,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service if (!Directory.Exists(pathName)) { Directory.CreateDirectory(pathName); - ZipHelper.unZipFile(zipPath, rootPath, out string msg); + ZipHelper.unZipFile(zipPath, rootPath, out var msg); if (msg.StartsWith("解压失败")) { Directory.Delete(pathName, true); @@ -1691,10 +1728,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service throw new ServiceException(msg); } } - XmlDocument doc = new XmlDocument(); + var doc = new XmlDocument(); doc.Load(xmlPath); var node = doc.GetElementsByTagName("Root")[0]; - SacInfo info = new SacInfo(node.Name, ""); + var info = new SacInfo(node.Name, ""); ReadXmlNode(node, info); info.formatFieldDescription(); result.Add(info); @@ -1717,7 +1754,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private void ReadXmlNode(XmlNode node, SacInfo sacInfo) { - if ((node.HasChildNodes && node.ChildNodes.Count == 1 && node.ChildNodes[0].NodeType == XmlNodeType.Text)) + if (node.HasChildNodes && node.ChildNodes.Count == 1 && node.ChildNodes[0].NodeType == XmlNodeType.Text) { sacInfo.FieldValue = node.InnerText; } @@ -1733,5 +1770,56 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } #endregion + + #region 导出 + /// + /// 导出 + /// + /// + /// + /// + public string ExportDetailsV2(int id, string fileTag, string path) + { + var reportHelper = new ReportInfoHelper(); + try + { + if (!reportHelper.Init(id, fileTag) || !reportHelper.SaveToZipFile(path)) + { + throw new ServiceException(reportHelper.ErrorMsg); + } + } + catch (Exception ex) + { + LogFactory.GetLogger("ExportDetails").Error(ex); + throw new ServiceException(ex.Message); + } + return path; + } + + #endregion + + #region 生成待重新上传的报送文件压缩包 + + private string GenerateUploadZipFile(ReportResponse res, string savePath) + { + if (res is null) + { + throw new ArgumentNullException(nameof(res)); + } + + if (string.IsNullOrWhiteSpace(savePath)) + { + throw new ArgumentException($"“{nameof(savePath)}”不能为 null 或空白。", nameof(savePath)); + } + + var reportHelper = new ReportInfoHelper(); + if (!reportHelper.Init(res) || !reportHelper.SaveToZipFile(savePath)) + { + throw new ServiceException(reportHelper.ErrorMsg); + } + return savePath; + } + + #endregion } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSupAgrmtService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSupAgrmtService.cs index 5bc40b14..ee214f6e 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSupAgrmtService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSupAgrmtService.cs @@ -19,158 +19,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1003; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SupAgrmt; - List noteList = new List(); - private List _cacheCodeList = new List(); + + readonly List noteList = new(); + private readonly List _cacheCodeList = new(); protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetSupAgrmtModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - LogFactory.GetLogger("GenerateBody").Info($"System:1"); - try - { - - - using (var baseDb = DbContextFactory.GetClientDbContext(null)) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var fileObjList = (from c in baseDb.client - join cf in baseDb.client_file - on c.id equals cf.ClientId - where c.ProcessStatus == "已开户" && cf.HasSent == false && cf.IsValid && - cf.FileTypeName == ConsGlobal.ClientFileType.EnhanceProtocol && cf.OptState == _operationType && - ((c.ProcessOptDate >= _reqInfo.ReportDate && c.ProcessOptDate < nextDate && cf.OptDate < nextDate) ||//如果这一天开户,则把这一天之前(含这一天)的所有文件都报送了 - (cf.OptDate >= _reqInfo.ReportDate && cf.OptDate < nextDate && c.ProcessOptDate < _reqInfo.ReportDate))//如果这一天不是开户日期,则只在报送日期大于开户日期时,报送当日修改的文件 - && cf.ApprovalOrder < 1 - select new - { - cf.id, - cf.OptState, - cf.ProtocolNumber, - cf.MainProtocolNumber, - cf.SignDate, - cf.FilePath, - cf.FileName, - cf.FileDesc, - }).ToArray(); - var cacheKey = $"{BusiDataType}"; - foreach (var item in fileObjList) - { - var info = new SupAgrmtModel(); - info.MasterAgrmtNo = item.MainProtocolNumber; - info.OperationType = item.OptState; - info.SupAgrmtNo = item.ProtocolNumber; - info.SigningDate = item.SignDate?.ToString("yyyy-MM-dd"); - info.SupAgrmtType = ReportTypeMap[item.OptState == OptFlagsEnum.A ? "首次" : "变更"]; - info.SupAgrmtRemark = item.FileDesc; - info.SupAgrmtAttTuple = new List(); - var tuple = new SupAgrmtAttModel(); - tuple.SupAgrmtAtt = item.FileName; - var cacheValue = info.MasterAgrmtNo + "_" + info.SupAgrmtNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - info.SupAgrmtAttTuple.Add(tuple); - - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{info.SupAgrmtNo}\",\"Source\":\"System\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.SupAgrmtID = note.BizId; - } - info.ExceID = base.formatExceID(); - if (!ReportStatus.CheckFileLength(item.FilePath)) - { - break; - } - else - { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - } - dataList.Add(info); - fileList.Add(item.FilePath); - note.id = 0; - note.DataId = item.id.ToString(); - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - catch(Exception ex) - { - LogFactory.GetLogger("GenerateBody").Info($"System:发生异常:" + ex.ToString()); ; - } - - } - LogFactory.GetLogger("GenerateBody").Info($"System:2"); var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.SupAgrmt = dataList; @@ -179,7 +60,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(SupAgrmtModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -208,9 +89,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } - if(model.SupAgrmtAttTuple != null && model.SupAgrmtAttTuple.Count > 0) + if (model.SupAgrmtAttTuple != null && model.SupAgrmtAttTuple.Count > 0) { - fileList.AddRange(model.SupAgrmtAttTuple.Select(x => x.SupAgrmtAtt)); + fileList.AddRange(model.SupAgrmtAttTuple.Select(x => x.SupAgrmtAtt)!); } model.ExceID = base.formatExceID(); note.id = 0; @@ -232,13 +113,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private List GetSupAgrmtModel(ref List fileList) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("补充协议")) { - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["补充协议"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["补充协议"]; + for (var i = 1; i < dt!.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -248,12 +128,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][2]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -263,40 +149,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - SupAgrmtModel model = new SupAgrmtModel(); - - model.OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U; - model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); - model.SupAgrmtNo = GetDataSetValue(dt, i, 1); + var model = new SupAgrmtModel + { + OperationType = optType == OptFlagsEnum.A ? OptFlagsEnum.A : OptFlagsEnum.U, + MasterAgrmtNo = GetDataSetValue(dt, i, 0), + SupAgrmtNo = GetDataSetValue(dt, i, 1) + }; var cacheValue = model.MasterAgrmtNo + "_" + model.SupAgrmtNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } model.SupAgrmtType = ConsReport.ReportTypeMap[optType == OptFlagsEnum.A ? "首次" : "变更"]; model.SigningDate = GetDataSetValue(dt, i, 3); model.SupAgrmtRemark = GetDataSetValue(dt, i, 4); - string[] atts = ((GetDataSetValue(dt, i, 5)) ?? "").Split(','); + var atts = ((GetDataSetValue(dt, i, 5)) ?? "").Split(','); foreach (var item in atts) { if (string.IsNullOrWhiteSpace(item)) { continue; } - string path = Path.Combine(sourcePath, item); + var path = Path.Combine(sourcePath, item); if (!ReportStatus.CheckFileLength(path)) { break; } - if (model.SupAgrmtAttTuple == null) - { - model.SupAgrmtAttTuple = new List(); - } + model.SupAgrmtAttTuple ??= new List(); model.SupAgrmtAttTuple.Add(new SupAgrmtAttModel() { SupAgrmtAtt = item }); fileList.Add(path); } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + var note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -332,7 +216,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (model.SupAgrmtAttTuple?.Count > 0) { - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); model.ExceID = base.formatExceID(); result.Add(model); note.id = 0; @@ -357,7 +241,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private string formatInfoTag(SupAgrmtModel model, bool suffixType = false) { - string result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.SupAgrmtNo.Replace("_", "-")}_"; + var result = $"{BusiDataType}_{model.MasterAgrmtNo.Replace("_", "-")}_{model.SupAgrmtNo.Replace("_", "-")}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -365,25 +249,41 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 4) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[2]; + arr[2] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.SupAgrmt != null) { - CheckHelper helper = new Common.CheckHelper(); - CheckHelper attHelper = new CheckHelper(); - for (int i = 0; i < model.SupAgrmt.Count; i++) + var helper = new Common.CheckHelper(); + var attHelper = new CheckHelper(); + for (var i = 0; i < model.SupAgrmt.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.SupAgrmt[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (item.SupAgrmtAttTuple != null) { - for (int j = 0; j < item.SupAgrmtAttTuple.Count; j++) + for (var j = 0; j < item.SupAgrmtAttTuple.Count; j++) { var listItem = new List(); var tuple = item.SupAgrmtAttTuple[j]; @@ -393,16 +293,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("SupAgrmtAttTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("SupAgrmtAttTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("SupAgrmt", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("SupAgrmt", i) + { + FieldValue = item.MasterAgrmtNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -428,7 +333,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationAttService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationAttService.cs index dc60da35..803e97bc 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationAttService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationAttService.cs @@ -1,8 +1,9 @@ -using System.Data; +using System.Data; using YieldChain.Helpers; using YLErp.BLL; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Helpers; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; using static YLErp.DBModels.Consts.ConsReport; @@ -21,258 +22,51 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1017; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ConfirmationAtt; - List noteList = new List(); + + readonly List noteList = new(); + IEnumerable SACReportNotesCache = null; + IEnumerable SACReportNotesCache_confirmation = null; protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + SACReportNotesCache = base.InitReportNotes(ReportType); + SACReportNotesCache_confirmation = base.InitReportNotes(SuperviseReportTypeEnum.SAC_SwapConfirmation); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { - dataList = GetSwapConfirmationAttModel(out fileList); + dataList = GetSwapConfirmationAttModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var nextDataDate = _reqInfo.DataDate.AddDays(1); - using (var db = new YLContext()) - { - var codeList = ReportStatus.GetCacheInfo(cacheKey); - var query = (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r - on tc.id equals tr.TradeCashId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - join ts in db.trade_swap - on t.id equals ts.TradeId - where - ((_operationType == OptFlagsEnum.A && t.TradeDate >= _reqInfo.DataDate && t.TradeDate < nextDataDate)//新增时使用交易日期判断 - || (_operationType != OptFlagsEnum.A && tc.OptDate >= _reqInfo.ReportDate && tc.OptDate < nextDate)//补正和废止时使用操作日期判断 - || tr.OptDate >= _reqInfo.DataDate) - && (_operationType == OptFlagsEnum.D || (t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid)) - && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType == "收益互换" - && tc.Action == "系统操作-期权费" - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - ts.IsGetFloatingProfit, - ts.IsPayFloatingProfit, - ts.GetVarietyId, - ts.PayVarietyId, - ts.GetUnderlyingCode, - ts.PayUnderlyingCode, - ts.GetLongShort, - ts.PayLongShort, - ts.GetSpotPrice, - ts.PaySpotPrice, - ts.GetTradePrice, - ts.PayTradePrice, - ts.GetSwapTimeAndRate, - ts.PaySwapTimeAndRate, - ts.GetFixedProfit, - ts.PayFixedProfit, - ts.GetMarginRate, - ts.PayMarginRate, - ts.GetTradeAmount, - ts.PayTradeAmount, - tr.ContractCode, - td.Paths, - td.StampDocumentFileName, - t.QuoteCurrency, - t.SettlementCurrency, - ts.GetUnAnnualRate, - ts.GetSingleFee, - ts.PayUnAnnualRate, - ts.PaySingleFee, - }).OrderBy(O => O.OptDate).ToArray().Where(O => !codeList.Contains(O.id + "")).ToArray(); - - List ids = query.Select(O => O.id).ToList(); - List delIds = new List(); - if (_operationType == OptFlagsEnum.D) - { - delIds = DbContext.TradeAuditLog.Where(O => ids.Contains(O.TradeId) && O.OptDate >= _reqInfo.ReportDate && O.OptDate < nextDate && O.OptType == "删除交易").Select(O => O.TradeId).ToList(); - } - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - Dictionary reportDescDic = DbContext.AppConfig.Where(O => O.PGroup == ConsAppConfig.ReportDescSwap).ToDictionary(K => K.PName, V => V.PValue); - foreach (var item in query) - { - var cacheValue = item.id.ToString(); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - //如果存在重复数据,则始终用较新的数据 - SwapConfirmationAttModel info = new SwapConfirmationAttModel(); - - info.ConfirmationNo = item.ContractCode; - var confirmationNote = base.GetReportNotes(SuperviseReportTypeEnum.SAC_SwapConfirmation, $"_{info.ConfirmationNo.Replace("_", "-")}_").FirstOrDefault(); - var currentCodes = ReportStatus.GetCacheInfo(DataFlagsEnum.A1005.ToString());//取出这一次报送交易要素的交易编号 - if (!currentCodes.Contains(item.id.ToString()) && (confirmationNote == null || !confirmationNote.ReportResponse)) - { - continue;//跳过交易要素还没报送的确认书附件; - } - SACReportNotes note = base.GetReportNotes(formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - info.OperationType = OptFlagsEnum.A; - note = new SACReportNotes() - { - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - if (!note.changeStatus) - { - continue;//交易没有被修改过,跳过 - } - info.OperationType = OptFlagsEnum.U; - note.IsValid = true; - break; - case OptFlagsEnum.D: - if (!delIds.Contains(item.id)) - { - continue;//交易没有被删除,跳过 - } - info.OperationType = OptFlagsEnum.D; - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); - if (info.OperationType != _operationType) - { - continue; - } - if (info.OperationType != OptFlagsEnum.D && (!item.tradeValid || !item.tradecashValid || !item.tradeContractRValid)) - {//非废止报送中,应跳过所有存在无效数据的数据 - continue; - } - if (metaDic.ContainsKey(item.id)) - { - var metaInfo = metaDic[item.id]; - var tradingPlace = metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) ? TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] : ""; - if (tradingPlace == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId;//确认书编号; - } - - - string path = item.StampDocumentFileName ?? item.Paths; - if (!path.StartsWith("\\") || path.StartsWith("/")) - { - path = "\\" + path; - } - var absolutePath = OtcAppContext.MapPath(path); - absolutePath = Path.ChangeExtension(absolutePath, "pdf"); - info.ConfirmationFilesTuple = new List() { new ConfirmationFilesTupleModel() { ConfirmationFiles = Path.GetFileName(absolutePath) } }; - info.ExceID = base.formatExceID(); - if (!ReportStatus.CheckFileLength(absolutePath)) - { - break; - } - fileList.Add(absolutePath); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.InfoCache = $"{{\"DueDate\":\"{item.OptDate?.ToString("yyyy-MM-dd")}\",\"Tag\":\"{info.ConfirmationNo}\",\"Source\":\"System\"}}"; - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.DataId = item.tcId.ToString(); - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.KingstarView) == SAC_ReportDataSourceEnum.KingstarView) - { - dataList.AddRange(GetSwapConfirmationAttModelFromView(out fileList)); - } - - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); + var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.ConfirmationAtt = dataList; return model; } - public bool AddSubsystemNote(SwapConfirmationAttModel model, List fileList, string tag) + public bool AddSubsystemNote(ConfirmationAttModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true), dataSource: SACReportNotesCache).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -305,7 +99,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { fileList.AddRange(model.ConfirmationFilesTuple.Select(x => x.ConfirmationFiles)); } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -323,16 +117,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - private List GetSwapConfirmationAttModel(out List fileList) + private List GetSwapConfirmationAttModel(ref List fileList) { - fileList = new List(); - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("收益互换确认书附件明细")) { - var cacheKey = $"{BusiDataType}"; - DataTable dt = _excelDataSource.Tables["收益互换确认书附件明细"]; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["收益互换确认书附件明细"]; + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -342,12 +134,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][1]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -357,12 +155,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - SwapConfirmationAttModel model = new SwapConfirmationAttModel(); - - model.ConfirmationNo = GetDataSetValue(dt, i, 0); - model.OperationType = optType; - var cacheValue = model.ConfirmationNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + var model = new ConfirmationAttModel + { + ConfirmationNo = GetDataSetValue(dt, i, 0), + OperationType = optType + }; + var cacheValue = (model.ConfirmationNo ?? "").ToString(); + if (cacheValue.IsNullOrWhiteSpace()) + { + continue; + } + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } @@ -378,10 +181,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service break; } fileList.Add(path); - model.ConfirmationFilesTuple.Add(new ConfirmationFilesTupleModel() { ConfirmationFiles = f }); + model.ConfirmationFilesTuple.Add(new ConfirmationFilesTupleModel() { IsSwap = "true", ConfirmationFiles = f }); } } - List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); + List notes = base.GetReportNotes(ReportType, formatInfoTag(model), dataSource: SACReportNotesCache); var note = notes.LastOrDefault(O => O.InfoCache.Contains(cacheValue)); if (note == null && _operationType == OptFlagsEnum.A) { @@ -417,9 +220,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { model.BizID = note.BizId; } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -440,126 +243,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - private List GetSwapConfirmationAttModelFromView(out List fileList) + private string formatInfoTag(ConfirmationAttModel model, bool suffixType = false) { - fileList = new List(); - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("交易确认书附件")) - { - var ftpHelper = new FtpHelper(PS.Config.ErpElement.KingstarView_RemotePath, PS.Config.ErpElement.KingstarView_RemoteUser, PS.Config.ErpElement.KingstarView_RemotePassword, PS.Config.ErpElement.KingstarView_FtpUsePassive, 3000, PS.Config.ErpElement.KingstarView_EnableSsl); - var cacheKey = $"{BusiDataType}"; - DataTable dt = _viewDataSource.Tables["交易确认书附件"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - var optType = OptFlagsEnum.NONE; - switch (GetDataSetValue(dt, i, "OPERATIONTYPE")) - { - case "A": - optType = OptFlagsEnum.A; - break; - case "U": - optType = OptFlagsEnum.U; - break; - case "D": - optType = OptFlagsEnum.D; - break; - } - if (optType != _operationType) - { - continue; - } - - SwapConfirmationAttModel model = new SwapConfirmationAttModel(); - model.IgnoreCheck = true; - model.ConfirmationNo = GetDataSetValue(dt, i, "CONFIRMATIONNO"); - model.OperationType = optType; - var cacheValue = model.ConfirmationNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - - model.ConfirmationFilesTuple = new List(); - ; - var files = GetDataSetValue(dt, i, "CONFIRMATIONFILES").Split(','); - foreach (var f in files) - { - if (!string.IsNullOrWhiteSpace(f)) - { - var downloadRet = ftpHelper.DownloadFile(CreateViewAttDownloadPath(f), ViewLocalAttFileDir + @"\kingstar\", out string message); - LogFactory.GetLogger("ftpHelper.DownloadFile").Info($"下载结果:{ViewLocalAttFileDir},{f},{downloadRet}"); - var path = downloadRet; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - model.ConfirmationFilesTuple.Add(new ConfirmationFilesTupleModel() { ConfirmationFiles = Path.GetFileName(path) }); - } - } - List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); - var note = notes.LastOrDefault(O => O.InfoCache.Contains(cacheValue)); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"KingstarView\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - - if (_operationType != OptFlagsEnum.A) - { - model.BizID = note.BizId; - } - model.ExceID = base.formatExceID(); - result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - note.id = 0; - note.ExceId = model.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(model, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - return result; - } - - - private string formatInfoTag(SwapConfirmationAttModel model, bool suffixType = false) - { - string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_成交_确认书_"; + var result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_成交_确认书_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -567,25 +253,56 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 5) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.ConfirmationAtt != null) { - CheckHelper helper = new CheckHelper(); - for (int i = 0; i < model.ConfirmationAtt.Count; i++) + var helper = new CheckHelper(); + var attHelper = new CheckHelper(); + for (var i = 0; i < model.ConfirmationAtt.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.ConfirmationAtt[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); + if (item.ConfirmationFilesTuple != null) + { + for (int j = 0; j < item.ConfirmationFilesTuple.Count; j++) + { + var att = item.ConfirmationFilesTuple[j]; + attHelper.ExecuteCheck(att, (name, value, msg) => + { + listRoot.Add(new SacInfo(name, value, msg)); + }); + } + } if (listRoot.Count > 0) { - var errMsg = new SacInfo("SwapConfirmationAtt", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("SwapConfirmationAtt", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -609,7 +326,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationService.cs index b77f1ffd..7d980eac 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapConfirmationService.cs @@ -1,11 +1,11 @@ -using BaseOUDAL; -using NPOI.SS.Formula.Functions; +using BaseOUDAL; using Qdp.Foundation.Implementations; using System.Data; using YieldChain.Helpers; using YLErp.BLL; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Helpers; using YLErp.Modules.EodModule; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; @@ -31,438 +31,35 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SwapConfirmation; - List noteList = new List(); + + readonly List noteList = new(); + IEnumerable SACReportNotesCache = null; protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; - LogFactory.GetLogger("GenerateBody").Info($"SAC_ReportDataSource:" + PS.Config.ErpElement.SAC_ReportDataSource.ToString()); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + SACReportNotesCache = base.InitReportNotes(ReportType); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetSwapConfirmationModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var nextDataDate = _reqInfo.DataDate.AddDays(1); - using (var db = new YLContext()) - { - var codeList = ReportStatus.GetCacheInfo(cacheKey); - var query = (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r - on tc.id equals tr.TradeCashId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - join ts in db.trade_swap - on t.id equals ts.TradeId - where - ((_operationType == OptFlagsEnum.A && t.TradeDate >= _reqInfo.DataDate && t.TradeDate < nextDataDate)//新增时使用交易日期判断 - || (_operationType != OptFlagsEnum.A && tc.OptDate >= _reqInfo.ReportDate && tc.OptDate < nextDate))//补正和废止时使用操作日期判断 - && (_operationType == OptFlagsEnum.D || (t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid)) - && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType == "收益互换" - && tc.Action == "系统操作-期权费" - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - ts.IsGetFloatingProfit, - ts.IsPayFloatingProfit, - ts.GetVarietyId, - ts.PayVarietyId, - ts.GetUnderlyingCode, - ts.PayUnderlyingCode, - ts.GetLongShort, - ts.PayLongShort, - ts.GetSpotPrice, - ts.PaySpotPrice, - ts.GetTradePrice, - ts.PayTradePrice, - ts.GetSwapTimeAndRate, - ts.PaySwapTimeAndRate, - ts.GetFixedProfit, - ts.PayFixedProfit, - ts.GetMarginRate, - ts.PayMarginRate, - ts.GetTradeAmount, - ts.PayTradeAmount, - tr.ContractCode, - td.Paths, - t.QuoteCurrency, - t.SettlementCurrency, - ts.GetUnAnnualRate, - ts.GetSingleFee, - ts.PayUnAnnualRate, - ts.PaySingleFee, - ts.SwapType, - td.Comments, - }).OrderBy(O => O.OptDate).ToArray().Where(O => !codeList.Contains(O.id + "")).ToArray(); - - List ids = query.Select(O => O.id).ToList(); - List delIds = new List(); - if (_operationType == OptFlagsEnum.D) - { - delIds = DbContext.TradeAuditLog.Where(O => ids.Contains(O.TradeId) && O.OptDate >= _reqInfo.ReportDate && O.OptDate < nextDate && O.OptType == "删除交易").Select(O => O.TradeId).ToList(); - } - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - Dictionary reportDescDic = DbContext.AppConfig.Where(O => O.PGroup == ConsAppConfig.ReportDescSwap).ToDictionary(K => K.PName, V => V.PValue); - foreach (var item in query) - { - var cacheValue = item.id.ToString(); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - //如果存在重复数据,则始终用较新的数据 - SwapConfirmationModel info = new SwapConfirmationModel(); - - //info.TradeId = item.id.ToString(); - info.ConfirmationNo = item.ContractCode; - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(info)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - info.OperationType = OptFlagsEnum.A; - note = new SACReportNotes() - { - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - if (!note.changeStatus) - { - continue;//交易没有被修改过,跳过 - } - info.OperationType = OptFlagsEnum.U; - note.IsValid = true; - break; - case OptFlagsEnum.D: - if (!delIds.Contains(item.id)) - { - continue;//交易没有被删除,跳过 - } - info.OperationType = OptFlagsEnum.D; - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); - if (info.OperationType != _operationType) - { - continue; - } - if (info.OperationType != OptFlagsEnum.D && (!item.tradeValid || !item.tradecashValid || !item.tradeContractRValid)) - {//非废止报送中,应跳过所有存在无效数据的数据 - continue; - } - if (metaDic.ContainsKey(item.id)) - { - var metaInfo = metaDic[item.id]; - info.MasterAgrmtNo = metaInfo.ContainsKey(ConsTradeMetaKey.MainProtocolCode) ? metaInfo[ConsTradeMetaKey.MainProtocolCode] : ""; - info.SupAgrmtNo = metaInfo.ContainsKey(ConsTradeMetaKey.SupProtocolCode) ? metaInfo[ConsTradeMetaKey.SupProtocolCode] : ""; - info.ClearingAgency = metaInfo.ContainsKey(ConsTradeMetaKey.ClearingAgency) ? ClearingAgencyMap[metaInfo[ConsTradeMetaKey.ClearingAgency]] : ""; - info.TradingPlace = metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) ? TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] : ""; - if (info.TradingPlace == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.ConfirmationID = note.BizId;//确认书编号; - } - info.ConfirmationType = ReportTypeMap[info.OperationType == OptFlagsEnum.A ? "首次" : "变更"]; - info.FillParty = FillPartyMap["甲方"]; - if (item.SwapType == "普通") - { - var longShort = item.IsPayFloatingProfit ? item.PayLongShort : item.GetLongShort; - info.SwapType = ConsReport.SwapTypeMap["客户" + longShort]; - } - else - { - info.SwapType = ConsReport.SwapTypeMap[item.SwapType]; - } - var variety = DataCacheProvider.GetVariety(item.UnderlyingCode); - var customizedResultsGet = QdpHelper.ParseAutocallCustomizedInfo(item.GetSwapTimeAndRate); - var getSwapRates = customizedResultsGet.Item2?.Distinct(); - var customizedResultsPay = QdpHelper.ParseAutocallCustomizedInfo(item.PaySwapTimeAndRate); - var paySwapRates = customizedResultsPay.Item2?.Distinct(); - - var rates = item.IsPayFloatingProfit ? getSwapRates : paySwapRates; - var paymentMethod = new PaymentMethodModel(); - if (GetPaySide(item.IsPayFloatingProfit, info.ClearingAgency)) - { - var underlyingCode = string.IsNullOrWhiteSpace(item.GetUnderlyingCode) ? item.PayUnderlyingCode : item.GetUnderlyingCode; - var um = DataCacheProvider.GetUnderlyingDataSource().GetData(underlyingCode); - info.PtyAUndrlygAssetNo = um.CommodityCode == "组合标的" ? UndrlygAssetNoMap["组合标的"] : UndrlygAssetNoMap["单一标的"]; - if (rates.Count() == 1) - { - info.PaymentMethod = PaymentMethodMap["固定利率收益"]; - paymentMethod.FixedInterestRate = (rates.First() * 100).ToString(); - } - else - { - info.PaymentMethod = PaymentMethodMap["浮动利率收益"]; - paymentMethod.FloatInterestRate = ConsReport.RefRateTypeMap["其他"]; - paymentMethod.ReferenceofFloatingInterestRate = "其他"; - paymentMethod.BasePoint = "0"; - } - } - else - { - info.PtyAUndrlygAssetNo = UndrlygAssetNoMap["单一标的"]; - if (rates.Count() == 1) - { - info.PaymentMethod = PaymentMethodMap["固定利率收益"]; - paymentMethod.FixedInterestRate = (rates.First() * 100).ToString(); - } - else - { - info.PaymentMethod = PaymentMethodMap["浮动利率收益"]; - paymentMethod.FloatInterestRate = ConsReport.RefRateTypeMap["其他"]; - paymentMethod.ReferenceofFloatingInterestRate = "其他"; - paymentMethod.BasePoint = "其他"; - paymentMethod.BasePoint = "0"; - } - } - paymentMethod.PaymentMethod = info.PaymentMethod; - paymentMethod.Payer = item.IsPayFloatingProfit ? ConsReport.PayerMap["乙方"] : ConsReport.PayerMap["甲方"]; - - var getSwapDates = customizedResultsGet.Item1?.Distinct(); - if (getSwapDates?.Count() == 1) - { - Date date = getSwapDates.First(); - paymentMethod.PaymentFreq = date == new Date(item.TradeDate.Value) ? PaymentFreqMap["期初支付"] : PaymentFreqMap["期末支付"]; - } - else - { - paymentMethod.PaymentFreq = PaymentFreqMap["期间多次支付"]; - } - var paySwapDates = customizedResultsPay.Item1?.Distinct(); - if (paySwapDates?.Count() == 1) - { - Date date = paySwapDates.First(); - paymentMethod.PaymentFreq = date == new Date(item.TradeDate.Value) ? PaymentFreqMap["期初支付"] : PaymentFreqMap["期末支付"]; - } - else - { - paymentMethod.PaymentFreq = PaymentFreqMap["期间多次支付"]; - } - info.StartDate = item.TradeDate?.ToString("yyyy-MM-dd"); - info.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd"); - info.SettlementDate = (item.SettlementDate ?? item.ExerciseDate)?.ToString("yyyy-MM-dd"); - if (PS.Config.Company == Configuration.CompanyEnum.中金) - { - var um = DataCacheProvider.GetUnderlyingDataSource().GetData(item.UnderlyingCode); - if (um.CloseDate != null && um.CloseDate != DateTime.MinValue) - { - info.DueDate = um.CloseDate?.ToString("yyyy-MM-dd"); - } - - } - var currency = (item.SettlementCurrency == "CNH" ? "CNY" : item.SettlementCurrency) ?? "CNY"; - info.Currency = ((int)(CurrencyEnum)Enum.Parse(typeof(CurrencyEnum), currency.ToUpper())).ToString();// ((int)CurrencyEnum.CNY).ToString(); - var rate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(item.QuoteCurrency, "CNY", _reqInfo.DataDate); - info.NotinalPrincipleAmt = (item.OriginalStockEqvNotional * rate)?.ToString("0.00"); - info.UndrlygAssetType = string.IsNullOrWhiteSpace(variety.MainCategoryDesc) ? UndrlygAssetTypeMap["其他"] : UndrlygAssetTypeMap[variety.MainCategoryDesc]; - //系统中的交易修改时必须回退,所以报送不存在修改时还存在有效的存续期记录的情况; - //if (info.OperationType == OptFlagsEnum.U) - //{ - // if (reportCacheDic.ContainsKey("DueDate") && !reportCacheDic["DueDate"].StartsWith(info.DueDate) && !info.DueDate.StartsWith(reportCacheDic["DueDate"])) - // { - // throw new ServiceException("补正时,如果该交易还存在有效的存续期记录,到期日字段不能修改"); - // } - // if (reportCacheDic.ContainsKey("NotinalPrincipleAmt") && reportCacheDic["NotinalPrincipleAmt"] != info.NotinalPrincipleAmt && reportCacheDic["NotinalPrincipleAmt"] != item.OriginalStockEqvNotional?.ToString("0")) - // { - // throw new ServiceException("补正时,如果该交易还存在有效的存续期记录,名义本金额(人民币)字段不能修改"); - // } - //} - #region 履约担保 - - var files = db.trade_file.Where(O => O.TradeId == item.id).ToArray(); - info.PerformanceGuaranteeType = item.MarginType == MarginTypeEnum.NONE ? PerformanceGuaranteeMap["无履约担保"] : PerformanceGuaranteeMap["部分担保"]; - if (item.MarginType != MarginTypeEnum.NONE) - { - info.PerformanceCollProvider = PerformanceCollProviderMap["乙方"]; - info.PartyUseColl = ConsReport.BoolMap[valuedateBLL.SystemDate.PartyUseColl || PS.Config.Company == Configuration.CompanyEnum.东莞 ? "是" : "否"];//todo:读取用户输入 - info.CollInstruction = valuedateBLL.SystemDate.CollInstruction;//todo:读取用户输入 - info.CalculateCollInterest = BoolMap["否"]; - info.PerformanceCollInitialRatio = (item.GetMarginRate * 100)?.ToString("0.##");//获取客户预付金率 - info.PerformanceCollAddtlRatio = "100"; - info.PerformanceCollOffsetRatio = "100"; - info.MaintainGuaranteeRatio = info.PerformanceCollInitialRatio; - if (PS.Config.Company == Configuration.CompanyEnum.中金) - { - info.PerformanceCollAddtlRatio = info.PerformanceCollInitialRatio; - info.PerformanceCollOffsetRatio = info.PerformanceCollInitialRatio; - info.MaintainGuaranteeRatio = info.PerformanceCollInitialRatio; - } - - var file_PerformanceGuarante = files.FirstOrDefault(O => O.Path.ToLower().EndsWith("履约保证书.pdf")); - info.PerformanceGuaranteeAtt = Path.GetFileName(file_PerformanceGuarante?.Path); - info.PerformanceGuaranteeRemark = file_PerformanceGuarante?.Description; - info.Remark = item.Comments; - info.PerformanceCollTuple = new List(); - info.PerformanceCollTuple.Add(new SwapPerformanceGuaranteeAttModel() - { - PerformanceCollType = PerformanceCollTypeMap["现金"], - PerformanceCollRange = /*item.MarginType == MarginTypeEnum.DEFAULT ? PerformanceCollRangeMap["本笔交易对应主协议框架下的所有交易"] :*/ PerformanceCollRangeMap["仅本笔交易"] - }); - if (!ReportStatus.CheckFileLength(file_PerformanceGuarante?.Path)) - { - break; - } - fileList.Add(file_PerformanceGuarante?.Path); - } - else - { - info.PerformanceCollInitialRatio = "0"; - info.MaintainGuaranteeRatio = "0"; - } - - #endregion - var file_ComplianceOpinion = files.FirstOrDefault(O => O.Path.ToLower().EndsWith("合规意见书.pdf")); - if (!string.IsNullOrWhiteSpace(file_ComplianceOpinion?.Path)) - { - string fileName = Path.GetFileName(file_ComplianceOpinion?.Path); - info.ComplianceOpinion = fileName; - if (!ReportStatus.CheckFileLength(file_ComplianceOpinion?.Path)) - { - break; - } - fileList.Add(file_ComplianceOpinion?.Path); - } - - var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId); - switch (PS.Config.Company) - { - case Configuration.CompanyEnum.中金: - GetCalculationInfoFromZhongJin(info, item.QuoteCurrency, item.IsPayFloatingProfit, item.IsPayFloatingProfit ? item.PayLongShort : item.GetLongShort, client.BoundSide); - break; - default: - string defaultDesc = reportDescDic.ContainsKey("默认") ? reportDescDic["默认"] : ""; - info.PtyAPrOfitCalculationInfo = reportDescDic.ContainsKey("甲方支付乙方") && !string.IsNullOrWhiteSpace(reportDescDic["甲方支付乙方"]) ? reportDescDic["甲方支付乙方"] : defaultDesc;//说明 - //info.PtyBProfitCalculationInfo = reportDescDic.ContainsKey("乙方支付甲方") && !string.IsNullOrWhiteSpace(reportDescDic["乙方支付甲方"]) ? reportDescDic["乙方支付甲方"] : defaultDesc;//说明 - break; - } - if (client.ClientType == "产品") - { - using (var baseDb = new ClientDBContext()) - { - if (PS.Config.Company == Configuration.CompanyEnum.中金) - { - info.FillParty = FillPartyMap["甲方"]; - info.PtyBPdctName = new ClientModule.ClientQueryService(OptUser).GetProductName(client.id) ?? ""; - info.PytBPdctCode = client.ProductNumber ?? ""; - } - else - { - //var clientFile = baseDb.client_file.Where(O => ((O.FileTypeName == ConsGlobal.ClientFileType.MainProtocol && O.ProtocolNumber == info.MasterAgrmtNo) || (O.FileTypeName == ConsGlobal.ClientFileType.AllographProduct && O.MainProtocolNumber == info.MasterAgrmtNo)) && O.ClientId == client.id && O.IsValid).AsEnumerable().GroupBy(O => O.FileTypeName).ToDictionary(K => K.Key, V => V.FirstOrDefault()); - //if (!clientFile.ContainsKey(ConsGlobal.ClientFileType.MainProtocol)) - //{ - // throw new ServiceException($"{client.Name} 主协议文件不存在,生成失败!"); - //} - ////下面这行注释掉是因为目前系统报送互换时只处理了报送方是甲方的情况,假如报送方为乙方,则所有涉及支付方向的参数都应该对调; - ////info.FillParty = FillPartyMap[clientFile[ConsGlobal.ClientFileType.MainProtocol].ReportorRole]; - //info.FillParty = FillPartyMap["甲方"]; - //var productFile = clientFile.ContainsKey(ConsGlobal.ClientFileType.AllographProduct) ? clientFile[ConsGlobal.ClientFileType.AllographProduct] : null; - if (info.FillParty == FillPartyMap["甲方"]) - { - info.PtyBPdctName = client.Name ?? ""; - info.PytBPdctCode = client.Number ?? ""; - } - else - { - info.PtyAPdctName = client.Name ?? ""; - info.PytAPdctCode = client.Number ?? ""; - } - } - } - } - info.CostPaymentTuple = new List() { paymentMethod }; - info.ExceID = base.formatExceID(); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - ReportStatus.AddCacheInfo($"{cacheKey}_{info.ConfirmationNo}", info.NotinalPrincipleAmt); - dataList.Add(info); - note.id = 0; - note.InfoCache = $"{{\"NotinalPrincipleAmt\":\"{info.NotinalPrincipleAmt}\",\"DueDate\":\"{info.DueDate}\",\"Tag\":\"{info.ConfirmationNo}\",\"Source\":\"System\"}}"; - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.DataId = item.tcId.ToString(); - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.KingstarView) == SAC_ReportDataSourceEnum.KingstarView) - { - LogFactory.GetLogger("GenerateBody").Info($"SAC_ReportDataSourceEnum.KingstarView"); - dataList.AddRange(GetSwapConfirmationModelFromView(ref fileList)); - } - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } fileList = fileList.Distinct().ToList(); noData = dataList.Count == 0; @@ -472,7 +69,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(SwapConfirmationModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var note = base.GetReportNotes(ReportType, formatInfoTag(model, true), dataSource: SACReportNotesCache).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -513,7 +110,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList.Add(model.ComplianceOpinion); } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -531,54 +128,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - - /// - /// 中金填写收益说明 - /// - /// - /// - /// - private void GetCalculationInfoFromZhongJin(SwapConfirmationModel info, string quoteCurrency, bool IsPaySide, string longShort, BoundSideEnum side) - { - //根据现金流支付方式 - info.PtyAPrOfitCalculationInfo = GetSingleCalculationInfo(info.PaymentMethod); - - var currency = (quoteCurrency == "CNH" || string.IsNullOrWhiteSpace(quoteCurrency)) ? "CNY" : quoteCurrency; - var qCurrency = ((CurrencyEnum)Enum.Parse(typeof(CurrencyEnum), currency)); - if (qCurrency != CurrencyEnum.CNY) - { - info.PtyAPrOfitCalculationInfo += "*结算汇率"; - //info.PtyBProfitCalculationInfo += "*结算汇率"; - } - } - - private string GetSingleCalculationInfo(string paymentMethod) - { - switch (paymentMethod) - { - case "0": - return "(期初价格-期末价格)*标的资产数量"; - case "1": - return "(期末价格 - 期初价格) * 标的资产数量"; - case "2": - return ""; - case "3": - return "标的资产数量*期初价格*固定收益率"; - default: - return ""; - } - } - private List GetSwapConfirmationModel(ref List fileList) { - List result = new List(); - string path = ""; + var result = new List(); + var path = ""; if (_excelDataSource != null && _excelDataSource.Tables.Contains("互换交易确认书明细")) { - var cacheKey = $"{BusiDataType}"; - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - DataTable dt = _excelDataSource.Tables["互换交易确认书明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["互换交易确认书明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -588,12 +146,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][3]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -603,19 +167,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - SwapConfirmationModel model = new SwapConfirmationModel(); - - model.OperationType = optType; - model.MasterAgrmtNo = GetDataSetValue(dt, i, 0); - model.SupAgrmtNo = GetDataSetValue(dt, i, 1); - model.ConfirmationNo = GetDataSetValue(dt, i, 2); - model.ConfirmationType = ConsReport.ReportTypeMap[optType == OptFlagsEnum.A ? "首次" : "变更"]; - model.FillParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 4)]; - model.SwapType = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 5)]; - model.StartDate = GetDataSetValue(dt, i, 6); - model.DueDate = GetDataSetValue(dt, i, 7); - model.SettlementDate = GetDataSetValue(dt, i, 8); - if (Enum.TryParse(GetDataSetValue(dt, i, 9).ToUpper(), out CurrencyEnum currency)) + var model = new SwapConfirmationModel + { + OperationType = optType, + MasterAgrmtNo = GetDataSetValue(dt, i, 0), + SupAgrmtNo = GetDataSetValue(dt, i, 1), + ConfirmationNo = GetDataSetValue(dt, i, 2), + ConfirmationType = ConsReport.ReportTypeMap[optType == OptFlagsEnum.A ? "首次" : "变更"], + FillParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 4)], + SwapType = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 5)], + StartDate = GetDataSetValue(dt, i, 6), + DueDate = GetDataSetValue(dt, i, 7), + SettlementDate = GetDataSetValue(dt, i, 8) + }; + var currencyStr = GetDataSetValue(dt, i, 9); + currencyStr = currencyStr == "其他" ? "Other" : currencyStr; + if (Enum.TryParse(currencyStr.ToUpper(), out CurrencyEnum currency)) { model.Currency = ((int)currency).ToString(); } @@ -653,12 +220,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var notinalPrincipleAmt = GetDataSetValueToDouble(dt, i, 10); - var cacheValue = model.ConfirmationNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + var cacheValue = (model.ConfirmationNo ?? "").ToString(); + if (cacheValue.IsNullOrWhiteSpace()) { continue; } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) + { + continue; + } + var note = base.GetReportNotes(ReportType, formatInfoTag(model), dataSource: SACReportNotesCache).FirstOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { note = new SACReportNotes() @@ -686,7 +257,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service default: throw new ServiceException("未知操作类型"); } - Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); + var reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); if (_operationType == OptFlagsEnum.U) { if (reportCacheDic.ContainsKey("DueDate") && !reportCacheDic["DueDate"].StartsWith(model.DueDate) && !model.DueDate.StartsWith(reportCacheDic["DueDate"])) @@ -721,9 +292,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } fileList.Add(path); } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.InfoCache = $"{{\"NotinalPrincipleAmt\":\"{model.NotinalPrincipleAmt}\",\"DueDate\":\"{model.DueDate}\",\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Template\"}}"; note.ExceId = model.ExceID; @@ -744,244 +315,36 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - private List GetSwapConfirmationModelFromView(ref List fileList) - { - var ftpHelper = new FtpHelper(PS.Config.ErpElement.KingstarView_RemotePath, PS.Config.ErpElement.KingstarView_RemoteUser, PS.Config.ErpElement.KingstarView_RemotePassword, PS.Config.ErpElement.KingstarView_FtpUsePassive, 3000, PS.Config.ErpElement.KingstarView_EnableSsl); - List result = new List(); - string path = ""; - if (_viewDataSource != null && _viewDataSource.Tables.Contains("交易确认书")) - { - var cacheKey = $"{BusiDataType}"; - DataTable dt = _viewDataSource.Tables["交易确认书"]; - LogFactory.GetLogger("GetSwapConfirmationModelFromView").Info($"交易确认书记录数:" + dt.Rows.Count); - for (int i = 0; i < dt.Rows.Count; i++) - { - LogFactory.GetLogger("GetSwapConfirmationModelFromView").Info($"交易确认书记录数:" + dt.Rows.Count); - var operateType = GetDataSetValue(dt, i, "OPERATIONTYPE"); - LogFactory.GetLogger("GetSwapConfirmationModelFromView").Info($"OperateType:" + operateType.ToString()); - var optType = OptFlagsEnum.NONE; - switch (GetDataSetValue(dt, i, "OPERATIONTYPE")) - { - case "A": - optType = OptFlagsEnum.A; - break; - case "U": - optType = OptFlagsEnum.U; - break; - case "D": - optType = OptFlagsEnum.D; - break; - } - if (optType != _operationType) - { - continue; - } - - SwapConfirmationModel model = new SwapConfirmationModel(); - model.IgnoreCheck = true; - model.OperationType = optType; - model.MasterAgrmtNo = GetDataSetValue(dt, i, "MASTERAGRMTNO"); - model.SupAgrmtNo = GetDataSetValue(dt, i, "SUPAGRMNO"); - model.ConfirmationNo = GetDataSetValue(dt, i, "CONFIRMATIONNO"); - model.ConfirmationType = ConsReport.ReportTypeMap[optType == OptFlagsEnum.A ? "首次" : "变更"]; - model.FillParty = GetDataSetValue(dt, i, "FILLPARTY"); - model.SwapType = GetDataSetValue(dt, i, "SWAPTYPE"); - model.StartDate = GetDataSetValue(dt, i, "STARTDATE"); - model.DueDate = GetDataSetValue(dt, i, "DUEDATE"); - model.SettlementDate = GetDataSetValue(dt, i, "SETTLEMENTDATE"); - - model.Currency = GetDataSetValue(dt, i, "CURRENCY"); - - model.NotinalPrincipleAmt = GetDataSetValue(dt, i, "NOTIONALPRINCIPLEAMT"); - model.ClearingAgency = GetDataSetValue(dt, i, "CLEARINGAGENCY"); - model.TradingPlace = GetDataSetValue(dt, i, "TRADINGPLACE"); - model.TradingPlaceOther = GetDataSetValue(dt, i, "TRADINGPLACEOTHER"); - model.UndrlygAssetType = GetDataSetValue(dt, i, "UNDRLYGASSETTYPE"); - model.ConfirmationRemark = GetDataSetValue(dt, i, "CONFIRMATIONREMARK"); - model.PerformanceGuaranteeType = GetDataSetValue(dt, i, "PERFORMANCEGUARANTEETYPE"); - model.PerformanceCollProvider = GetDataSetValue(dt, i, "PERFORMANCECOLLPROVIDER"); - model.PartyUseColl = GetDataSetValue(dt, i, "PARTYUSECOLL"); - model.CollInstruction = GetDataSetValue(dt, i, "COLLINSTRUCTION"); - model.CalculateCollInterest = GetDataSetValue(dt, i, "CALCULATECOLLINTEREST"); - model.PerformanceCollInitialRatio = GetDataSetValue(dt, i, "PERFORMANCECOLLINITIALRATIO"); - model.PerformanceCollAddtlRatio = GetDataSetValue(dt, i, "PERFORMANCECOLLADDTLRATIO"); - model.PerformanceCollOffsetRatio = GetDataSetValue(dt, i, "PERFORMANCECOLLOFFSETRATIO"); - model.MaintainGuaranteeRatio = GetDataSetValue(dt, i, "MAINTAINGUARANTEERATIO"); - model.PerformanceGuaranteeAtt = GetDataSetValue(dt, i, "PERFORMANCEGUARANTEEATT"); - model.PerformanceGuaranteeRemark = GetDataSetValue(dt, i, "PERFORMANCEGUARANTEEREMARK"); - model.Remark = GetDataSetValue(dt, i, "REMARK"); - model.ComplianceOpinion = GetDataSetValue(dt, i, "COMPLIANCEOPINION"); - model.PtyAUndrlygAssetNo = GetDataSetValue(dt, i, "PTYAUNDRLYGASSETNO"); - model.PtyAPrOfitCalculationInfo = GetDataSetValue(dt, i, "PTYAPROFITCALCULATIONINFO"); - model.PtyAProfitRemark = GetDataSetValue(dt, i, "PTYAPROFITREMARK"); - model.PtyAPdctName = GetDataSetValue(dt, i, "PTYAPDCTNAME"); - model.PytAPdctCode = GetDataSetValue(dt, i, "PTYAPDCTCODE"); - model.PtyBPdctName = GetDataSetValue(dt, i, "PTYBPDCTNAME"); - model.PytBPdctCode = GetDataSetValue(dt, i, "PTYBPDCTCODE"); - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); - - model.CostPaymentTuple = GetCostPaymentTupleFromView(model.ConfirmationNo); - model.PerformanceCollTuple = GetPerformanceGuaranteeAttModelFromView(model.ConfirmationNo); - - var notinalPrincipleAmt = GetDataSetValueToDouble(dt, i, "NOTIONALPRINCIPLEAMT"); - - var cacheValue = model.ConfirmationNo; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model)).FirstOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - Dictionary reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); - if (_operationType == OptFlagsEnum.U) - { - if (reportCacheDic.ContainsKey("DueDate") && !reportCacheDic["DueDate"].StartsWith(model.DueDate) && !model.DueDate.StartsWith(reportCacheDic["DueDate"])) - { - throw new ServiceException("补正时,如果该交易还有存续期记录,到期日字段不能修改"); - } - if (reportCacheDic.ContainsKey("NotinalPrincipleAmt") && reportCacheDic["NotinalPrincipleAmt"] != model.NotinalPrincipleAmt && reportCacheDic["NotinalPrincipleAmt"] != notinalPrincipleAmt.ToString("0")) - { - throw new ServiceException("补正时,如果该交易还有存续期记录,名义本金额(人民币)字段不能修改"); - } - } - } - if (model.OperationType != OptFlagsEnum.A) - { - model.ConfirmationID = note.BizId;//确认书编号; - } - if (!string.IsNullOrWhiteSpace(model.PerformanceGuaranteeAtt)) - { - var downloadRet = ftpHelper.DownloadFile(CreateViewAttDownloadPath(model.PerformanceGuaranteeAtt), ViewLocalAttFileDir + @"\kingstar\", out string message); - LogFactory.GetLogger("ftpHelper.DownloadFile").Info($"下载结果:{ViewLocalAttFileDir},{model.PerformanceGuaranteeAtt},{downloadRet}"); - path = downloadRet; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - model.PerformanceGuaranteeAtt = Path.GetFileName(path); - } - if (!string.IsNullOrWhiteSpace(model.ComplianceOpinion)) - { - var downloadRet = ftpHelper.DownloadFile(CreateViewAttDownloadPath(model.ComplianceOpinion), ViewLocalAttFileDir + @"\kingstar\", out string message); - LogFactory.GetLogger("ftpHelper.DownloadFile").Info($"下载结果:{ViewLocalAttFileDir},{model.ComplianceOpinion},{downloadRet}"); - path = downloadRet; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - model.ComplianceOpinion = Path.GetFileName(path); - } - model.ExceID = base.formatExceID(); - result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - note.id = 0; - note.InfoCache = $"{{\"NotinalPrincipleAmt\":\"{model.NotinalPrincipleAmt}\",\"DueDate\":\"{model.DueDate}\",\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"KingstarView\"}}"; - note.ExceId = model.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(model, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - return result; - } - private List GetCostPaymentTuple(string confirmationNo) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("收益互换交易费用支付端")) { - DataTable dt = _excelDataSource.Tables["收益互换交易费用支付端"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["收益互换交易费用支付端"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != confirmationNo) + if (dt.Rows[i][0]?.ToString().Trim() != confirmationNo) { continue; } - PaymentMethodModel model = new PaymentMethodModel(); - model.PaymentMethod = ConsReport.PaymentMethodMap[GetDataSetValue(dt, i, 1)]; - model.Payer = ConsReport.PayerMap[GetDataSetValue(dt, i, 2)]; - model.PaymentFreq = ConsReport.PaymentFreqMap[GetDataSetValue(dt, i, 3)]; - model.FixedInterestRate = GetDataSetValue(dt, i, 4); - model.FloatInterestRate = ConsReport.RefRateTypeMap[GetDataSetValue(dt, i, 5)]; - model.ReferenceofFloatingInterestRate = GetDataSetValue(dt, i, 6); - model.BasePoint = GetDataSetValue(dt, i, 7); - model.Blank1 = GetDataSetValue(dt, i, 8); - model.Blank2 = GetDataSetValue(dt, i, 9); - - result.Add(model); - } - } - return result; - } - - private List GetCostPaymentTupleFromView(string confirmationNo) - { - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("费用端支付")) - { - DataTable dt = _viewDataSource.Tables["费用端支付"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - - if (GetDataSetValue(dt, i, "CONFIRMATIONNO") != confirmationNo) + var model = new PaymentMethodModel { - continue; - } - - PaymentMethodModel model = new PaymentMethodModel(); - model.PaymentMethod = GetDataSetValue(dt, i, "PAYMENTMETHOD"); - model.Payer = GetDataSetValue(dt, i, "PAYER"); - model.PaymentFreq = GetDataSetValue(dt, i, "PAYMENTFREQ"); - model.FixedInterestRate = GetDataSetValue(dt, i, "FIXEDINTERESTRATE"); - model.FloatInterestRate = GetDataSetValue(dt, i, "FLOATINTERESTRATE"); - model.ReferenceofFloatingInterestRate = GetDataSetValue(dt, i, "REFFLOATINGINTERESTRATE"); - model.BasePoint = GetDataSetValue(dt, i, "BASEPOINT"); - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); + PaymentMethod = ConsReport.PaymentMethodMap[GetDataSetValue(dt, i, 1)], + Payer = ConsReport.PayerMap[GetDataSetValue(dt, i, 2)], + PaymentFreq = ConsReport.PaymentFreqMap[GetDataSetValue(dt, i, 3)], + FixedInterestRate = GetDataSetValue(dt, i, 4), + FloatInterestRate = ConsReport.RefRateTypeMap[GetDataSetValue(dt, i, 5)], + ReferenceofFloatingInterestRate = GetDataSetValue(dt, i, 6), + BasePoint = GetDataSetValue(dt, i, 7), + Blank1 = GetDataSetValue(dt, i, 8), + Blank2 = GetDataSetValue(dt, i, 9) + }; result.Add(model); } @@ -991,64 +354,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private List GetPerformanceGuaranteeAttModel(string confirmationNo) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("履约担保品明细")) { - DataTable dt = _excelDataSource.Tables["履约担保品明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["履约担保品明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != confirmationNo) + if (dt.Rows[i][0]?.ToString().Trim() != confirmationNo) { continue; } - SwapPerformanceGuaranteeAttModel model = new SwapPerformanceGuaranteeAttModel(); - - model.PerformanceCollType = ConsReport.PerformanceCollTypeMap[GetDataSetValue(dt, i, 1)]; - model.PerformanceCollRange = ConsReport.PerformanceCollRangeMap[GetDataSetValue(dt, i, 2)]; - model.MultiConfirmationID = GetDataSetValue(dt, i, 3); - model.Remarks = GetDataSetValue(dt, i, 4); + var model = new SwapPerformanceGuaranteeAttModel + { + PerformanceCollType = ConsReport.PerformanceCollTypeMap[GetDataSetValue(dt, i, 1)], + PerformanceCollRange = ConsReport.PerformanceCollRangeMap[GetDataSetValue(dt, i, 2)], + MultiConfirmationID = GetDataSetValue(dt, i, 3), + Remarks = GetDataSetValue(dt, i, 4) + }; result.Add(model); } } return result; } - - private List GetPerformanceGuaranteeAttModelFromView(string confirmationNo) + + private string formatInfoTag(SwapConfirmationModel model, bool suffixType = false) { - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("履约担保品")) - { - DataTable dt = _viewDataSource.Tables["履约担保品"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - - if (GetDataSetValue(dt, i, "CONFIRMATIONNO") != confirmationNo) - { - continue; - } - - SwapPerformanceGuaranteeAttModel model = new SwapPerformanceGuaranteeAttModel(); - model.PerformanceCollType = GetDataSetValue(dt, i, "PERFORMANCECOLLTYPE"); - model.PerformanceCollRange = GetDataSetValue(dt, i, "PERFORMANCECOLLRANGE"); - model.MultiConfirmationID = GetDataSetValue(dt, i, "MULTICONFIRMATIONID"); - model.Remarks = GetDataSetValue(dt, i, "REMARKS"); - - result.Add(model); - } - } - return result; - } - - private string formatInfoTag(SwapConfirmationModel model, bool suffixType = false, bool isSettlement = false) - { - string result = $"{(isSettlement ? "" : BusiDataType.ToString())}_{model.ConfirmationNo.Replace("_", "-")}_{(isSettlement ? "" : "成交_")}"; + var result = $"{BusiDataType.ToString()}_{model.ConfirmationNo.Replace("_", "-")}_成交_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -1056,26 +394,42 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 4) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.SwapConfirmation != null) { - CheckHelper helper = new Common.CheckHelper(); - CheckHelper pAttHelper = new Common.CheckHelper(); - CheckHelper cAttHelper = new Common.CheckHelper(); - for (int i = 0; i < model.SwapConfirmation.Count; i++) + var helper = new Common.CheckHelper(); + var pAttHelper = new Common.CheckHelper(); + var cAttHelper = new Common.CheckHelper(); + for (var i = 0; i < model.SwapConfirmation.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.SwapConfirmation[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (item.CostPaymentTuple != null) { - for (int j = 0; j < item.CostPaymentTuple.Count; j++) + for (var j = 0; j < item.CostPaymentTuple.Count; j++) { var listItem = new List(); var attItem = item.CostPaymentTuple[j]; @@ -1085,15 +439,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("CostPaymentTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("CostPaymentTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (item.PerformanceCollTuple != null) { - for (int j = 0; j < item.PerformanceCollTuple.Count; j++) + for (var j = 0; j < item.PerformanceCollTuple.Count; j++) { var listItem = new List(); var attItem = item.PerformanceCollTuple[j]; @@ -1103,16 +459,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("PerformanceCollTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("PerformanceCollTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("SwapConfirmation", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("SwapConfirmation", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -1136,20 +497,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } return true; } - - private bool GetPaySide(bool IsPaySide, string clearingAgency) - { - if (PS.Config.Company == Configuration.CompanyEnum.中金) - { - return clearingAgency == ClearingAgencyMap["甲方"]; - } - return IsPaySide; - } } } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapEquityPaymentService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapEquityPaymentService.cs index 81196560..07b56618 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapEquityPaymentService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapEquityPaymentService.cs @@ -1,6 +1,9 @@ -using Qdp.Foundation.Implementations; +using MoreLinq; +using Qdp.Foundation.Implementations; +using System.Collections.ObjectModel; using System.Data; using YLErp.BLL; +using YLErp.Commons; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; using YLErp.Modules.SuperviseReportModule.SAC.Common; @@ -22,339 +25,40 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1016; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SwapEquityPayment; - List noteList = new List(); + + readonly List noteList = new(); + IEnumerable SACReportNotesCache = null; protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - var cacheKey = $"{BusiDataType}"; - List dataList = new List(); + var model = new BodyModel(); + SACReportNotesCache = base.InitReportNotes(ReportType); + var dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { dataList = GetSwapEquityPaymentModel(); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var nextDate = _reqInfo.ReportDate.AddDays(1); - var nextDataDate = _reqInfo.DataDate.AddDays(1); - using (var db = new YLContext()) - { - var actions = new List() { "系统操作-平仓费", "系统操作-行权费", "系统操作-期权费" }; - var codeList = ReportStatus.GetCacheInfo(cacheKey); - var query = (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on tc.TradeId equals tr.TradeId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - join ts in db.trade_swap - on t.id equals ts.TradeId - where - ((_operationType == OptFlagsEnum.A && tc.ValueDate >= _reqInfo.DataDate && t.TradeDate < nextDataDate)//新增时使用交易日期判断 - || (_operationType != OptFlagsEnum.A && tc.OptDate >= _reqInfo.ReportDate && tc.OptDate < nextDate))//补正和废止时使用操作日期判断 - && (_operationType == OptFlagsEnum.D || (t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid)) - && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType == "收益互换" - && actions.Contains(tc.Action) - select new - { - ValueDate = tc.HappenedDate ?? tc.ValueDate, - isSettle = tc.Action != "系统操作-期权费", - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - ts.IsGetFloatingProfit, - ts.IsPayFloatingProfit, - ts.GetVarietyId, - ts.PayVarietyId, - ts.GetUnderlyingCode, - ts.PayUnderlyingCode, - ts.GetLongShort, - ts.PayLongShort, - ts.GetSpotPrice, - ts.PaySpotPrice, - ts.GetTradePrice, - ts.PayTradePrice, - ts.GetSwapTimeAndRate, - ts.PaySwapTimeAndRate, - ts.GetFixedProfit, - ts.PayFixedProfit, - ts.GetMarginRate, - ts.PayMarginRate, - ts.GetTradeAmount, - ts.PayTradeAmount, - tr.ContractCode, - td.Paths, - t.QuoteCurrency, - t.SettlementCurrency, - ts.GetUnAnnualRate, - ts.GetSingleFee, - ts.PayUnAnnualRate, - ts.PaySingleFee, - ts.SwapType, - tc.Notional, - tc.UnwindNotional, - tc.FinalPrice, - }).OrderBy(O => O.OptDate).ToArray().Where(O => !codeList.Contains(O.id + "")).ToArray(); - - List ids = query.Select(O => O.id).ToList(); - List delIds = new List(); - if (_operationType == OptFlagsEnum.D) - { - delIds = DbContext.TradeAuditLog.Where(O => ids.Contains(O.TradeId) && O.OptDate >= _reqInfo.ReportDate && O.OptDate < nextDate && O.OptType == "删除交易").Select(O => O.TradeId).ToList(); - } - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - Dictionary reportDescDic = DbContext.AppConfig.Where(O => O.PGroup == ConsAppConfig.ReportDescSwap).ToDictionary(K => K.PName, V => V.PValue); - foreach (var item in query) - { - var cacheValue = item.id.ToString() + item.isSettle; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - //如果存在重复数据,则始终用较新的数据 - SwapEquityPaymentModel info = new SwapEquityPaymentModel(); - - info.ConfirmationNo = item.ContractCode; - var currentDealCodes = ReportStatus.GetCacheInfo(DataFlagsEnum.A1005.ToString());//取出这一次报送交易要素的交易编号 - var currentSettleCodes = ReportStatus.GetCacheInfo(DataFlagsEnum.A1006.ToString()).Select(O => O.Split('_')[0]);//取出这一次报送交易要素的交易编号 - if ((!item.isSettle && !currentDealCodes.Contains(item.id.ToString())) || (item.isSettle && !currentSettleCodes.Contains(item.id.ToString()))) - { - continue;//跳过交易要素还没报送的确认书附件; - } - if (item.isSettle) - { - var tempDate = item.ValueDate; - var count = db.trade_cash.Where(O => O.TradeId == item.id && O.ValueDate < tempDate && (O.Action == "系统操作-行权费" || O.Action == "系统操作-平仓费")).Select(O => O.ValueDate).ToHashSet().Count; - count += db.ExtensionTime.Where(O => O.TradeId == item.id && O.OptDate < tempDate).Select(O => O.OptDate).ToArray().Select(O => O.GetValueOrDefault().Date).ToHashSet().Count; - info.DurationEventNO = count.ToString("0000"); - } - List notes = base.GetReportNotes(formatInfoTag(info)); - SACReportNotes note = notes.FirstOrDefault(O => O.InfoCache.Contains(item.ValueDate.ToString("yyyy-MM-dd")) && O.InfoCache.Contains(item.isSettle.ToString())); - if (note == null && _operationType == OptFlagsEnum.A) - { - info.OperationType = OptFlagsEnum.A; - note = new SACReportNotes() - { - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - if (!note.changeStatus) - { - continue;//交易没有被修改过,跳过 - } - info.OperationType = OptFlagsEnum.U; - note.IsValid = true; - break; - case OptFlagsEnum.D: - if (!delIds.Contains(item.id)) - { - continue;//交易没有被删除,跳过 - } - info.OperationType = OptFlagsEnum.D; - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - if (info.OperationType != _operationType) - { - continue; - } - if (info.OperationType != OptFlagsEnum.D && (!item.tradeValid || !item.tradecashValid || !item.tradeContractRValid)) - {//非废止报送中,应跳过所有存在无效数据的数据 - continue; - } - if (metaDic.ContainsKey(item.id)) - { - var metaInfo = metaDic[item.id]; - var tradingPlace = metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) ? TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] : ""; - if (tradingPlace == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId;//确认书编号; - } - var swapEquityPayment = new SwapEquityPaymentTupleModel(); - var longShort = item.IsPayFloatingProfit ? item.PayLongShort : item.GetLongShort; - if (item.SwapType == "普通") - { - swapEquityPayment.PaymentMethod = ConsReport.PaymentMethodMap["权益收益(" + longShort + ")"]; - } - else - { - swapEquityPayment.PaymentMethod = ConsReport.SwapTypeMap["权益收益" + item.SwapType]; - } - swapEquityPayment.Payer = item.IsPayFloatingProfit ? ConsReport.PayerMap["甲方"] : ConsReport.PayerMap["乙方"]; - - var customizedResultsGet = QdpHelper.ParseAutocallCustomizedInfo(item.GetSwapTimeAndRate); - var getSwapRates = customizedResultsGet.Item2.Distinct(); - var customizedResultsPay = QdpHelper.ParseAutocallCustomizedInfo(item.PaySwapTimeAndRate); - var paySwapRates = customizedResultsPay.Item2.Distinct(); - if (item.IsGetFloatingProfit) - { - var getSwapDates = customizedResultsGet.Item1.Distinct(); - if (getSwapDates.Count() == 1) - { - Date date = getSwapDates.First(); - swapEquityPayment.PaymentFreq = date == new Date(item.TradeDate.Value) ? PaymentFreqMap["期初支付"] : PaymentFreqMap["期末支付"]; - } - else - { - swapEquityPayment.PaymentFreq = PaymentFreqMap["期间多次支付"]; - } - swapEquityPayment.InterestRate = (getSwapRates.FirstOrDefault() * 100).ToString(); - } - else - { - var paySwapDates = customizedResultsPay.Item1.Distinct(); - if (paySwapDates.Count() == 1) - { - Date date = paySwapDates.First(); - swapEquityPayment.PaymentFreq = date == new Date(item.TradeDate.Value) ? PaymentFreqMap["期初支付"] : PaymentFreqMap["期末支付"]; - } - else - { - swapEquityPayment.PaymentFreq = PaymentFreqMap["期间多次支付"]; - } - swapEquityPayment.InterestRate = (paySwapRates.FirstOrDefault() * 100).ToString(); - } - swapEquityPayment.OpenandClosingDate = item.ValueDate.ToString("yyyy-MM-dd"); - var codeInfo = DataCacheProvider.GetUnderlyingDataSource().GetData(item.UnderlyingCode); - swapEquityPayment.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(codeInfo.MarketName) ? "其他" : codeInfo.MarketName; - - if (SwapUndrlygAssetDtldTypeMap.TryGetValue(ConsGlobal.InstrumentType.GetDesc(codeInfo.UnderlyingInstrumentType), out var AssetDtldType)) - { - swapEquityPayment.UndrlygAssetDtldType = AssetDtldType; - } - else - { - swapEquityPayment.UndrlygAssetDtldType = UndrlygAssetDtldTypeMap["其他标的"]; - } - var rate = new EodModule.EodCurrencyRateService(UserInfo).GetCurrencyRate(item.QuoteCurrency, "CNY", item.ValueDate); - var notional = item.isSettle ? (item.UnwindNotional ?? 0) : item.Notional; - var price = (item.isSettle ? item.FinalPrice : item.SpotPrice) ?? 0; - swapEquityPayment.UndrlygAssetCode = codeInfo.UnderlyingCode; - swapEquityPayment.UndrlygAssetName = codeInfo.UnderlyingName; - swapEquityPayment.UndrlygAssetAmt = (notional / codeInfo.CountRatio / codeInfo.ContractSize).ToString("0.000000"); - swapEquityPayment.ContractMultiplier = codeInfo.ContractSize.ToString("0"); - swapEquityPayment.UndrlygAssetPrice = (price * rate).ToString("0.0000"); - var notionalAmt = (price * notional / codeInfo.CountRatio * rate); - if (item.isSettle) - { - var list = ReportStatus.GetCacheInfo($"{DataFlagsEnum.A1006.ToString()}_{info.ConfirmationNo}_{info.DurationEventNO}"); - if (list.Count > 0 && double.TryParse(list[0], out var temp)) - { - notionalAmt = temp; - } - } - else - { - var list = ReportStatus.GetCacheInfo($"{DataFlagsEnum.A1005.ToString()}_{info.ConfirmationNo}"); - if (list.Count > 0 && double.TryParse(list[0], out var temp)) - { - notionalAmt = temp; - } - } - if (longShort == "多头") - { - swapEquityPayment.UndrlygAssetPosition = UndrlygAssetPositionMap[item.isSettle ? "平多仓" : "开多仓"]; - swapEquityPayment.LNotinalPrincipleAmt = notionalAmt.ToString("0.0000"); - } - else - { - swapEquityPayment.UndrlygAssetPosition = UndrlygAssetPositionMap[item.isSettle ? "平空仓" : "开空仓"]; - swapEquityPayment.SNotinalPrincipleAmt = (-notionalAmt).ToString("0.0000"); - } - info.SwapEquityPaymentTuple = new List(); - info.SwapEquityPaymentTuple.Add(swapEquityPayment); - - info.ExceID = base.formatExceID(); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.InfoCache = $"{{\"DueDate\":\"{swapEquityPayment.OpenandClosingDate}\",\"OptType\":\"{(item.isSettle)}\",\"Tag\":\"{info.ConfirmationNo}\",\"DurationEventNO\":\"{info.DurationEventNO}\",\"Source\":\"System\"}}"; - note.ExceId = info.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.DataId = item.tcId.ToString(); - note.BizId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.KingstarView) == SAC_ReportDataSourceEnum.KingstarView) - { - dataList.AddRange(GetSwapEquityPaymentModelFromView()); - } - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.SwapEquityPayment = dataList; @@ -363,7 +67,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(SwapEquityPaymentModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true), dataSource: SACReportNotesCache).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 if (note == null) { note = new SACReportNotes() @@ -392,7 +96,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -412,12 +116,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private List GetSwapEquityPaymentModel() { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("收益互换交易权益端支付")) { - var cacheKey = $"{BusiDataType}"; - DataTable dt = _excelDataSource.Tables["收益互换交易权益端支付"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["收益互换交易权益端支付"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -427,12 +130,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][1]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -442,11 +151,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - SwapEquityPaymentModel model = new SwapEquityPaymentModel(); - - model.ConfirmationNo = GetDataSetValue(dt, i, 0); - model.OperationType = optType; - model.DurationEventNO = GetDataSetValue(dt, i, 2); + var model = new SwapEquityPaymentModel + { + ConfirmationNo = GetDataSetValue(dt, i, 0), + OperationType = optType, + DurationEventNO = GetDataSetValue(dt, i, 2) + }; if (string.IsNullOrWhiteSpace(model.DurationEventNO)) { model.DurationEventNO = null; @@ -455,11 +165,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service model.Blank2 = GetDataSetValue(dt, i, 4); var cacheValue = formatInfoTag(model); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } - List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); + List notes = base.GetReportNotes(ReportType, formatInfoTag(model), dataSource: SACReportNotesCache); var note = notes.LastOrDefault(); if (note == null && _operationType == OptFlagsEnum.A) { @@ -497,114 +207,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { model.BizID = note.BizId; } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - note.id = 0; - note.ExceId = model.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(model, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - return result; - } - - private List GetSwapEquityPaymentModelFromView() - { - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("互换交易权益端支付")) - { - var cacheKey = $"{BusiDataType}"; - DataTable dt = _viewDataSource.Tables["互换交易权益端支付"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - var optType = OptFlagsEnum.NONE; - switch (GetDataSetValue(dt, i, "OPERATIONTYPE")) - { - case "A": - optType = OptFlagsEnum.A; - break; - case "U": - optType = OptFlagsEnum.U; - break; - case "D": - optType = OptFlagsEnum.D; - break; - } - if (optType != _operationType) - { - continue; - } - - SwapEquityPaymentModel model = new SwapEquityPaymentModel(); - model.IgnoreCheck = true; - model.ConfirmationNo = GetDataSetValue(dt, i, "CONFIRMATIONNO"); - model.OperationType = optType; - model.DurationEventNO = GetDataSetValue(dt, i, "DURATIONEVENTNO"); - if (string.IsNullOrWhiteSpace(model.DurationEventNO)) - { - model.DurationEventNO = null; - } - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); - - var cacheValue = formatInfoTag(model); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); - var note = notes.LastOrDefault(); - if (note == null && _operationType == OptFlagsEnum.A) - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"DurationEventNO\":\"{model.DurationEventNO}\",\"Source\":\"KingstarView\"}}", - IsValid = true, - }; - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - } - - model.SwapEquityPaymentTuple = GetSwapEquityPaymentTupleFromView(model.ConfirmationNo); - - if (model.OperationType != OptFlagsEnum.A) - { - model.BizID = note.BizId; - } - model.ExceID = base.formatExceID(); - result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -632,30 +237,31 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service /// private List GetSwapEquityPaymentTuple(string confirmationNo) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("权益端支付明细")) { - DataTable dt = _excelDataSource.Tables["权益端支付明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["权益端支付明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != confirmationNo) + if (dt.Rows[i][0]?.ToString().Trim() != confirmationNo) { continue; } - SwapEquityPaymentTupleModel model = new SwapEquityPaymentTupleModel(); - - model.UndrlygAssetCode = GetDataSetValue(dt, i, 0); - model.PaymentMethod = ConsReport.PaymentMethodMap[GetDataSetValue(dt, i, 1)]; - model.Payer = ConsReport.PayerMap[GetDataSetValue(dt, i, 2)]; - model.PaymentFreq = ConsReport.PaymentFreqMap[GetDataSetValue(dt, i, 3)]; - model.OpenandClosingDate = GetDataSetValue(dt, i, 4); - model.UndrlygAssetDtldType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 5)]; + var model = new SwapEquityPaymentTupleModel + { + UndrlygAssetCode = GetDataSetValue(dt, i, 0), + PaymentMethod = ConsReport.PaymentMethodMap[GetDataSetValue(dt, i, 1)], + Payer = ConsReport.PayerMap[GetDataSetValue(dt, i, 2)], + PaymentFreq = ConsReport.PaymentFreqMap[GetDataSetValue(dt, i, 3)], + OpenandClosingDate = GetDataSetValue(dt, i, 4), + UndrlygAssetDtldType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 5)] + }; model.UndrlygAssetCode = GetDataSetValue(dt, i, 6); model.UndrlygAssetName = GetDataSetValue(dt, i, 7); model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 8); @@ -675,54 +281,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - /// - /// 获取权益端支付明细 - /// - /// - /// - private List GetSwapEquityPaymentTupleFromView(string confirmationNo) - { - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("权益端支付")) - { - DataTable dt = _viewDataSource.Tables["权益端支付"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - - if (GetDataSetValue(dt, i, "CONFIRMATIONNO") != confirmationNo) - { - continue; - } - - SwapEquityPaymentTupleModel model = new SwapEquityPaymentTupleModel(); - model.UndrlygAssetCode = GetDataSetValue(dt, i, "UNDRLYGASSETCODE"); - model.PaymentMethod = GetDataSetValue(dt, i, "PAYMENTMETHOD"); - model.Payer = GetDataSetValue(dt, i, "PAYER"); - model.PaymentFreq = GetDataSetValue(dt, i, "PAYMENTFREQ"); - model.OpenandClosingDate = GetDataSetValue(dt, i, "OPENANDCLOSINGDATE"); - model.UndrlygAssetDtldType = GetDataSetValue(dt, i, "UNDRLYGASSETDTLDTYPE"); - model.UndrlygAssetCode = GetDataSetValue(dt, i, "UNDRLYGASSETCODE"); - model.UndrlygAssetName = GetDataSetValue(dt, i, "UNDRLYGASSETNAME"); - model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, "UNDRLYGASSETTRADEPLC"); - model.UndrlygAssetPrice = GetDataSetValue(dt, i, "UNDRLYGASSETPRICE"); - model.UndrlygAssetPosition = GetDataSetValue(dt, i, "UNDRLYGASSETPOSITION"); - model.UndrlygAssetAmt = GetDataSetValue(dt, i, "UNDRLYGASSETAMT"); - model.ContractMultiplier = GetDataSetValue(dt, i, "CONTRACTMULTIPLIER"); - model.LNotinalPrincipleAmt = GetDataSetValue(dt, i, "LNOTINALPRINCIPLEAMT"); - model.SNotinalPrincipleAmt = GetDataSetValue(dt, i, "SNOTINALPRINCIPLEAMT"); - model.InterestRate = GetDataSetValue(dt, i, "INTERESTRATE"); - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); - - result.Add(model); - } - } - return result; - } - private string formatInfoTag(SwapEquityPaymentModel model, bool suffixType = false) { - string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_成交_权益端支付_{model.DurationEventNO}_"; + var result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_成交_权益端支付_{model.DurationEventNO}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -730,25 +291,41 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 6) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.SwapEquityPayment != null) { - CheckHelper helper = new CheckHelper(); - CheckHelper tupleHelper = new CheckHelper(); - for (int i = 0; i < model.SwapEquityPayment.Count; i++) + var helper = new CheckHelper(); + var tupleHelper = new CheckHelper(); + for (var i = 0; i < model.SwapEquityPayment.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.SwapEquityPayment[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (item.SwapEquityPaymentTuple != null) { - for (int j = 0; j < item.SwapEquityPaymentTuple.Count; j++) + for (var j = 0; j < item.SwapEquityPaymentTuple.Count; j++) { var listItem = new List(); var attItem = item.SwapEquityPaymentTuple[j]; @@ -758,16 +335,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (listItem.Count > 0) { - var temp = new SacInfo("SwapEquityPaymentTuple", j); - temp.SubMaps = new List(listItem); + var temp = new SacInfo("SwapEquityPaymentTuple", j) + { + SubMaps = new List(listItem) + }; listRoot.Add(temp); } } } if (listRoot.Count > 0) { - var errMsg = new SacInfo("SwapEquityPayment", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("SwapEquityPayment", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -791,7 +373,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapTerminationService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapTerminationService.cs index cb647262..61371ac3 100644 --- a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapTerminationService.cs +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportSwapTerminationService.cs @@ -1,13 +1,19 @@ -using System.Data; +using Microsoft.Office.Interop.Excel; +using NPOI.SS.UserModel; +using System.Data; +using System.Net; using System.Text.RegularExpressions; using YieldChain.Helpers; using YLErp.BLL; +using YLErp.Commons; +using YLErp.DBModels; using YLErp.DBModels.Consts; using YLErp.DBModels.Enums; +using YLErp.Models; using YLErp.Modules.EodModule; using YLErp.Modules.SuperviseReportModule.SAC.Common; using YLErp.Modules.SuperviseReportModule.SAC.Model; -using static alglib; +using static YLErp.ConsGlobal; using static YLErp.DBModels.Consts.ConsReport; namespace YLErp.Modules.SuperviseReportModule.SAC.Service @@ -24,55 +30,42 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1006; - private List _validOperationType = null; + private List? _validOperationType = null; public override List ValidOperationType { get { - if (_validOperationType == null) - { - _validOperationType = new List() { + _validOperationType ??= new List() { OptFlagsEnum.A, OptFlagsEnum.U, OptFlagsEnum.D, }; - } return _validOperationType; } } protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SwapDurationManagement; - List noteList = new List(); + + readonly List noteList = new(); + IEnumerable SACReportNotesCache = null; + IEnumerable SACReportNotesCache_confirmation = null; protected override BodyModel GenerateBody(out bool noData, out List fileList) { fileList = new List(); - BodyModel model = new BodyModel(); - List dataList = new List(); - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) + var model = new BodyModel(); + SACReportNotesCache = base.InitReportNotes(ReportType); + SACReportNotesCache_confirmation = base.InitReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation); + var dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) { - dataList = GetSwapDurationManagementModel(out fileList); + dataList = GetSwapDurationManagementModel(ref fileList); } - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System) - { - var cacheKey = $"{BusiDataType}"; - var nextDate = _reqInfo.ReportDate.AddDays(1); - using (var db = new YLContext()) - { - dataList.AddRange(GetOptionTerminationExtensionTimeFromDb(db, cacheKey, nextDate)); - - dataList.AddRange(GetOptionTerminationSettlementFromDb(db, cacheKey, nextDate)); - } - } - - if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.KingstarView) == SAC_ReportDataSourceEnum.KingstarView) - { - dataList.AddRange(GetSwapDurationManagementModelFromView(out fileList)); - } - var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); if (subsystemDataList != null && subsystemDataList.Count > 0) + { dataList.AddRange(subsystemDataList); + } noData = dataList.Count == 0; model.SwapDurationManagement = dataList; @@ -81,9 +74,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service public bool AddSubsystemNote(SwapDurationManagementModel model, List fileList, string tag) { - SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 - var isExtensionTime = model.DurationOperationType == ConsReport.OperationTypeMap["展期"]; - DateTime date = DateTime.MinValue; + SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true), dataSource: SACReportNotesCache).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + var isExtensionTime = model.DurationOperationType == ConsReport.SwapOperationTypeMap["展期"]; + var date = DateTime.MinValue; if (isExtensionTime) { DateTime.TryParse(model.RenewalDate, out date); @@ -96,8 +89,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { if (isExtensionTime) { - string oldDateStr = ""; - var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); + var oldDateStr = ""; + var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A", dataSource: SACReportNotesCache_confirmation).FirstOrDefault(); oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; if (DateTime.TryParse(oldDateStr, out var oldDate)) { @@ -128,8 +121,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service case OptFlagsEnum.U: if (isExtensionTime) { - string oldDateStr = ""; - var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); + var oldDateStr = ""; + var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A", dataSource: SACReportNotesCache_confirmation).FirstOrDefault(); oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; if (DateTime.TryParse(oldDateStr, out var oldDate)) { @@ -158,7 +151,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } var extensionTimeInfo = isExtensionTime ? "-" : ""; - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -176,436 +169,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return true; } - private List GetOptionTerminationExtensionTimeFromDb(YLContext db, string cacheKey, DateTime nextDate) - { - List dataList = new List(); - var extensionTimeList = (from et in db.ExtensionTime - join t in db.trade - on et.TradeId equals t.id - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - join ts in db.trade_swap - on t.id equals ts.TradeId - where - et.OptDate >= _reqInfo.ReportDate && - et.OptDate < nextDate && - t.TradeType == "收益互换" && - tr.IsValid - select new - { - et.id, - et.TradeId, - et.OldMaturityDate, - et.NewMaturityDate, - et.IsValid, - et.OptDate, - tr.ContractCode, - t.StockEqvNotional, - ts.GetMarginRate, - ts.PayMarginRate - }).ToArray(); - - List ids = extensionTimeList.Select(O => O.TradeId).ToList(); - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - foreach (var item in extensionTimeList) - { - var cacheValue = item.id.ToString(); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - if (metaDic.ContainsKey(item.TradeId)) - { - var metaInfo = metaDic[item.TradeId]; - if (metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) && TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - var info = new SwapDurationManagementModel(); - - //info.TradeId = item.TradeId.ToString(); - var tempDate = item.OptDate.GetValueOrDefault().Date; - var count = db.trade_cash.Where(O => O.TradeId == item.TradeId && O.ValueDate < tempDate && (O.Action == "系统操作-行权费" || O.Action == "系统操作-平仓费")).Select(O => O.ValueDate).ToHashSet().Count; - count += db.ExtensionTime.Where(O => O.TradeId == item.TradeId && O.OptDate < tempDate).Select(O => O.OptDate).ToArray().Select(O => O.GetValueOrDefault().Date).ToHashSet().Count; - info.DurationEventNO = count.ToString("0000"); - info.ConfirmationNo = item.ContractCode; - info.DurationOperationDate = item.OptDate?.ToString("yyyy-MM-dd"); - List notes = base.GetReportNotes(ReportType, $"_{info.ConfirmationNo.Replace("_", "-")}_", true); - var note = notes.FirstOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(info, extensionTimeInfo: item.id.ToString()))); - if (!item.IsValid) - {//当前信息是无效的,报送过就是废止,否则就不需要报 - if (note != null) - { - info.OperationType = OptFlagsEnum.D; - } - else - { - continue; - } - } - else - {//当前信息是有效的,报送过,就是修改,否则就是新增 - if (note == null) - { - info.OperationType = OptFlagsEnum.A; - } - else - { - if (!note.changeStatus) - { - continue; - } - info.OperationType = OptFlagsEnum.U; - } - } - if (info.OperationType != _operationType) - { - continue; - } - switch (info.OperationType) - { - case OptFlagsEnum.A: - note = new SACReportNotes() - { - IsValid = true, - }; - break; - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId; - } - var infoCache = JsonHelper.Deserialize>(note?.InfoCache) ?? new Dictionary(); - var oldMaturityDate = infoCache.TryGetValue("NewMaturityDate", out var date) ? DateTime.Parse(date) : item.OldMaturityDate; - var newMaturityDate = item.NewMaturityDate; - if (info.OperationType == OptFlagsEnum.D) - { - oldMaturityDate = infoCache.TryGetValue("OldMaturityDate", out date) ? DateTime.Parse(date) : item.OldMaturityDate; - newMaturityDate = infoCache.TryGetValue("NewMaturityDate", out date) ? DateTime.Parse(date) : item.NewMaturityDate; - } - else - { - if (newMaturityDate <= oldMaturityDate) - { - throw new ServiceException($"确认书编号:{item.ContractCode}\r\n新展期日:{newMaturityDate.ToString("yyyy-MM-dd")}\r\n原到期日:{oldMaturityDate.ToString("yyyy-MM-dd")}\r\n新展期日应大于原到期日"); - } - } - //info.ExpirationDate = item.OldMaturityDate.ToString("yyyy-MM-dd"); - info.DurationOperationType = OperationTypeMap["展期"]; - info.RenewalDate = newMaturityDate.ToString("yyyy-MM-dd"); - info.Balance = Math.Max(item.StockEqvNotional, 0).ToString("0.00"); - info.MarginRatio = ((item.GetMarginRate ?? item.PayMarginRate) * 100)?.ToString("0.00"); - info.ExceID = base.formatExceID(); - - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - dataList.Add(info); - note.id = 0; - note.ExceId = info.ExceID; - note.InfoCache = $"{{\"Tag\":\"{info.ConfirmationNo}\",\"OldMaturityDate\":\"{oldMaturityDate.ToString("yyyy-MM-dd")}\",\"NewMaturityDate\":\"{newMaturityDate.ToString("yyyy-MM-dd")}\",\"DurationEventNO\":\"{info.DurationEventNO}\",\"Source\":\"System\"}}"; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true, item.id.ToString()); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - return dataList; - } - - private List GetOptionTerminationSettlementFromDb(YLContext db, string cacheKey, DateTime nextDate) - { - List dataList = new List(); - var actions = new List() { "系统操作-平仓费", "系统操作-行权费"/*, "系统操作-互换"*/ }; - //当天有回退记录的资金记录 - var query = (from t in db.trade - join log in db.TradeAuditLog on t.id equals log.TradeId - join tc in db.trade_cash on t.id equals tc.TradeId - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - join ts in db.trade_swap - on t.id equals ts.TradeId - where log.OptDate >= _reqInfo.ReportDate && log.OptDate < nextDate && log.OptType == "交易回退" && - (actions.Contains(tc.Action) || (tc.Action == "系统操作-互换" && tc.ExerciseWay == "到期行权")) && /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType == "收益互换" && tr.IsValid - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - tc.ValueDate, - tc.Notional, - tc.UnwindNotional, - tc.Amount, - t.OriginalNotional, - tr.ContractCode, - t.QuoteCurrency, - t.SettlementCurrency, - ts.SwapType, - ts.IsPayFloatingProfit, - ts.GetLongShort, - ts.PayLongShort, - ts.GetMarginRate, - ts.PayMarginRate, - }).Union//当天有了结的资金记录 - (from t in db.trade - join tc in db.trade_cash - on t.id equals tc.TradeId - join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书") - on t.id equals tr.TradeId - join td in db.trade_contract_document - on tr.ContractCode equals td.Code - join ts in db.trade_swap - on t.id equals ts.TradeId - where tc.ValueDate == _reqInfo.DataDate && - t.ValidState != "InValid" && tc.ValidState != "InValid" && !tc.IsDeleted && tr.IsValid && - /*t.UnderlyingInstrumentType == "Stock" &&*/ t.TradeType == "收益互换" && - (actions.Contains(tc.Action) || (tc.Action == "系统操作-互换" && tc.ExerciseWay == "到期行权")) - select new - { - tcId = tc.id, - tc.OptDate, - tradeValid = t.ValidState != "InValid", - tradecashValid = tc.ValidState != "InValid" && !tc.IsDeleted, - tradeContractRValid = tr.IsValid, - t.id, - t.ClientId, - t.TradeDate, - t.ExerciseDate, - t.SettlementDate, - t.ExerciseMode, - t.BuySell, - TradeType = t.StructureType ?? t.TradeType, - t.OptionType, - t.OriginalStockEqvNotional, - t.StockEqvNotionalReal, - t.IsMoneynessOption, - t.SpotPrice, - t.Strike, - t.MarginTemplateName, - t.MarginType, - t.InitialMargin, - t.UnderlyingCode, - t.AnnualizeFactor, - tc.ValueDate, - tc.Notional, - tc.UnwindNotional, - tc.Amount, - t.OriginalNotional, - tr.ContractCode, - t.QuoteCurrency, - t.SettlementCurrency, - ts.SwapType, - ts.IsPayFloatingProfit, - ts.GetLongShort, - ts.PayLongShort, - ts.GetMarginRate, - ts.PayMarginRate, - }).ToArray().GroupBy(O => new { O.id, O.ValueDate }).ToDictionary(K => K.Key, V => V.ToList()); - List ids = query.Keys.Select(O => O.id).ToList(); - Dictionary> metaDic = DbContext.TradeMeta.Where(O => ids.Contains(O.TradeId)).AsEnumerable().GroupBy(O => O.TradeId).ToDictionary(K => K.Key, V => V.ToDictionary(K1 => K1.MetaKey, V1 => V1.MetaValue)); - foreach (var item in query.ToArray()) - { - var cacheValue = item.Key.id.ToString() + item.Key.ValueDate.ToString("_yyyy-MM-dd"); - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - if (metaDic.ContainsKey(item.Key.id)) - { - var metaInfo = metaDic[item.Key.id]; - if (metaInfo.ContainsKey(ConsTradeMetaKey.TradingPlace) && TradingPlaceMap[metaInfo[ConsTradeMetaKey.TradingPlace]] == "1")//跳过交易场所为报价系统的交易; - { - continue; - } - } - var info = new SwapDurationManagementModel(); - - //info.TradeId = item.Key.id.ToString(); - var validItem = item.Value.FirstOrDefault(O => O.tradecashValid); - var invalidItem = item.Value.FirstOrDefault(O => !O.tradecashValid); - var obj = invalidItem ?? validItem; - var tempDate = obj.ValueDate; - var tcQuery = db.trade_cash.Where(O => O.TradeId == obj.id && O.ValueDate < tempDate && actions.Contains(O.Action)); - var count = tcQuery.Select(O => O.ValueDate).ToHashSet().Count; - count += db.ExtensionTime.Where(O => O.TradeId == obj.id && O.OptDate < tempDate).Select(O => O.OptDate).ToArray().Select(O => O.GetValueOrDefault().Date).ToHashSet().Count; - info.DurationEventNO = count.ToString("0000"); - info.DurationOperationDate = obj.ValueDate.ToString("yyyy-MM-dd"); - info.ConfirmationNo = obj.ContractCode; - List notes = base.GetReportNotes(ReportType, $"_{info.ConfirmationNo.Replace("_", "-")}_", true); - var note = notes.FirstOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(info)) && O.InfoCache.Contains(info.DurationOperationDate)); - if (validItem == null && invalidItem != null) - {//有效资金记录不存在,无效资金记录存在时,当天报送过就是废止,否则就不需要报 - obj = invalidItem; - if (note != null) - { - info.OperationType = OptFlagsEnum.D; - } - else - { - continue; - } - } - else - {//有效资金记录存在时,当天报送过,就是修改,否则就是新增 - obj = validItem; - if (note == null) - { - info.OperationType = OptFlagsEnum.A; - } - else - { - if (!note.changeStatus) - { - continue; - } - info.OperationType = OptFlagsEnum.U; - } - } - if (info.OperationType != _operationType) - { - continue; - } - switch (info.OperationType) - { - case OptFlagsEnum.A: - note = new SACReportNotes() - { - IsValid = true, - }; - break; - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - } - if (info.OperationType != OptFlagsEnum.A) - { - info.BizID = note.BizId; - } - info.DurationOperationType = OperationTypeMap["终止"]; - if (obj.SwapType == "普通") - { - var longShort = obj.IsPayFloatingProfit ? obj.PayLongShort : obj.GetLongShort; - info.SwapType = ConsReport.SwapTypeMap["客户" + longShort]; - } - else - { - info.SwapType = ConsReport.SwapTypeMap[obj.SwapType]; - } - var quoteRate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(obj.QuoteCurrency, "CNY", obj.ValueDate); - var settlementRate = new EodCurrencyRateService(UserInfo).GetCurrencyRate(obj.SettlementCurrency, "CNY", obj.ValueDate); - var currentStockEqvNotional = Math.Round(Math.Min((obj.UnwindNotional / obj.OriginalNotional * obj.OriginalStockEqvNotional) ?? 0, obj.OriginalStockEqvNotional ?? 0) * quoteRate, 2); - var latestStockEqvNotional = Math.Round(Math.Min((obj.Notional / obj.OriginalNotional * obj.OriginalStockEqvNotional) ?? 0, obj.OriginalStockEqvNotional ?? 0) * quoteRate, 2); - var isComplete = Math.Abs(obj.Notional - (obj.UnwindNotional ?? 0)) < 1e-4; - if (isComplete) - { - var tcArr = tcQuery.Where(O => O.ValidState != "InValid" && O.IsDeleted == false).ToArray(); - var originalStockEqvNotional = obj.OriginalStockEqvNotional ?? 0; - currentStockEqvNotional = originalStockEqvNotional - tcArr.Sum(O => Math.Round(Math.Min((O.UnwindNotional / obj.OriginalNotional * originalStockEqvNotional) ?? 0, originalStockEqvNotional) * quoteRate, 2)); - latestStockEqvNotional = currentStockEqvNotional; - } - //info.TerminationAmount = currentStockEqvNotional.ToString("0.00"); - info.ChangeAmount = (-currentStockEqvNotional).ToString("0.00"); - info.Balance = Math.Max((latestStockEqvNotional - currentStockEqvNotional), 0).ToString("0.00"); - info.AmountPaidThisTime = (obj.Amount * settlementRate * -1).ToString(); - info.MarginRatio = ((obj.GetMarginRate ?? obj.PayMarginRate) * 100)?.ToString("0.00"); - if (double.TryParse(info.Balance, out var temp) && temp > 0) - { - var currentPosition = new CurrentPositionDetailModel(); - currentPosition.UndrlygAssetCode = obj.UnderlyingCode; - var codeInfo = DataCacheProvider.GetUnderlyingDataSource().GetData(obj.UnderlyingCode); - currentPosition.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(codeInfo.MarketName) ? "其他" : codeInfo.MarketName; - - if (SwapUndrlygAssetDtldTypeMap.TryGetValue(ConsGlobal.InstrumentType.GetDesc(codeInfo.UnderlyingInstrumentType), out var AssetDtldType)) - { - currentPosition.UndrlygAssetDtldType = AssetDtldType; - } - else - { - currentPosition.UndrlygAssetDtldType = UndrlygAssetDtldTypeMap["其他标的"]; - } - var notional = obj.Notional - (obj.UnwindNotional ?? 0); - currentPosition.UndrlygAssetName = codeInfo.UnderlyingName; - currentPosition.InvestorPosition = ConsReport.SwapTypeMap["客户" + (obj.IsPayFloatingProfit ? obj.PayLongShort : obj.GetLongShort)]; - currentPosition.UndrlygAssetAmt = (notional / codeInfo.CountRatio / codeInfo.ContractSize).ToString("0.000000"); - currentPosition.ContractMultiplier = codeInfo.ContractSize.ToString("0"); - currentPosition.UndrlygAssetPrice = (obj.SpotPrice * quoteRate)?.ToString("0.0000"); - currentPosition.NotinalPrincipleAmt = Math.Max((latestStockEqvNotional - currentStockEqvNotional), 0).ToString("0.0000"); - info.CurrentPositionDetails = new List() { currentPosition }; - } - info.ExceID = base.formatExceID(); - - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - ReportStatus.AddCacheInfo($"{cacheKey}_{info.ConfirmationNo}_{info.DurationEventNO}", currentStockEqvNotional.ToString("0.00")); - dataList.Add(info); - note.id = 0; - note.ExceId = info.ExceID; - note.InfoCache = $"{{\"Tag\":\"{info.ConfirmationNo}\",\"ValueDate\":\"{info.DurationOperationDate}\",\"DurationEventNO\":\"{info.DurationEventNO}\",\"Source\":\"System\"}}"; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(info, true); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - return dataList; - } - - private List GetSwapDurationManagementModel(out List fileList) + private List GetSwapDurationManagementModel(ref List fileList) { fileList = new List(); - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("互换交易存续期明细")) { - string sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); - var cacheKey = $"{BusiDataType}"; - DataTable dt = _excelDataSource.Tables["互换交易存续期明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var sourcePath = Path.Combine(_excelDataSourceRootPath, "附件"); + var dt = _excelDataSource.Tables["互换交易存续期明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { @@ -615,12 +187,18 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service var optType = OptFlagsEnum.NONE; switch (dt.Rows[i][1]?.ToString()) { + case "0": + case "A": case "首次": optType = OptFlagsEnum.A; break; + case "1": + case "U": case "变更": optType = OptFlagsEnum.U; break; + case "2": + case "D": case "废止": optType = OptFlagsEnum.D; break; @@ -630,27 +208,28 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service continue; } - SwapDurationManagementModel model = new SwapDurationManagementModel(); + var model = new SwapDurationManagementModel + { + ConfirmationNo = GetDataSetValue(dt, i, 0), + OperationType = optType, + SwapType = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 2)], + DurationEventNO = GetDataSetValue(dt, i, 3), + DurationOperationType = ConsReport.SwapOperationTypeMap[GetDataSetValue(dt, i, 4)], + DurationOperationDate = GetDataSetValue(dt, i, 5), + RenewalDate = GetDataSetValue(dt, i, 6), + DefaultingParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 7)], + DefaultEvent = GetDataSetValue(dt, i, 8), + ChangeAmount = GetDataSetValue(dt, i, 9), + Balance = GetDataSetValue(dt, i, 10), + AmountPaidThisTime = GetDataSetValue(dt, i, 11), + MarginRatio = GetDataSetValue(dt, i, 12), + SwapDurationManagementAtt = GetDataSetValue(dt, i, 13), + Blank1 = GetDataSetValue(dt, i, 14), + Blank2 = GetDataSetValue(dt, i, 15) + }; - model.ConfirmationNo = GetDataSetValue(dt, i, 0); - model.OperationType = optType; - model.SwapType = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 2)]; - model.DurationEventNO = GetDataSetValue(dt, i, 3); - model.DurationOperationType = ConsReport.OperationTypeMap[GetDataSetValue(dt, i, 4)]; - model.DurationOperationDate = GetDataSetValue(dt, i, 5); - model.RenewalDate = GetDataSetValue(dt, i, 6); - model.DefaultingParty = ConsReport.FillPartyMap[GetDataSetValue(dt, i, 7)]; - model.DefaultEvent = GetDataSetValue(dt, i, 8); - model.ChangeAmount = GetDataSetValue(dt, i, 9); - model.Balance = GetDataSetValue(dt, i, 10); - model.AmountPaidThisTime = GetDataSetValue(dt, i, 11); - model.MarginRatio = GetDataSetValue(dt, i, 12); - model.SwapDurationManagementAtt = GetDataSetValue(dt, i, 13); - model.Blank1 = GetDataSetValue(dt, i, 14); - model.Blank2 = GetDataSetValue(dt, i, 15); - - var isExtensionTime = model.DurationOperationType == ConsReport.OperationTypeMap["展期"]; - DateTime date = DateTime.MinValue; + var isExtensionTime = model.DurationOperationType == ConsReport.SwapOperationTypeMap["展期"]; + var date = DateTime.MinValue; if (isExtensionTime) { DateTime.TryParse(model.RenewalDate, out date); @@ -660,7 +239,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service DateTime.TryParse(model.DurationOperationDate, out date); } var cacheValue = $"{model.ConfirmationNo}_{model.DurationEventNO}_"; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) { continue; } @@ -674,15 +253,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service fileList.Add(path); } var extensionTimeInfo = isExtensionTime ? "-" : ""; - List notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_", true); + List notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_", true, SACReportNotesCache); //永远查找现有成功报送了结的新增记录,而不是修改; var note = notes.LastOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(model, extensionTimeInfo: extensionTimeInfo)) && O.InfoCache.Contains(date.ToString("yyyy-MM-dd"))); if (note == null && _operationType == OptFlagsEnum.A) { if (isExtensionTime) { - string oldDateStr = ""; - var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); + var oldDateStr = ""; + var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A", dataSource: SACReportNotesCache_confirmation).FirstOrDefault(); oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; if (DateTime.TryParse(oldDateStr, out var oldDate)) { @@ -732,167 +311,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service { model.BizID = note.BizId; } - model.ExceID = base.formatExceID(); + model.ExceID = base.formatExceID(SACReportNotesCache); result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); - note.id = 0; - note.ExceId = model.ExceID; - note.CreateTime = DateTime.Now; - note.FileTag = FileTag; - note.ReportType = ReportType; - note.ReportDate = _reqInfo.ReportDate; - note.InfoTag = formatInfoTag(model, true, extensionTimeInfo); - note.OptTime = note.CreateTime; - note.RetCode = ""; - note.RetMsg = ""; - note.ReportResponse = false; - note.BizId = ""; - note.DataId = ""; - note.changeStatus = false; - noteList.Add(note); - } - } - return result; - } - - private List GetSwapDurationManagementModelFromView(out List fileList) - { - fileList = new List(); - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("互换交易存续期管理")) - { - var ftpHelper = new FtpHelper(PS.Config.ErpElement.KingstarView_RemotePath, PS.Config.ErpElement.KingstarView_RemoteUser, PS.Config.ErpElement.KingstarView_RemotePassword, PS.Config.ErpElement.KingstarView_FtpUsePassive, 3000, PS.Config.ErpElement.KingstarView_EnableSsl); - var cacheKey = $"{BusiDataType}"; - DataTable dt = _viewDataSource.Tables["互换交易存续期管理"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - - var optType = OptFlagsEnum.NONE; - switch (GetDataSetValue(dt, i, "OPERATIONTYPE")) - { - case "A": - optType = OptFlagsEnum.A; - break; - case "U": - optType = OptFlagsEnum.U; - break; - case "D": - optType = OptFlagsEnum.D; - break; - } - if (optType != _operationType) - { - continue; - } - - SwapDurationManagementModel model = new SwapDurationManagementModel(); - model.IgnoreCheck = true; - model.ConfirmationNo = GetDataSetValue(dt, i, "CONFIRMATIONNO"); - model.OperationType = optType; - - model.DurationEventNO = GetDataSetValue(dt, i, "DURATIONEVENTNO"); - model.DurationOperationType = GetDataSetValue(dt, i, "DURATIONOPERATIONTYPE"); - model.DurationOperationDate = GetDataSetValue(dt, i, "DURATIONOPERATIONDATE"); - model.RenewalDate = GetDataSetValue(dt, i, "RENEWALDATE"); - model.DefaultingParty = GetDataSetValue(dt, i, "DEFAULTINGPARTY"); - model.DefaultEvent = GetDataSetValue(dt, i, "DEFAULTEVENT"); - model.ChangeAmount = GetDataSetValue(dt, i, "CHANGEAMOUNT"); - model.Balance = GetDataSetValue(dt, i, "BALANCE"); - model.AmountPaidThisTime = GetDataSetValue(dt, i, "AMOUNTPAIDTHISTIME"); - model.MarginRatio = GetDataSetValue(dt, i, "MARGINRATIO"); - model.SwapDurationManagementAtt = GetDataSetValue(dt, i, "SWAPDURATIONMANAGEMENTATT"); - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); - - var isExtensionTime = model.DurationOperationType == ConsReport.OperationTypeMap["展期"]; - DateTime date = DateTime.MinValue; - if (isExtensionTime) - { - DateTime.TryParse(model.RenewalDate, out date); - } - else - { - DateTime.TryParse(model.DurationOperationDate, out date); - } - var cacheValue = $"{model.ConfirmationNo}_{model.DurationEventNO}_"; - if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue)) - { - continue; - } - if (!string.IsNullOrWhiteSpace(model.SwapDurationManagementAtt)) - { - var downloadRet = ftpHelper.DownloadFile(CreateViewAttDownloadPath(model.SwapDurationManagementAtt), ViewLocalAttFileDir + @"\kingstar\", out string message); - LogFactory.GetLogger("ftpHelper.DownloadFile").Info($"下载结果:{ViewLocalAttFileDir},{model.SwapDurationManagementAtt},{downloadRet}"); - var path = downloadRet; - if (!ReportStatus.CheckFileLength(path)) - { - break; - } - fileList.Add(path); - model.SwapDurationManagementAtt = Path.GetFileName(path); - } - var extensionTimeInfo = isExtensionTime ? "-" : ""; - List notes = base.GetReportNotes(ReportType, $"_{model.ConfirmationNo.Replace("_", "-")}_", true); - //永远查找现有成功报送了结的新增记录,而不是修改; - var note = notes.LastOrDefault(O => O.IsValid && O.InfoTag.Contains(formatInfoTag(model, extensionTimeInfo: extensionTimeInfo)) && O.InfoCache.Contains(date.ToString("yyyy-MM-dd"))); - if (note == null && _operationType == OptFlagsEnum.A) - { - if (isExtensionTime) - { - string oldDateStr = ""; - var oldData = base.GetReportNotes(SuperviseReportTypeEnum.SAC_OptionConfirmation, $"A1005_{model.ConfirmationNo.Replace("_", "-")}_成交_A").FirstOrDefault(); - oldDateStr = Regex.Match(oldData?.InfoCache ?? "", "(?<=DueDate\":\")[^\"]+(?=\")").Value; - if (DateTime.TryParse(oldDateStr, out var oldDate)) - { - oldDateStr = $",\"OldMaturityDate\":\"{oldDate.ToString("yyyy-MM-dd")}\""; - } - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\"{oldDateStr},\"NewMaturityDate\":\"{date.ToString("yyyy-MM-dd")}\",\"DurationEventNO\":\"{model.DurationEventNO}\",\"Source\":\"KingstarView\"}}", - IsValid = true, - }; - } - else - { - note = new SACReportNotes() - { - InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"ValueDate\":\"{date.ToString("yyyy-MM-dd")}\",\"DurationEventNO\":\"{model.DurationEventNO}\",\"Source\":\"KingstarView\"}}", - IsValid = true, - }; - } - } - else - { - if (note == null) - { - continue; - } - switch (_operationType) - { - case OptFlagsEnum.A: - continue;//新增数据已报送,跳过 - case OptFlagsEnum.U: - note.IsValid = true; - break; - case OptFlagsEnum.D: - note.IsValid = false; - break; - case OptFlagsEnum.NONE: - default: - throw new ServiceException("未知操作类型"); - } - note.InfoCache = Regex.Replace(note.InfoCache, "(?<=NewMaturityDate\":\")[^\"]+ (?= \")", date.ToString("yyyy-MM-dd")); - } - - model.CurrentPositionDetails = GetCurrentPositionDetailsModelFromView(model.ConfirmationNo); - - if (model.OperationType != OptFlagsEnum.A) - { - model.BizID = note.BizId; - } - model.ExceID = base.formatExceID(); - result.Add(model); - ReportStatus.AddCacheInfo(cacheKey, cacheValue); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); note.id = 0; note.ExceId = model.ExceID; note.CreateTime = DateTime.Now; @@ -915,35 +336,36 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service private List GetCurrentPositionDetailsModel(string confirmationNo) { - List result = new List(); + var result = new List(); if (_excelDataSource != null && _excelDataSource.Tables.Contains("合约持仓明细")) { - DataTable dt = _excelDataSource.Tables["合约持仓明细"]; - for (int i = 1; i < dt.Rows.Count; i++) + var dt = _excelDataSource.Tables["合约持仓明细"]; + for (var i = 1; i < dt.Rows.Count; i++) { if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) { //第一列空白说明数据结束了; break; } - if (dt.Rows[i][0]?.ToString() != confirmationNo) + if (dt.Rows[i][0]?.ToString().Trim() != confirmationNo) { continue; } - CurrentPositionDetailModel model = new CurrentPositionDetailModel(); - - model.UndrlygAssetCode = GetDataSetValue(dt, i, 1); - model.UndrlygAssetDtldType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 2)]; - model.UndrlygAssetName = GetDataSetValue(dt, i, 3); - model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 4); - model.UndrlygAssetPrice = GetDataSetValue(dt, i, 5); - model.InvestorPosition = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 6)]; - model.UndrlygAssetAmt = GetDataSetValue(dt, i, 7); - model.ContractMultiplier = GetDataSetValue(dt, i, 8); - model.NotinalPrincipleAmt = GetDataSetValue(dt, i, 9); - model.Blank1 = GetDataSetValue(dt, i, 10); - model.Blank2 = GetDataSetValue(dt, i, 11); + var model = new CurrentPositionDetailModel + { + UndrlygAssetCode = GetDataSetValue(dt, i, 1), + UndrlygAssetDtldType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 2)], + UndrlygAssetName = GetDataSetValue(dt, i, 3), + UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 4), + UndrlygAssetPrice = GetDataSetValue(dt, i, 5), + InvestorPosition = ConsReport.SwapTypeMap[GetDataSetValue(dt, i, 6)], + UndrlygAssetAmt = GetDataSetValue(dt, i, 7), + ContractMultiplier = GetDataSetValue(dt, i, 8), + NotinalPrincipleAmt = GetDataSetValue(dt, i, 9), + Blank1 = GetDataSetValue(dt, i, 10), + Blank2 = GetDataSetValue(dt, i, 11) + }; result.Add(model); } @@ -951,42 +373,9 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } - private List GetCurrentPositionDetailsModelFromView(string confirmationNo) - { - List result = new List(); - if (_viewDataSource != null && _viewDataSource.Tables.Contains("合约持仓明细")) - { - DataTable dt = _viewDataSource.Tables["合约持仓明细"]; - for (int i = 0; i < dt.Rows.Count; i++) - { - if (GetDataSetValue(dt, i, "CONFIRMATIONNO") != confirmationNo) - { - continue; - } - - CurrentPositionDetailModel model = new CurrentPositionDetailModel(); - model.UndrlygAssetCode = GetDataSetValue(dt, i, "UNDRLYGASSETCODE"); - model.UndrlygAssetDtldType = GetDataSetValue(dt, i, "UNDRLYGASSETDTLDTYPE"); - model.UndrlygAssetName = GetDataSetValue(dt, i, "UNDRLYGASSETNAME"); - model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, "UNDRLYGASSETTRADEPLACE"); - model.UndrlygAssetPrice = GetDataSetValue(dt, i, "UNDRLYGASSETPRICE"); - model.InvestorPosition = GetDataSetValue(dt, i, "INVESTORPOSITION"); - model.UndrlygAssetAmt = GetDataSetValue(dt, i, "UNDRLYGASSETAMT"); - model.ContractMultiplier = GetDataSetValue(dt, i, "CONTRACTMULTIPLIER"); - model.NotinalPrincipleAmt = GetDataSetValue(dt, i, "NOTINALPRINCIPLEAMT"); - model.Blank1 = GetDataSetValue(dt, i, "BLANK1"); - model.Blank2 = GetDataSetValue(dt, i, "BLANK2"); - - result.Add(model); - } - } - return result; - } - - private string formatInfoTag(SwapDurationManagementModel model, bool suffixType = false, string extensionTimeInfo = "") { - string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_{(string.IsNullOrWhiteSpace(extensionTimeInfo) ? "了结" : ($"_{extensionTimeInfo}_展期"))}_{model.DurationEventNO}_"; + var result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_{(string.IsNullOrWhiteSpace(extensionTimeInfo) ? "了结" : $"_{extensionTimeInfo}_展期")}_{model.DurationEventNO}_"; if (suffixType) { result = $"{result}{_operationType}"; @@ -994,27 +383,43 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service return result; } + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 5 && arr.Length != 6) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) { - List result = new List(); + var result = new List(); if (model?.SwapDurationManagement != null) { - CheckHelper helper = new CheckHelper(); - CheckHelper positionhelper = new CheckHelper(); - for (int i = 0; i < model.SwapDurationManagement.Count; i++) + var helper = new CheckHelper(); + var positionhelper = new CheckHelper(); + for (var i = 0; i < model.SwapDurationManagement.Count; i++) { - List listRoot = new List(); + var listRoot = new List(); var item = model.SwapDurationManagement[i]; - if (item.IgnoreCheck) continue; + if (item.IgnoreCheck) + { + continue; + } + helper.ExecuteCheck(item, (name, value, msg) => { listRoot.Add(new SacInfo(name, value, msg)); }); if (item.CurrentPositionDetails != null) { - for (int j = 0; j < item.CurrentPositionDetails.Count; j++) + for (var j = 0; j < item.CurrentPositionDetails.Count; j++) { - List attList = new List(); + var attList = new List(); var attItem = item.CurrentPositionDetails[j]; positionhelper.ExecuteCheck(attItem, (name, value, msg) => { @@ -1022,8 +427,10 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }); if (attList.Count > 0) { - var temp = new SacInfo("CurrentPositionDetails", j); - temp.SubMaps = new List(attList); + var temp = new SacInfo("CurrentPositionDetails", j) + { + SubMaps = new List(attList) + }; listRoot.Add(temp); } @@ -1031,8 +438,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service } if (listRoot.Count > 0) { - var errMsg = new SacInfo("SwapDurationManagement", i); - errMsg.SubMaps = new List(listRoot); + var errMsg = new SacInfo("SwapDurationManagement", i) + { + FieldValue = item.ConfirmationNo, + SubMaps = new List(listRoot) + }; result.Add(errMsg); } } @@ -1056,7 +466,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service }; } - for (int i = 0; i < noteList.Count; i++) + for (var i = 0; i < noteList.Count; i++) { base.SaveReportNotes(noteList[i]); } diff --git a/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportValuationInformationService.cs b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportValuationInformationService.cs new file mode 100644 index 00000000..298fff9a --- /dev/null +++ b/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportValuationInformationService.cs @@ -0,0 +1,484 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static YLErp.DBModels.Consts.ConsReport; +using YLErp.BLL; +using YLErp.DBModels.Consts; +using YLErp.DBModels.Enums; +using YLErp.DBModels; +using YLErp.Modules.SuperviseReportModule.SAC.Common; +using YLErp.Modules.SuperviseReportModule.SAC.Model; +using System.Data; +using System.IO; +using static iTextSharp.text.pdf.AcroFields; +using YLErp.DBModels.Helpers; +using YLErp.Modules.EodModule; +using System.Collections.ObjectModel; +using YLErp.Helpers; +using YLErp.Modules.PricingModule.Models; +using YLErp.Modules.CalculationModule; +using YLErp.BLL.Calculation; +using YLErp.Enums; +using YLErp.Modules.DataProviderModule; +using YLErp.QdpModule; +using Qdp.Pricing.Base.Utilities; +using YLErp.Enums; +using YLErp.Configuration; +using Qdp.Foundation.Implementations; +using YLErp.Modules.VolatilityModule; +using MoreLinq; + +namespace YLErp.Modules.SuperviseReportModule.SAC.Service +{ + class ReportValuationInformationService : ReportBaseService + { + public ReportValuationInformationService(OptUserInfo optUser) : base(optUser) + { + } + + protected override string _excelDataSourcePath => "交易相关\\"; + + protected override string _excelDataSourceFileName => "import_ValuationInformation_template.xlsx"; + + protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1018; + + private List _validOperationType = null; + public override List ValidOperationType + { + get + { + if (_validOperationType == null) + { + _validOperationType = new List() { + OptFlagsEnum.A, + OptFlagsEnum.U, + OptFlagsEnum.D, + }; + } + return _validOperationType; + } + } + + protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ValuationInformation; + List noteList = new List(); + + protected override BodyModel GenerateBody(out bool noData, out List fileList) + { + fileList = new List(); + BodyModel model = new BodyModel(); + List dataList = new List(); + if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template)) + { + dataList = GetValuationInformationModelFromExcel(ref fileList); + } + ReadOnlyCollection useDel = null; + if (_operationType == OptFlagsEnum.D && (useDel = ReportStatus.GetCacheInfo($"{DataFlagsEnum.A1018}_D")).Count > 0) + { + dataList.AddRange(GetValuationInformationModelFromCache(useDel)); + } + var subsystemDataList = loadSubsystemDataSource(fileList, AddSubsystemNote); + if (subsystemDataList != null && subsystemDataList.Count > 0) + dataList.AddRange(subsystemDataList); + + noData = dataList.Count == 0; + model.ValuationInformation = dataList; + return model; + } + + private List GetValuationInformationModelFromCache(IEnumerable useDel) + { + List result = new List(); + foreach (var item in useDel) + { + var notes = base.GetReportNotes(formatInfoTag(item)); + foreach (var note in notes) + { + var info = new ValuationInformationModel(); + var reportCacheDic = JsonHelper.ToObject>(note.InfoCache) ?? new Dictionary(); + info.ValuationDate = reportCacheDic.ContainsKey("ValuationDate") ? reportCacheDic["ValuationDate"] : ""; + if (info.ValuationDate.IsNullOrWhiteSpace()) + { + continue; + } + info.ConfirmationNo = item; + var cacheValue = $"{info.ConfirmationNo}_{info.ValuationDate}"; + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) + { + continue; + } + info.BizID = note.BizId; + info.OperationType = OptFlagsEnum.D; + info.Balance = "0.00"; + info.MarginRatio = "0.00"; + info.OptionValuation = "0.00"; + info.Delta = "0.00"; + info.Gamma = "0.00"; + info.Vega = "0.00"; + info.Theta = "0.00"; + info.Rho = "0.00"; + info.RhoQ = "0.00"; + info.DeltaCash = "0.00"; + info.GammaCash = "0.00"; + info.VegaCash = "0.00"; + info.ThetaCash = "0.00"; + info.RhoCash = "0.00"; + info.RhoQCash = "0.00"; + info.Blank1 = "0.00"; + info.Blank2 = "0.00"; + + var exceId_TY = $"{info.ConfirmationNo}_{info.ValuationDate}"; + info.ExceID = base.formatExceID(); + result.Add(info); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); + note.id = 0; + note.InfoCache = $"{{\"Tag\":\"{info.ConfirmationNo}\",\"ValuationDate\":\"{info.ValuationDate}\",\"ExceId_TY\":\"{exceId_TY}\"}}"; + note.ExceId = info.ExceID; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = formatInfoTag(info, true); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.DataId = ""; + note.changeStatus = false; + noteList.Add(note); + } + } + return result; + } + + public bool AddSubsystemNote(ValuationInformationModel model, List fileList, string tag) + { + SACReportNotes note = base.GetReportNotes(ReportType, formatInfoTag(model, true)).FirstOrDefault();//参数true要加,要不A和D会查到同一条记录,在D时候,就会和A相同的数据 + if (note == null) + { + note = new SACReportNotes() + { + InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Subsystem\",\"SubFileTag\":\"{tag}\",\"ExceID\":\"{model.ExceID}\"}}", + IsValid = true, + }; + } + else + { + switch (model.OperationType) + { + case OptFlagsEnum.A: + return false;//新增数据已报送,跳过 + case OptFlagsEnum.U: + //多次U的时候,每次用最新的tag来赋值SubFileTag + note.InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"Source\":\"Subsystem\",\"SubFileTag\":\"{tag}\",\"ExceID\":\"{model.ExceID}\"}}"; + note.IsValid = true; + break; + case OptFlagsEnum.D: + note.IsValid = false; + break; + case OptFlagsEnum.NONE: + default: + throw new ServiceException("未知操作类型"); + } + } + + model.ExceID = base.formatExceID(); + note.id = 0; + note.ExceId = model.ExceID; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = formatInfoTag(model, true); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.changeStatus = false; + noteList.Add(note); + return true; + } + + private List GetValuationInformationModelFromExcel(ref List fileList) + { + List result = new List(); + if (_excelDataSource != null && _excelDataSource.Tables.Contains("每日估值信息")) + { + DataTable dt = _excelDataSource.Tables["每日估值信息"]; + for (int i = 1; i < dt.Rows.Count; i++) + { + if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString())) + { + //第一列空白说明数据结束了; + break; + } + var optType = OptFlagsEnum.NONE; + switch (dt.Rows[i][1]?.ToString()) + { + case "0": + case "A": + case "首次": + optType = OptFlagsEnum.A; + break; + case "1": + case "U": + case "变更": + optType = OptFlagsEnum.U; + break; + case "2": + case "D": + case "废止": + optType = OptFlagsEnum.D; + break; + } + if (optType != _operationType) + { + continue; + } + + ValuationInformationModel model = new ValuationInformationModel(); + + model.ConfirmationNo = GetDataSetValue(dt, i, 0); + model.OperationType = _operationType; + DateTime.TryParse(GetDataSetValue(dt, i, 2), out DateTime date); + model.ValuationDate = date == DateTime.MinValue ? null : date.ToString("yyyy-MM-dd"); + var cacheValue = $"{model.ConfirmationNo}_{model.ValuationDate}"; + if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue)) + { + continue; + } + + List notes = base.GetReportNotes(ReportType, formatInfoTag(model)); + var note = notes.LastOrDefault(O => O.InfoCache.Contains(model.ConfirmationNo)); + if (note == null && _operationType == OptFlagsEnum.A) + { + note = new SACReportNotes() + { + InfoCache = $"{{\"Tag\":\"{model.ConfirmationNo}\",\"ValuationDate\":\"{model.ValuationDate}\",\"Source\":\"Template\"}}", + IsValid = true, + }; + } + else + { + if (note == null) + { + continue; + } + switch (_operationType) + { + case OptFlagsEnum.A: + continue;//新增数据已报送,跳过 + case OptFlagsEnum.U: + note.IsValid = true; + break; + case OptFlagsEnum.D: + note.IsValid = false; + break; + case OptFlagsEnum.NONE: + default: + throw new ServiceException("未知操作类型"); + } + } + + if (_operationType != OptFlagsEnum.A) + { + model.BizID = note.BizId; + } + model.Balance = GetDataSetValueToDoubleOrNull(dt, i, 3)?.ToString("0.00"); + model.MarginRatio = GetDataSetValue(dt, i, 4); + model.OptionValuation = GetDataSetValueToDoubleOrNull(dt, i, 5)?.ToString("0.00"); + model.Delta = GetDataSetValue(dt, i, 6); + model.Gamma = GetDataSetValue(dt, i, 7); + model.Vega = GetDataSetValue(dt, i, 8); + model.Theta = GetDataSetValue(dt, i, 9); + model.Rho = GetDataSetValue(dt, i, 10); + model.RhoQ = GetDataSetValue(dt, i, 11); + model.DeltaCash = GetDataSetValue(dt, i, 12); + model.GammaCash = GetDataSetValue(dt, i, 13); + model.VegaCash = GetDataSetValue(dt, i, 14); + model.ThetaCash = GetDataSetValue(dt, i, 15); + model.RhoCash = GetDataSetValue(dt, i, 16); + model.RhoQCash = GetDataSetValue(dt, i, 17); + model.Blank1 = GetDataSetValue(dt, i, 18); ; + model.Blank2 = GetDataSetValue(dt, i, 19); + + model.ExceID = base.formatExceID(); + result.Add(model); + ReportStatus.AddCacheInfo(CacheKey, cacheValue); + note.id = 0; + note.ExceId = model.ExceID; + note.CreateTime = DateTime.Now; + note.FileTag = FileTag; + note.ReportType = ReportType; + note.ReportDate = _reqInfo.ReportDate; + note.InfoTag = formatInfoTag(model, true); + note.OptTime = note.CreateTime; + note.RetCode = ""; + note.RetMsg = ""; + note.ReportResponse = false; + note.BizId = ""; + note.DataId = ""; + note.changeStatus = false; + noteList.Add(note); + } + } + return result; + } + + private string formatInfoTag(ValuationInformationModel model, bool suffixType = false) + { + string result = $"{BusiDataType}_{model.ConfirmationNo.Replace("_", "-")}_{model.ValuationDate}_"; + if (suffixType) + { + result = $"{result}{_operationType}"; + } + return result; + } + + private string formatInfoTag(string confirmationNo) + { + string result = $"{BusiDataType}_{confirmationNo.Replace("_", "-")}_"; + return result; + } + + protected override string _changeCodeOfInfoTag(string infoTag, string newCode, out string originalCode) + { + var arr = infoTag.Split('_'); + if (arr.Length != 4) + { + throw new ServiceException($"InfoTag信息不匹配:{infoTag}"); + } + originalCode = arr[1]; + arr[1] = newCode.Replace("_", "-"); + return string.Join("_", arr); + } + + protected override List CheckBodyValue(BodyModel model, out bool checkStatus) + { + List result = new List(); + if (model?.ValuationInformation != null) + { + CheckHelper helper = new CheckHelper(); + for (int i = 0; i < model.ValuationInformation.Count; i++) + { + List listRoot = new List(); + var item = model.ValuationInformation[i]; + helper.ExecuteCheck(item, (name, value, msg) => + { + listRoot.Add(new SacInfo(name, value, msg)); + }); + if (listRoot.Count > 0) + { + var errMsg = new SacInfo("ValuationInformation", i); + errMsg.FieldValue = item.ConfirmationNo; + errMsg.SubMaps = new List(listRoot); + result.Add(errMsg); + } + } + } + checkStatus = result.Count > 0; + return result; + } + + public override bool BeforeOfGenerated(out string errMsg) + { + errMsg = ""; + for (int i = 0; i < noteList.Count; i++) + { + base.SaveReportNotes(noteList[i]); + } + return true; + } + + private enum clacTargetEnum + { + /// + /// 波动率变动 + /// + vol, + /// + /// 无风险利率变动 + /// + r, + /// + /// 分红率变动 + /// + q + } + + /// + /// 计算参数 + /// + private class calcParam + { + /// + /// 计算指标 + /// + public clacTargetEnum Target { get; set; } + /// + /// 交易列表 + /// + public IEnumerable TradeList { get; set; } + /// + /// 估值日期 + /// + public DateTime Date { get; set; } + /// + /// 偏移值 + /// 每次只变动一个参数,所以只需要一个 + /// + public double Offset { get; set; } + /// + /// 波动率变动 + /// + public Dictionary UpVolForTrade { get; set; } + /// + /// 无风险利率或分红率变动 + /// + public Action UpParamOverride { get; set; } + /// + /// 波动率变动 + /// + public Dictionary DownVolForTrade { get; set; } + /// + /// 无风险利率或分红率变动 + /// + public Action DownParamOverride { get; set; } + /// + /// PV差 + /// + public Dictionary PvDiff { get; set; } + + /// + /// + /// + /// + /// + /// + /// + public calcParam( + clacTargetEnum target, + IEnumerable tradeList, + DateTime date, + double offset, + Dictionary upVolForTrade, + Dictionary downVolForTrade, + Action upParamOverride, + Action downParamOverride) + { + this.Target = target; + this.TradeList = tradeList; + this.Date = date; + this.Offset = offset; + this.UpVolForTrade = upVolForTrade; + this.DownVolForTrade = downVolForTrade; + this.UpParamOverride = upParamOverride; + this.DownParamOverride = downParamOverride; + } + } + } +} + diff --git a/YLErpWeb/App_Data/FunctionRight.xml b/YLErpWeb/App_Data/FunctionRight.xml index d73456b4..61c05dfc 100644 --- a/YLErpWeb/App_Data/FunctionRight.xml +++ b/YLErpWeb/App_Data/FunctionRight.xml @@ -73,6 +73,9 @@ + + + diff --git a/YLErpWeb/App_Data/Menus.txt b/YLErpWeb/App_Data/Menus.txt index 20ed8103..8dec75aa 100644 --- a/YLErpWeb/App_Data/Menus.txt +++ b/YLErpWeb/App_Data/Menus.txt @@ -27,6 +27,11 @@ {Name:"每日估值报告",Rights:["结算管理-每日估值报告"],Url:"clientbalance/TradeMarketReport"}, ] }, +{Name:"监管报告",Rights:["监管报告"],Icon:"menu-icon iconteleven" +,SubItems:[ + {Name:"证券业报送",Rights:["监管报告-证券业报送"],Url:"supervise_report/supervise_sac_report"} + ] +}, {Name:"客户管理",Rights:["客户管理"],Icon:"menu-icon iconeight" ,SubItems:[ {Name:"开户管理",Rights:["客户管理-开户管理"],Url:"AccountOpeningProcess/clientList"}, diff --git a/YLErpWeb/App_Docs/导入模板/Report.zip b/YLErpWeb/App_Docs/导入模板/Report.zip index d18bedbe..e65164eb 100644 Binary files a/YLErpWeb/App_Docs/导入模板/Report.zip and b/YLErpWeb/App_Docs/导入模板/Report.zip differ diff --git a/YLErpWeb/Controllers/supervise_reportController.cs b/YLErpWeb/Controllers/supervise_reportController.cs index 6177bdd7..56eef48b 100644 --- a/YLErpWeb/Controllers/supervise_reportController.cs +++ b/YLErpWeb/Controllers/supervise_reportController.cs @@ -945,28 +945,34 @@ namespace YLErp.Web.Controllers public JsonResult superviseSACReportQuery(ReportInfo req) { - LogFactory.GetLogger("superviseSACReportQuery").Info($"1"); if (PS.Config.ErpElement.SecuritiesEnvironment) { try { - LogFactory.GetLogger("superviseSACReportQuery").Info($"2"); List filePath = new ReportService(CurUser).Execute(req); - LogFactory.GetLogger("superviseSACReportQuery").Info($"3"); return Json(Return.Success(filePath.Select(O => O.FileTag))); } catch (ServiceException ex) { - LogFactory.GetLogger("superviseSACReportQuery").Info($"4"); - if (ex.Tag is List objs) + var errFilePath = ""; + if (ex.Tag != null && ex.Tag is ExceptionExtensionInfo) { - LogFactory.GetLogger("superviseSACReportQuery").Info($"6"); - string key = Guid.NewGuid().ToString(); - Server.CacheProvider.Set(key, objs, DateTime.Now.AddMinutes(1)); - ex.Tag = key; - LogFactory.GetLogger("superviseSACReportQuery").Info($"7"); + var obj = (ExceptionExtensionInfo)ex.Tag; + + if (obj.Tag.Count > 0) + { + string key = Guid.NewGuid().ToString(); + + Server.CacheProvider.Set(key, obj.Tag, DateTime.Now.AddMinutes(1)); + ex.Tag = key; + } + errFilePath = obj.ErrFilePath; + + } + if (ex.Tag != null) + { + Server.CacheProvider.Set($"File_{ex.Tag}", errFilePath, DateTime.Now.AddMinutes(1)); } - LogFactory.GetLogger("superviseSACReportQuery").Info($"5"); return Json(Return.Fail(ex.Message, ex.Tag)); } catch (Exception ex) @@ -1003,7 +1009,9 @@ namespace YLErp.Web.Controllers public ActionResult superviseErrorInfo(string key) { var sacInfoList = Server.CacheProvider.Get(key) as List; + var path = Server.CacheProvider.Get($"File_{key}") as string; ViewBag.ShowMessage = true; + ViewBag.DownloadPath = path; return View("supervisePreview", sacInfoList); } @@ -1112,6 +1120,7 @@ namespace YLErp.Web.Controllers } [MyAuthorize("监管报告-证券业报送")] + [DisableRequestSizeLimit] public JsonResult UploadSACReportFile(string fileType, DateTime date) { LogFactory.GetLogger("UploadEventReportFile").Info("开始上传:"); @@ -1151,7 +1160,8 @@ namespace YLErp.Web.Controllers Directory.CreateDirectory(absPath); } var name = $"{date.ToString("yyyyMMdd")}{file.FileName}"; - file.SaveAs(Path.Combine(absPath, name)); + var fileName = Path.Combine(absPath, name); + file.SaveAs(fileName); fileInfos.Add(new tempfile() { createDate = date, @@ -1163,7 +1173,7 @@ namespace YLErp.Web.Controllers validStatus = true }); LogFactory.GetLogger("UploadEventReportFile").Info($"文件 {i + 1} 保存成功"); - var fileLength = new FileInfo(Path.Combine(absPath, name)).Length; + var fileLength = new FileInfo(fileName).Length; if (fileType == "报送模板" && Path.GetExtension(name).ToLower() == ".zip") { LogFactory.GetLogger("UploadEventReportFile").Info($"处理报送模板"); @@ -1171,15 +1181,14 @@ namespace YLErp.Web.Controllers { return Json(Return.Fail("上传失败,单次上传模板文件大小不应超过200MB")); } - var path = Path.Combine(absPath, name); - var pathName = Path.GetFileNameWithoutExtension(path); + var pathName = Path.GetFileNameWithoutExtension(fileName); var temp = Path.Combine(absPath, pathName); if (Directory.Exists(temp)) { Directory.Delete(temp, true); } LogFactory.GetLogger("UploadEventReportFile").Info($"解压"); - var outPath = ZipHelper.unZipFile(path, absPath, out string msg); + var outPath = ZipHelper.unZipFile(fileName, absPath, out string msg); if (msg.StartsWith("解压成功")) { LogFactory.GetLogger("UploadEventReportFile").Info($"成功"); @@ -1253,6 +1262,44 @@ namespace YLErp.Web.Controllers return Json(Return.Fail("上传失败")); } + [MyAuthorize("监管报告-证券业报送")] + public JsonResult UploadFile(string fileType) + { + LogFactory.GetLogger("UploadFile").Info("开始上传修改编号附件"); + try + { + var service = new TempFilesService(CurUser); + LogFactory.GetLogger("UploadFile").Info("文件数量:" + Request.Form.Files.Count); + for (var i = 0; i < Request.Form.Files.Count; i++) + { + var file = Request.Form.Files[i]; + if (fileType == "修改编号") + { + using var inputStream = file.OpenReadStream(); + ReportService.EditContractNumber(inputStream); + } + string filePath = $"/App_Docs/Download/Report/{UserId}/{fileType}/{DateTime.Now.ToString("yyyyMMdd")}/"; + string absPath = Server.MapPath(filePath); + LogFactory.GetLogger("UploadFile").Info("保存地址:" + absPath); + if (!Directory.Exists(absPath)) + { + Directory.CreateDirectory(absPath); + } + var name = $"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}{file.FileName}"; + var fileName = Path.Combine(absPath, name); + file.SaveAs(fileName); + LogFactory.GetLogger("UploadFile").Info($"文件 {i + 1} 保存成功:{fileName}"); + } + LogFactory.GetLogger("UploadFile").Info($"入库完成;处理完成;"); + return Json(Return.Success("修改成功")); + } + catch (Exception ex) + { + LogFactory.GetLogger("UploadFile").Error(ex); + return Json(Return.Fail("修改失败" + ex.Message)); + } + } + public JsonResult QueryEventReportFile(BaseSearchReq req) { if (string.IsNullOrWhiteSpace(req.sidx)) @@ -1342,7 +1389,7 @@ namespace YLErp.Web.Controllers var sourcePath = Server.MapPath("~/App_Docs"); var sourceFileName = Path.Combine(sourcePath, "导出模板", service.TemplateName); var targetPath = Path.Combine(sourcePath, req.ValueDate.ToString("yyyyMMdd")); - + if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); @@ -1381,5 +1428,34 @@ namespace YLErp.Web.Controllers { return double.TryParse(str, out var v) ? v : null; } + + public ActionResult ExportDetailsV2(string encryptId, string fileTag) + { + var id = DecryptInt(encryptId); + var path = $"~/App_Docs/Download/Report/Output/{CurUser.UserId}/{fileTag}报送文件{DateTime.Now:yyyyMMddHHmmss}.zip"; + var absPath = OtcAppContext.MapPath(path); + new ReportService(CurUser).ExportDetailsV2(id, fileTag, path); + return File(System.IO.File.ReadAllBytes(absPath), "application/zip", Path.GetFileName(path)); + } + + /// + /// 是否上传过模板 + /// + /// + public JsonResult IsUploadFile(DateTime ReportDate) + { + var tempFilesService = new TempFilesService(CurUser); + + var path = tempFilesService.QueryTempFile(ReportDate, "报送模板").Select(O => O.filePath).FirstOrDefault(); + + return Json(!string.IsNullOrWhiteSpace(path)); + } + + public ActionResult DownloadReportFile(string path) + { + var result = OtcAppContext.MapPath(path); + var bytes = System.IO.File.ReadAllBytes(result); + return File(bytes, "application/zip", $"报送文件{DateTime.Now:yyyyMMddHHmmss}.zip"); + } } } \ No newline at end of file diff --git a/YLErpWeb/Views/supervise_report/supervise_SAC_Report.cshtml b/YLErpWeb/Views/supervise_report/supervise_SAC_Report.cshtml index b056f120..01e9d0e7 100644 --- a/YLErpWeb/Views/supervise_report/supervise_SAC_Report.cshtml +++ b/YLErpWeb/Views/supervise_report/supervise_SAC_Report.cshtml @@ -1,7 +1,6 @@ - -@{ +@{ ViewBag.Title = "证券业监管报告"; - ViewBag.Menu = "监管报告-证券业报告"; + ViewBag.Menu = "监管报告-证券业报送"; Layout = "~/Views/Shared/_MainLayout.cshtml"; var valueDate = ViewBag.valueDate; var dataSourceMode = PS.Config.ErpElement.SAC_ReportDataSource; @@ -23,8 +22,9 @@ const page = { sysdate: '@valueDate', maxRequestLength: @maxRequestLength, + dataSourceMode: @((int)PS.Config.ErpElement.SAC_ReportDataSource), g_grid: {}, - uploadColumns :[ + uploadColumns: [ { name: 'id', label: 'id', index: 'id', align: 'center', hidden: true }, { @@ -56,7 +56,7 @@ return html; } }], - reportList :[ + reportList: [ { name: 'id', label: 'id', index: 'id', align: 'center', hidden: true }, { @@ -86,9 +86,9 @@ var html = ""; switch (cellValue) { case 0: - html = "" + html = "" .template(cellValue, "确认发送"); - html += "" + html += "" .template(cellValue, "删除"); break; case 1: @@ -121,10 +121,11 @@ ReportDescOption: [], ReportDescSwap: [] }, - isZhongjin : '@(PS.Config.Company == CompanyEnum.中金 )' == 'True' + isZhongjin : false } $(function () { + $("#editCode").hide(); initPage(); }); @@ -182,6 +183,13 @@ a[readonly] i { color: darkgrey; } + + .my-skin .layui-layer-btn a { + background-color: red; + border: 1px solid red; + color: #fff; + } + @@ -193,14 +201,11 @@ 报送说明
+ @MyControls.Btn("修改编号", "Upload('修改编号','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','/App_Docs/导入模板/修改约定编号导入模板.xlsx')", id: "editCode") @MyControls.Btn("手工上传", "Upload('报送模板','application/zip','/App_Docs/导入模板/Report.zip')") @MyControls.Btn("附加信息", "showWindow($('#extendInfo'),'收益计算说明',saveReportDesc)") @MyControls.Btn("查看附件", "jqGridInit('查看附件')") @MyControls.Btn("生成报告", "generateReportFile()") - @if (PS.Config.Company == CompanyEnum.中金) - { - @MyControls.Btn("批量导出", "showModal()") - } @MyControls.Btn("查看/发送", "jqGridInit('查看/发送报告')")
@@ -218,21 +223,6 @@ 接收方代码 - @if ((dataSourceMode & ConsReport.SAC_ReportDataSourceEnum.System) == ConsReport.SAC_ReportDataSourceEnum.System) - { - - - - } @Html.MyAceDropdownInput2("sacReport", "SAC报告月份", monthList, false) @Html.MyAceDropdownInput2("nafmiiReport", "NAFMII报告月份", monthList, false) @Html.MyAceDropdownInput2("isdaReport", "ISDA报告月份", monthList, false) @@ -241,9 +231,9 @@ @*
- 撤销重大事项报告报送日 - -
*@ + 撤销重大事项报告报送日 + + *@
重大事项说明 @@ -253,9 +243,9 @@
@*
- 撤销其他事项报送日 - -
*@ + 撤销其他事项报送日 + + *@
其他事项说明 @@ -269,14 +259,14 @@
@await Html.PartialAsync("/Views/Common/_importFiles.cshtml", new ImportFileModel() +{ + Accept = "application/pdf", + Buttons = new Dictionary() { - Accept = "application/pdf", - Buttons = new Dictionary() - { - ["上传"] = new BtnReq() { OnClick = "uploadOuterData()" }, - }, - NotesHtml = "" - }) + ["上传"] = new BtnReq() { OnClick = "uploadOuterData()" }, + }, + NotesHtml = "" +}) + diff --git a/YLErpWeb/wwwroot/Scripts/app/superviseReport/sacReport.js b/YLErpWeb/wwwroot/Scripts/app/superviseReport/sacReport.js index 850753c0..90c5079d 100644 --- a/YLErpWeb/wwwroot/Scripts/app/superviseReport/sacReport.js +++ b/YLErpWeb/wwwroot/Scripts/app/superviseReport/sacReport.js @@ -1,7 +1,7 @@ function initPage() { initTree(); $("#notes").append('
' + $("#periodicReportQuarter").parent().html().replace(/periodicReportQuarter/g, 'fileDate') + '
'); - $("#notes").append('
注意:重大事项,其他事项和季度报告的相关文件不包含在模板文件中,请到相应功能点上传.
单个文件不应超过30MB,周期内有效文件总大小,不应超过200MB,若超过限制,请考虑分批报送或精简文件
'); + $("#notes").append('
注意:
'); $("#buttons").prepend('下载模板') //$("#LastMonthCash,#LatestMonthCash,#LatestNetAssets").parent().hide(); //$("#sacReport").parent().hide(); @@ -75,7 +75,7 @@ function exportDetails(id, fileTag) { window.open("/supervise_report/exportDetailsForZhongJin?encryptId=" + id + "&fileTag=" + fileTag); } else { - window.open("/supervise_report/exportDetails?encryptId=" + id + "&fileTag=" + fileTag); + window.open("/supervise_report/ExportDetailsV2?encryptId=" + id + "&fileTag=" + fileTag); } } @@ -83,14 +83,17 @@ function exportDetails(id, fileTag) { function showDetails(id) { var width = "1260px"; var url = "/supervise_report/QueryDetails?encryptId=" + id; + var itemIndex = 0; var colModel = [ { name: 'FileTag', label: '报告标识', index: 'FileTag', width: 340, align: 'left', sortable: false, formatter: (cellValue, options, rowObject) => { var html = ""; if (cellValue.startsWith("{")) { + cellValue = cellValue.replace(/\s/g, ""); var obj = JSON.parse(cellValue); - html = "" + obj.Tag; + html = "【{0}】{1}".template((++itemIndex), obj.Tag); } else { + itemIndex = 0; html = cellValue; } return html; @@ -208,8 +211,6 @@ function DownLoadDoc(res) { window.open(res); } - - function SendReportFile(res) { var opt = { url: "/supervise_report/SendReport", @@ -236,7 +237,7 @@ function testSql() { data: { sqlStr: $("#testsql").val() }, success: function (res) { if (res.Success) { - + main.message(res.Msg); } else { @@ -471,6 +472,7 @@ function initTree() { { id: "confirmation", ckId: "input_confirmation", name: "交易确认书", open: true, children: [ { id: "optionConfirmation", ckId: "input_optionConfirmation", tag: 5, pId: "confirmation", name: "期权交易确认书" }, + { id: "optionConfirmationAtt", ckId: "input_optionConfirmationAtt", tag: 19, pId: "confirmation", name: "场外期权交易确认书附件" }, { id: "swapConfirmation", ckId: "input_swapConfirmation", tag: 6, pId: "confirmation", name: "互换交易确认书" }, { id: "confirmationAtt", ckId: "input_confirmationAtt", tag: 17, pId: "confirmation", name: "互换交易确认书附件" }, ] @@ -482,6 +484,7 @@ function initTree() { { id: "swapTermination", ckId: "input_swapTermination", tag: 8, pId: "termination", name: "互换交易存续期管理" }, ] }, + { id: "valuationInformation", ckId: "input_valuationInformation", tag: 18, name: "场外期权合约估值信息" }, { id: "periodicReport", ckId: "input_periodicReport", name: "定期报告", open: true, children: [ { @@ -538,7 +541,7 @@ function initTree() { $(".bottom_open").addClass("bottom_docu").removeClass("bottom_open"); $(".root_open").addClass("root_docu").removeClass("root_open"); var notes = zTree.getNodes()[0].children - var selectNotes = ["主协议", "主协议关联产品列表", "补充协议", "履约保证书", "交易确认书", "交易存续期管理", "权益端支付"]; + var selectNotes = ["主协议", "主协议关联产品列表", "补充协议", "履约保证书", "交易确认书", "交易存续期管理", "权益端支付", "场外期权合约估值信息"]; _.forEach(notes, (v) => { if ($.inArray(v.name, selectNotes) >= 0) { onClick(null, v, null); @@ -562,7 +565,29 @@ function queryReportInfo() { }); } +//生成报告 function generateReportFile() { + //历史正常逻辑 + if (isExist(getReportType()) && page.dataSourceMode != 2) { + //判断是否手工上传过文件 + $.get("/supervise_report/IsUploadFile?ReportDate=" + $("#DateValueDate").val()).done(function (res) { + if (res && typeof (res) === 'boolean') { + layer.open({ + type: 1, + title: '生成报告', + content: $('#reportTpl').html(), + area: ["350px", "350px"] + }); + } else { + GenerateReport(false); + } + }); + } else { + GenerateReport(false); + } +} + +function GenerateReport(isUploaded) { var postData = { ReportDate: $("#DateValueDate").val(), DataDate: $("#DateDataDate").val(), @@ -572,6 +597,7 @@ function generateReportFile() { LatestMonthCash: $("#LatestMonthCash").val(), LatestNetAssets: $("#LatestNetAssets").val(), ReportTypes: getReportType(), + DataSource: isUploaded ? 2 : page.dataSourceMode }; postData.SACReportDate = $("#sacReport").val(); switch ($("input[name='input_periodicReportSAC']:checked").attr('id')) { @@ -666,7 +692,7 @@ function generateReportFile() { title: "请选择报送方式", shadeClose: false, shade: 0.4, - area: ['300px'], + area: ['366px'], content: html, }); } @@ -691,14 +717,21 @@ function Upload(fileType, accept, templateFile) { $("#modalFileUpload #uploadType").text(fileType) $("#fileDate").val($("#DateValueDate").val()) $("#fileDate").parent().hide(); - $("#tip").hide(); - if (fileType == "季度报告") { - $("#fileDate option:eq(1)").prop('selected', 'selected'); - $("#fileDate").parent().show(); - } else if (fileType == "报送模板") { - $("#tip").show(); + var tip = "单个文件不应超过30MB,周期内有效文件总大小,不应超过200MB,若超过限制,请考虑分批报送或精简文件"; + switch (fileType) { + case "报送模板": + tip = "重大事项,其他事项和季度报告的相关文件不包含在模板文件中,请到相应功能点上传.
" + tip; + break; + case "修改编号": + tip = "修改编号功能仅适用于双方约定编号或产品名的修改,该功能仅修改镒链系统内数据,修改后须另外以补正的方式将修改后的数据报送给协会;
修改数据可能需要废止相关报告,请遵循协会要求,废止成功后再操作."; + break; + case "季度报告": + $("#fileDate option:eq(1)").prop('selected', 'selected'); + $("#fileDate").parent().show(); + break; } + $("#tip").html(tip); if (accept) { $("#uploadfile").prop("accept", accept); } @@ -720,11 +753,17 @@ function uploadOuterData() { main.alert("请选择要上传的文件!"); return; } - var date = '0001-01-01'; - if ($("#fileDate").val()) { - date = $("#fileDate").val(); - } + var url = ""; var fileType = $("#modalFileUpload #uploadType").text(); + if (fileType == "修改编号") { + url = "/supervise_report/UploadFile?fileType=" + fileType; + } else { + var date = '0001-01-01'; + if ($("#fileDate").val()) { + date = $("#fileDate").val(); + } + url = "/supervise_report/UploadSACReportFile?fileType=" + fileType + "&date=" + date; + } var fd = new FormData(); var useSend = true; _.forEach($("#uploadfile")[0].files, (f, i) => { @@ -740,7 +779,7 @@ function uploadOuterData() { return; } main.ajax({ - url: "/supervise_report/UploadSACReportFile?fileType=" + fileType + "&date=" + date, + url: url, type: "POST", processData: false, contentType: false, @@ -799,4 +838,29 @@ function showHtml(title, url, width) { width = '1250px'; } main.open(title, url, { area: [width, '800px'] }); +} + +function generateReportFromFile() { + var val = $('#generateReport option:selected').val(); + if (val == "0") { + GenerateReport(false); + } else { + GenerateReport(true); + } +} +//用jquery写一个方法,判断传入的数组中是否存在0~8和16~19范围的数字 +function isExist(arr) { + var arr = arr; + var arr2 = []; + for (var i = 0; i < arr.length; i++) { + //只有日报和SAC月报才需要展示数据源选项 + if (arr[i] >= 0 && arr[i] <= 9 || arr[i] >= 16 && arr[i] <= 19) { + arr2.push(arr[i]); + } + } + if (arr2.length > 0) { + return true; + } else { + return false; + } } \ No newline at end of file diff --git a/YLerpbase.sln b/YLerpbase.sln index a9b1bc83..5962b956 100644 --- a/YLerpbase.sln +++ b/YLerpbase.sln @@ -92,6 +92,7 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {B454A6FB-CF27-4B00-AEDC-BA1F0ED2F6D1} = {15F732CE-6C51-48F0-BC50-3BEC018460E5} + {5981434D-792E-4528-AFC8-7EB8AFD9F80C} = {15F732CE-6C51-48F0-BC50-3BEC018460E5} {C7E0F300-16D5-438B-97A2-79DC2311D1D5} = {F315B5D3-F4FE-43E5-AF22-AF92978A71BE} {FEDA115A-88ED-42FE-A5FF-0AAE229DC4CF} = {F315B5D3-F4FE-43E5-AF22-AF92978A71BE} {206EBAE4-AB3E-4F09-9428-DDC3E64CFC42} = {F315B5D3-F4FE-43E5-AF22-AF92978A71BE}