326 lines
12 KiB
C#
326 lines
12 KiB
C#
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;
|
|
using YLErp.Modules.SuperviseReportModule.SAC.Common;
|
|
using static YLErp.DBModels.Consts.ConsReport;
|
|
|
|
namespace YLErp.Modules.SuperviseReportModule.SAC.Model
|
|
{
|
|
[XmlRoot(ElementName = "Root", IsNullable = false)]
|
|
public class ReportRootModel
|
|
{
|
|
/// <summary>
|
|
/// 报头
|
|
/// </summary>
|
|
[SacDescription("Header", "报头", "", false, "")]
|
|
public HeaderModel Header { get; set; }
|
|
/// <summary>
|
|
/// 报文内容
|
|
/// </summary>
|
|
[SacDescription("Body", "报文内容", "", false, "")]
|
|
public BodyModel Body { get; set; }
|
|
/// <summary>
|
|
/// 文件名
|
|
/// </summary>
|
|
[XmlIgnore]
|
|
[DefaultValue("")]
|
|
[SacDescription("FileTag", "文件名", "", false, "")]
|
|
public string FileTag
|
|
{
|
|
get
|
|
{
|
|
return Header == null
|
|
? ""
|
|
: $"OTC_{Header.SenderCode}_{Header.ReceiverCode}_{Header.SendDate.Replace("-", "")}_{Header.FileNumber}_{Header.BusiDataType}_{Header.OperationType}";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件
|
|
/// </summary>
|
|
[XmlIgnore]
|
|
[SacDescription("Annex", "附件", "", false, "")]
|
|
public List<string> Annex { get; set; }
|
|
|
|
private string _xmlStr;
|
|
/// <summary>
|
|
/// Xml
|
|
/// </summary>
|
|
[XmlIgnore]
|
|
[DefaultValue("")]
|
|
[SacDescription("XmlStr", "Xml", "", false, "")]
|
|
public string XmlStr
|
|
{
|
|
get { return _xmlStr; }
|
|
set { _xmlStr = check(value); }
|
|
}
|
|
|
|
private string check(string xml)
|
|
{
|
|
var result = xml;
|
|
switch (this.Header.BusiDataType)
|
|
{
|
|
case DataFlagsEnum.A1016:
|
|
try
|
|
{
|
|
var doc = new System.Xml.XmlDocument();
|
|
doc.LoadXml(xml);
|
|
var body = doc.GetElementsByTagName("SwapEquityPayment");
|
|
if (body.Count > 0)
|
|
{
|
|
foreach (XmlElement item in body)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
|
catch (Exception ex)
|
|
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
|
{
|
|
}
|
|
break;
|
|
case DataFlagsEnum.A1004:
|
|
if (result.Contains("<PerformanceCollTuple />"))
|
|
{
|
|
result = result.Replace("<PerformanceCollTuple />", "");
|
|
}
|
|
break;
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 请求/应答报文Header模型
|
|
/// </summary>
|
|
public class HeaderModel
|
|
{
|
|
/// <summary>
|
|
/// 版本号
|
|
/// <para>长度:3</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:</para>
|
|
/// </summary>
|
|
[SacDescription("Version", "版本号", "3", true, "")]
|
|
public string Version
|
|
{
|
|
get => "001";
|
|
set { }
|
|
}
|
|
/// <summary>
|
|
/// 文件创建人代码
|
|
/// <para>长度:6</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:报告库分配</para>
|
|
/// </summary>
|
|
[CheckStringLength(Length = 6)]
|
|
[DefaultValue("")]
|
|
[SacDescription("SenderCode", "文件创建人代码", "6", true, "报告库分配;")]
|
|
public string SenderCode { get; set; }
|
|
/// <summary>
|
|
/// 文件接收人代码
|
|
/// <para>长度:6</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:报告库分配</para>
|
|
/// </summary>
|
|
[CheckStringLength(Length = 6)]
|
|
[DefaultValue("")]
|
|
[SacDescription("ReceiverCode", "文件接收人代码", "6", true, "报告库分配;")]
|
|
public string ReceiverCode { get; set; }
|
|
/// <summary>
|
|
/// 报告类型代码
|
|
/// <para>长度:3</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:衍生品业务填写:YSP</para>
|
|
/// </summary>
|
|
[XmlIgnore]
|
|
[SacDescription("ReportType", "报告类型代码", "3", true, "衍生品业务填写:YSP;")]
|
|
public string ReportType { get => "YSP"; }
|
|
/// <summary>
|
|
/// 文件发送日期
|
|
/// <para>长度:10</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:校验规则:必须是yyyy-MM-dd</para>
|
|
/// </summary>
|
|
[CheckStringMaxLength(MaxLength = 10, Required = false)]
|
|
[CheckStringIsDateTimeFormat]
|
|
[DefaultValue("")]
|
|
[SacDescription("SendDate", "文件发送日期", "10", true, "校验规则:必须是yyyy-MM-dd;")]
|
|
public string SendDate { get; set; }
|
|
/// <summary>
|
|
/// 文件序号
|
|
/// <para>长度:4</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:0001~9999</para>
|
|
/// </summary>
|
|
[CheckStringLength(Length = 4)]
|
|
[DefaultValue("")]
|
|
[SacDescription("FileNumber", "文件序号", "4", true, "0001~9999;")]
|
|
public string FileNumber { get; set; }
|
|
/// <summary>
|
|
/// 接口标识
|
|
/// <para>长度:5</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:<see cref="DataFlagsEnum"/></para>
|
|
/// </summary>
|
|
[CheckStringInMap(Map = new[] { "A1001", "A1002","A1003","A1004", "A1005", "A1006" ,"A1007",
|
|
"A1008", "A1009","A1010", "A1011", "A1012","A1013","A1014","A1015","A1016","A1017","A1018","A1019" })]
|
|
[SacDescription("BusiDataType", "接口标识", "5", true, "")]
|
|
public DataFlagsEnum BusiDataType { get; set; }
|
|
/// <summary>
|
|
/// 操作标识
|
|
/// <para>长度:1</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:<see cref="OptFlagsEnum"/></para>
|
|
/// </summary>
|
|
[CheckStringInMap(Map = new[] { "A", "U", "D" })]
|
|
[DefaultValue("")]
|
|
[SacDescription("OperationType", "操作标识", "1", true, "")]
|
|
public string OperationType { get; set; }
|
|
/// <summary>
|
|
/// 响应码
|
|
/// <para>长度:6</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.RetCodeMap"/>报送时该字段应为Null</para>
|
|
/// </summary>
|
|
[XmlElement(IsNullable = false)]
|
|
[DefaultValue("")]
|
|
[SacDescription("RetCode", "响应码", "6", true, "报送时该字段应为Null;")]
|
|
public string RetCode { get; set; }
|
|
/// <summary>
|
|
/// 响应描述
|
|
/// <para>长度:1000</para>
|
|
/// <para>必填:是</para>
|
|
/// <para>说明:报送时该字段应为Null</para>
|
|
/// </summary>
|
|
[XmlElement(IsNullable = false)]
|
|
[DefaultValue("")]
|
|
[SacDescription("RetMsg", "响应描述", "1000", true, "报送时该字段应为Null;")]
|
|
public string RetMsg { get; set; }
|
|
}
|
|
|
|
public class BodyModel
|
|
{
|
|
/// <summary>
|
|
/// 主协议信息
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("MasterAgrmt", "主协议信息", "", false, "")]
|
|
public List<MasterAgrmtModel> MasterAgrmt { get; set; }
|
|
/// <summary>
|
|
/// 主协议关联产品列表
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("MasterAgrmtProduct", "主协议关联产品列表", "", false, "")]
|
|
public List<MasterAgrmtProductModel> MasterAgrmtProduct { get; set; }
|
|
/// <summary>
|
|
/// 补充协议列表
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("SupAgrmt", "补充协议列表", "", false, "")]
|
|
public List<SupAgrmtModel> SupAgrmt { get; set; }
|
|
/// <summary>
|
|
/// 履约担保协议
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("PerformanceGuaranteeAgrmt", "履约担保协议", "", false, "")]
|
|
public List<PerformanceGuaranteeAgrmtModel> PerformanceGuaranteeAgrmt { get; set; }
|
|
/// <summary>
|
|
/// 期权交易确认书列表
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("OptionConfirmation", "期权交易确认书列表", "", false, "")]
|
|
public List<OptionConfirmationModel> OptionConfirmation { get; set; }
|
|
/// <summary>
|
|
/// 互换交易确认书列表
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("SwapConfirmation", "互换交易确认书列表", "", false, "")]
|
|
public List<SwapConfirmationModel> SwapConfirmation { get; set; }
|
|
/// <summary>
|
|
/// 收益互换交易权益端支付
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("SwapEquityPayment", "收益互换交易权益端支付", "", false, "")]
|
|
public List<SwapEquityPaymentModel> SwapEquityPayment { get; set; }
|
|
/// <summary>
|
|
/// 交易确认书附件
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("ConfirmationAtt", "交易确认书附件", "", false, "")]
|
|
public List<ConfirmationAttModel> ConfirmationAtt { get; set; }
|
|
/// <summary>
|
|
/// 期权交易存续期管理
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("OptionTermination", "期权交易存续期管理", "", false, "")]
|
|
public List<OptionTerminationModel> OptionTermination { get; set; }
|
|
/// <summary>
|
|
/// 收益互换交易存续期管理
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("SwapDurationManagement", "收益互换交易存续期管理", "", false, "")]
|
|
public List<SwapDurationManagementModel> SwapDurationManagement { get; set; }
|
|
/// <summary>
|
|
/// 场外期权合约估值信息
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("ValuationInformation", "场外期权合约估值信息", "", false, "")]
|
|
public List<ValuationInformationModel> ValuationInformation { get; set; }
|
|
/// <summary>
|
|
/// 定期报告-SAC模板
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("PeriodicReportSAC", "SAC定期报告", "", false, "")]
|
|
public PeriodicReportSACModel PeriodicReportSAC { get; set; }
|
|
/// <summary>
|
|
/// 定期报告-NAFMII模板
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("PeriodicReportNAFMII", "NAFMII定期报告", "", false, "")]
|
|
public PeriodicReportNAFMIIModel PeriodicReportNAFMII { get; set; }
|
|
/// <summary>
|
|
/// 定期报告-ISDA模板
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("PeriodicReportISDA", "ISDA定期报告", "", false, "")]
|
|
public PeriodicReportISDAModel PeriodicReportISDA { get; set; }
|
|
/// <summary>
|
|
/// 重大事项报告
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("EventReport", "重大事项报告", "", false, "")]
|
|
public EventReportModel EventReport { get; set; }
|
|
/// <summary>
|
|
/// 其他事项报告
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("OtherReport", "其他事项报告", "", false, "")]
|
|
public OtherReportModel OtherReport { get; set; }
|
|
/// <summary>
|
|
/// 季度报告/半年报
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("PeriodicReportQuarter", "季度报告/半年报", "", false, "")]
|
|
public PeriodicReportQuarterModel PeriodicReportQuarter { get; set; }
|
|
/// <summary>
|
|
/// 双方约定编号数据处理
|
|
/// </summary>
|
|
[XmlElement]
|
|
[SacDescription("ContractNumberProcess", "双方约定编号数据处理", "", false, "")]
|
|
public ContractNumberProcessModel ContractNumberProcess { get; set; }
|
|
}
|
|
}
|