518 lines
30 KiB
C#
518 lines
30 KiB
C#
using System.Data;
|
|
using YLErp.DBModels.Consts;
|
|
using YLErp.DBModels.Enums;
|
|
using YLErp.Modules.SuperviseReportModule.SAC.Common;
|
|
using YLErp.Modules.SuperviseReportModule.SAC.Model;
|
|
using static YLErp.DBModels.Consts.ConsReport;
|
|
|
|
namespace YLErp.Modules.SuperviseReportModule.SAC.Service
|
|
{
|
|
class ReportPeriodicReportNAFMIIService : ReportBaseService
|
|
{
|
|
public ReportPeriodicReportNAFMIIService(OptUserInfo optUser) : base(optUser)
|
|
{
|
|
}
|
|
|
|
protected override string _excelDataSourcePath => "定期报告\\";
|
|
|
|
protected override string _excelDataSourceFileName => "import_NAFMII_template.xlsx";
|
|
|
|
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1012;
|
|
|
|
private List<OptFlagsEnum>? _validOperationType = null;
|
|
public override List<OptFlagsEnum> ValidOperationType
|
|
{
|
|
get
|
|
{
|
|
_validOperationType ??= new List<OptFlagsEnum>() {
|
|
OptFlagsEnum.A,
|
|
OptFlagsEnum.U,
|
|
OptFlagsEnum.D,
|
|
};
|
|
return _validOperationType;
|
|
}
|
|
}
|
|
|
|
DateTime minDate = DateTime.MinValue;
|
|
DateTime maxDate = DateTime.MinValue;
|
|
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportNAFMII;
|
|
|
|
readonly List<SACReportNotes> noteList = new();
|
|
|
|
public override bool CheckRequestParamer(ReportInfo req, out string errMsg)
|
|
{
|
|
if (!base.CheckRequestParamer(req, out errMsg))
|
|
{
|
|
return false;
|
|
}
|
|
if (req.NAFMIIReportDate == null)
|
|
{
|
|
errMsg = "NAFMII定期报告对应的报告月份不应为空";
|
|
return false;
|
|
}
|
|
switch (req.NAFMIIReportStatus)
|
|
{
|
|
case OptFlagsEnum.U:
|
|
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);
|
|
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定期报告记录,请重新选择";
|
|
return false;
|
|
}
|
|
break;
|
|
case OptFlagsEnum.A:
|
|
if (base.GetReportNotes(ReportType, formatInfoTag(req.NAFMIIReportDate.Value.ToString("yyyy-MM"))).Any())
|
|
{
|
|
minDate = req.NAFMIIReportDate.Value.Date.AddDays(-req.NAFMIIReportDate.Value.Day).AddDays(1);
|
|
maxDate = req.NAFMIIReportDate.Value.Date.AddMonths(1).AddDays(-req.NAFMIIReportDate.Value.Day);
|
|
errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}最新NAFMII定期报告记录已报送成功,请选择补正";
|
|
return false;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
errMsg = "";
|
|
return true;
|
|
}
|
|
|
|
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
|
|
{
|
|
fileList = new List<string>();
|
|
noData = true;
|
|
var model = new BodyModel();
|
|
var cacheValue = formatInfoTag(_reqInfo.NAFMIIReportDate.Value.ToString("yyyy-MM"));
|
|
if (ReportStatus.CheckCacheInfo(CacheKey, cacheValue))
|
|
{
|
|
return model;
|
|
}
|
|
model.PeriodicReportNAFMII = new PeriodicReportNAFMIIModel
|
|
{
|
|
OperationType = _operationType
|
|
};
|
|
var note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault();
|
|
if (note == null && _operationType == OptFlagsEnum.A)
|
|
{
|
|
note = new SACReportNotes()
|
|
{
|
|
InfoCache = $"{{\"Tag\":\"{_reqInfo.NAFMIIReportDate.Value.ToString("yyyy-MM")}\"}}",
|
|
IsValid = true,
|
|
};
|
|
LogFactory.GetLogger("NAFMII").Info($"新增数据报送");
|
|
}
|
|
else
|
|
{
|
|
switch (_operationType)
|
|
{
|
|
case OptFlagsEnum.A:
|
|
noData = true;//新增数据已报送,跳过
|
|
LogFactory.GetLogger("NAFMII").Info($"新增数据已报送");
|
|
return model;
|
|
case OptFlagsEnum.U:
|
|
LogFactory.GetLogger("NAFMII").Info($"修改数据报送");
|
|
note.IsValid = true;
|
|
break;
|
|
case OptFlagsEnum.D:
|
|
LogFactory.GetLogger("NAFMII").Info($"删除数据报送");
|
|
note.IsValid = false;
|
|
break;
|
|
case OptFlagsEnum.NONE:
|
|
default:
|
|
throw new ServiceException("未知操作类型");
|
|
}
|
|
}
|
|
if (_operationType != OptFlagsEnum.A)
|
|
{
|
|
model.PeriodicReportNAFMII.BizID = note.BizId;
|
|
}
|
|
if (_excelDataSource != null)
|
|
{
|
|
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;
|
|
GetProtocolInfo(model, dt, 2, 1);
|
|
GetBisinessInfo(model, dt, 11, 1);
|
|
|
|
model.PeriodicReportNAFMII.InterestRateSwapDetails = GetInterestRateSwapDetailModel();
|
|
model.PeriodicReportNAFMII.InterestRateOptionDetails = GetInterestRateOptionDetailModel();
|
|
model.PeriodicReportNAFMII.ScheduleOfOtherTransactions = GetScheduleOfOtherTransactionModel();
|
|
|
|
model.PeriodicReportNAFMII.ExceID = base.formatExceID();
|
|
}
|
|
noData = string.IsNullOrWhiteSpace(model.PeriodicReportNAFMII?.MainAgreementLastMonthAccumulatedThisYear);
|
|
ReportStatus.AddCacheInfo(CacheKey, cacheValue);
|
|
if (!noData)
|
|
{
|
|
note.id = 0;
|
|
note.ExceId = model.PeriodicReportNAFMII.ExceID;
|
|
note.CreateTime = DateTime.Now;
|
|
note.FileTag = FileTag;
|
|
note.ReportType = ReportType;
|
|
note.ReportDate = _reqInfo.ReportDate;
|
|
note.InfoTag = formatInfoTag(_reqInfo.NAFMIIReportDate.Value.ToString("yyyy-MM"), true);
|
|
note.OptTime = note.CreateTime;
|
|
note.RetCode = "";
|
|
note.RetMsg = "";
|
|
note.ReportResponse = false;
|
|
note.BizId = "";
|
|
note.changeStatus = false;
|
|
noteList.Add(note);
|
|
}
|
|
return model;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取签署协议统计
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <param name="dt"></param>
|
|
/// <param name="startRow"></param>
|
|
/// <param name="startCol"></param>
|
|
private void GetProtocolInfo(BodyModel model, DataTable dt, int startRow, int startCol)
|
|
{
|
|
var row = startRow + 0;
|
|
model.PeriodicReportNAFMII.MainAgreementLastMonthAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.MainAgreementAddedThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.MainAgreementAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.MainAgreementValidedAtEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
|
|
row = startRow + 1;
|
|
model.PeriodicReportNAFMII.SupplementalAgreementLastMonthAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.SupplementalAgreementAddedThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.SupplementalAgreementAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.SupplementalAgreementValidedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
|
|
row = startRow + 2;
|
|
model.PeriodicReportNAFMII.PerformanceGuaranteeAgreementLastMonthAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.PerformanceGuaranteeAgreementAddedThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.PerformanceGuaranteeAgreementAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
|
|
row = startRow + 3;
|
|
model.PeriodicReportNAFMII.TransactionConfirmationLastMonthAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.TransactionConfirmationAddedThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.TransactionConfirmationBookAccumulatedThisYear = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.TransactionConfirmationValidedAtEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取业务规模统计
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <param name="dt"></param>
|
|
/// <param name="startRow"></param>
|
|
/// <param name="startCol"></param>
|
|
private void GetBisinessInfo(BodyModel model, DataTable dt, int startRow, int startCol)
|
|
{
|
|
var row = startRow + 0;
|
|
model.PeriodicReportNAFMII.NominalPrincipalInterestRateTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalRateIncreasesThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalRateIsSettledThisMonth = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalRateRemainsTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalRateAsOfTheEndOfThisMonthToAddTransactions = GetDataSetValue(dt, row, startCol + 4).ToString();
|
|
model.PeriodicReportNAFMII.ContractsInterestRateTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 5).ToString();
|
|
model.PeriodicReportNAFMII.NumberOfContractedInterestRatesThisMonthToAddTransactions = GetDataSetValue(dt, row, startCol + 6).ToString();
|
|
model.PeriodicReportNAFMII.AmountOfInterestInTheContractIsSettledThisMonth = GetDataSetValue(dt, row, startCol + 7).ToString();
|
|
model.PeriodicReportNAFMII.ContractInterestRatesRemainTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 8).ToString();
|
|
model.PeriodicReportNAFMII.ContractsInterestRateAsOfTheEndOfThisMonthAddNewTransactions = GetDataSetValue(dt, row, startCol + 9).ToString();
|
|
|
|
row = startRow + 1;
|
|
model.PeriodicReportNAFMII.NominalPrincipalGoldTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.NominalGoldThisMonthToAddTransactions = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.TheNominalGoldIsTradingThisMonth = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalGoldIsTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalGoldAsOfTheEndOfThisYearTheNewTransaction = GetDataSetValue(dt, row, startCol + 4).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsForGoldIsTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 5).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsGoldThisMonthToAddTransactions = GetDataSetValue(dt, row, startCol + 6).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsIsGoldThisMonth = GetDataSetValue(dt, row, startCol + 7).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsIsGoldAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 8).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsForTheGoldAsOfTheEndOfThisYearTheNewTransaction = GetDataSetValue(dt, row, startCol + 9).ToString();
|
|
|
|
row = startRow + 2;
|
|
model.PeriodicReportNAFMII.NominalPrincipalForeignExchangeTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalForeignExchangeThisMonthToAddTransactions = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.TheNominalPrincipalForeignExchangeSettledThisMonth = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalForeignExchangeTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalForeignExchangeAsOfTheEndOfThisYearTheNewTransaction = GetDataSetValue(dt, row, startCol + 4).ToString();
|
|
model.PeriodicReportNAFMII.ContractsForeignExchangeIsTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 5).ToString();
|
|
model.PeriodicReportNAFMII.ContractNumberForeignExchangeThisMonthNewTransaction = GetDataSetValue(dt, row, startCol + 6).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsForForeignExchangeTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 7).ToString();
|
|
model.PeriodicReportNAFMII.ContractsForeignExchangeIsTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 8).ToString();
|
|
model.PeriodicReportNAFMII.NumberOfContractsForeignExchangeAsOfTheEndOfThisMonthTheNewTransaction = GetDataSetValue(dt, row, startCol + 9).ToString();
|
|
|
|
row = startRow + 3;
|
|
model.PeriodicReportNAFMII.TheNameOfThePrincipalOtherTransactionsHeldEarlierThisMonth = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalOtherNewTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.TheNameOfThePrincipalOtherTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalOtherTransactionsRemainAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalOtherTransactionsUpToTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 4).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsIsTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 5).ToString();
|
|
model.PeriodicReportNAFMII.ContractNumberOtherNewTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 6).ToString();
|
|
model.PeriodicReportNAFMII.TheNumberOfContractsOtherTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 7).ToString();
|
|
model.PeriodicReportNAFMII.ContractsOthersRemainTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 8).ToString();
|
|
model.PeriodicReportNAFMII.NumberOfContractsOtherTransactionsAsOfTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 9).ToString();
|
|
|
|
row = startRow + 4;
|
|
model.PeriodicReportNAFMII.TheNominalPrincipalIsTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 0).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalTotalNewTransactionsThisMonth = GetDataSetValue(dt, row, startCol + 1).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalTotalSettledThisMonth = GetDataSetValue(dt, row, startCol + 2).ToString();
|
|
model.PeriodicReportNAFMII.TheNominalPrincipalIsTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 3).ToString();
|
|
model.PeriodicReportNAFMII.NominalPrincipalTotalNewTransactionAsOfTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 4).ToString();
|
|
model.PeriodicReportNAFMII.TheTotalNumberOfContractsIsTradedAtTheBeginningOfThisMonth = GetDataSetValue(dt, row, startCol + 5).ToString();
|
|
model.PeriodicReportNAFMII.TheTotalNumberOfContractsIsAddedThisMonth = GetDataSetValue(dt, row, startCol + 6).ToString();
|
|
model.PeriodicReportNAFMII.TheTotalNumberOfContractsIsSettledThisMonth = GetDataSetValue(dt, row, startCol + 7).ToString();
|
|
model.PeriodicReportNAFMII.TheTotalNumberOfContractsIsTradedAtTheEndOfThisMonth = GetDataSetValue(dt, row, startCol + 8).ToString();
|
|
model.PeriodicReportNAFMII.TheTotalNumberOfContractsAsOfTheEndOfThisYearAddTheNewTransaction = GetDataSetValue(dt, row, startCol + 9).ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取其他交易明细
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private List<ScheduleOfOtherTransactionModel> GetScheduleOfOtherTransactionModel()
|
|
{
|
|
var result = new List<ScheduleOfOtherTransactionModel>();
|
|
if (_excelDataSource != null && _excelDataSource.Tables.Contains("其他交易明细"))
|
|
{
|
|
var dt = _excelDataSource.Tables["其他交易明细"];
|
|
for (var i = 1; i < dt.Rows.Count; i++)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
|
|
{
|
|
//第一列空白说明数据结束了;
|
|
break;
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取利率互换明细
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private List<InterestRateSwapDetailModel> GetInterestRateSwapDetailModel()
|
|
{
|
|
var result = new List<InterestRateSwapDetailModel>();
|
|
if (_excelDataSource != null && _excelDataSource.Tables.Contains("利率互换明细"))
|
|
{
|
|
var dt = _excelDataSource.Tables["利率互换明细"];
|
|
for (var i = 2; i < dt.Rows.Count; i++)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
|
|
{
|
|
//第一列空白说明数据结束了;
|
|
break;
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取利率期权明细
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private List<InterestRateOptionDetailModel> GetInterestRateOptionDetailModel()
|
|
{
|
|
var result = new List<InterestRateOptionDetailModel>();
|
|
if (_excelDataSource != null && _excelDataSource.Tables.Contains("利率期权明细"))
|
|
{
|
|
var dt = _excelDataSource.Tables["利率期权明细"];
|
|
for (var i = 1; i < dt.Rows.Count; i++)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
|
|
{
|
|
//第一列空白说明数据结束了;
|
|
break;
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
protected override List<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
|
|
{
|
|
var result = new List<SacInfo>();
|
|
if (model?.PeriodicReportNAFMII != null)
|
|
{
|
|
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 (var i = 0; i < model.PeriodicReportNAFMII.InterestRateSwapDetails.Count; i++)
|
|
{
|
|
var listItem = new List<SacInfo>();
|
|
var item = model.PeriodicReportNAFMII.InterestRateSwapDetails[i];
|
|
swapDetailHelper.ExecuteCheck(item, (name, value, msg) =>
|
|
{
|
|
listItem.Add(new SacInfo(name, value, msg));
|
|
});
|
|
if (listItem.Count > 0)
|
|
{
|
|
var temp = new SacInfo("InterestRateSwapDetails", i)
|
|
{
|
|
SubMaps = new List<SacInfo>(listItem)
|
|
};
|
|
listRoot.Add(temp);
|
|
}
|
|
}
|
|
}
|
|
if (model.PeriodicReportNAFMII.InterestRateOptionDetails != null)
|
|
{
|
|
for (var i = 0; i < model.PeriodicReportNAFMII.InterestRateOptionDetails.Count; i++)
|
|
{
|
|
var listItem = new List<SacInfo>();
|
|
var item = model.PeriodicReportNAFMII.InterestRateOptionDetails[i];
|
|
optionDetailHelper.ExecuteCheck(item, (name, value, msg) =>
|
|
{
|
|
listItem.Add(new SacInfo(name, value, msg));
|
|
});
|
|
if (listItem.Count > 0)
|
|
{
|
|
var temp = new SacInfo("InterestRateOptionDetails", i)
|
|
{
|
|
SubMaps = new List<SacInfo>(listItem)
|
|
};
|
|
listRoot.Add(temp);
|
|
}
|
|
}
|
|
}
|
|
if (model.PeriodicReportNAFMII.ScheduleOfOtherTransactions != null)
|
|
{
|
|
for (var i = 0; i < model.PeriodicReportNAFMII.ScheduleOfOtherTransactions.Count; i++)
|
|
{
|
|
var listItem = new List<SacInfo>();
|
|
var item = model.PeriodicReportNAFMII.ScheduleOfOtherTransactions[i];
|
|
transactionHelper.ExecuteCheck(item, (name, value, msg) =>
|
|
{
|
|
listItem.Add(new SacInfo(name, value, msg));
|
|
});
|
|
if (listItem.Count > 0)
|
|
{
|
|
var temp = new SacInfo("ScheduleOfOtherTransactions", i)
|
|
{
|
|
SubMaps = new List<SacInfo>(listItem)
|
|
};
|
|
listRoot.Add(temp);
|
|
}
|
|
}
|
|
}
|
|
if (listRoot.Count > 0)
|
|
{
|
|
var errMsg = new SacInfo("PeriodicReportNAFMII")
|
|
{
|
|
SubMaps = new List<SacInfo>(listRoot)
|
|
};
|
|
result.Add(errMsg);
|
|
}
|
|
}
|
|
checkStatus = result.Count > 0;
|
|
return result;
|
|
}
|
|
|
|
private string formatInfoTag(string tag, bool suffixType = false)
|
|
{
|
|
var result = $"{BusiDataType}_{tag}_";
|
|
if (suffixType)
|
|
{
|
|
result = $"{result}{_operationType}";
|
|
}
|
|
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 (var i = 0; i < noteList.Count; i++)
|
|
{
|
|
base.SaveReportNotes(noteList[i]);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|