Files
zszq-trs/YLErpDAL/Modules/SuperviseReportModule/ExtendReport/ZheShang/SwapTradeMothReport.cs
T
2025-09-10 10:32:52 +08:00

71 lines
2.8 KiB
C#

using BaseOUDAL;
using CsvHelper;
using Org.BouncyCastle.Ocsp;
using Qdp.Foundation.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YLErp.DBModels;
using YLErp.DBModels.Consts;
using YLErp.DBModels.Enums;
using YLErp.Helpers;
using YLErp.Model;
using YLErp.Modules.SuperviseReportModule.ExtendReport.ZheQi;
namespace YLErp.Modules.SuperviseReportModule.ExtendReport.ZheShang
{
public class SwapTradeMothReport: SimpleExtendReportBaseService
{
public SwapTradeMothReport(OptUserInfo userInfo, SuperviseReportReq req) : base(userInfo, req)
{
}
public override string TemplateName => "月报基础数据债券收益互换.xlsx";
public override string TargetFileName => "月报基础数据债券收益互换"+ base.RequestInfo.ValueDate.ToString("yyyyMM") +".xlsx";
public override Dictionary<string, object> SearchReportInfo()
{
var yearMonth = RequestInfo.ValueDate.ToString("yyyy-MM-dd");
var dealList = new List<SwapTradeMothReportModel>();
var addList= new List<SwapTradeMothReportModel>();
var reportData = GetSwapMonthReport(yearMonth);
if (reportData != null)
{
if (reportData.DealList != null && reportData.DealList.Count > 0)
{
dealList = reportData.DealList;
}
if (reportData.AddList != null && reportData.AddList.Count > 0)
{
addList = reportData.AddList;
}
}
return new Dictionary<string, object>() {
{"本月新增业务明细", addList},
{"本月末存量业务明细", dealList}
};
}
private SwapTradeMothReportModelList GetSwapMonthReport(string yearMonth)
{
var baseUrl = Environment.GetEnvironmentVariable("Reg_Report_Url");
var calculateUrl = "/swap-trade/month-report?date="+yearMonth;
LogFactory.GetLogger("SwapTradeMothReport").Info("获取收益互换月报信息地址:" + baseUrl+ calculateUrl);
if (!string.IsNullOrEmpty(baseUrl))
{
var httpHelper = new HttpHelper(baseUrl, null);
var result = httpHelper.GetRequestNoAuth< SwapTradeMothReportModelListReponse>(calculateUrl).Result;
if (result != null && !result.success)
{
LogFactory.GetLogger("SwapTradeMothReport").Info("获取收益互换月报信息失败:" + result.message);
}
else
{
return result.data;
}
}
return null;
}
}
}