找回证券业报送的逻辑,仅支持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
@@ -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>();