Merge branch 'glms/feature/1.4.2' of http://git.yiliantech.com/gitlab/otc-dev/zszq-trs into glms/feature/1.4.2

This commit is contained in:
锦麟 王
2026-03-13 18:27:47 +08:00
8 changed files with 37 additions and 26 deletions
+14
View File
@@ -229,6 +229,7 @@ namespace YLErp.MailKit
// 创建一个HttpClient实例
using (var httpClient = new HttpClient())
{
httpClient.Timeout = TimeSpan.FromMinutes(3); // 根据需要调整
var content = new MultipartFormDataContent();
// 添加收件人
content.Add(new StringContent(string.Join(",", option.MailTo)), "to");
@@ -276,6 +277,10 @@ namespace YLErp.MailKit
}
}
}
if (log != null) {
log.Invoke("邮件发送接口", "BaseUrl:" + baseUrl);
log.Invoke("邮件发送接口", "EmailPath:" + emailPath);
}
// 发送POST请求
var response = httpClient.PostAsync($"{baseUrl}{emailPath}", content).Result;
@@ -284,6 +289,10 @@ namespace YLErp.MailKit
{
// 解析响应内容并返回结果
var result = response.Content.ReadAsStringAsync().Result;
if (log != null)
{
log.Invoke("邮件发送接口", "响应内容:" + result);
}
if (string.IsNullOrEmpty(result))
{
throw new ArgumentException("发送邮件失败");
@@ -297,6 +306,11 @@ namespace YLErp.MailKit
}
else
{
if (log != null)
{
log.Invoke("邮件发送接口", "响应状态码:" + response.StatusCode);
log.Invoke("邮件发送接口", "响应内容:" + response.Content.ReadAsStringAsync().Result);
}
// 处理错误情况
}
}
@@ -25,6 +25,9 @@
<None Update="App_Docs\交易确认书\浙商证券利率债收益互换合约交易确认书模版.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="App_Docs\交易确认书\证券利率债收益互换合约交易确认书模版.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="App_Docs\结算单\DMA结算单.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+3 -3
View File
@@ -71,7 +71,7 @@ namespace YLErp.Helpers
.ToHashSet(StringComparer.OrdinalIgnoreCase);
var mailToArr = toSet.ToArray();
LogFactory.GetLogger("邮件发送").Info($"开始发送邮件,mailTo={mailTo},subject={subject}");
string result = MailSender.SendApi(new MailSendingOption
{
MailTo = mailToArr,
@@ -80,8 +80,8 @@ namespace YLErp.Helpers
IsBodyHtml = isBodyHtml,
FilesToAttach = filesToAttach,
CC = ccEmail
});
}, (name, info) => { LogFactory.GetLogger(name).Info(info); });
LogFactory.GetLogger("邮件发送").Info($"邮件发送完成,mailTo={mailTo},subject={subject},result={result}");
return string.Empty;
}
catch (Exception ex)
@@ -121,9 +121,7 @@ namespace YLErp.Modules.ReportModule.SettlementReportModule
/// <returns></returns>
public (EmailTradeConfirmResultType status, string message) SendSettlementReports(DingShiReportEmail emailData, ClientDingShiReport_ShanXi report, string template, bool IsSkipCheckMarginCall = false, List<string> recevier = null)
{
LogFactory.GetLogger().Error("开始发邮件[error]SendSettlementReports");
LogFactory.GetLogger().Info("开始发邮件[info]SendSettlementReports");
Console.WriteLine("开始发邮件[console]SendSettlementReports");
string message = null;
var attachFiles = new List<string>();
List<string> fileTypes=new List<string>();
@@ -175,13 +173,9 @@ namespace YLErp.Modules.ReportModule.SettlementReportModule
mailFrom = DBCacheManager.Single.GetStr(CacheTable.TradeMarketSendUser);
}
LogFactory.GetLogger().Error("开始发邮件[error]SendSettlementReports_start");
LogFactory.GetLogger().Info("开始发邮件[info]SendSettlementReports_start");
Console.WriteLine("开始发邮件[console]SendSettlementReports_start");
message = EmailHelper.SendMail(string.Join(";", emails), title, detail, true, attachFiles, emailData.CCEmail, mailFrom);
LogFactory.GetLogger().Error($"开始发邮件[error]SendSettlementReports_end {message}");
LogFactory.GetLogger().Info($"开始发邮件[info]SendSettlementReports_end {message}");
Console.WriteLine($"开始发邮件[console]SendSettlementReports_end {message}");
if (!string.IsNullOrEmpty(message))
{
@@ -56,7 +56,6 @@ namespace YLErp.Services.CashRecordModule
// 构建请求 URL
var apiUrl = $"{_baseUrl}/eusp/queryStatement";
var queryString = $"?token={Uri.EscapeDataString(token)}" +
$"&account={Uri.EscapeDataString(account)}" +
$"&beginDate={Uri.EscapeDataString(beginDate)}" +
$"&endDate={Uri.EscapeDataString(endDate)}";
@@ -157,7 +157,9 @@ namespace YLErp.Web.Areas.Admin.Controllers
{
return JsonError("发送邮件地址不能为空");
}
LogFactory.GetLogger().Info($"邮件发送测试,mailTo={mailTo}");
var error = EmailHelper.SendMail(mailTo, "邮件发送测试", "邮件发送测试");
LogFactory.GetLogger().Info($"邮件发送测试完成,mailTo={mailTo},error={error}");
if (string.IsNullOrWhiteSpace(error))
{
return JsonSuccess();
@@ -480,9 +480,7 @@ namespace YLErp.Web.Controllers
{
try
{
LogFactory.GetLogger<clientbalanceController>().Error("开始发邮件[error]SendReportMails");
LogFactory.GetLogger<clientbalanceController>().Info("开始发邮件[info]SendReportMails");
Console.WriteLine("开始发邮件[console]SendReportMails");
LogFactory.GetLogger().Info("开始发邮件[error]SendReportMails");
EmailTradeConfirmResultType status;
string message;
var report = new SettlementReportFotShanXiService(user).GetReportData(emailData, userAssetUnits, template);
@@ -501,10 +499,6 @@ namespace YLErp.Web.Controllers
}
catch (Exception e)
{
LogFactory.GetLogger().Error($"开始发邮件[error]SendSettlementReports_end", e);
LogFactory.GetLogger().Info($"开始发邮件[info]SendSettlementReports_end11");
Console.WriteLine($"开始发邮件[console]SendSettlementReports_end", e);
LogFactory.GetLogger<clientbalanceController>().Error(e, "GenerateTradeMarketBill2");
return JsonError(e.Message == "The number of columns in PdfPTable constructor must be greater than zero." ? "生成的pdf列表的列数必须大于零,请检查配置列不可为空" : e.Message);
}
+14 -9
View File
@@ -537,12 +537,6 @@ namespace YLErp.Web.Controllers
return JsonSuccess("未获取到银行流水数据");
}
var clientId = req.clientId;
if (!clientId.HasValue || clientId == 0)
{
return JsonError("请选择客户");
}
var existingFlowIds = yldb.ClientCashInCashOut
.Where(c => !string.IsNullOrEmpty(c.BankFlowId))
.Select(c => c.BankFlowId)
@@ -553,6 +547,7 @@ namespace YLErp.Web.Controllers
var skipCount = 0;
var duplicateCount = 0;
var invalidCounterpartyCount = 0;
var ids = new List<int>();
foreach (var flow in result.data)
{
@@ -601,14 +596,19 @@ namespace YLErp.Web.Controllers
BankFlowId = flow.flowId,
SerialNumber = flow.flowId,
OpenBankCard = flow.counterpartyAccount,
cash_type = direction == "入金" ? "追保账户" : "初保账户",
Comments = $"银行流水导入 | 对方账号:{flow.counterpartyAccount} | 对方户名:{flow.counterpartyName} | 用途:{flow.useDescribe}"
};
try
{
service.SaveEntryexit(null, cashRecord);
existingFlowIds.Add(flow.flowId);
saveCount++;
var savedId = service.SaveEntryexit(null, cashRecord);
if (null != savedId )
{
ids.Add(savedId.id);
existingFlowIds.Add(flow.flowId);
saveCount++;
}
}
catch (Exception ex)
{
@@ -616,6 +616,11 @@ namespace YLErp.Web.Controllers
}
}
if (ids.Any())
{
new ClientCashInCashOutDataService(CurUser).ExcuteEntryExit(ids, kafkaProduceHelper);
}
return JsonSuccess($"获取银行流水成功,共处理{result.data.Count}条,成功保存{saveCount}条,跳过{skipCount}条(无效对手方账号{invalidCounterpartyCount}条,重复{duplicateCount}条)");
}
catch (Exception ex)