找回证券业报送的逻辑,仅支持Excel模板报送

This commit is contained in:
嬴政 时
2025-05-14 20:00:04 +08:00
parent 0c9cd64038
commit fe2ff3bbcf
52 changed files with 10829 additions and 7124 deletions
File diff suppressed because it is too large Load Diff
@@ -95,5 +95,15 @@
/// </summary>
[Description("互换交易确认书附件")]
SAC_ConfirmationAtt = 17,
/// <summary>
/// 场外期权估值
/// </summary>
[Description("场外期权估值")]
SAC_ValuationInformation = 18,
/// <summary>
/// 场外期权交易确认书附件
/// </summary>
[Description("场外期权交易确认书附件")]
SAC_OptionConfirmationAtt = 19,
}
}
+1 -1
View File
@@ -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");
@@ -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<string> msgArr = new List<string>();
var msgArr = new List<string>();
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<string> msgArr = new List<string>();
var msgArr = new List<string>();
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<string> msgArr = new List<string>();
var msgArr = new List<string>();
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<object> objs = value as IEnumerable<object>;
var state = false;
var objs = value as IEnumerable<object>;
//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;
}
}
/// <summary>
@@ -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
/// 检查帮助类
/// </summary>
/// <typeparam name="T"></typeparam>
public class CheckHelper<T>
public class CheckHelper<T> where T:notnull
{
private PropertyInfo[] _properties = null;
private readonly PropertyInfo[]? _properties = null;
/// <summary>
/// 属性缓存
/// <para>应通过<see cref="CheckHelper{T}.getPropertyInfos(T)"/>方法访问</para>
/// </summary>
private Dictionary<T, Dictionary<string, object>> _propertyInfoDict = null;
private Dictionary<T, Dictionary<string, object>>? _propertyInfoDict = null;
/// <summary>
/// 检查不通过时回调的委托
/// </summary>
@@ -1101,10 +1102,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common
private Dictionary<string, object> getPropertyInfos(T obj)
{
if (_propertyInfoDict == null)
{
_propertyInfoDict = new Dictionary<T, Dictionary<string, object>>();
}
_propertyInfoDict ??= new Dictionary<T, Dictionary<string, object>>();
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<BaseCheckConditionAttribute> conditionAttributes, Dictionary<string, object> 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<string[], bool> callback)
{
bool state = true;
IEnumerable<BaseCheckConditionAttribute> conditionAttrs = pInfo.GetCustomAttributes(typeof(BaseCheckConditionAttribute), true).Cast<BaseCheckConditionAttribute>();
var state = true;
var conditionAttrs = pInfo.GetCustomAttributes(typeof(BaseCheckConditionAttribute), true).Cast<BaseCheckConditionAttribute>();
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<string, object> 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
/// <returns></returns>
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<BaseCheckAttribute>().ToArray();
var attr = p.GetCustomAttributes(typeof(BaseCheckAttribute), true).Cast<BaseCheckAttribute>().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;
File diff suppressed because it is too large Load Diff
@@ -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<SacMap> 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 "";
}
}
/// <summary>
@@ -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<SacInfo> Tag { get; set; }
public string ErrFilePath { get; set; }
}
}
@@ -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
{
/// <summary>
/// 交易确认书附件
/// </summary>
[Table("A1019_ConfirmationAtt")]
public class ConfirmationAttModel : ReportBaseModel
{
/// <summary>
/// 交易确认书编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")]
public string ConfirmationNo { get; set; }
/// <summary>
/// 操作标识
/// <para>长度:1</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OptFlagsEnum"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("OperationType", "操作标识", "1", true, "")]
public OptFlagsEnum OperationType { get; set; }
/// <summary>
/// 交易确认书附件
/// <para>长度:1</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OptFlagsEnum"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("ConfirmationAtt", "交易确认书附件", "1", true, "说明:校验规则:只支持PDF格式")]
public string ConfirmationAtt { get; set; }
/// <summary>
/// 交易确认书附件
/// <para>长度:1</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OptFlagsEnum"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("ConfirmationFiles", "交易确认书附件", "1", true, "说明:校验规则:只支持PDF格式")]
public string ConfirmationFiles { get; set; }
/// <summary>
/// 交易确认书附件
/// <para>长度:</para>
/// <para>必填:是</para>
/// <para>说明:多附件;</para>
/// </summary>
[CheckIEnumerableTMinCount(MinCount = 1)]
[XmlElement]
[NotMapped]
[SacDescription("ConfirmationFilesTuple", "交易确认书附件", "", true, "多附件;")]
public List<ConfirmationFilesTupleModel> ConfirmationFilesTuple { get; set; }
}
public class ConfirmationFilesTupleModel
{
/// <summary>
/// 是否为收益互换
/// </summary>
//[CheckStringInMap(Map = new[] { "true", "false" })]
[XmlIgnore]
public string IsSwap { get; set; }
/// <summary>
/// 场外期权交易确认书附件
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:只支持PDF格式</para>
/// </summary>
[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; }
/// <summary>
/// 收益互换交易确认书附件
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:只支持PDF格式</para>
/// </summary>
[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; }
}
}
@@ -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
/// <summary>
/// 主协议
/// </summary>
[Table("A1001_MasterAgrmt")]
public class MasterAgrmtModel : ReportBaseModel
{
/// <summary>
@@ -44,7 +46,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "双方约定;")]
public string MasterAgrmtNo { get; set; }
/// <summary>
/// 签时间
/// 签时间
/// <para>长度:10</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:必须是yyyy-MM-dd</para>
@@ -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; }
/// <summary>
/// 主协议版本
@@ -75,28 +77,28 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("FillParty", "填报方角色", "2", true, "")]
public string FillParty { get; set; }
/// <summary>
/// 交易对手方名称
/// 交易对手方名称(全称)
/// <para>长度:200</para>
/// <para>必填:是</para>
/// <para>说明:</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 200)]
[DefaultValue("")]
[SacDescription("NameOfCounterparty", "交易对手方名称", "200", true, "")]
[SacDescription("NameOfCounterparty", "交易对手方名称(全称)", "200", true, "")]
public string NameOfCounterparty { get; set; }
/// <summary>
/// 统一社会信用代码
/// <para>长度:18</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>说明:校验规则:字段长度18位;当交易对手方类型是除了境外金融机构、境外非金融机构外的机构时,必填 </para>
/// </summary>
[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; }
/// <summary>
/// 交易对手编码
@@ -112,13 +114,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// LEI码
/// <para>长度:20</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:当交易对手方类型是境外金融机构、境外非金融机构外的机构时,必填 </para>
/// <para>说明:校验规则:当交易对手方类型是境外金融机构、境外非金融机构时,必填 </para>
/// </summary>
[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; }
/// <summary>
/// 交易对手类别
@@ -144,14 +146,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 非金融机构行业代码
/// <para>长度:20</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:交易对手方类型非金融机构时必填;参照国家统计局发布的《国民经济行业分类》</para>
/// <para>说明:校验规则:当“交易对手方类型”选择境内非金融机构时必填;参照国家统计局发布的《国民经济行业分类》</para>
/// </summary>
[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; }
/// <summary>
/// 交易对手方注册资本(万元)
@@ -161,7 +163,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("CounterpartyRegdCptl", "交易对手方注册资本(万元)", "36,2", false, "校验规则:保留两位小数;")]
[SacDescription("CounterpartyRegdCptl", "交易对手方注册资本(万元)", "36,2", false, "校验规则:必须两位小数以内")]
public string CounterpartyRegdCptl { get; set; }
/// <summary>
/// 主协议备注
@@ -201,6 +203,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[CheckIEnumerableTMinCount(MinCount = 1)]
[XmlElement]
[NotMapped]
[SacDescription("CounterpartyInformationTuple", "填报方业务代表明细", "", false, "")]
public List<CounterpartyInfomationModel> CounterpartyInformationTuple { get; set; }
}
@@ -208,8 +211,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 填报方业务代表明细
/// </summary>
public class CounterpartyInfomationModel
[Table("A1001_CounterpartyInfomation")]
public class CounterpartyInfomationModel : ReportSubBaseModel
{
/// <summary>
/// 主协议编号
/// <para>长度:200</para>
/// <para>必填:是</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
public string MasterAgrmtNo { get; set; }
/// <summary>
/// 填报方业务代表姓名
/// <para>长度:200</para>
@@ -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
/// <summary>
/// 主协议关联产品
/// </summary>
[Table("A1002_MasterAgrmtProduct")]
public class MasterAgrmtProductModel : ReportBaseModel
{
/// <summary>
@@ -52,11 +54,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 产品名称
/// <para>长度:100</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>
/// 说明:校验规则:
/// 1 主协议交易对手方身份为产品管理人时必填;
/// 2 主协议交易对手方身份为自营禁止填值;
/// 2 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
/// <summary>
/// 交易对手码(产品)
/// <para>长度:20</para>
/// <para>必填:</para>
/// <para>说明:应当符合标准规范</para>
/// <para>必填:</para>
/// <para>说明:校验规则:1、主协议交易对手方身份为产品管理人必填;2、主协议交易对手方身份为自营禁止填值;3、应当符合标准规范</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 20)]
[DefaultValue("")]
[SacDescription("CounterpartyCodeProducts", "交易对手码(产品)", "20", true, "应当符合标准规范;")]
[SacDescription("CounterpartyCodeProducts", "交易对手码(产品)", "20", false, "校验规则:\r\n1、主协议交易对手方身份为产品管理人必填;\r\n2、主协议交易对手方身份为自营禁止填值;\r\n3、应当符合标准规范;")]
public string CounterpartyCodeProducts { get; set; }
/// <summary>
/// 产品投资经理姓名
/// <para>长度:100</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>
/// 说明:校验规则:
/// 1 主协议交易对手方身份为产品管理人必填;
/// 2 主协议交易对手方身份为自营禁止填值;
/// 1 主协议交易对手方身份为产品管理人必填;
/// 2 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
/// <summary>
/// 投资经理联系电话
/// <para>长度:20</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>
/// 说明:校验规则:
/// 1 主协议交易对手方身份为产品管理人必填;
/// 2 主协议交易对手方身份为自营禁止填值;
/// 1 主协议交易对手方身份为产品管理人必填;
/// 2 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
/// <summary>
/// 托管机构(如有)
@@ -116,7 +118,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>必填:否</para>
/// <para>
/// 说明:校验规则:
/// 1 主协议交易对手方身份为自营禁止填值;
/// 1 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
/// <summary>
/// 入表日期
/// <para>长度:10</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>
/// 说明:校验规则:
/// 1 必须是yyyy-MM-dd;
/// 2 主协议交易对手方身份为产品管理人必填;
/// 3 主协议交易对手方身份为自营禁止填值;
/// 1 必须是YYYY-MM-DD;
/// 2 主协议交易对手方身份为产品管理人必填;
/// 3 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
/// <summary>
/// 代签产品附件
/// <para>长度:10</para>
/// <para>必填:</para>
/// <para>必填:</para>
/// <para>
/// 说明:校验规则:
/// 1 只支持PDF格式;
/// 2 主协议交易对手方身份为产品管理人必填;
/// 3 主协议交易对手方身份为自营禁止填值;
/// 2 主协议交易对手方身份为产品管理人必填;
/// 3 主协议交易对手方身份为自营禁止填值;
/// </para>
/// </summary>
[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; }
}
}
File diff suppressed because it is too large Load Diff
@@ -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
{
/// <summary>
/// 了结确认书
/// </summary>
[Table("A1007_OptionTermination")]
public class OptionTerminationModel : ReportBaseModel
{
/// <summary>
@@ -30,6 +38,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("BizID", "业务编号", "50", false, "校验规则:补正时必填;")]
public new string BizID { get; set; }
/// <summary>
/// 操作事件编号
/// <para>长度:6</para>
/// <para>必填:是</para>
/// <para>
/// 说明:存续期发生相关事件时,必填;
/// 同一笔交易确认书下应当保证唯一性,并按照事件发生顺序进行编号,起始编号为0000.
/// 如一笔交易下依次发生展期\调仓\终止事件,编号应当分别为0000\0001\0002,
/// 场外业务报告系统返回编号分别为E0000\R0001\T0002
/// </para>
/// </summary>
[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; }
/// <summary>
/// 交易确认书编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
@@ -37,53 +60,37 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("ConfirmationNo", "交易确认书编号", "100", true, "双方约定;")]
[SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")]
public string ConfirmationNo { get; set; }
/// <summary>
/// 终止日期
/// 存续期操作类型
/// <para>长度:2</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.OperationTypeMap"/>敲入、敲出只限于自动赎回、安全气囊、障碍及其组合类期权填写</para>
/// </summary>
[CheckStringInMap(Map = new[] { "01", "02", "03", "05", "06" })]
[DefaultValue("")]
[SacDescription("DurationOperationType", "存续期操作类型", "2", true, "敲入、敲出只限于自动赎回、安全气囊、障碍及其组合类期权填写")]
public string DurationOperationType { get; set; }
/// <summary>
/// 操作发生日期
/// <para>长度:10</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 必须是yyyy-MM-dd;3 不存在展期数据:不得等于晚于原合约到期日;4 存在展期数据:不得等于晚于最新展期日期;5 新增终止:一个日期只能存在一条终止数据;</para>
/// <para>说明:分别为“确定进行展期日期”“合约终止日期”“交易发生违约日期”“发生敲入事件日期”“发生敲出事件日期”</para>
/// </summary>
[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; }
/// <summary>
/// 违约方
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.OptionTraderMap"/> 校验规则:存续期操作类型为违约终止时必填;</para>
/// </summary>
[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; }
/// <summary>
/// 违约事件说明
/// <para>长度:1024</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:存续期操作类型为违约终止时必填;</para>
/// </summary>
[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; }
/// <summary>
/// 展期日期
/// 展期后到期日
/// <para>长度:10</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:1 存续期操作类型为展期时必填;2 必须是yyyy-MM-dd;3 不存在展期数据:不得早于等于原合约到期日;4 存在展期数据:不得早于等于最新展期日期;5 新增终止:一个日期只能存在一条终止数据;</para>
/// <para>说明:当“存续期操作类型”为“展期”时,必填;不存在展期操作数据不得早于原合约到期日存在展期操作数据不得早于最近一次展期数据的“展期后到期日”</para>
/// </summary>
[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; }
/// <summary>
/// 存续期操作类型
/// 违约方
/// <para>长度:2</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.OperationTypeMap"/></para>
/// </summary>
[CheckStringInMap(Map = new[] { "01", "02", "03" })]
[DefaultValue("")]
[SacDescription("DurationOperationType", "存续期操作类型", "2", true, "")]
public string DurationOperationType { get; set; }
/// <summary>
/// 本次终止金额
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 保留两位小数;3 TODO 选展期时,该字段不能填,否则报送失败.4 大于0且小于等于上次余额;</para>
/// <para>说明:<see cref="FillPartyMap"/>当"存续期操作类型"为"违约终止"时,必填</para>
/// </summary>
[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; }
/// <summary>
/// 违约事件说明
/// <para>长度:1024</para>
/// <para>必填:否</para>
/// <para>说明:当"存续期操作类型"为"违约终止"时,必填</para>
/// </summary>
[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; }
/// <summary>
/// 名义本金变动(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:当"存续期操作类型"选择"终止""违约终止"时,必填,数值必须为负数</para>
/// </summary>
[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; }
/// <summary>
/// 余额
/// 存量名义本金(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:1 保留两位小数;2 值等于该交易上次余额-本次终止金额;</para>
/// <para>说明:大于等于 0 的数字</para>
/// </summary>
[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; }
/// <summary>
/// 本次支付金额
/// 本次支付金额(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 保留两位小数;3 TODO 选展期时,该字段不能填,否则报送失败;</para>
/// <para>说明:校验规则:1 当存续期操作类型,选择终止\违约终止时必填;2 支付为正,收取为负</para>
/// </summary>
[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; }
/// <summary>
/// 已了结交易实际收益率(%)
/// <para>长度:8,2</para>
/// <para>必填:否</para>
/// <para>说明:当“存续期操作类型”选择“终止”“违约终止”时,必填;</para>
/// </summary>
[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; }
/// <summary>
/// 存续期信息附件
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:只支持 PDF 格式</para>
/// </summary>
[CheckStringEndsWith(EndsWithString = ".pdf", Required = false)]
[DefaultValue("")]
[SacDescription("OptionDurationManagementAtt", "存续期信息附件", "", false, "校验规则:只支持 PDF 格式")]
public string OptionDurationManagementAtt { get; set; }
/// <summary>
/// 障碍事件状态
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="BarrierEventStatusMap"/>根据存续期操作类型中 05 敲入、06 敲出的填写情况,由系统自动取值,填报方无需填写报送</para>
/// </summary>
[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; }
/// <summary>
/// 空白1
/// </summary>
[XmlIgnore]
[DefaultValue("")]
[SacDescription("Blank1", "空白1", "", false, "")]
public string Blank1 { get; set; }
/// <summary>
/// 空白2
/// </summary>
[XmlIgnore]
[DefaultValue("")]
[SacDescription("Blank2", "空白2", "", false, "")]
public string Blank2 { get; set; }
}
}
@@ -50,7 +50,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("Telephone", "手机", "11", true, "校验规则:手机号")]
public string Telephone { get; set; }
/// <summary>
/// 固定电话
/// 手机
/// <para>长度:200</para>
/// <para>必填:否</para>
/// <para>说明:</para>
@@ -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
/// <summary>
/// 履约保证书
/// </summary>
[Table("A1008_PerformanceGuaranteeAgrmt")]
public class PerformanceGuaranteeAgrmtModel : ReportBaseModel
{
/// <summary>
@@ -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; }
}
}
@@ -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
/// 上月末收益互换存量交易对应履约担保品价值(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth", "上月末收益互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留位小数;")]
[SacDescription("TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth", "上月末收益互换存量交易对应履约担保品价值(元)", "36,2", true, "校验规则:保留位小数;")]
public string TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth { get; set; }
/// <summary>
/// 本月末收益互换现金担保物价值(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("SwapCashCollateralValueThisMonth", "本月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
[SacDescription("SwapCashCollateralValueThisMonth", "本月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
public string SwapCashCollateralValueThisMonth { get; set; }
/// <summary>
/// 上月末收益互换现金担保物价值(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("SwapCashCollateralValueLastMonth", "上月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
[SacDescription("SwapCashCollateralValueLastMonth", "上月末收益互换现金担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
public string SwapCashCollateralValueLastMonth { get; set; }
/// <summary>
/// 本月末收益互换证券担保物价值(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("SwapSecuritiesCollateralValueThisMonth", "本月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
[SacDescription("SwapSecuritiesCollateralValueThisMonth", "本月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
public string SwapSecuritiesCollateralValueThisMonth { get; set; }
/// <summary>
/// 上月末收益互换证券担保物价值(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("SwapSecuritiesCollateralValueLastMonthThisMonth", "上月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
[SacDescription("SwapSecuritiesCollateralValueLastMonthThisMonth", "上月末收益互换证券担保物价值(元)", "36,2", true, "校验规则:保留位小数;")]
public string SwapSecuritiesCollateralValueLastMonthThisMonth { get; set; }
/// <summary>
@@ -1329,14 +1330,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string SwapExpensesCashFlow { get; set; }
/// <summary>
/// 互换使用预付金形成的净收益对应现金流(万元)
/// 互换使用保证金形成的净收益对应现金流(万元)
/// <para>长度:36,4</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 32, AfterPointLength = 4)]
[DefaultValue("")]
[SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用预付金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")]
[SacDescription("CashFlowCorrespondingToNetIncomeOnSwapMargin", "互换使用保证金形成的净收益对应现金流(万元)", "36,4", true, "校验规则:保留四位小数;")]
public string CashFlowCorrespondingToNetIncomeOnSwapMargin { get; set; }
/// <summary>
@@ -1560,7 +1561,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 标的情况与对冲
/// </summary>
public class ISDATargetCaseAndHedgeModel
public class ISDATargetCaseAndHedgeModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -1621,7 +1622,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 标的交易场所
/// <para>长度:200</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// <para>说明:股指期货和大宗商品买入对冲包括开多仓和平空仓;保留两位小数</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 200, Required = false)]
[DefaultValue("")]
@@ -1674,13 +1675,13 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 本月末持仓数量(股/手)
/// <para>长度:36,4</para>
/// <para>长度:36,6</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:大于等于0;\r\n权益类填写股数</para>
/// <para>说明:校验规则:大于等于0;\r\n权益类填写股数;</para>
/// </summary>
[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; }
/// <summary>
@@ -1693,12 +1694,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[DefaultValue("")]
[SacDescription("AveragePriceAtTheEndOfTheMonth", "本月末持仓平均价格(元)", "36,2", false, "校验规则:保留两位小数;")]
public string AveragePriceAtTheEndOfTheMonth { get; set; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 本月末存量业务明细
/// </summary>
public class ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel
public class ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -1769,22 +1779,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金(或多头名义本金)(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;</para>
/// </summary>
[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; }
/// <summary>
/// 空头名义本金(元)(多空组合填写)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;</para>
/// </summary>
[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; }
/// <summary>
@@ -1859,7 +1869,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 场外期权标的小类(场外期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="UndrlygAssetDtldTypeMap"/></para>
/// <para>说明:<see cref="SwapUndrlygAssetDtldTypeMap"/></para>
/// </summary>
[CheckStringMaxLength(MaxLength = 2, Required = false)]
[DefaultValue("")]
@@ -1897,24 +1907,27 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>必填:否</para>
/// <para>说明:<see cref="OptionStructureTypeMap"/>校验规则:当"业务类型"为"场外期权"时,必填</para>
/// </summary>
[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; }
/// <summary>
/// 本月末维持预付金比例(%)
/// 本月末维持保证金比例(%)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>
/// 说明:指月末维持预付金加浮动盈亏占合约存续名义本金的比例;
/// 对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.
/// 例如维持预付金比例为50%,填写50.00
/// 说明:指月末维持保证金加浮动盈亏占合约存续名义本金的比例;
/// 对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.
/// 例如维持保证金比例为50%,填写50.00
/// </para>
/// </summary>
[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; }
/// <summary>
@@ -1958,12 +1971,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[DefaultValue("")]
[SacDescription("ShortPositionContractValue", "空头合约价值(元)", "36,2", false, "客户空头、多空组合收益互换需填写;\r\n保留两位小数;")]
public string ShortPositionContractValue { get; set; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 本月新增业务明细
/// </summary>
public class ISDAIncreaseBusinessDetailsThisMonthModel
public class ISDAIncreaseBusinessDetailsThisMonthModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -2034,22 +2056,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金(或多头名义本金)(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,多空组合填写多头名义本;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留位小数;")]
[SacDescription("NotionalPrincipalAmountLNotionalPrincipalAmount", "名义本金(或多头名义本金)(元)", "36,2", false, "校验规则:保留2位小数,多空组合填写多头;")]
public string NotionalPrincipalAmountLNotionalPrincipalAmount { get; set; }
/// <summary>
/// 空头名义本金(元)(多空组合填写)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留位小数;")]
[SacDescription("SNotionalPrincipalAmount", "空头名义本金(元)(多空组合填写)", "36,2", false, "校验规则:保留2位小数;")]
public string SNotionalPrincipalAmount { get; set; }
/// <summary>
@@ -2109,11 +2131,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("UndrlygAssetCode", "标的编码", "200", false, "")]
public string UndrlygAssetCode { get; set; }
/// <summary>
/// 标的交易场所
/// <para>长度:200</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 200, Required = false)]
[DefaultValue("")]
[SacDescription("UndrlygAssetTradgPlc", "标的交易场所", "200", false, "")]
public string UndrlygAssetTradgPlc { get; set; }
/// <summary>
/// 场外期权标的小类(场外期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="UndrlygAssetDtldTypeMap"/></para>
/// <para>说明:<see cref="SwapUndrlygAssetDtldTypeMap"/></para>
/// </summary>
[CheckStringMaxLength(MaxLength = 2, Required = false)]
[DefaultValue("")]
@@ -2151,9 +2184,21 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>必填:否</para>
/// <para>说明:<see cref="OptionStructureTypeMap"/></para>
/// </summary>
[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; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
}
@@ -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
/// <summary>
/// 其他交易明细表
/// </summary>
public class ScheduleOfOtherTransactionModel
public class ScheduleOfOtherTransactionModel : ReportSubBaseModel
{
/// <summary>
/// 交易日期
/// 起始日
/// <para>长度:10</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:必须是YYYY-MM-DD;</para>
@@ -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; }
/// <summary>
@@ -907,11 +908,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留4位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
@@ -960,15 +961,25 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("ContractExpirationDate", "合约到期日", "10", false, "校验规则:必须是YYYY-MM-DD;\r\n合约到期日不能小于合约起始日;")]
public string ContractExpirationDate { get; set; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 利率期权明细
/// </summary>
public class InterestRateOptionDetailModel
public class InterestRateOptionDetailModel : ReportSubBaseModel
{
/// <summary>
/// 交易日期
/// 起始日
/// <para>长度:10</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:必须是YYYY-MM-DD;</para>
@@ -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; }
/// <summary>
@@ -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; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 利率互换明细
/// </summary>
public class InterestRateSwapDetailModel
public class InterestRateSwapDetailModel : ReportSubBaseModel
{
/// <summary>
/// 交易日期
@@ -1263,11 +1283,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金金额
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
@@ -1309,11 +1329,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 固定利率
/// <para>长度:8,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为18位;</para>
/// </summary>
[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; }
/// <summary>
@@ -1404,5 +1424,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[DefaultValue("")]
[SacDescription("FirstInterestPaymentDay", "首次利息支付(互换)日", "10", false, "校验规则:必须是YYYY-MM-DD;")]
public string FirstInterestPaymentDay { get; set; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
}
@@ -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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 34, AfterPointLength = 4)]
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 4)]
[DefaultValue("")]
[SacDescription("SwapExpensesCashFlow", "互换支出现金流(万元)", "36,4", true, "校验规则:保留四位小数;")]
public string SwapExpensesCashFlow { get; set; }
/// <summary>
/// 互换使用预付金形成的净收益对应现金流(万元)
/// 互换使用保证金形成的净收益对应现金流(万元)
/// <para>长度:36,4</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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; }
/// <summary>
@@ -1821,7 +1822,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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
/// <para>必填:是</para>
/// <para>说明:校验规则:保留四位小数;</para>
/// </summary>
[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<TargetCaseAndHedgeModel> TargetCaseAndHedgeTuple { get; set; }
/// <summary>
/// 收益互换整体业务存量对应预付金(元)+ 期权费(元)
/// 收益互换整体业务存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginOfSubsistSwap", "收益互换整体业务存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginOfSubsistSwap", "收益互换整体业务存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginOfSubsistSwap { get; set; }
/// <summary>
@@ -2066,14 +2067,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string LeverageRatiOfSwap { get; set; }
/// <summary>
/// 收益互换股指标的存量对应预付金(元)+ 期权费(元)
/// 收益互换股指标的存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginOfSubsistStockIndexSwap", "收益互换股指标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginOfSubsistStockIndexSwap", "收益互换股指标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginOfSubsistStockIndexSwap { get; set; }
/// <summary>
@@ -2099,14 +2100,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string LeverageRatioOfStockIndexSwap { get; set; }
/// <summary>
/// 收益互换个股标的存量对应预付金(元)+ 期权费(元)
/// 收益互换个股标的存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginOfSubsistStockSwap", "收益互换个股标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginOfSubsistStockSwap", "收益互换个股标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginOfSubsistStockSwap { get; set; }
/// <summary>
@@ -2132,14 +2133,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string LeverageRatioOfStockSwap { get; set; }
/// <summary>
/// 场外期权整体业务存量对应预付金(元)+ 期权费(元)
/// 场外期权整体业务存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginandPremiumOfSubsistOption", "场外期权整体业务存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginandPremiumOfSubsistOption", "场外期权整体业务存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginandPremiumOfSubsistOption { get; set; }
/// <summary>
@@ -2165,14 +2166,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string LeverageRatioOfOption { get; set; }
/// <summary>
/// 场外期权股指标的存量对应预付金(元)+ 期权费(元)
/// 场外期权股指标的存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginandPremiumOfSubsistStockIndexOption", "场外期权股指标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginandPremiumOfSubsistStockIndexOption", "场外期权股指标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginandPremiumOfSubsistStockIndexOption { get; set; }
/// <summary>
@@ -2198,14 +2199,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
public string LeverageRatioOfStockIndexOption { get; set; }
/// <summary>
/// 场外期权个股标的存量对应预付金(元)+ 期权费(元)
/// 场外期权个股标的存量对应保证金(元)+ 期权费(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:保留两位小数</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginandPremiumOfSubsistStockOption", "场外期权个股标的存量对应预付金(元)+", "36,2", true, "校验规则:保留两位小数;")]
[SacDescription("MarginandPremiumOfSubsistStockOption", "场外期权个股标的存量对应保证金(元)+ 期权费(元)", "36,2", true, "校验规则:保留两位小数;")]
public string MarginandPremiumOfSubsistStockOption { get; set; }
/// <summary>
@@ -2454,7 +2455,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 标的情况与对冲
/// </summary>
public class TargetCaseAndHedgeModel
public class TargetCaseAndHedgeModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -2576,7 +2577,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 权益类填写股数
/// </para>
/// </summary>
[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; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 本月末存量业务明细
/// </summary>
public class InventoryBusinessDetailsAtTheEndOfThisMonthModel
public class InventoryBusinessDetailsAtTheEndOfThisMonthModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -2667,22 +2677,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金(或多头名义本金)(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
/// 空头名义本金(元)(多空组合填写)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
@@ -2754,12 +2764,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 期权标的小类(场外期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="UndrlygAssetDtldTypeMap"/>校验规则:如业务类型为期权,需填写本字段;</para>
/// <para>说明:<see cref="SwapUndrlygAssetDtldTypeMap"/>校验规则:如业务类型为期权,需填写本字段;</para>
/// </summary>
[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; }
/// <summary>
/// 期权类型
/// 期权结构类型(期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.OptionStructureTypeMap"/> 校验规则:如业务类型为期权,需填写本字段;</para>
/// </summary>
[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; }
/// <summary>
/// 本月末维持预付金比例(%)
/// 本月末维持保证金比例(%)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>
/// 说明:指月末维持预付金加浮动盈亏占合约存续名义本金的比例;
/// 对于多空互换,指维持预付金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.
/// 例如维持预付金比例为50%,填写50.00
/// 说明:指月末维持保证金加浮动盈亏占合约存续名义本金的比例;
/// 对于多空互换,指维持保证金加浮动盈亏占多头名义本金和空头名义本金孰高的比例.
/// 例如维持保证金比例为50%,填写50.00
/// </para>
/// </summary>
[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; }
/// <summary>
/// 标的相关系数
@@ -2870,12 +2880,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[DefaultValue("")]
[SacDescription("ShortPositionContractValue", "空头合约价值(元)", "36,2", false, "客户空头、多空组合收益互换需填写;\r\n保留两位小数;")]
public string ShortPositionContractValue { get; set; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
/// <summary>
/// 本月新增业务明细
/// </summary>
public class IncreaseBusinessDetailsThisMonthModel
public class IncreaseBusinessDetailsThisMonthModel : ReportSubBaseModel
{
/// <summary>
/// 报送机构名称(全称)
@@ -2949,22 +2969,22 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 名义本金(或多头名义本金)(元)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留4位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
/// 空头名义本金(元)(多空组合填写)
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:保留位小数;</para>
/// <para>说明:校验规则:保留2位小数,同时总的字符长度不能超过20,即整数位最多可为15位;</para>
/// </summary>
[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; }
/// <summary>
@@ -3030,12 +3050,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 期权标的小类(场外期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="UndrlygAssetDtldTypeMap"/>校验规则:如业务类型为场外期权,需填写本字段;</para>
/// <para>说明:<see cref="SwapUndrlygAssetDtldTypeMap"/>校验规则:如业务类型为场外期权,需填写本字段;</para>
/// </summary>
[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; }
/// <summary>
/// 期权类型(期权填写)
/// 期权结构类型(期权填写)
/// <para>长度:2</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="OptionStructureTypeMap"/>校验规则:如业务类型为期权,需填写本字段;</para>
/// </summary>
[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; }
/// <summary>
/// 序号
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[SacDescription("Index", "序号", "", false, "")]
public string Index { get; set; }
}
}
@@ -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
/// 报告类型
/// </summary>
public List<int> ReportTypes { get; set; }
/// <summary>
/// 证券业报送中定期报告取值模式
/// <para>1=Db;</para>
/// <para>2=Excel模板;</para>
/// <para>3=Db+Excel模板(该方式中涉及百分比汇总计算时仍使用模板中数据)</para>
/// <para>4=金仕达视图(该方式只涉及互换确认书及存续期的数据)</para>
/// <para>5=Db+金仕达视图</para>
/// <para>6=Excel+金仕达视图</para>
/// <para>7=Db+Excel+金仕达视图</para>
/// </summary>
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
/// <para>仅外部数据来源使用</para>
/// </summary>
[XmlIgnore]
[NotMapped]
public bool IgnoreCheck { get; set; }
[Key]
[XmlIgnore]
public int Id { get; set; }
/// <summary>
/// 报送日期
/// </summary>
[XmlIgnore]
public DateTime ReportDate { get; set; }
/// <summary>
/// 业务数据流水号
/// <para>长度:28</para>
/// <para>必填:是</para>
/// <para>说明:文件创建人代码(6位)+文件接收人代码(6位)+报送日期(8位)+当日顺序编号(8位)</para>
/// </summary>
[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
/// <para>说明:<see cref="Consts.RetCodeMap"/>报送时该字段应为Null</para>
/// </summary>
[XmlElement(IsNullable = false)]
[NotMapped]
[SacDescription("RetCode", "响应码", "6", true, "报送时该字段应为Null;")]
public string RetCode { get; set; }
/// <summary>
@@ -152,6 +180,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>说明:报送时该字段应为Null</para>
/// </summary>
[XmlElement(IsNullable = false)]
[NotMapped]
[SacDescription("RetMsg", "响应描述", "1000", true, "报送时该字段应为Null;")]
public string RetMsg { get; set; }
/// <summary>
@@ -162,6 +191,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>报送时该字段应为Null</para>
/// </summary>
[XmlElement(IsNullable = false)]
[NotMapped]
[SacDescription("BizID", "报送数据业务编号", "50", false, "报告库接口返回,数据处理异常时为空\r\n报送时该字段应为Null;")]
public string BizID { get; set; }
/// <summary>
@@ -172,10 +202,30 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>报送时该字段应为Null</para>
/// </summary>
[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; }
/// <summary>
/// 报送日期
/// </summary>
[XmlIgnore]
public DateTime ReportDate { get; set; }
/// <summary>
/// 来源报送文件 ExceID
/// </summary>
[XmlIgnore]
public string ExceID { get; set; }
}
/// <summary>
/// 报告状态
/// </summary>
@@ -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
/// </summary>
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;
//}
}
/// <summary>
@@ -252,10 +301,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <returns>缓存是否存在value</returns>
public bool CheckCacheInfo(string key, string value)
{
if (CacheInfo == null)
{
CacheInfo = new Dictionary<string, List<string>>();
}
CacheInfo ??= new Dictionary<string, List<string>>();
if (!CacheInfo.ContainsKey(key))
{
CacheInfo[key] = new List<string>();
@@ -270,10 +316,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <returns></returns>
public ReadOnlyCollection<string> GetCacheInfo(string key)
{
if (CacheInfo == null)
{
CacheInfo = new Dictionary<string, List<string>>();
}
CacheInfo ??= new Dictionary<string, List<string>>();
if (!CacheInfo.ContainsKey(key))
{
CacheInfo[key] = new List<string>();
@@ -288,10 +331,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <param name="value"></param>
public void AddCacheInfo(string key, string value)
{
if (CacheInfo == null)
{
CacheInfo = new Dictionary<string, List<string>>();
}
CacheInfo ??= new Dictionary<string, List<string>>();
if (!CacheInfo.ContainsKey(key))
{
CacheInfo[key] = new List<string>();
@@ -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("<PerformanceCollTuple />"))
{
result = result.Replace("<PerformanceCollTuple />", "");
}
break;
}
return result;
}
@@ -161,7 +176,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <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" })]
"A1008", "A1009","A1010", "A1011", "A1012","A1013","A1014","A1015","A1016","A1017","A1018","A1019" })]
[SacDescription("BusiDataType", "接口标识", "5", true, "")]
public DataFlagsEnum BusiDataType { get; set; }
/// <summary>
@@ -241,11 +256,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("SwapEquityPayment", "收益互换交易权益端支付", "", false, "")]
public List<SwapEquityPaymentModel> SwapEquityPayment { get; set; }
/// <summary>
/// 互换交易确认书附件
/// 交易确认书附件
/// </summary>
[XmlElement]
[SacDescription("ConfirmationAtt", "互换交易确认书附件", "", false, "")]
public List<SwapConfirmationAttModel> ConfirmationAtt { get; set; }
[SacDescription("ConfirmationAtt", "交易确认书附件", "", false, "")]
public List<ConfirmationAttModel> ConfirmationAtt { get; set; }
/// <summary>
/// 期权交易存续期管理
/// </summary>
@@ -259,6 +274,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[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]
@@ -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
/// <summary>
/// 补充协议
/// </summary>
[Table("A1003_SupAgrmt")]
public class SupAgrmtModel : ReportBaseModel
{
/// <summary>
@@ -23,14 +26,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 主协议编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:双方约定</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "校验规则:双方约定;")]
[SacDescription("MasterAgrmtNo", "主协议编号(双方约定)", "100", true, "双方约定;")]
public string MasterAgrmtNo { get; set; }
/// <summary>
/// 补充议编号
/// 补充议编号
/// <para>长度:32</para>
/// <para>必填:否</para>
/// <para>说明:校验规则:补正时必填</para>
@@ -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; }
/// <summary>
/// 补充协议编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:双方约定</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("SupAgrmtNo", "补充协议编号(双方约定)", "100", true, "校验规则:双方约定;")]
[SacDescription("SupAgrmtNo", "补充协议编号(双方约定)", "100", true, "双方约定;")]
public string SupAgrmtNo { get; set; }
/// <summary>
/// 补充协议类型
@@ -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; }
/// <summary>
/// 签署时间
/// <para>长度:10</para>
@@ -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; }
/// <summary>
/// 补充协议备注
@@ -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; }
/// <summary>
/// 补充协议附件
/// <para>长度:1024</para>
/// <para>必填:否</para>
/// <para>说明:上述所有字段未能包含的信息</para>
/// </summary>
[XmlIgnore]
public string SupAgrmtAtt { get; set; }
/// <summary>
/// 补充协议附件
/// <summary>
/// 补充协议附件
/// <para>长度:</para>
@@ -90,14 +103,15 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>说明:</para>
/// </summary>
[XmlElement]
[NotMapped]
[SacDescription("SupAgrmtAttTuple", "补充协议附件", "", true, "")]
public List<SupAgrmtAttModel> SupAgrmtAttTuple { get; set; }
public List<SupAgrmtAttModel>? SupAgrmtAttTuple { get; set; }
}
/// <summary>
/// 补充协议附件
/// </summary>
public class SupAgrmtAttModel
public class SupAgrmtAttModel : ReportSubBaseModel
{
/// <summary>
/// 补充协议附件
@@ -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; }
}
}
@@ -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
{
/// <summary>
/// 互换交易确认书附件
/// </summary>
public class SwapConfirmationAttModel : ReportBaseModel
{
/// <summary>
/// 交易确认书编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")]
public string ConfirmationNo { get; set; }
/// <summary>
/// 操作标识
/// <para>长度:1</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OptFlagsEnum"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("OperationType", "操作标识", "1", true, "")]
public OptFlagsEnum OperationType { get; set; }
/// <summary>
/// 交易确认书附件
/// <para>长度:</para>
/// <para>必填:是</para>
/// <para>说明:多附件;</para>
/// </summary>
[CheckIEnumerableTMinCount(MinCount = 1)]
[XmlElement]
[SacDescription("ConfirmationFilesTuple", "交易确认书附件", "", true, "多附件;")]
public List<ConfirmationFilesTupleModel> ConfirmationFilesTuple { get; set; }
}
public class ConfirmationFilesTupleModel
{
/// <summary>
/// 交易确认书附件
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:只支持PDF格式</para>
/// </summary>
[CheckStringEndsWith(EndsWithString = ".pdf")]
[DefaultValue("")]
[SacDescription("ConfirmationFiles", "交易确认书附件", "100", true, "校验规则:只支持PDF格式;")]
public string ConfirmationFiles { get; set; }
}
}
@@ -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
/// <summary>
/// 互换交易确认书
/// </summary>
[Table("A1005_SwapConfirmation")]
public class SwapConfirmationModel : ReportBaseModel
{
/// <summary>
@@ -17,6 +20,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>说明:<see cref="PaymentMethodMap"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("PaymentMethod", "支付方式", "2", true, "")]
public string PaymentMethod { get; set; }
/// <summary>
/// 操作标识
@@ -64,7 +68,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 交易确认书编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:双方约定;</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
@@ -74,11 +78,11 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 交易确认书类型
/// <para>长度:2</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="ReportTypeMap"/></para>
/// <para>说明:<see cref="ReportTypeMap"/>校验规则:首次提交时填0,补正时填1</para>
/// </summary>
[CheckStringInMap(Map = new[] { "0", "1" })]
[DefaultValue("")]
[SacDescription("ConfirmationType", "交易确认书类型", "2", true, "")]
[SacDescription("ConfirmationType", "交易确认书类型", "2", true, "校验规则:首次提交时填0,补正时填1;")]
public string ConfirmationType { get; set; }
/// <summary>
/// 填报方角色
@@ -104,34 +108,34 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 起始日
/// <para>长度:10</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:1 起始日不能大于到期日日期;2 必须是yyyy-MM-dd</para>
/// <para>说明:校验规则:1 起始日不能大于到期日日期;2 必须是YYYY-MM-DD</para>
/// </summary>
[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; }
/// <summary>
/// 到期日
/// <para>长度:10</para>
/// <para>必填:是</para>
/// <para>说明:指定的进行结算金额收付的日期. 校验规则:1 到期日不能小于起始日日期;2 必须是yyyy-MM-dd;3 补正时,如果该交易还有未被废除的存续期记录(包括展期\终止数据),到期日字段不能修改;</para>
/// <para>说明:指定的进行结算金额收付的日期. 校验规则:1 到期日不能小于起始日日期;2 必须是YYYY-MM-DD;</para>
/// </summary>
[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; }
/// <summary>
/// 结算日
/// <para>长度:10</para>
/// <para>必填:否</para>
/// <para>说明:交易双方在交易有效约定中指定的进行结算金额收付的日期;校验规则:1 必须是yyyy-MM-dd;</para>
/// <para>说明:校验规则:1 必须是YYYY-MM-DD;</para>
/// </summary>
[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; }
/// <summary>
/// 结算货币
@@ -144,7 +148,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[SacDescription("Currency", "结算货币", "2", true, "使用货币通用代码(大写);")]
public string Currency { get; set; }
/// <summary>
/// 名义本金额(人民币、元)
/// 名义本金(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:1 必须两位小数以内;2 补正时,如果该交易还有未被废除的存续期记录(包括展期\终止数据),名义本金额(人民币)字段不能修改;</para>
@@ -152,7 +156,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[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; }
/// <summary>
/// 清算机构
@@ -181,7 +185,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <para>说明:交易场所选"99:其他交易场所"时,必填</para>
/// </summary>
[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
/// 费用端支付
/// </summary>
[XmlElement]
[NotMapped]
[SacDescription("CostPaymentTuple", "费用端支付", "", false, "")]
public List<PaymentMethodModel> CostPaymentTuple { get; set; }
/// <summary>
@@ -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; }
/// <summary>
/// 担保品收取方是否可使用担保品
/// <para>长度:5</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.BoolMap"/>检验规则:履约担保类型为部分担保,全额担保时必填;</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.BoolMap"/>检验规则:履约担保类型为"部分担保"或"全额担保"时必填;</para>
/// </summary>
[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; }
/// <summary>
/// 担保品使用说明
/// <para>长度:1024</para>
/// <para>必填:否</para>
/// <para>说明:检验规则:当担保品收取方是否可使用担保品选择时必填;</para>
/// <para>说明:检验规则:当"担保品收取方是否可使用担保品"选择"是"时必填;</para>
/// </summary>
[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
/// 是否计算担保品价值产生利息
/// <para>长度:5</para>
/// <para>必填:否</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.BoolMap"/>检验规则:当"履约担保类型"为"部分担保"\"全额担保"时必填</para>
/// <para>说明:<see cref="YLErp.DBModels.Consts.ConsReport.BoolMap"/>检验规则:当"履约担保类型"为"部分担保""全额担保"时必填</para>
/// </summary>
[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
/// 履约担保品初始比率(%
/// <para>长度:5,2</para>
/// <para>必填:是</para>
/// <para>说明:校验规则:1 当"履约保障类型"选择"部分担保"或"全额担保"时必填;2 大于等于0的数字,最多2位小数,该值为100%时,填写100.00</para>
/// <para>说明:校验规则:大于等于0的数字,最多2位小数,该值为100%时,填写100.00</para>
/// </summary>
[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; }
/// <summary>
/// 履约担保品追保比率(%
@@ -291,8 +296,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[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
/// </summary>
[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<SwapPerformanceGuaranteeAttModel> PerformanceCollTuple { get; set; }
/// <summary>
@@ -373,31 +379,31 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 标的个数
/// <para>长度:2</para>
/// <para>必填:是</para>
/// <para>说明: <see cref="UndrlygAssetNoMap"/>多标的时,权益收益\浮动利率收益固定利率收益信息需新增多个</para>
/// <para>说明: <see cref="UndrlygAssetNoMap"/>多标的时,权益收益浮动利率收益固定利率收益信息需新增多个</para>
/// </summary>
[CheckStringInMap(Map = new[] { "0", "1" })]
[DefaultValue("")]
[SacDescription("PtyAUndrlygAssetNo", "标的个数", "2", true, "多标的时,权益收益、浮动利率收益固定利率收益信息需新增多个;")]
[SacDescription("PtyAUndrlygAssetNo", "标的个数", "2", true, "多标的时,权益收益、浮动利率收益固定利率收益信息需新增多个;")]
public string PtyAUndrlygAssetNo { get; set; }
/// <summary>
/// 收益计算说明
/// <para>长度:1024</para>
/// <para>必填:是</para>
/// <para>说明:甲方支付乙方,详细说明收益计算方式;</para>
/// <para>说明:详细说明收益计算方式</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 1024)]
[DefaultValue("")]
[SacDescription("PtyAPrOfitCalculationInfo", "收益计算说明", "1024", true, "甲方支付乙方,详细说明收益计算方式;")]
[SacDescription("PtyAPrOfitCalculationInfo", "收益计算说明", "1024", true, "详细说明收益计算方式;")]
public string PtyAPrOfitCalculationInfo { get; set; }
/// <summary>
/// 收益备注
/// <para>长度:1024</para>
/// <para>必填:否</para>
/// <para>说明:甲方支付乙方,填写上述字段或交易确认书中不能包含的信息;</para>
/// <para>说明:填写上述字段或交易确认书中不能包含的信息</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 1024, Required = false)]
[DefaultValue("")]
[SacDescription("PtyAProfitRemark", "收益备注", "1024", false, "甲方支付乙方,填写上述字段或交易确认书中不能包含的信息;")]
[SacDescription("PtyAProfitRemark", "收益备注", "1024", false, "填写上述字段或交易确认书中不能包含的信息;")]
public string PtyAProfitRemark { get; set; }
/// <summary>
/// 甲方代签产品名称
@@ -451,6 +457,17 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
[DefaultValue("")]
[SacDescription("PytBPdctCode", "乙方交易对手码(产品)", "20", false, "校验规则:如乙方代签产品名称或乙方代签产品代码填值,则甲方代签产品名称和甲方代签产品代码禁止填值;")]
public string PytBPdctCode { get; set; }
//TODO: 2.3互换上线时取消注释
///// <summary>
///// 是否为跨境交易
///// <para>长度:5</para>
///// <para>必填:是</para>
///// <para>说明:<see cref="BoolMap"/></para>
///// </summary>
//[CheckStringInMap(Map = new[] { "true", "false" })]
//[DefaultValue("")]
//[SacDescription("CrossBorderTransactions", "是否为跨境交易", "5", true, "")]
//public string CrossBorderTransactions { get; set; }
/// <summary>
/// 空白1
/// </summary>
@@ -468,7 +485,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 履约担保品详情
/// </summary>
public class SwapPerformanceGuaranteeAttModel
[Table("A1005_SwapPerformanceGuaranteeAtt")]
public class SwapPerformanceGuaranteeAttModel : ReportSubBaseModel
{
/// <summary>
/// 履约担保品类型
@@ -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; }
}
/// <summary>
/// 收益互换交易费用端支付
/// </summary>
public class PaymentMethodModel
[Table("A1005_PaymentMethod")]
public class PaymentMethodModel : ReportSubBaseModel
{
/// <summary>
/// 支付方式
@@ -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; }
}
}
@@ -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
/// <summary>
/// 收益互换交易存续期管理
/// </summary>
[Table("A1006_SwapDurationManagement")]
public class SwapDurationManagementModel : ReportBaseModel
{
/// <summary>
@@ -57,12 +60,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// 存续期操作类型
/// <para>长度:2</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OperationTypeMap"/>当"收益互换交易类型"为"多空组合"时,可选"调仓"</para>
/// <para>说明:<see cref="SwapOperationTypeMap"/>当"收益互换交易类型"为"多空组合"时,可选"调仓"</para>
/// </summary>
[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
/// 当"存续期操作类型"选择"调仓"时,可增可减
/// </para>
/// </summary>
[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; }
/// <summary>
/// 预付金比例(%)
/// 保证金比例(%)
/// <para>长度:8,2</para>
/// <para>必填:是</para>
/// <para>说明:为预付金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者</para>
/// <para>说明:为保证金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 8, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("MarginRatio", "预付金比例(%)", "8,2", true, "为预付金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者;")]
[SacDescription("MarginRatio", "保证金比例(%)", "8,2", true, "为保证金占存量名义本金比例,其中多空组合收益互换存量名义本金为存量多头名义本金和空头名义本金孰大者;")]
public string MarginRatio { get; set; }
/// <summary>
/// 合约持仓明细
@@ -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<CurrentPositionDetailModel> CurrentPositionDetails { get; set; }
/// <summary>
@@ -216,7 +220,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 合约持仓明细
/// </summary>
public class CurrentPositionDetailModel
[Table("A1006_CurrentPositionDetail")]
public class CurrentPositionDetailModel : ReportSubBaseModel
{
/// <summary>
/// 挂钩标的编码
@@ -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; }
}
}
@@ -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
/// <summary>
/// 收益互换交易权益端支付
/// </summary>
[Table("A1016_SwapEquityPayment")]
public class SwapEquityPaymentModel : ReportBaseModel
{
/// <summary>
@@ -27,13 +32,14 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("ConfirmationNo", "交易确认书", "100", true, "双方约定;")]
[SacDescription("ConfirmationNo", "交易确认书(双方约定)", "100", true, "双方约定;")]
public string ConfirmationNo { get; set; }
/// <summary>
/// 权益端支付
/// </summary>
[XmlElement]
[CheckIEnumerableTMinCount(MinCount = 1)]
[NotMapped]
[SacDescription("SwapEquityPaymentTuple", "权益端支付", "", false, "")]
public List<SwapEquityPaymentTupleModel> SwapEquityPaymentTuple { get; set; }
/// <summary>
@@ -50,7 +56,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[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; }
/// <summary>
/// 空白1
/// </summary>
@@ -68,7 +74,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// <summary>
/// 权益端支付
/// </summary>
public class SwapEquityPaymentTupleModel
[Table("A1016_SwapEquityPaymentTuple")]
public class SwapEquityPaymentTupleModel : ReportSubBaseModel
{
/// <summary>
/// 支付方式
@@ -106,7 +113,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[CheckStringIsDateTimeFormat]
[DefaultValue("")]
[SacDescription("OpenandClosingDate", "标的开/平仓日期", "2", true, "yyyy-MM-dd;")]
[SacDescription("OpenandClosingDate", "标的开/平仓日期", "10", true, "yyyy-MM-dd;")]
public string OpenandClosingDate { get; set; }
/// <summary>
/// 标的小类
@@ -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; }
/// <summary>
/// 空头名义本金(元)
@@ -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; }
/// <summary>
/// 利率(%)
@@ -220,7 +227,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Model
/// </summary>
[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; }
/// <summary>
/// 空白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; }
}
}
@@ -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
{
/// <summary>
/// 场外期权合约估值信息
/// </summary>
[Table("A1018_ValuationInformation")]
public class ValuationInformationModel : ReportBaseModel
{
/// <summary>
/// 操作标识
/// <para>长度:1</para>
/// <para>必填:是</para>
/// <para>说明:<see cref="OptFlagsEnum"/></para>
/// </summary>
[XmlIgnore]
[SacDescription("OperationType", "操作标识", "1", true, "")]
public OptFlagsEnum OperationType { get; set; }
/// <summary>
/// 交易确认书编号(双方约定)
/// <para>长度:100</para>
/// <para>必填:是</para>
/// <para>说明:双方约定</para>
/// </summary>
[CheckStringMaxLength(MaxLength = 100)]
[DefaultValue("")]
[SacDescription("ConfirmationNo", "交易确认书编号(双方约定)", "100", true, "双方约定;")]
public string ConfirmationNo { get; set; }
/// <summary>
/// 估值日期
/// <para>长度:10</para>
/// <para>必填:是</para>
/// <para>说明:</para>
/// </summary>
[CheckStringLength(Length = 10)]
[CheckStringIsDateTimeFormat(FormatString = "yyyy-MM-dd")]
[DefaultValue("")]
[SacDescription("ValuationDate", "估值日期", "10", true, "")]
public string ValuationDate { get; set; }
/// <summary>
/// 存量名义本金(元)
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:两位小数;大于等于0的数字</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, MinValue = 0)]
[DefaultValue("")]
[SacDescription("Balance", "存量名义本金(元)", "36,2", true, "大于等于0的数字;")]
public string Balance { get; set; }
/// <summary>
/// 保证金比例(%
/// <para>长度:8,2</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 8, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("MarginRatio", "保证金比例(%", "8,2", false, "")]
public string MarginRatio { get; set; }
/// <summary>
/// 期权估值
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntLength(BeforePointMaxLength = 36, AfterPointLength = 2)]
[DefaultValue("")]
[SacDescription("OptionValuation", "期权估值", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string OptionValuation { get; set; }
/// <summary>
/// Delta
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("Delta", "Delta", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string Delta { get; set; }
/// <summary>
/// Gamma
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("Gamma", "Gamma", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string Gamma { get; set; }
/// <summary>
/// Vega
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("Vega", "Vega", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string Vega { get; set; }
/// <summary>
/// Theta
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("Theta", "Theta", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string Theta { get; set; }
/// <summary>
/// Rho
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("Rho", "Rho", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string Rho { get; set; }
/// <summary>
/// RhoQ
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("RhoQ", "RhoQ", "36,2", false, "")]
public string RhoQ { get; set; }
/// <summary>
/// DeltaCash
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("DeltaCash", "DeltaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string DeltaCash { get; set; }
/// <summary>
/// GammaCash
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("GammaCash", "GammaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string GammaCash { get; set; }
/// <summary>
/// VegaCash
/// <para>长度:36,2</para>
/// <para>必填:是</para>
/// <para>说明:期权生效后,每个交易日更新,直至期权终止</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2)]
[DefaultValue("")]
[SacDescription("VegaCash", "VegaCash", "36,2", true, "期权生效后,每个交易日更新,直至期权终止;")]
public string VegaCash { get; set; }
/// <summary>
/// ThetaCash
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("ThetaCash", "ThetaCash", "36,2", false, "")]
public string ThetaCash { get; set; }
/// <summary>
/// RhoCash
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("RhoCash", "RhoCash", "36,2", false, "")]
public string RhoCash { get; set; }
/// <summary>
/// RhoQCash
/// <para>长度:36,2</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[CheckStringIntMaxLength(BeforePointMaxLength = 36, AfterPointMaxLength = 2, Required = false)]
[DefaultValue("")]
[SacDescription("RhoQCash", "RhoQCash", "36,2", false, "")]
public string RhoQCash { get; set; }
/// <summary>
/// 空白1
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[DefaultValue("")]
[SacDescription("Blank1", "空白1", "", false, "")]
public string Blank1 { get; set; }
/// <summary>
/// 空白2
/// <para>长度:</para>
/// <para>必填:否</para>
/// <para>说明:</para>
/// </summary>
[XmlIgnore]
[DefaultValue("")]
[SacDescription("Blank2", "空白2", "", false, "")]
public string Blank2 { get; set; }
}
}
@@ -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<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ContractNumberProcess;
List<SACReportNotes> noteList = new List<SACReportNotes>();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
model.ContractNumberProcess = new ContractNumberProcessModel();
model.ContractNumberProcess.MasterAgrmtTuple = new List<ChangeMasterAgrmtModel>();
model.ContractNumberProcess.SupAgrmtTuple = new List<ChangeSupAgrmtModel>();
model.ContractNumberProcess.OptionConfirmationTuple = new List<ChangeOptionConfirmationModel>();
model.ContractNumberProcess.SwapConfirmationTuple = new List<ChangeOptionConfirmationModel>();
HashSet<string> masterAgrmtTupleId = new HashSet<string>();
HashSet<string> masterAgrmtTupleNo = new HashSet<string>();
HashSet<string> supAgrmtTupleId = new HashSet<string>();
HashSet<string> supAgrmtTupleNo = new HashSet<string>();
HashSet<string> confirmationTupleId = new HashSet<string>();
HashSet<string> confirmationTupleNo = new HashSet<string>();
var model = new BodyModel
{
ContractNumberProcess = new ContractNumberProcessModel
{
MasterAgrmtTuple = new List<ChangeMasterAgrmtModel>(),
SupAgrmtTuple = new List<ChangeSupAgrmtModel>(),
OptionConfirmationTuple = new List<ChangeOptionConfirmationModel>(),
SwapConfirmationTuple = new List<ChangeOptionConfirmationModel>()
}
};
var masterAgrmtTupleId = new HashSet<string>();
var masterAgrmtTupleNo = new HashSet<string>();
var supAgrmtTupleId = new HashSet<string>();
var supAgrmtTupleNo = new HashSet<string>();
var confirmationTupleId = new HashSet<string>();
var confirmationTupleNo = new HashSet<string>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model.ContractNumberProcess != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<ContractNumberProcessModel> helper = new CheckHelper<ContractNumberProcessModel>();
CheckHelper<ChangeMasterAgrmtModel> masterAgrmtHelper = new CheckHelper<ChangeMasterAgrmtModel>();
CheckHelper<ChangeSupAgrmtModel> supAgrmtHelper = new CheckHelper<ChangeSupAgrmtModel>();
CheckHelper<ChangeOptionConfirmationModel> optionConfirmationHelper = new CheckHelper<ChangeOptionConfirmationModel>();
var listRoot = new List<SacInfo>();
var helper = new CheckHelper<ContractNumberProcessModel>();
var masterAgrmtHelper = new CheckHelper<ChangeMasterAgrmtModel>();
var supAgrmtHelper = new CheckHelper<ChangeSupAgrmtModel>();
var optionConfirmationHelper = new CheckHelper<ChangeOptionConfirmationModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("MasterAgrmtTuple", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("SupAgrmtTuple", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("OptionConfirmationTuple", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("SwapConfirmationTuple", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("ContractNumberProcess");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("ContractNumberProcess")
{
SubMaps = new List<SacInfo>(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;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -15,25 +15,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1009;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_EventReport;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> 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<string>();
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<EventReportDetailModel>();
@@ -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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model.EventReport != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<EventReportModel> helper = new CheckHelper<EventReportModel>();
CheckHelper<EventReportDetailModel> attHelper = new CheckHelper<EventReportDetailModel>();
var listRoot = new List<SacInfo>();
var helper = new CheckHelper<EventReportModel>();
var attHelper = new CheckHelper<EventReportDetailModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("EventReportTuple", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("EventReport");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("EventReport")
{
SubMaps = new List<SacInfo>(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]);
}
@@ -23,168 +23,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1002;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_MasterAgrmtProduct;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> noteList = new();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<MasterAgrmtProductModel> dataList = new List<MasterAgrmtProductModel>();
if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
var model = new BodyModel();
var dataList = new List<MasterAgrmtProductModel>();
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<int, ClientDuty> clientdutyDict = null;
if (ct != null)
{
clientdutyDict = new ExpandoDictionary<int, ClientDuty>(
(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<MasterAgrmtProductModel>(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<string> 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<MasterAgrmtProductModel> GetMasterAgrmtProductModel(ref List<string> fileList)
private List<MasterAgrmtProductModel> GetMasterAgrmtProductModelFromExcel(ref List<string> fileList)
{
List<MasterAgrmtProductModel> result = new List<MasterAgrmtProductModel>();
var result = new List<MasterAgrmtProductModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.MasterAgrmtProduct != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<MasterAgrmtProductModel> helper = new Common.CheckHelper<MasterAgrmtProductModel>();
for (int i = 0; i < model.MasterAgrmtProduct.Count; i++)
var helper = new Common.CheckHelper<MasterAgrmtProductModel>();
for (var i = 0; i < model.MasterAgrmtProduct.Count; i++)
{
var listRoot = new List<SacInfo>();
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<SacInfo>(listRoot);
var errMsg = new SacInfo("MasterAgrmtProduct", i)
{
FieldValue = item.ProductName,
SubMaps = new List<SacInfo>(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);
}
}
}
@@ -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<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_MasterAgrmt;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> noteList = new();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<MasterAgrmtModel> dataList = new List<MasterAgrmtModel>();
if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
var model = new BodyModel();
var dataList = new List<MasterAgrmtModel>();
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<MasterAgrmtModel>(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<string> 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<MasterAgrmtModel> GetMasterAgrmtModelFromDb(ref List<string> fileList)
{
var dataList = new List<MasterAgrmtModel>();
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<int, ClientDuty> clientdutyDict = null;
if (ct != null)
{
clientdutyDict = new ExpandoDictionary<int, ClientDuty>(
(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>();
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<MasterAgrmtModel> GetMasterAgrmtModelFromExcel(ref List<string> fileList)
{
List<MasterAgrmtModel> result = new List<MasterAgrmtModel>();
var result = new List<MasterAgrmtModel>();
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<CounterpartyInfomationModel> GetCounterpartyInfomationModelFromExcel(string masterAgrmtNo)
{
List<CounterpartyInfomationModel> result = new List<CounterpartyInfomationModel>();
var result = new List<CounterpartyInfomationModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.MasterAgrmt != null)
{
CheckHelper<MasterAgrmtModel> helper = new Common.CheckHelper<MasterAgrmtModel>();
CheckHelper<CounterpartyInfomationModel> infoHelper = new Common.CheckHelper<CounterpartyInfomationModel>();
for (int i = 0; i < model.MasterAgrmt.Count; i++)
var helper = new Common.CheckHelper<MasterAgrmtModel>();
var infoHelper = new Common.CheckHelper<CounterpartyInfomationModel>();
for (var i = 0; i < model.MasterAgrmt.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("CounterpartyInformationTuple", j)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("MasterAgrmt", i);
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("MasterAgrmt", i)
{
FieldValue = item.MasterAgrmtNo,
SubMaps = new List<SacInfo>(listRoot)
};
result.Add(errMsg);
}
}
@@ -542,7 +381,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
LogFactory.GetLogger<ReportMasterAgrmtProductService>().Error(e);
};
}
for (int i = 0; i < noteList.Count; i++)
for (var i = 0; i < noteList.Count; i++)
{
base.SaveReportNotes(noteList[i]);
}
@@ -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<OptFlagsEnum> _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OptionConfirmationAtt;
List<SACReportNotes> noteList = new List<SACReportNotes>();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<ConfirmationAttModel> dataList = new List<ConfirmationAttModel>();
if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template))
{
dataList = GetOptionConfirmationAttModel(out fileList);
}
var subsystemDataList = loadSubsystemDataSource<ConfirmationAttModel>(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<string> 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<ConfirmationAttModel> GetOptionConfirmationAttModel(out List<string> fileList)
{
fileList = new List<string>();
List<ConfirmationAttModel> result = new List<ConfirmationAttModel>();
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<ConfirmationFilesTupleModel>();
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<SACReportNotes> 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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
if (model?.ConfirmationAtt != null)
{
CheckHelper<ConfirmationAttModel> helper = new CheckHelper<ConfirmationAttModel>();
CheckHelper<ConfirmationFilesTupleModel> attHelper = new CheckHelper<ConfirmationFilesTupleModel>();
for (int i = 0; i < model.ConfirmationAtt.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
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<SacInfo>(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;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -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<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
OptFlagsEnum.U,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OptionTermination;
List<SACReportNotes> noteList = new List<SACReportNotes>();
private List<string> _cacheCodeList = new List<string>();
readonly List<SACReportNotes> noteList = new();
private readonly List<string> _cacheCodeList = new();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<OptionTerminationModel> dataList = new List<OptionTerminationModel>();
if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
var model = new BodyModel();
var dataList = new List<OptionTerminationModel>();
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<string>() { "系统操作-平仓费", "系统操作-行权费" };
using (var db = new YLContext())
{
dataList.AddRange(GetOptionTerminationExtensionTimeFromDb(db, cacheKey, nextDate));
dataList.AddRange(GetOptionTerminationSettlementFromDb(db, cacheKey, nextDate));
}
}
var subsystemDataList = loadSubsystemDataSource<OptionTerminationModel>(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<string> 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<SACReportNotes> 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;
}
/// <summary>
/// 从数据库获取展期记录
/// </summary>
/// <param name="db"></param>
/// <param name="cacheKey"></param>
/// <param name="nextDate"></param>
/// <returns></returns>
private List<OptionTerminationModel> GetOptionTerminationExtensionTimeFromDb(YLContext db, string cacheKey, DateTime nextDate)
{
List<OptionTerminationModel> dataList = new List<OptionTerminationModel>();
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<int> ids = extensionTimeList.Select(O => O.TradeId).ToList();
Dictionary<int, Dictionary<string, string>> 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<SACReportNotes> 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<Dictionary<string, string>>(note?.InfoCache) ?? new Dictionary<string, string>();
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;
}
/// <summary>
/// 从数据库获取结算信息
/// </summary>
/// <param name="db"></param>
/// <param name="cacheKey"></param>
/// <param name="nextDate"></param>
/// <returns></returns>
private IEnumerable<OptionTerminationModel> GetOptionTerminationSettlementFromDb(YLContext db, string cacheKey, DateTime nextDate)
{
List<OptionTerminationModel> dataList = new List<OptionTerminationModel>();
var actions = new List<string>() { "系统操作-平仓费", "系统操作-行权费" };
//当天有回退记录的资金记录
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<int> ids = query.Keys.Select(O => O.id).ToList();
Dictionary<int, Dictionary<string, string>> 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<SACReportNotes> 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;
}
/// <summary>
/// 格式化报送标签,用于关联报表和业务信息
/// </summary>
@@ -546,25 +171,50 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
/// <returns></returns>
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);
}
/// <summary>
/// 从Excel获取结算信息
/// </summary>
/// <returns></returns>
private List<OptionTerminationModel> GetOptionTerminationFromExcel()
private List<OptionTerminationModel> GetOptionTerminationModel(ref List<string> fileList)
{
List<OptionTerminationModel> result = new List<OptionTerminationModel>();
var result = new List<OptionTerminationModel>();
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<SACReportNotes> 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<SACReportNotes> 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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.OptionTermination != null)
{
CheckHelper<OptionTerminationModel> helper = new Common.CheckHelper<OptionTerminationModel>();
for (int i = 0; i < model.OptionTermination.Count; i++)
var helper = new Common.CheckHelper<OptionTerminationModel>();
for (var i = 0; i < model.OptionTermination.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>(listRoot);
var errMsg = new SacInfo("OptionTermination", i)
{
FieldValue = item.ConfirmationNo,
SubMaps = new List<SacInfo>(listRoot)
};
result.Add(errMsg);
}
}
@@ -736,7 +396,7 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
LogFactory.GetLogger<ReportMasterAgrmtProductService>().Error(e);
};
}
for (int i = 0; i < noteList.Count; i++)
for (var i = 0; i < noteList.Count; i++)
{
base.SaveReportNotes(noteList[i]);
}
@@ -15,25 +15,23 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1010;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_OtherReport;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> 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<string>();
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<OtherReportFileDetailModel>();
@@ -174,8 +176,8 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
model.OtherReport.DetailedDescription = _reqInfo.OtherReportDesc;
}
model.OtherReport.ExceID = base.formatExceID();
List<SACReportNotes> 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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.OtherReport != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<OtherReportModel> helper = new CheckHelper<OtherReportModel>();
CheckHelper<OtherReportFileDetailModel> detailHelper = new CheckHelper<OtherReportFileDetailModel>();
var listRoot = new List<SacInfo>();
var helper = new CheckHelper<OtherReportModel>();
var detailHelper = new CheckHelper<OtherReportFileDetailModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("OtherReportFileTuple", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("OtherReport");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("OtherReport")
{
SubMaps = new List<SacInfo>(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]);
}
@@ -19,151 +19,38 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1008;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> noteList = new();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<PerformanceGuaranteeAgrmtModel> dataList = new List<PerformanceGuaranteeAgrmtModel>();
if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
var model = new BodyModel();
var dataList = new List<PerformanceGuaranteeAgrmtModel>();
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<string, client_file> protocolFileDict = null;
if (codes.Count() > 0)
{
protocolFileDict = new ExpandoDictionary<string, client_file>(
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<PerformanceGuaranteeAgrmtModel>(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<string> 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<PerformanceGuaranteeAgrmtModel> GetPerformanceGuaranteeAgrmtModel(ref List<string> fileList)
{
List<PerformanceGuaranteeAgrmtModel> result = new List<PerformanceGuaranteeAgrmtModel>();
var result = new List<PerformanceGuaranteeAgrmtModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model.PerformanceGuaranteeAgrmt != null)
{
CheckHelper<PerformanceGuaranteeAgrmtModel> helper = new Common.CheckHelper<PerformanceGuaranteeAgrmtModel>();
for (int i = 0; i < model.PerformanceGuaranteeAgrmt.Count; i++)
var helper = new Common.CheckHelper<PerformanceGuaranteeAgrmtModel>();
for (var i = 0; i < model.PerformanceGuaranteeAgrmt.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>(listRoot);
var errMsg = new SacInfo("PerformanceGuaranteeAgrmt", i)
{
FieldValue = item.MasterAgrmtNo,
SubMaps = new List<SacInfo>(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]);
}
@@ -20,19 +20,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1013;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
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<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> 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<string>();
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
/// <returns></returns>
private List<ISDAIncreaseBusinessDetailsThisMonthModel> GetIncreaseBusinessDetailsThisMonthTuple()
{
List<ISDAIncreaseBusinessDetailsThisMonthModel> result = new List<ISDAIncreaseBusinessDetailsThisMonthModel>();
var result = new List<ISDAIncreaseBusinessDetailsThisMonthModel>();
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
/// <returns></returns>
private List<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel> GetInventoryBusinessDetailsAtTheEndOfThisMonthTuple()
{
List<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel> result = new List<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel>();
var result = new List<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel>();
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
/// <returns></returns>
private List<ISDATargetCaseAndHedgeModel> GetTargetCaseAndHedgeTuple()
{
List<ISDATargetCaseAndHedgeModel> result = new List<ISDATargetCaseAndHedgeModel>();
var result = new List<ISDATargetCaseAndHedgeModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.PeriodicReportISDA != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<PeriodicReportISDAModel> helper = new Common.CheckHelper<PeriodicReportISDAModel>();
CheckHelper<ISDAIncreaseBusinessDetailsThisMonthModel> detailHelper = new Common.CheckHelper<ISDAIncreaseBusinessDetailsThisMonthModel>();
CheckHelper<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel> detail2Helper = new Common.CheckHelper<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel>();
CheckHelper<ISDATargetCaseAndHedgeModel> hedgeHelper = new Common.CheckHelper<ISDATargetCaseAndHedgeModel>();
var listRoot = new List<SacInfo>();
var helper = new Common.CheckHelper<PeriodicReportISDAModel>();
var detailHelper = new Common.CheckHelper<ISDAIncreaseBusinessDetailsThisMonthModel>();
var detail2Helper = new Common.CheckHelper<ISDAInventoryBusinessDetailsAtTheEndOfThisMonthModel>();
var hedgeHelper = new Common.CheckHelper<ISDATargetCaseAndHedgeModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("TargetCaseAndHedgeTuple", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("PeriodicReportISDA");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("PeriodicReportISDA")
{
SubMaps = new List<SacInfo>(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]);
}
@@ -19,19 +19,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1012;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
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<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> 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<string>();
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
/// <returns></returns>
private List<ScheduleOfOtherTransactionModel> GetScheduleOfOtherTransactionModel()
{
List<ScheduleOfOtherTransactionModel> result = new List<ScheduleOfOtherTransactionModel>();
var result = new List<ScheduleOfOtherTransactionModel>();
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
/// <returns></returns>
private List<InterestRateSwapDetailModel> GetInterestRateSwapDetailModel()
{
List<InterestRateSwapDetailModel> result = new List<InterestRateSwapDetailModel>();
var result = new List<InterestRateSwapDetailModel>();
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
/// <returns></returns>
private List<InterestRateOptionDetailModel> GetInterestRateOptionDetailModel()
{
List<InterestRateOptionDetailModel> result = new List<InterestRateOptionDetailModel>();
var result = new List<InterestRateOptionDetailModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.PeriodicReportNAFMII != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<PeriodicReportNAFMIIModel> helper = new Common.CheckHelper<PeriodicReportNAFMIIModel>();
CheckHelper<InterestRateSwapDetailModel> swapDetailHelper = new Common.CheckHelper<InterestRateSwapDetailModel>();
CheckHelper<InterestRateOptionDetailModel> optionDetailHelper = new Common.CheckHelper<InterestRateOptionDetailModel>();
CheckHelper<ScheduleOfOtherTransactionModel> transactionHelper = new Common.CheckHelper<ScheduleOfOtherTransactionModel>();
var listRoot = new List<SacInfo>();
var helper = new Common.CheckHelper<PeriodicReportNAFMIIModel>();
var swapDetailHelper = new Common.CheckHelper<InterestRateSwapDetailModel>();
var optionDetailHelper = new Common.CheckHelper<InterestRateOptionDetailModel>();
var transactionHelper = new Common.CheckHelper<ScheduleOfOtherTransactionModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("InterestRateSwapDetails", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("InterestRateOptionDetails", i)
{
SubMaps = new List<SacInfo>(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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("ScheduleOfOtherTransactions", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("PeriodicReportNAFMII");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("PeriodicReportNAFMII")
{
SubMaps = new List<SacInfo>(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]);
}
@@ -15,19 +15,16 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override ConsReport.DataFlagsEnum BusiDataType => ConsReport.DataFlagsEnum.A1014;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<ConsReport.OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
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<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> 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<string>();
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<DerivativesQuarterlyReportAnnexModel>();
@@ -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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.PeriodicReportQuarter != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
CheckHelper<PeriodicReportQuarterModel> helper = new Common.CheckHelper<PeriodicReportQuarterModel>();
CheckHelper<DerivativesQuarterlyReportAnnexModel> annexHelper = new Common.CheckHelper<DerivativesQuarterlyReportAnnexModel>();
var listRoot = new List<SacInfo>();
var helper = new Common.CheckHelper<PeriodicReportQuarterModel>();
var annexHelper = new Common.CheckHelper<DerivativesQuarterlyReportAnnexModel>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("DerivativesQuarterlyReportAnnexTuple", i)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("PeriodicReportQuarter");
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("PeriodicReportQuarter")
{
SubMaps = new List<SacInfo>(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]);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -19,158 +19,39 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Service
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1003;
private List<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SupAgrmt;
List<SACReportNotes> noteList = new List<SACReportNotes>();
private List<string> _cacheCodeList = new List<string>();
readonly List<SACReportNotes> noteList = new();
private readonly List<string> _cacheCodeList = new();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<SupAgrmtModel> dataList = new List<SupAgrmtModel>();
if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
var model = new BodyModel();
var dataList = new List<SupAgrmtModel>();
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<SupAgrmtAttModel>();
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<SupAgrmtModel>(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<string> 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<SupAgrmtModel> GetSupAgrmtModel(ref List<string> fileList)
{
List<SupAgrmtModel> result = new List<SupAgrmtModel>();
var result = new List<SupAgrmtModel>();
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<SupAgrmtAttModel>();
}
model.SupAgrmtAttTuple ??= new List<SupAgrmtAttModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.SupAgrmt != null)
{
CheckHelper<SupAgrmtModel> helper = new Common.CheckHelper<SupAgrmtModel>();
CheckHelper<SupAgrmtAttModel> attHelper = new CheckHelper<SupAgrmtAttModel>();
for (int i = 0; i < model.SupAgrmt.Count; i++)
var helper = new Common.CheckHelper<SupAgrmtModel>();
var attHelper = new CheckHelper<SupAgrmtAttModel>();
for (var i = 0; i < model.SupAgrmt.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("SupAgrmtAttTuple", j)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("SupAgrmt", i);
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("SupAgrmt", i)
{
FieldValue = item.MasterAgrmtNo,
SubMaps = new List<SacInfo>(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]);
}
@@ -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<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ConfirmationAtt;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> noteList = new();
IEnumerable<SACReportNotes> SACReportNotesCache = null;
IEnumerable<SACReportNotes> SACReportNotesCache_confirmation = null;
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
var cacheKey = $"{BusiDataType}";
List<SwapConfirmationAttModel> dataList = new List<SwapConfirmationAttModel>();
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<ConfirmationAttModel>();
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<int> ids = query.Select(O => O.id).ToList();
List<int> delIds = new List<int>();
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<int, Dictionary<string, string>> 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<string, string> 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<string, string> reportCacheDic = JsonHelper.ToObject<Dictionary<string, string>>(note.InfoCache) ?? new Dictionary<string, string>();
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<ConfirmationFilesTupleModel>() { 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<SwapConfirmationAttModel>(fileList, AddSubsystemNote);
var subsystemDataList = loadSubsystemDataSource<ConfirmationAttModel>(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<string> fileList, string tag)
public bool AddSubsystemNote(ConfirmationAttModel model, List<string> 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<SwapConfirmationAttModel> GetSwapConfirmationAttModel(out List<string> fileList)
private List<ConfirmationAttModel> GetSwapConfirmationAttModel(ref List<string> fileList)
{
fileList = new List<string>();
List<SwapConfirmationAttModel> result = new List<SwapConfirmationAttModel>();
var result = new List<ConfirmationAttModel>();
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<SACReportNotes> notes = base.GetReportNotes(ReportType, formatInfoTag(model));
List<SACReportNotes> 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<SwapConfirmationAttModel> GetSwapConfirmationAttModelFromView(out List<string> fileList)
private string formatInfoTag(ConfirmationAttModel model, bool suffixType = false)
{
fileList = new List<string>();
List<SwapConfirmationAttModel> result = new List<SwapConfirmationAttModel>();
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<ConfirmationFilesTupleModel>();
;
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<SACReportNotes> 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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.ConfirmationAtt != null)
{
CheckHelper<SwapConfirmationAttModel> helper = new CheckHelper<SwapConfirmationAttModel>();
for (int i = 0; i < model.ConfirmationAtt.Count; i++)
var helper = new CheckHelper<ConfirmationAttModel>();
var attHelper = new CheckHelper<ConfirmationFilesTupleModel>();
for (var i = 0; i < model.ConfirmationAtt.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>(listRoot);
var errMsg = new SacInfo("SwapConfirmationAtt", i)
{
FieldValue = item.ConfirmationNo,
SubMaps = new List<SacInfo>(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]);
}
File diff suppressed because it is too large Load Diff
@@ -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<OptFlagsEnum> _validOperationType = null;
private List<OptFlagsEnum>? _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
_validOperationType ??= new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_SwapEquityPayment;
List<SACReportNotes> noteList = new List<SACReportNotes>();
readonly List<SACReportNotes> noteList = new();
IEnumerable<SACReportNotes> SACReportNotesCache = null;
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
var cacheKey = $"{BusiDataType}";
List<SwapEquityPaymentModel> dataList = new List<SwapEquityPaymentModel>();
var model = new BodyModel();
SACReportNotesCache = base.InitReportNotes(ReportType);
var dataList = new List<SwapEquityPaymentModel>();
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<string>() { "系统操作-平仓费", "系统操作-行权费", "系统操作-期权费" };
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<int> ids = query.Select(O => O.id).ToList();
List<int> delIds = new List<int>();
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<int, Dictionary<string, string>> 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<string, string> 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<SACReportNotes> 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<SwapEquityPaymentTupleModel>();
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<SwapEquityPaymentModel>(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<string> 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<SwapEquityPaymentModel> GetSwapEquityPaymentModel()
{
List<SwapEquityPaymentModel> result = new List<SwapEquityPaymentModel>();
var result = new List<SwapEquityPaymentModel>();
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<SACReportNotes> notes = base.GetReportNotes(ReportType, formatInfoTag(model));
List<SACReportNotes> 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<SwapEquityPaymentModel> GetSwapEquityPaymentModelFromView()
{
List<SwapEquityPaymentModel> result = new List<SwapEquityPaymentModel>();
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<SACReportNotes> 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
/// <returns></returns>
private List<SwapEquityPaymentTupleModel> GetSwapEquityPaymentTuple(string confirmationNo)
{
List<SwapEquityPaymentTupleModel> result = new List<SwapEquityPaymentTupleModel>();
var result = new List<SwapEquityPaymentTupleModel>();
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;
}
/// <summary>
/// 获取权益端支付明细
/// </summary>
/// <param name="confirmationNo"></param>
/// <returns></returns>
private List<SwapEquityPaymentTupleModel> GetSwapEquityPaymentTupleFromView(string confirmationNo)
{
List<SwapEquityPaymentTupleModel> result = new List<SwapEquityPaymentTupleModel>();
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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
var result = new List<SacInfo>();
if (model?.SwapEquityPayment != null)
{
CheckHelper<SwapEquityPaymentModel> helper = new CheckHelper<SwapEquityPaymentModel>();
CheckHelper<SwapEquityPaymentTupleModel> tupleHelper = new CheckHelper<SwapEquityPaymentTupleModel>();
for (int i = 0; i < model.SwapEquityPayment.Count; i++)
var helper = new CheckHelper<SwapEquityPaymentModel>();
var tupleHelper = new CheckHelper<SwapEquityPaymentTupleModel>();
for (var i = 0; i < model.SwapEquityPayment.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
var listRoot = new List<SacInfo>();
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<SacInfo>();
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<SacInfo>(listItem);
var temp = new SacInfo("SwapEquityPaymentTuple", j)
{
SubMaps = new List<SacInfo>(listItem)
};
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("SwapEquityPayment", i);
errMsg.SubMaps = new List<SacInfo>(listRoot);
var errMsg = new SacInfo("SwapEquityPayment", i)
{
FieldValue = item.ConfirmationNo,
SubMaps = new List<SacInfo>(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]);
}
File diff suppressed because it is too large Load Diff
@@ -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<OptFlagsEnum> _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_ValuationInformation;
List<SACReportNotes> noteList = new List<SACReportNotes>();
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
BodyModel model = new BodyModel();
List<ValuationInformationModel> dataList = new List<ValuationInformationModel>();
if (_reqInfo.DataSource.HasFlag(SAC_ReportDataSourceEnum.Template))
{
dataList = GetValuationInformationModelFromExcel(ref fileList);
}
ReadOnlyCollection<string> useDel = null;
if (_operationType == OptFlagsEnum.D && (useDel = ReportStatus.GetCacheInfo($"{DataFlagsEnum.A1018}_D")).Count > 0)
{
dataList.AddRange(GetValuationInformationModelFromCache(useDel));
}
var subsystemDataList = loadSubsystemDataSource<ValuationInformationModel>(fileList, AddSubsystemNote);
if (subsystemDataList != null && subsystemDataList.Count > 0)
dataList.AddRange(subsystemDataList);
noData = dataList.Count == 0;
model.ValuationInformation = dataList;
return model;
}
private List<ValuationInformationModel> GetValuationInformationModelFromCache(IEnumerable<string> useDel)
{
List<ValuationInformationModel> result = new List<ValuationInformationModel>();
foreach (var item in useDel)
{
var notes = base.GetReportNotes(formatInfoTag(item));
foreach (var note in notes)
{
var info = new ValuationInformationModel();
var reportCacheDic = JsonHelper.ToObject<Dictionary<string, string>>(note.InfoCache) ?? new Dictionary<string, string>();
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<string> 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<ValuationInformationModel> GetValuationInformationModelFromExcel(ref List<string> fileList)
{
List<ValuationInformationModel> result = new List<ValuationInformationModel>();
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<SACReportNotes> 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<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
if (model?.ValuationInformation != null)
{
CheckHelper<ValuationInformationModel> helper = new CheckHelper<ValuationInformationModel>();
for (int i = 0; i < model.ValuationInformation.Count; i++)
{
List<SacInfo> listRoot = new List<SacInfo>();
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<SacInfo>(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
{
/// <summary>
/// 波动率变动
/// </summary>
vol,
/// <summary>
/// 无风险利率变动
/// </summary>
r,
/// <summary>
/// 分红率变动
/// </summary>
q
}
/// <summary>
/// 计算参数
/// </summary>
private class calcParam
{
/// <summary>
/// 计算指标
/// </summary>
public clacTargetEnum Target { get; set; }
/// <summary>
/// 交易列表
/// </summary>
public IEnumerable<trade> TradeList { get; set; }
/// <summary>
/// 估值日期
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// 偏移值
/// <para>每次只变动一个参数,所以只需要一个</para>
/// </summary>
public double Offset { get; set; }
/// <summary>
/// 波动率变动
/// </summary>
public Dictionary<int, double> UpVolForTrade { get; set; }
/// <summary>
/// 无风险利率或分红率变动
/// </summary>
public Action<OptionTradeParamBase> UpParamOverride { get; set; }
/// <summary>
/// 波动率变动
/// </summary>
public Dictionary<int, double> DownVolForTrade { get; set; }
/// <summary>
/// 无风险利率或分红率变动
/// </summary>
public Action<OptionTradeParamBase> DownParamOverride { get; set; }
/// <summary>
/// PV差
/// </summary>
public Dictionary<int, double> PvDiff { get; set; }
/// <summary>
///
/// </summary>
/// <param name="offset"></param>
/// <param name="volForTrade"></param>
/// <param name="rParamOverride"></param>
/// <param name="qParamOverride"></param>
public calcParam(
clacTargetEnum target,
IEnumerable<trade> tradeList,
DateTime date,
double offset,
Dictionary<int, double> upVolForTrade,
Dictionary<int, double> downVolForTrade,
Action<OptionTradeParamBase> upParamOverride,
Action<OptionTradeParamBase> 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;
}
}
}
}
+3
View File
@@ -73,6 +73,9 @@
<FunctionSub Name="其他报告" Title="其他报告" Note="用于存放用户个性化的非通用报表,仅针对此功能定制开发过的用户有效"></FunctionSub>
<FunctionSub Name="出入金是否进行资金账户类型用途的校验" Type="Operate" Title="出入金是否进行资金账户类型用途的校验"></FunctionSub>
</FunctionParent>
<FunctionParent Name="监管报告" Title="监管报告">
<FunctionSub Name="证券业报送" Title="证券业报送"></FunctionSub>
</FunctionParent>
<FunctionParent Name="客户管理" Title="客户管理">
<FunctionSub Name="客户查看" Title="客户列表"></FunctionSub>
<FunctionSub Name="开户管理" Title="开户管理"></FunctionSub>
+5
View File
@@ -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"},
Binary file not shown.
@@ -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<SuperviseReport> 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<SacInfo> 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<SacInfo>;
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));
}
/// <summary>
/// 是否上传过模板
/// </summary>
/// <returns></returns>
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");
}
}
}
@@ -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 = "<input type=\"button\" class=\"wentiEdit\" title='发送该文件' onclick=\"SendReportFile('" + rowObject.EncryptId+"')\" value=\"{1}\" />"
html = "<input type=\"button\" class=\"wentiEdit\" title='发送该文件' onclick=\"SendReportFile('" + rowObject.EncryptId + "')\" value=\"{1}\" />"
.template(cellValue, "确认发送");
html += "<input type=\"button\" class=\"wentiEdit\" title='删除该文件' onclick=\"DeleteReportFile('" + rowObject.FileTag+"')\" value=\"{1}\" />"
html += "<input type=\"button\" class=\"wentiEdit\" title='删除该文件' onclick=\"DeleteReportFile('" + rowObject.FileTag + "')\" value=\"{1}\" />"
.template(cellValue, "删除");
break;
case 1:
@@ -121,10 +121,11 @@
ReportDescOption: [],
ReportDescSwap: []
},
isZhongjin : '@(PS.Config.Company == CompanyEnum.中金 )' == 'True'
isZhongjin : false
}
$(function () {
$("#editCode").hide();
initPage();
});
</script>
@@ -182,6 +183,13 @@
a[readonly] i {
color: darkgrey;
}
.my-skin .layui-layer-btn a {
background-color: red;
border: 1px solid red;
color: #fff;
}
</style>
</head>
<body>
@@ -193,14 +201,11 @@
<a title="监管报送逻辑" style="text-decoration: underline; cursor: pointer;" onclick="showWindow($('#tipInfo'),'监管报送逻辑');return false;">报送说明</a>
</div>
<div class="right">
@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('查看/发送报告')")
</div>
</div>
@@ -218,21 +223,6 @@
<span class="search-label" for="ReceiverCode">接收方代码</span>
<input class="search-input" id="ReceiverCode" name="ReceiverCode" type="text" value="" autocomplete="off">
</div>
@if ((dataSourceMode & ConsReport.SAC_ReportDataSourceEnum.System) == ConsReport.SAC_ReportDataSourceEnum.System)
{
<div class="search-group" style="display: none;">
<span class="search-label" for="LastMonthCash">上月末现金余额(SAC)</span>
<input class="search-input" id="LastMonthCash" name="LastMonthCash" type="text" value="" autocomplete="off">
</div>
<div class="search-group" style="display: none;">
<span class="search-label" for="LatestMonthCash">本月末现金余额(SAC)</span>
<input class="search-input" id="LatestMonthCash" name="LatestMonthCash" type="text" value="" autocomplete="off">
</div>
<div class="search-group" style="display: none;">
<span class="search-label" for="LatestNetAssets">本月末净资本(SAC)</span>
<input class="search-input" id="LatestNetAssets" name="LatestNetAssets" type="text" value="" autocomplete="off">
</div>
}
@Html.MyAceDropdownInput2("sacReport", "SAC报告月份", monthList, false)
@Html.MyAceDropdownInput2("nafmiiReport", "NAFMII报告月份", monthList, false)
@Html.MyAceDropdownInput2("isdaReport", "ISDA报告月份", monthList, false)
@@ -241,9 +231,9 @@
<input id="eventReport_A" value="上传" class="search-input" type="button" onclick="Upload('重大事项报告')" />
</div>
@*<div class="search-group">
<span for="eventReport" class="search-label">撤销重大事项报告报送日</span>
<input class="search-input datepicker" id="eventReport" name="eventReport" type="text" value="" autocomplete="off">
</div>*@
<span for="eventReport" class="search-label">撤销重大事项报告报送日</span>
<input class="search-input datepicker" id="eventReport" name="eventReport" type="text" value="" autocomplete="off">
</div>*@
<div class="search-group">
<span for="eventReportDesc" class="search-label">重大事项说明</span>
<input class="search-input" id="eventReportDesc" name="eventReport" type="text" value="" autocomplete="off">
@@ -253,9 +243,9 @@
<input id="otherReport_A" value="上传" class="search-input" type="button" onclick="Upload('其他事项报告')" />
</div>
@*<div class="search-group">
<span for="otherReport" class="search-label">撤销其他事项报送日</span>
<input class="search-input datepicker" id="otherReport" name="otherReport" type="text" value="" autocomplete="off">
</div>*@
<span for="otherReport" class="search-label">撤销其他事项报送日</span>
<input class="search-input datepicker" id="otherReport" name="otherReport" type="text" value="" autocomplete="off">
</div>*@
<div class="search-group">
<span for="otherReportDesc" class="search-label">其他事项说明</span>
<input class="search-input" id="otherReportDesc" name="otherReport" type="text" value="" autocomplete="off">
@@ -269,14 +259,14 @@
</div>
</div>
@await Html.PartialAsync("/Views/Common/_importFiles.cshtml", new ImportFileModel()
{
Accept = "application/pdf",
Buttons = new Dictionary<string, BtnReq>()
{
Accept = "application/pdf",
Buttons = new Dictionary<string, BtnReq>()
{
["上传"] = new BtnReq() { OnClick = "uploadOuterData()" },
},
NotesHtml = "<div id='uploadType' style='display: none;'></div>"
})
["上传"] = new BtnReq() { OnClick = "uploadOuterData()" },
},
NotesHtml = "<div id='uploadType' style='display: none;'></div>"
})
<div id="extendInfo" style="display:none">
<div class="yc-panel">
<span style="color: #6c757d;">场外期权 &gt;</span>
@@ -338,42 +328,6 @@
<li>新增展期、补正展期、废止展期、补正了结、废止了结操作,将根据报送时选择的报告日期去查找上述操作的操作日期相匹配且对应交易报送过新增且仍未废止的记录去报送;</li>
</ul>
</div>
@if ((PS.Config.ErpElement.SAC_ReportDataSource & ConsReport.SAC_ReportDataSourceEnum.System) == ConsReport.SAC_ReportDataSourceEnum.System)
{
<div class="yc-panel">
<h2>关于数据源的说明</h2>
<hr />
<h4>客户相关协议:</h4>
<span>根据配置的数据源,取值</span>
<ul>
<li>包括主协议、主协议关联产品列表、补充协议、履约保证书</li>
</ul>
<h4>交易确认书相关:</h4>
<span>根据配置的数据源,取值</span>
<ul>
<li>包括期权交易确认书、互换交易确认书</li>
</ul>
<h4>交易存续期相关:</h4>
<span>根据配置的数据源,取值</span>
<ul>
<li>包括期权展期、互换展期、期权了结、互换了结</li>
</ul>
<h4>定期报告相关:</h4>
<span>始终从上传的模板中取值</span>
<ul>
<li>包括SAC模板、NAFMII模板、ISDA模板、重大事项报告、其他事项报告</li>
</ul>
<h4>季度报告相关:</h4>
<span>从上传的附件中取值</span>
<ul>
<li>包括季度报告、半年报告</li>
</ul>
</div>
}
</div>
<div class="modal" tabindex="-1" id="modalChooseDateRange" data-backdrop="static">
<div class="modal-dialog">
@@ -396,5 +350,29 @@
</div>
</div>
</div>
<script type="text/html" id="reportTpl">
<div class="container" style="overflow:hidden;padding:20px;">
<form class="form-horizontal" method="post" id="generateReport" onsubmit="return false;">
<div class="form-group">
@* <label class="formlabel">标的资产类型</label> *@
<select id="reportType">
<option value="0">系统默认</option>
<option value="1">手动上传</option>
</select>
</div>
<div class="form-group" >
<h6>说明:</h6>
<div>系统默认:系统根据配置的数据源,生成所有数据源中要报送的数据;</div>
<div>
手工上传:系统将仅从当天最后一次上传的模板中,生成要报送的数据;
</div>
</div>
<div style="margin: 0px auto; padding: 10px;">
<input class="btn btn-primary" type="button" onclick="generateReportFromFile();return false;" value="确定" />
<input class="btn btn-primary" type="button" onclick="layer.closeAll();return false;" value="关闭" />
</div>
</form>
</div>
</script>
</body>
</html>
@@ -1,7 +1,7 @@
function initPage() {
initTree();
$("#notes").append('<div>' + $("#periodicReportQuarter").parent().html().replace(/periodicReportQuarter/g, 'fileDate') + '</div>');
$("#notes").append('<div><span>注意:<span id="tip">重大事项,其他事项和季度报告的相关文件不包含在模板文件中,请到相应功能点上传.<br/></span>单个文件不应超过30MB,周期内有效文件总大小,不应超过200MB,若超过限制,请考虑分批报送或精简文件</span></div>');
$("#notes").append('<div><span>注意:<span id="tip"></span></span></div>');
$("#buttons").prepend('<a id="templateFile" href="">下载模板</a>')
//$("#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 = "<i class='fa fa-arrow-right' aria-hidden='true'></i>" + obj.Tag;
html = "【{0}】<i class='fa fa-arrow-right' aria-hidden='true'></i>{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 = "重大事项,其他事项和季度报告的相关文件不包含在模板文件中,请到相应功能点上传.<br/>" + tip;
break;
case "修改编号":
tip = "修改编号功能仅适用于双方约定编号或产品名的修改,该功能仅修改镒链系统内数据,修改后须另外以补正的方式将修改后的数据报送给协会;<br/>修改数据可能需要废止相关报告,请遵循协会要求,废止成功后再操作.";
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;
}
}
+1
View File
@@ -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}