study-邮件发送修改-迁移
parent
40806ffda4
commit
c4e53d5654
|
@ -78,7 +78,9 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Hangfire.Tags.SqlServer" Version="1.8.1" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.5" />
|
||||
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
|
||||
|
|
|
@ -45,22 +45,7 @@
|
|||
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6300"
|
||||
},
|
||||
"IRaCIS.CertificateApply": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "CertificateApply"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6400"
|
||||
},
|
||||
"IRaCIS.CenterImageDev": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "CenterImageDev"
|
||||
},
|
||||
"applicationUrl": "http://localhost:6500"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -114,7 +114,7 @@ namespace IRaCIS.Core.API
|
|||
//services.AddDistributedMemoryCache();
|
||||
|
||||
// hangfire 定时任务框架 有界面,更友好~
|
||||
//services.AddhangfireSetup(_configuration);
|
||||
services.AddhangfireSetup(_configuration);
|
||||
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
|
||||
services.AddQuartZSetup(_configuration);
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace IRaCIS.Core.API
|
|||
app.UseLogDashboard("/LogDashboard");
|
||||
|
||||
//hangfire
|
||||
//app.UseHangfireConfig(env);
|
||||
app.UseHangfireConfig(env);
|
||||
|
||||
////暂时废弃
|
||||
//app.UseHttpReports();
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
using Hangfire;
|
||||
using Hangfire.Dashboard;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
|
||||
|
||||
public static class HangfireConfig
|
||||
{
|
||||
|
||||
public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseHangfireDashboard("/api/hangfire", new DashboardOptions()
|
||||
{
|
||||
//直接访问,没有带token 获取不到用户身份信息,所以这种自定义授权暂时没法使用
|
||||
//Authorization = new[] { new hangfireAuthorizationFilter() }
|
||||
|
||||
//本地请求 才能看
|
||||
Authorization = new[] { new LocalRequestsOnlyAuthorizationFilter() }
|
||||
|
||||
});
|
||||
|
||||
#region hangfire
|
||||
//// 延迟任务执行 1秒之后执行 有时启动没运行 换成添加到队列中
|
||||
//BackgroundJob.Schedule<ICacheTrialStatusJob>(t => t.MemoryCacheTrialStatus(), TimeSpan.FromSeconds(1));
|
||||
////添加到后台任务队列,
|
||||
//BackgroundJob.Enqueue<ICacheTrialStatusJob>(t => t.MemoryCacheTrialStatus());
|
||||
|
||||
//周期性任务,1天执行一次
|
||||
|
||||
RecurringJob.AddOrUpdate<IIRaCISCacheHangfireJob>(t => t.ProjectStartCache(), Cron.Daily);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
using Hangfire;
|
||||
using Hangfire.Dashboard;
|
||||
using Hangfire.Dashboard.BasicAuthorization;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
using IRaCIS.Core.API.Filter;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
|
||||
|
||||
public static class HangfireConfig
|
||||
{
|
||||
|
||||
public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
||||
|
||||
app.UseHangfireDashboard("/back/hangfire", new DashboardOptions()
|
||||
{
|
||||
|
||||
|
||||
|
||||
Authorization = new IDashboardAuthorizationFilter[] { /*new hangfireAuthorizationFilter(),*/
|
||||
|
||||
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
|
||||
SslRedirect=false,
|
||||
RequireSsl=false,
|
||||
Users=new BasicAuthAuthorizationUser[]{
|
||||
new BasicAuthAuthorizationUser(){
|
||||
Login="admin",
|
||||
PasswordClear="admin",
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
DashboardTitle ="后台任务管理",
|
||||
|
||||
|
||||
//Authorization = new BasicAuthAuthorizationFilter[] {
|
||||
// new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
|
||||
// SslRedirect=false,
|
||||
// RequireSsl=false,
|
||||
// Users=new BasicAuthAuthorizationUser[]{
|
||||
// new BasicAuthAuthorizationUser(){
|
||||
// Login="admin",
|
||||
// PasswordClear="test",
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// })
|
||||
//}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
using Hangfire;
|
||||
using Hangfire.SqlServer;
|
||||
using Hangfire.Tags.SqlServer;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
public static class hangfireSetup
|
||||
public static class hangfireSetup
|
||||
{
|
||||
public static void AddhangfireSetup(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
|
@ -15,24 +14,29 @@ namespace IRaCIS.Core.API
|
|||
|
||||
services.AddHangfire(hangFireConfig =>
|
||||
{
|
||||
|
||||
//hangFireConfig.UseInMemoryStorage();
|
||||
|
||||
//指定存储介质
|
||||
hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions()
|
||||
{
|
||||
SchemaName = "hangfire",
|
||||
SchemaName = "dbo",
|
||||
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
||||
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
||||
QueuePollInterval = TimeSpan.Zero,
|
||||
UseRecommendedIsolationLevel = true,
|
||||
UsePageLocksOnDequeue = true,
|
||||
DisableGlobalLocks = true
|
||||
});
|
||||
|
||||
hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer
|
||||
//hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer
|
||||
//.UseHangfireHttpJob();
|
||||
|
||||
});
|
||||
|
||||
services.AddHangfireServer();
|
||||
services.AddHangfireServer(option =>
|
||||
{
|
||||
option.Queues = new[] { "immediately_once", "default", "sys_init", "not_immediately_once" };
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=CenterImage_Test;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
},
|
||||
"BasicSystemConfig": {
|
||||
|
||||
"OpenUserComplexPassword": false,
|
||||
|
||||
"OpenSignDocumentBeforeWork": false,
|
||||
|
||||
"OpenTrialRelationDelete": true,
|
||||
|
||||
"OpenLoginLimit": false,
|
||||
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 30
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
"Port": 465,
|
||||
"Host": "smtp.qiye.aliyun.com",
|
||||
"FromEmail": "test@extimaging.com",
|
||||
"FromName": "Test_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021"
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_Certificate;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
|
||||
},
|
||||
"BasicSystemConfig": {
|
||||
|
||||
"OpenUserComplexPassword": false,
|
||||
|
||||
"OpenSignDocumentBeforeWork": false,
|
||||
|
||||
"OpenTrialRelationDelete": true,
|
||||
|
||||
"OpenLoginLimit": false
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
"Port": 465,
|
||||
"Host": "smtp.qiye.aliyun.com",
|
||||
"FromEmail": "test@extimaging.com",
|
||||
"FromName": "Test_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021"
|
||||
}
|
||||
|
||||
}
|
|
@ -38,7 +38,9 @@
|
|||
"Host": "smtp.qiye.aliyun.com",
|
||||
"FromEmail": "test@extimaging.com",
|
||||
"FromName": "Test_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021"
|
||||
"AuthorizationCode": "SHzyyl2021",
|
||||
|
||||
"SiteUrl": "http://test.extimaging.com/login"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
"Host": "smtp.qiye.aliyun.com",
|
||||
"FromEmail": "IRC@extimaging.com",
|
||||
"FromName": "IRC",
|
||||
"AuthorizationCode": "ExtImg@2022"
|
||||
"AuthorizationCode": "ExtImg@2022",
|
||||
"SiteUrl": "http://irc.extimaging.com/login"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
"Host": "smtp.qiye.aliyun.com",
|
||||
"FromEmail": "uat@extimaging.com",
|
||||
"FromName": "UAT_IRC",
|
||||
"AuthorizationCode": "SHzyyl2021"
|
||||
"AuthorizationCode": "SHzyyl2021",
|
||||
"SiteUrl": "http://uat.extimaging.com/login"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
using Hangfire;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Helper
|
||||
{
|
||||
public static class HangfireJobHelper
|
||||
{
|
||||
|
||||
|
||||
|
||||
//public static void AddOrUpdateCronJob(string jobId, string queueName, Expression<Action> methodCall, string cron)
|
||||
//{
|
||||
// RecurringJob.AddOrUpdate(jobId, queueName, methodCall, cron);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//添加 或者更新定时任务 Id 要唯一标识一个定义任务
|
||||
public static void AddOrUpdateCronJob<T>(string jobId, Expression<Action<T>> methodCall, string cron, string queueName = "default")
|
||||
{
|
||||
RecurringJob.AddOrUpdate<T>(jobId, queueName, methodCall, cron);
|
||||
}
|
||||
|
||||
public static void AddOrUpdateInitCronJob<T>(string jobId, Expression<Action<T>> methodCall, string cron)
|
||||
{
|
||||
RecurringJob.AddOrUpdate<T>(jobId, "sys_init", methodCall, cron);
|
||||
}
|
||||
|
||||
public static void RemoveCronJob(string jobId)
|
||||
{
|
||||
RecurringJob.RemoveIfExists(jobId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void ImmediatelyOnceOnlyJob(Expression<Action> methodCall)
|
||||
{
|
||||
BackgroundJob.Enqueue("immediately_once", methodCall);
|
||||
}
|
||||
|
||||
public static void ImmediatelyOnceOnlyJob<T>(Expression<Action<T>> methodCall)
|
||||
{
|
||||
BackgroundJob.Enqueue<T>("immediately_once", methodCall);
|
||||
}
|
||||
|
||||
public static void NotImmediatelyOnceOnlyJob(Expression<Action> methodCall, TimeSpan timeSpan)
|
||||
{
|
||||
BackgroundJob.Schedule("not_immediately_once", methodCall, timeSpan);
|
||||
}
|
||||
|
||||
public static void NotImmediatelyOnceOnlyJob<T>(Expression<Action<T>> methodCall, TimeSpan timeSpan)
|
||||
{
|
||||
BackgroundJob.Schedule<T>("not_immediately_once", methodCall, timeSpan);
|
||||
}
|
||||
|
||||
|
||||
public static void AddOrUpdateTrialCronJob (string jobId, Guid trialId, EmailBusinessScenario businessScenario, string emailCron)
|
||||
{
|
||||
|
||||
switch (businessScenario)
|
||||
{
|
||||
|
||||
case EmailBusinessScenario.QCTask:
|
||||
HangfireJobHelper.AddOrUpdateCronJob<IEmailSendService>(jobId, t => t.SendTrialImageQCTaskEmailAsync(trialId), emailCron);
|
||||
break;
|
||||
case EmailBusinessScenario.QCQuestion:
|
||||
HangfireJobHelper.AddOrUpdateCronJob<IEmailSendService>(jobId, t => t.SendTrialQCQuestionEmailAsync(trialId), emailCron);
|
||||
break;
|
||||
case EmailBusinessScenario.ImageQuestion:
|
||||
HangfireJobHelper.AddOrUpdateCronJob<IEmailSendService>(jobId, t => t.SendTrialImageQuestionAsync(trialId), emailCron);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,6 +64,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.5" />
|
||||
<PackageReference Include="AutoMapper.Collection.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="BeetleX.BNR" Version="1.0.1" />
|
||||
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
|
||||
|
@ -76,9 +77,6 @@
|
|||
<PackageReference Include="fo-dicom.Drawing" Version="4.0.8" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.0.3" />
|
||||
<PackageReference Include="FreeSpire.Doc" Version="10.8.0" />
|
||||
<PackageReference Include="Hangfire" Version="1.7.31">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magicodes.IE.Core" Version="2.7.4.2" />
|
||||
<PackageReference Include="Magicodes.IE.Csv" Version="2.7.4.2">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
|
|
|
@ -685,6 +685,27 @@
|
|||
PublishLogService
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.EmailSendService.SendTrialImageQCTaskEmailAsync(System.Guid)">
|
||||
<summary>
|
||||
影像质控
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.EmailSendService.SendTrialQCQuestionEmailAsync(System.Guid)">
|
||||
<summary>
|
||||
QC质疑
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.EmailSendService.SendTrialImageQuestionAsync(System.Guid)">
|
||||
<summary>
|
||||
影像质疑
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService">
|
||||
<summary>
|
||||
TrialEmailNoticeConfigService
|
||||
|
@ -706,7 +727,7 @@
|
|||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.SyncSystemEmainCofigDocListAsync(System.Guid)">
|
||||
<summary>
|
||||
同步系统配置的文档到想项目中
|
||||
同步系统配置的文档到想项目中 ---废弃
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
|
@ -756,6 +777,27 @@
|
|||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.GetTrialUserIdSelectList(System.Guid)">
|
||||
<summary>
|
||||
黑名单用户Id 列表
|
||||
</summary>
|
||||
<param name="trialEmailNoticeConfigId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.GetSysEmailNoticeConfigList(IRaCIS.Core.Application.Contracts.EmailNoticeConfigQuery)">
|
||||
<summary>
|
||||
获取系统 邮件配置 勾选列表
|
||||
</summary>
|
||||
<param name="queryEmailNoticeConfig"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.BatchAddSysEmailConfig(System.Collections.Generic.List{IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig})">
|
||||
<summary>
|
||||
批量勾选 传递列表每行数据,后台进行处理转换,建立关联关系
|
||||
</summary>
|
||||
<param name="batchAddList"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
|
||||
<summary> 指定资源Id,渲染Dicom检查的Jpeg预览图像 </summary>
|
||||
<param name="studyId"> Dicom检查的Id </param>
|
||||
|
@ -8922,6 +8964,27 @@
|
|||
<member name="T:IRaCIS.Core.Application.ViewModel.TrialEmailNoticeConfigQuery">
|
||||
<summary>TrialEmailNoticeConfigQuery 列表查询参数模型</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.BusinessModuleEnum">
|
||||
<summary> 业务模块 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.BusinessLevelEnum">
|
||||
<summary> 业务层级 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.EmailTypeEnum">
|
||||
<summary> 邮件类型 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.EmailUrgentEnum">
|
||||
<summary> 邮件加急类型 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.EmailCron">
|
||||
<summary> 定时周期 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.EmailTopic">
|
||||
<summary> 邮件主题 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.ViewModel.BatchAddTrialEmailNoticeConfig.AttachPath">
|
||||
<summary> 附件 /// </summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.ViewModel.TrialEmailNoticeConfigAddOrEdit">
|
||||
<summary> TrialEmailNoticeConfigAddOrEdit 列表查询参数模型</summary>
|
||||
</member>
|
||||
|
@ -9816,6 +9879,24 @@
|
|||
是否区分标准
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.BusinessModuleEnum">
|
||||
<summary> 业务模块 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.BusinessLevelEnum">
|
||||
<summary> 业务层级 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.EmailTypeEnum">
|
||||
<summary> 邮件类型 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.EmailUrgentEnum">
|
||||
<summary> 邮件加急类型 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.EmailCron">
|
||||
<summary> 定时周期 /// </summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.EmailNoticeConfigAddOrEdit.EmailTopic">
|
||||
<summary> 邮件主题 /// </summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Contracts.SystemBasicDataView">
|
||||
<summary> SystemBasicDataView 列表视图模型 </summary>
|
||||
</member>
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
{
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
public CommonDocumentFileType? FileTypeEnum { get; set; }
|
||||
public CommonDocumentBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
|
||||
public string Name { get; set; } = String.Empty;
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
public CommonDocumentFileType FileTypeEnum { get; set; }
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
|
||||
//public Guid FileTypeId { get; set; }
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
// 生成时间 2022-02-15 11:55:57
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
public class TrialSelectEmailNoticeConfigView : EmailNoticeConfigView
|
||||
{
|
||||
public bool IsHaveSelected { get; set; }
|
||||
}
|
||||
|
||||
/// <summary> EmailNoticeConfigView 列表视图模型 </summary>
|
||||
public class EmailNoticeConfigView : EmailNoticeConfigAddOrEdit
|
||||
{
|
||||
|
@ -19,6 +25,12 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
|
||||
public List<EmailUserTypeDto> EmailNoticeUserList { get; set; }
|
||||
|
||||
|
||||
public new List<UserTypeEnum> ToUserTypeList => EmailNoticeUserList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList();
|
||||
public new List<UserTypeEnum> CopyUserTypeList => EmailNoticeUserList.Where(t => t.EmailUserType == EmailUserType.Copy).Select(t => t.UserType).ToList();
|
||||
|
||||
//[JsonIgnore]
|
||||
//public SystemBasicDataSelect Scenario { get; set; }
|
||||
////public Guid? ScenarioParentId => Scenario.ParentId;
|
||||
|
@ -28,17 +40,29 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class EmailUserTypeDto
|
||||
{
|
||||
public UserTypeEnum UserType { get; set; }
|
||||
|
||||
public EmailUserType EmailUserType { get; set; }
|
||||
}
|
||||
|
||||
///<summary>EmailNoticeConfigQuery 列表查询参数模型</summary>
|
||||
public class EmailNoticeConfigQuery:PageInput
|
||||
public class EmailNoticeConfigQuery : PageInput
|
||||
{
|
||||
//public Guid? ScenarioId { get; set; }
|
||||
|
||||
public CommonDocumentBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
|
||||
public bool? IsReturnRequired { get; set; }
|
||||
public bool? IsUrgent { get; set; }
|
||||
public bool? IsEnable { get; set; }
|
||||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
public bool? IsDistinguishCriteria { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary> EmailNoticeConfigAddOrEdit 列表查询参数模型</summary>
|
||||
|
@ -47,31 +71,66 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public Guid? Id { get; set; }
|
||||
public string Code { get; set; } = String.Empty;
|
||||
|
||||
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否区分标准
|
||||
/// </summary>
|
||||
public bool IsDistinguishCriteria { get; set; }
|
||||
|
||||
|
||||
//public string AuthorizationCode { get; set; } = String.Empty;
|
||||
//public Guid ScenarioId { get; set; }
|
||||
//public string Title { get; set; } = String.Empty;
|
||||
//public string Body { get; set; } = String.Empty;
|
||||
//public string FromEmail { get; set; } = String.Empty;
|
||||
//public string ReceiveEmail { get; set; } = String.Empty;
|
||||
//public string CopyEmail { get; set; } = String.Empty;
|
||||
public bool IsReturnRequired { get; set; }
|
||||
public bool IsUrgent { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public bool IsAutoSend { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
|
||||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 业务模块 /// </summary>
|
||||
public int BusinessModuleEnum { get; set; }
|
||||
|
||||
/// <summary> 业务层级 /// </summary>
|
||||
public int BusinessLevelEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件类型 /// </summary>
|
||||
public int EmailTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件加急类型 /// </summary>
|
||||
public int EmailUrgentEnum { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary> 定时周期 /// </summary>
|
||||
public string EmailCron { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 邮件主题 /// </summary>
|
||||
public string EmailTopic { get; set; } = string.Empty;
|
||||
|
||||
public string EmailTopicCN { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string AttachPath { get; set; } = string.Empty;
|
||||
|
||||
public string AttachCNPath { get; set; } = string.Empty;
|
||||
|
||||
public string EmailHtmlContent { get; set; } = string.Empty;
|
||||
|
||||
public string EmailHtmlContentCN { get; set; } = string.Empty;
|
||||
|
||||
public string AttachName { get; set; }
|
||||
public string AttachNameCN { get; set; }
|
||||
|
||||
|
||||
public List<UserTypeEnum> ToUserTypeList { get; set; }
|
||||
public List<UserTypeEnum> CopyUserTypeList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,19 +17,22 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public class EmailNoticeConfigService : BaseService, IEmailNoticeConfigService
|
||||
{
|
||||
private readonly IRepository<EmailNoticeConfig> _emailNoticeConfigrepository;
|
||||
private readonly IRepository<EmailNoticeUserType> _emailNoticeUserTypeRepository;
|
||||
|
||||
public EmailNoticeConfigService(IRepository<EmailNoticeConfig> repository)
|
||||
public EmailNoticeConfigService(IRepository<EmailNoticeConfig> repository, IRepository<EmailNoticeUserType> emailNoticeUserTypeRepository)
|
||||
{
|
||||
_emailNoticeConfigrepository = repository;
|
||||
_emailNoticeUserTypeRepository = emailNoticeUserTypeRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<EmailNoticeConfigView>> GetEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig)
|
||||
{
|
||||
var emailNoticeConfigQueryable = _emailNoticeConfigrepository
|
||||
.WhereIf(queryEmailNoticeConfig.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == queryEmailNoticeConfig.IsDistinguishCriteria)
|
||||
.WhereIf(queryEmailNoticeConfig.CriterionTypeEnum != null, t => t.CriterionTypeEnum == queryEmailNoticeConfig.CriterionTypeEnum)
|
||||
.WhereIf(queryEmailNoticeConfig.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryEmailNoticeConfig.BusinessScenarioEnum)
|
||||
.WhereIf(queryEmailNoticeConfig.IsReturnRequired != null, t => t.IsReturnRequired == queryEmailNoticeConfig.IsReturnRequired)
|
||||
.WhereIf(queryEmailNoticeConfig.IsUrgent != null, t => t.IsUrgent == queryEmailNoticeConfig.IsUrgent)
|
||||
.WhereIf(queryEmailNoticeConfig.IsEnable != null, t => t.IsEnable == queryEmailNoticeConfig.IsEnable)
|
||||
.ProjectTo<EmailNoticeConfigView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
@ -39,10 +42,55 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public async Task<IResponseOutput> AddOrUpdateEmailNoticeConfig(EmailNoticeConfigAddOrEdit addOrEditEmailNoticeConfig)
|
||||
{
|
||||
|
||||
var entity = await _emailNoticeConfigrepository.InsertOrUpdateAsync(addOrEditEmailNoticeConfig, true);
|
||||
if (addOrEditEmailNoticeConfig.Id == null)
|
||||
{
|
||||
|
||||
var entity = _mapper.Map<EmailNoticeConfig>(addOrEditEmailNoticeConfig);
|
||||
|
||||
|
||||
foreach (var item in addOrEditEmailNoticeConfig.ToUserTypeList)
|
||||
{
|
||||
entity.EmailNoticeUserTypeList.Add(new EmailNoticeUserType() { EmailUserType = EmailUserType.To, UserType = item });
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in addOrEditEmailNoticeConfig.CopyUserTypeList)
|
||||
{
|
||||
entity.EmailNoticeUserTypeList.Add(new EmailNoticeUserType() { EmailUserType = EmailUserType.Copy, UserType = item });
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _emailNoticeConfigrepository.AddAsync(entity, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
var emailNoticeConfigId = addOrEditEmailNoticeConfig.Id;
|
||||
await _emailNoticeUserTypeRepository.BatchDeleteNoTrackingAsync(t => t.EmailNoticeConfigId == emailNoticeConfigId);
|
||||
|
||||
|
||||
foreach (var item in addOrEditEmailNoticeConfig.ToUserTypeList)
|
||||
{
|
||||
await _emailNoticeUserTypeRepository.AddAsync(new EmailNoticeUserType() { EmailUserType = EmailUserType.To, UserType = item, EmailNoticeConfigId = (Guid)emailNoticeConfigId });
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in addOrEditEmailNoticeConfig.CopyUserTypeList)
|
||||
{
|
||||
await _emailNoticeUserTypeRepository.AddAsync(new EmailNoticeUserType() { EmailUserType = EmailUserType.Copy, UserType = item, EmailNoticeConfigId = (Guid)emailNoticeConfigId });
|
||||
|
||||
}
|
||||
|
||||
|
||||
var entity = await _emailNoticeConfigrepository.UpdateFromDTOAsync(addOrEditEmailNoticeConfig, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<FrontAuditConfig, FrontAuditConfigAddOrEdit>().ReverseMap();
|
||||
|
||||
CreateMap<EmailNoticeConfigAddOrEdit, EmailNoticeConfig>().ReverseMap();
|
||||
CreateMap<EmailNoticeConfig, EmailNoticeConfigView>();
|
||||
var trialId = Guid.Empty;
|
||||
CreateMap<EmailNoticeConfig, TrialSelectEmailNoticeConfigView>().IncludeBase<EmailNoticeConfig, EmailNoticeConfigView>()
|
||||
.ForMember(o => o.IsHaveSelected, t => t.MapFrom(u => u.TrialEmailNoticeConfigList.Any(c => c.TrialId == trialId && c.SysEmailNoticeConfigId == u.Id)))
|
||||
;
|
||||
|
||||
CreateMap<EmailNoticeConfig, EmailNoticeConfigView>()
|
||||
.ForMember(t => t.EmailNoticeUserList, u => u.MapFrom(c => c.EmailNoticeUserTypeList));
|
||||
|
||||
|
||||
CreateMap<SystemBasicData, SystemBasicDataView>();
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
}
|
||||
|
||||
|
||||
public class EmailUserInfoDto
|
||||
public class EmailUserInfoDto
|
||||
{
|
||||
|
||||
public Guid TrialEmailNoticeConfigId { get; set; }
|
||||
|
@ -77,7 +77,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
/// <summary>
|
||||
/// SMTP端口
|
||||
/// </summary>
|
||||
public int? EmailSMTPServerPort { get; set; }
|
||||
public int EmailSMTPServerPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否配置过邮箱
|
||||
|
@ -87,7 +87,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public class SetTrialEmailInDto : GetTrialEmailSetOutDto
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public class GetTrialEmailSetInDto
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public CommonDocumentBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario? BusinessScenarioEnum { get; set; }
|
||||
|
||||
//public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
|
@ -117,51 +117,98 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
}
|
||||
|
||||
///<summary> TrialEmailNoticeConfigAddOrEdit 列表查询参数模型</summary>
|
||||
public class TrialEmailNoticeConfigAddOrEdit
|
||||
public class BatchAddTrialEmailNoticeConfig
|
||||
{
|
||||
|
||||
|
||||
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string AuthorizationCode { get; set; } = string.Empty;
|
||||
|
||||
public string SMTPServerAddress { get; set; } = string.Empty;
|
||||
|
||||
public int SMTPServerPort { get; set; }
|
||||
|
||||
public CriterionType CriterionTypeEnum { get; set; }
|
||||
|
||||
public string FromName { get; set; } = string.Empty;
|
||||
|
||||
public string FromEmail { get; set; } = string.Empty;
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
|
||||
public List<UserTypeEnum>? ToUserTypeList { get; set; }
|
||||
public List<UserTypeEnum> ToUserTypeList { get; set; }
|
||||
public List<UserTypeEnum> CopyUserTypeList { get; set; }
|
||||
|
||||
|
||||
|
||||
public bool IsUrgent { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
public bool IsAutoSend { get; set; }
|
||||
|
||||
|
||||
public bool IsReturnRequired { get; set; }
|
||||
|
||||
public string FilePath { get; set; } = string.Empty;
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary> 业务模块 /// </summary>
|
||||
public int BusinessModuleEnum { get; set; }
|
||||
|
||||
/// <summary> 业务层级 /// </summary>
|
||||
public int BusinessLevelEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件类型 /// </summary>
|
||||
public int EmailTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件加急类型 /// </summary>
|
||||
public int EmailUrgentEnum { get; set; }
|
||||
|
||||
/// <summary> 定时周期 /// </summary>
|
||||
public string EmailCron { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 邮件主题 /// </summary>
|
||||
public string EmailTopic { get; set; } = string.Empty;
|
||||
|
||||
public string EmailTopicCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 附件 /// </summary>
|
||||
public string AttachPath { get; set; } = string.Empty;
|
||||
|
||||
public string AttachCNPath { get; set; } = string.Empty;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string AttachName { get; set; } = string.Empty;
|
||||
public string AttachNameCN { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string EmailHtmlContent { get; set; } = string.Empty;
|
||||
public string EmailHtmlContentCN { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
///<summary> TrialEmailNoticeConfigAddOrEdit 列表查询参数模型</summary>
|
||||
public class TrialEmailNoticeConfigAddOrEdit : BatchAddTrialEmailNoticeConfig
|
||||
{
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
|
||||
public string AuthorizationCode { get; set; } = string.Empty;
|
||||
|
||||
public string SMTPServerAddress { get; set; } = string.Empty;
|
||||
|
||||
public int SMTPServerPort { get; set; }
|
||||
|
||||
|
||||
public string FromName { get; set; } = string.Empty;
|
||||
|
||||
public string FromEmail { get; set; } = string.Empty;
|
||||
|
||||
public List<Guid> BlackUserIdList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,403 @@
|
|||
using DocumentFormat.OpenXml.EMMA;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MailKit;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.VisualBasic;
|
||||
using MimeKit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
public interface IEmailSendService
|
||||
{
|
||||
Task SendEnrollOrPdEmail(Guid visitTaskId, bool? isEnrollment, bool? isPDConfirm);
|
||||
Task SendTrialImageQCTaskEmailAsync(Guid trialId);
|
||||
|
||||
Task SendTrialQCQuestionEmailAsync(Guid trialId);
|
||||
Task SendTrialImageQuestionAsync(Guid trialId);
|
||||
}
|
||||
|
||||
public class EmailSendService : BaseService, IEmailSendService
|
||||
{
|
||||
private readonly IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository;
|
||||
|
||||
private readonly IRepository<EmailNoticeConfig> _emailNoticeConfigRepository;
|
||||
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
private readonly IDictionaryService _dictionaryService;
|
||||
private readonly IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig;
|
||||
|
||||
public readonly static string EmailNamePlaceholder = "EmailNamePlaceholder";
|
||||
|
||||
public EmailSendService(IRepository<TrialEmailNoticeConfig> trialEmailNoticeConfigRepository, IRepository<EmailNoticeConfig> emailNoticeConfigRepository, IRepository<Trial> trialRepository, IOptionsMonitor<SystemEmailSendConfig> systemEmailSendConfig, IDictionaryService dictionaryService)
|
||||
{
|
||||
_trialEmailNoticeConfigRepository = trialEmailNoticeConfigRepository;
|
||||
_emailNoticeConfigRepository = emailNoticeConfigRepository;
|
||||
_trialRepository = trialRepository;
|
||||
_SystemEmailSendConfig = systemEmailSendConfig;
|
||||
_dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
//入组确认/PD确认
|
||||
|
||||
public async Task SendEnrollOrPdEmail(Guid visitTaskId, bool? isEnrollment, bool? isPDConfirm)
|
||||
{
|
||||
EmailBusinessScenario businessScenarioEnum;
|
||||
|
||||
bool? result = null;
|
||||
|
||||
if (isEnrollment != null && isPDConfirm == null)
|
||||
{
|
||||
businessScenarioEnum = EmailBusinessScenario.EnrollConfirmed;
|
||||
|
||||
result = isEnrollment;
|
||||
}
|
||||
else
|
||||
{
|
||||
businessScenarioEnum = EmailBusinessScenario.PDConfirmed;
|
||||
|
||||
result = isPDConfirm;
|
||||
}
|
||||
|
||||
var taskInfo = await _repository.Where<VisitTask>(t => t.Id == visitTaskId).Select(t => new
|
||||
{
|
||||
t.Subject.SiteId,
|
||||
t.Trial.ResearchProgramNo,
|
||||
t.Subject.TrialSite.TrialSiteCode,
|
||||
SubjectCode = t.Subject.Code,
|
||||
t.Trial.Sponsor.SponsorName,
|
||||
t.SourceSubjectVisit.VisitName,
|
||||
t.TrialId,
|
||||
|
||||
}).FirstNotNullAsync();
|
||||
|
||||
var isEn_us = _userInfo.IsEn_Us;
|
||||
|
||||
var resultStr = isEn_us ? (result == true ? "Yes" : "No") : (result == true ? "是" : "否");
|
||||
|
||||
if (isEnrollment == true)
|
||||
{
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode);
|
||||
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, resultStr);
|
||||
return (topicStr, htmlBodyStr, isEn_us, null);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.SiteId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName);
|
||||
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
EmailNamePlaceholder, taskInfo.ResearchProgramNo, taskInfo.SubjectCode, taskInfo.VisitName, resultStr);
|
||||
|
||||
return (topicStr, htmlBodyStr, isEn_us, null);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.SiteId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 影像质控
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SendTrialImageQCTaskEmailAsync(Guid trialId)
|
||||
{
|
||||
var isEn_us = false;
|
||||
var trialInfo = await _repository.Where<Trial>(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
||||
|
||||
//找到 该项目的IQC 用户Id
|
||||
var userList = await _repository.Where<TrialUser>(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
var userIdList = userList.Select(t => t.UserId).ToList();
|
||||
|
||||
foreach (var user in userList)
|
||||
{
|
||||
var userId = user.UserId;
|
||||
|
||||
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
|
||||
var query = _trialRepository.Where(t => t.Id == trialId)
|
||||
.Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit)
|
||||
.Select(t => new
|
||||
{
|
||||
//待领取量
|
||||
ToBeClaimedCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.Submitted && u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != userId && u.ReviewAuditUserId == null))).Count(),
|
||||
|
||||
//待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了)
|
||||
ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == userId).Count()
|
||||
|
||||
});
|
||||
|
||||
var sendStat = await query.FirstOrDefaultAsync();
|
||||
|
||||
//当前人 有待领取的或者有待审核的才发邮件
|
||||
if (sendStat != null && (sendStat.ToBeClaimedCount > 0 || sendStat.ToBeReviewedCount > 0))
|
||||
{
|
||||
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
user.FullName, DateTime.Now, sendStat.ToBeClaimedCount, sendStat.ToBeReviewedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
return (topicStr, htmlBodyStr, false, userId);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(trialId, EmailBusinessScenario.QCTask, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// QC质疑
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SendTrialQCQuestionEmailAsync(Guid trialId)
|
||||
{
|
||||
var isEn_us = false;
|
||||
var trialInfo = _repository.Where<Trial>(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr, t.DeclarationTypeEnumList }).FirstOrDefault();
|
||||
|
||||
//找到 该项目的IQC 用户Id
|
||||
var userList = await _repository.Where<TrialUser>(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
|
||||
foreach (var user in userList)
|
||||
{
|
||||
var userId = user.UserId;
|
||||
|
||||
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
|
||||
var query = _trialRepository
|
||||
.Where(t => t.Id == trialId)
|
||||
.Select(t => new
|
||||
{
|
||||
ReUploadTobeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList)
|
||||
.Where(u => u.CreateUserId == userId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.ReuploadEnum == QCChanllengeReuploadEnum.CRCRequestReupload).Count(),
|
||||
|
||||
//质疑待处理 发送邮件的时候 需要减去ReUploadTobeDealedCount
|
||||
ToBeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList)
|
||||
.Where(u => u.CreateUserId == userId && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(),
|
||||
});
|
||||
|
||||
var sendStat = await query.FirstOrDefaultAsync();
|
||||
|
||||
//当前人
|
||||
if (sendStat != null && (sendStat.ToBeDealedCount > 0 || sendStat.ReUploadTobeDealedCount > 0))
|
||||
{
|
||||
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
|
||||
user.FullName, DateTime.Now, sendStat.ToBeDealedCount - sendStat.ReUploadTobeDealedCount, sendStat.ReUploadTobeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
return (topicStr, htmlBodyStr, false, userId);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(trialId, EmailBusinessScenario.QCQuestion, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 影像质疑
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SendTrialImageQuestionAsync(Guid trialId)
|
||||
{
|
||||
var isEn_us = false;
|
||||
|
||||
var trialInfo = _repository.Where<Trial>(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstOrDefault();
|
||||
|
||||
//找到 该项目的CRC 用户Id
|
||||
var userList = await _repository.Where<TrialUser>(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
|
||||
foreach (var user in userList)
|
||||
{
|
||||
var userId = user.UserId;
|
||||
//过滤项目 并且 将 _userInfo.Id 换位 当前发送邮件的Id
|
||||
var query = _trialRepository.Where(t => t.Id == trialId)
|
||||
|
||||
.Select(t => new
|
||||
{
|
||||
//质疑待处理
|
||||
ToBeDealedCount = t.SubjectVisitList.Where(t => t.TrialSite.CRCUserList.Any(t => t.UserId == userId)).SelectMany(c => c.QCChallengeList)
|
||||
.Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count(),
|
||||
|
||||
});
|
||||
|
||||
var sendStat = await query.FirstOrDefaultAsync();
|
||||
|
||||
//当前人
|
||||
if (sendStat != null && (sendStat.ToBeDealedCount > 0))
|
||||
{
|
||||
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
user.FullName, DateTime.Now, sendStat.ToBeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
return (topicStr, htmlBodyStr, isEn_us, userId);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(trialId, EmailBusinessScenario.ImageQuestion, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task SendTrialEmailAsync(Guid trialId, EmailBusinessScenario businessScenario, Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc, Guid? siteId = null, Guid? trialReadingCriterionId = null)
|
||||
{
|
||||
//找到配置
|
||||
var trialEmailConfig = await _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.BusinessScenarioEnum == businessScenario, ignoreQueryFilters: true)
|
||||
.Include(t => t.TrialEmailNoticeUserList).Include(t => t.TrialEmailBlackUserList).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (trialEmailConfig == null || trialEmailConfig.IsAutoSend == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sendEmailConfig = new SMTPEmailConfig();
|
||||
|
||||
var (topicStr, htmlBodyStr, isEn_us, onlyToUserId) = topicAndHtmlFunc(trialEmailConfig);
|
||||
|
||||
|
||||
sendEmailConfig.TopicDescription = topicStr;
|
||||
sendEmailConfig.HtmlBodyStr = htmlBodyStr;
|
||||
|
||||
|
||||
var blackUserIdList = trialEmailConfig.TrialEmailBlackUserList.Select(t => t.UserId).ToList();
|
||||
|
||||
|
||||
var toUserTypeEnumList = trialEmailConfig.TrialEmailNoticeUserList.Where(t => t.EmailUserType == EmailUserType.To).Select(c => c.UserType).ToList();
|
||||
|
||||
var copyUserTypeEnumList = trialEmailConfig.TrialEmailNoticeUserList.Where(t => t.EmailUserType == EmailUserType.Copy).Select(c => c.UserType).ToList();
|
||||
|
||||
var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList();
|
||||
|
||||
var allUserList = await _repository.Where<TrialUser>(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.User.UserTypeEnum)).Select(t => new { t.UserId, t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToListAsync();
|
||||
|
||||
|
||||
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
.ToList();
|
||||
|
||||
//收件人 有CRC CRA , CRC CRA的账户要按照中心发送
|
||||
if (siteId == null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA) && onlyToUserId == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前场景收件人包含CRC CRA,但是没有siteId,请联系后端开发");
|
||||
}
|
||||
if (siteId != null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId).Select(t => t.UserId).ToList();
|
||||
|
||||
toUserList = toUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
||||
|
||||
//去除黑名单
|
||||
toUserList = toUserList.Where(t => !blackUserIdList.Contains(t.UserId)).ToList();
|
||||
|
||||
var copyUserList = allUserList.Where(t => copyUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
.Where(t => !blackUserIdList.Contains(t.UserId)).ToList();
|
||||
|
||||
if (siteId != null && copyUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId).Select(t => t.UserId).ToList();
|
||||
|
||||
copyUserList = copyUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
||||
if (onlyToUserId != null)
|
||||
{
|
||||
toUserList = toUserList.Where(t => t.UserId == onlyToUserId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
sendEmailConfig.HtmlBodyStr = htmlBodyStr.Replace(EmailNamePlaceholder, string.Join(isEn_us ? ", " : "、", toUserList.Select(t => t.FullName).ToList()));
|
||||
}
|
||||
|
||||
if (toUserList.Count() == 0)
|
||||
{
|
||||
//---没有收件人,无法发送邮件
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_NoRecipient"]);
|
||||
}
|
||||
|
||||
|
||||
if (trialEmailConfig.FromEmail.Contains("@") && !string.IsNullOrEmpty(trialEmailConfig.FromEmail))
|
||||
{
|
||||
|
||||
sendEmailConfig.FromEmailAddress = new MimeKit.MailboxAddress(trialEmailConfig.FromName, trialEmailConfig.FromEmail);
|
||||
sendEmailConfig.AuthorizationCode = trialEmailConfig.AuthorizationCode;
|
||||
sendEmailConfig.UserName = trialEmailConfig.FromEmail;
|
||||
|
||||
sendEmailConfig.Host = trialEmailConfig.SMTPServerAddress;
|
||||
sendEmailConfig.Port = trialEmailConfig.SMTPServerPort;
|
||||
}
|
||||
else
|
||||
{
|
||||
//---项目发件邮箱配置有误,请核实
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidEmailConfig"]);
|
||||
}
|
||||
|
||||
foreach (var item in toUserList)
|
||||
{
|
||||
|
||||
if (item.EMail.Contains("@") && !string.IsNullOrEmpty(item.EMail))
|
||||
{
|
||||
|
||||
sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(item.FullName, item.EMail));
|
||||
|
||||
}
|
||||
}
|
||||
foreach (var item in copyUserList)
|
||||
{
|
||||
|
||||
if (item.EMail.Contains("@") && !string.IsNullOrEmpty(item.EMail))
|
||||
{
|
||||
|
||||
sendEmailConfig.CopyToMailAddressList.Add(new MimeKit.MailboxAddress(item.FullName, item.EMail));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -32,30 +32,41 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
|
||||
private readonly IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository;
|
||||
private readonly IRepository<TrialEmailBlackUser> _trialEmailBlackUserRepository;
|
||||
private readonly IRepository<EmailNoticeConfig> _emailNoticeConfigRepository;
|
||||
|
||||
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
private readonly IRepository<TaskMedicalReview> _taskMedicalReviewRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
private readonly IRepository<TrialUser> _trialUserRepository;
|
||||
private readonly IRepository<Subject> _subjectRepository;
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
public IRepository<VisitTask> _visitTaskRepository { get; }
|
||||
public IRepository<TrialUser> _trialUserRepository { get; }
|
||||
|
||||
public IRepository<Subject> _subjectRepository { get; }
|
||||
|
||||
public IRepository<SubjectVisit> _subjectVisitRepository { get; }
|
||||
|
||||
public TrialEmailNoticeConfigService(IRepository<TrialEmailNoticeConfig> trialEmailNoticeConfigRepository, IRepository<VisitTask> visitTaskRepository,
|
||||
public TrialEmailNoticeConfigService(
|
||||
IRepository<TrialEmailNoticeConfig> trialEmailNoticeConfigRepository,
|
||||
IRepository<VisitTask> visitTaskRepository,
|
||||
IRepository<Trial> trialRepository,
|
||||
IRepository<TrialUser> trialUserRepository, IRepository<TaskMedicalReview> taskMedicalReviewRepository, IRepository<Subject> subjectRepository, IRepository<SubjectVisit> subjectVisitRepository)
|
||||
IRepository<TrialUser> trialUserRepository,
|
||||
IRepository<TaskMedicalReview> taskMedicalReviewRepository,
|
||||
IRepository<Subject> subjectRepository,
|
||||
IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<TrialEmailBlackUser> trialEmailBlackUserRepository,
|
||||
IRepository<EmailNoticeConfig> emailNoticeConfigRepository
|
||||
)
|
||||
{
|
||||
_trialEmailNoticeConfigRepository = trialEmailNoticeConfigRepository;
|
||||
_visitTaskRepository = visitTaskRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
_trialRepository = trialRepository;
|
||||
_trialUserRepository = trialUserRepository;
|
||||
_taskMedicalReviewRepository = taskMedicalReviewRepository;
|
||||
_subjectRepository = subjectRepository;
|
||||
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
_trialEmailBlackUserRepository = trialEmailBlackUserRepository;
|
||||
_emailNoticeConfigRepository = emailNoticeConfigRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -66,7 +77,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<GetTrialEmailSetOutDto> GetTrialEmail(GetTrialEmailSetInDto inDto)
|
||||
{
|
||||
return await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new GetTrialEmailSetOutDto()
|
||||
return await _trialRepository.Where(x => x.Id == inDto.TrialId, ignoreQueryFilters: true).Select(x => new GetTrialEmailSetOutDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
EmailAuthorizationCode = x.EmailAuthorizationCode,
|
||||
|
@ -76,7 +87,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IsConfigureEmail = x.IsConfigureEmail,
|
||||
EmailSMTPServerPort = x.EmailSMTPServerPort
|
||||
|
||||
}).FirstNotNullAsync();
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -94,7 +105,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
FromEmail = inDto.EmailFromEmail,
|
||||
FromName = inDto.EmailFromName,
|
||||
SMTPServerAddress = inDto.EmailSMTPServerAddress,
|
||||
SMTPServerPort = inDto.EmailSMTPServerPort.Value,
|
||||
SMTPServerPort = inDto.EmailSMTPServerPort,
|
||||
TrialId = inDto.TrialId,
|
||||
});
|
||||
|
||||
|
@ -117,7 +128,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
FromEmail = inDto.EmailFromEmail,
|
||||
FromName = inDto.EmailFromName,
|
||||
SMTPServerAddress = inDto.EmailSMTPServerAddress,
|
||||
SMTPServerPort = inDto.EmailSMTPServerPort.Value,
|
||||
SMTPServerPort = inDto.EmailSMTPServerPort,
|
||||
});
|
||||
|
||||
await _trialRepository.SaveChangesAsync();
|
||||
|
@ -125,7 +136,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步系统配置的文档到想项目中
|
||||
/// 同步系统配置的文档到想项目中 ---废弃
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -139,7 +150,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
|
||||
//只要有系统标准的文档 说明同步过了
|
||||
var trialDocCount = _trialEmailNoticeConfigRepository.Where(t =>/* t.CriterionTypeEnum == criterionTypeEnum &&*/ t.TrialId == trialId && t.TrialReadingCriterionId != null).Count();
|
||||
var trialDocCount = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId).Count();
|
||||
|
||||
if (trialDocCount == 0)
|
||||
{
|
||||
|
@ -148,7 +159,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var confirmedCriterionTypeList = list.Select(t => (CriterionType?)t.CriterionType).ToList();
|
||||
|
||||
var docmentList = _repository.Where<CommonDocument>(t => confirmedCriterionTypeList.Contains(t.CriterionTypeEnum)).Select(t => new { t.Path, t.Name, t.Code, t.BusinessScenarioEnum, t.CriterionTypeEnum }).ToList();
|
||||
var docmentList = _repository.Where<TrialEmailNoticeConfig>(t => t.BusinessScenarioEnum == EmailBusinessScenario.EnrollConfirmed || t.BusinessScenarioEnum == EmailBusinessScenario.PDConfirmed)
|
||||
//.Where(t => (confirmedCriterionTypeList.Contains(t.CriterionTypeEnum)) || t.CriterionTypeEnum == null).Select(t => new { t.Path, t.Name, t.Code, t.BusinessScenarioEnum, t.CriterionTypeEnum })
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
foreach (var item in docmentList)
|
||||
|
@ -157,8 +171,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
TrialId = trialId,
|
||||
TrialReadingCriterionId = list.Where(t => t.CriterionType == item.CriterionTypeEnum).FirstOrDefault()?.TrialReadingCriterionId,
|
||||
FileName = item.Name,
|
||||
FilePath = item.Path,
|
||||
//FileName = item.Name,
|
||||
//FilePath = item.Path,
|
||||
BusinessScenarioEnum = item.BusinessScenarioEnum,
|
||||
Code = item.Code
|
||||
});
|
||||
|
@ -176,6 +190,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
|
||||
private async Task<bool> DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isHandSend, string pdAnswer, List<Guid> taskIdList, List<Guid> minUserIdList)
|
||||
{
|
||||
|
||||
|
@ -241,7 +256,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<string> BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isHandSend, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
|
||||
{
|
||||
|
||||
CommonDocumentBusinessScenario? businessScenarioEnum = null;
|
||||
EmailBusinessScenario? businessScenarioEnum = null;
|
||||
|
||||
#region 任务关联的项目配置 标准信息及配置,subject 信息
|
||||
var taskInfo = await _visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => new
|
||||
|
@ -309,7 +324,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//入组确认场景
|
||||
if (taskInfo.IsEnrollmentConfirm == true && taskInfo.IsEnrollementQualificationConfirm == true && taskInfo.IsBaseline == true)
|
||||
{
|
||||
businessScenarioEnum = CommonDocumentBusinessScenario.EnrollConfirmed;
|
||||
businessScenarioEnum = EmailBusinessScenario.EnrollConfirmed;
|
||||
|
||||
|
||||
}
|
||||
|
@ -318,7 +333,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
(taskInfo.PDState == PDStateEnum.PDProgress && taskInfo.SourceSubjectVisitId != null) ||
|
||||
(taskInfo.SouceReadModuleId != null && taskInfo.MoudulePDState == PDStateEnum.PDProgress))
|
||||
{
|
||||
businessScenarioEnum = CommonDocumentBusinessScenario.PDConfirmed;
|
||||
businessScenarioEnum = EmailBusinessScenario.PDConfirmed;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,7 +359,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.Include(t => t.TrialEmailNoticeUserList).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (emailConfig == null || (emailConfig.IsAutoSend == false && isHandSend==null))
|
||||
if (emailConfig == null || (emailConfig.IsAutoSend == false && isHandSend == null))
|
||||
{
|
||||
//throw new BusinessValidationFailedException("找不到该项目标准场景下邮件的配置");
|
||||
|
||||
|
@ -418,7 +433,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
#region 确保 邮件Html存在
|
||||
|
||||
//邮件附件
|
||||
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, emailConfig.FilePath);
|
||||
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, _userInfo.IsEn_Us ? emailConfig.AttachPath : emailConfig.AttachCNPath);
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
|
@ -431,7 +446,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
+ Path.DirectorySeparatorChar.ToString()
|
||||
+ "EmailTemplate"
|
||||
+ Path.DirectorySeparatorChar.ToString()
|
||||
//+ "SubjectEnrollConfirmOrPDProgress.html";
|
||||
//+ "SubjectEnrollConfirmOrPDProgress.html";
|
||||
+ (_userInfo.IsEn_Us ? "SubjectEnrollConfirmOrPDProgress_US.html" : "SubjectEnrollConfirmOrPDProgress.html");
|
||||
|
||||
#endregion
|
||||
|
@ -439,7 +454,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
#region 不同场景 Tile 设置
|
||||
|
||||
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
|
||||
if (businessScenarioEnum == EmailBusinessScenario.EnrollConfirmed)
|
||||
{
|
||||
sendEmailConfig.TopicDescription = _localizer["TrialEmailN_EnrollmentConfirmation", taskInfo.ResearchProgramNo, taskInfo.SubjectCode];
|
||||
|
||||
|
@ -454,7 +469,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
);
|
||||
}
|
||||
}
|
||||
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
||||
else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed)
|
||||
{
|
||||
sendEmailConfig.TopicDescription = _localizer["TrialEmailN_PDReport", taskInfo.ResearchProgramNo, taskInfo.SubjectCode];
|
||||
|
||||
|
@ -464,7 +479,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
|
||||
//--- 附件为疾病进展确认报告,请查收
|
||||
//--- 附件为疾病进展确认报告,请查收
|
||||
_localizer["TrialEmailN_SubjectDiseaseProgression"]
|
||||
);
|
||||
}
|
||||
|
@ -486,7 +501,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
//入组确认 根据每个标准配置的是否自动发送,发送邮件与否
|
||||
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
|
||||
if (businessScenarioEnum == EmailBusinessScenario.EnrollConfirmed)
|
||||
{
|
||||
if (await _repository.Where<ReadingTableQuestionAnswer>().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
|
||||
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
|
||||
|
@ -531,7 +546,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
}
|
||||
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
||||
else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed)
|
||||
{
|
||||
|
||||
|
||||
|
@ -629,7 +644,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
//---发送PD 进展邮件中发现任务数据有问题!
|
||||
//---发送PD 进展邮件中发现任务数据有问题!
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_PDProgressEmailTask"]);
|
||||
}
|
||||
|
||||
|
@ -639,13 +654,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
else
|
||||
{
|
||||
|
||||
//---双重有序阅片 没有定义该仲裁规则处理逻辑,请联系业务和后台开发核查!
|
||||
//---双重有序阅片 没有定义该仲裁规则处理逻辑,请联系业务和后台开发核查!
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_DoubleBlindedError"]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//屏蔽单重阅片添加
|
||||
else
|
||||
{
|
||||
|
@ -661,7 +676,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// if (taskInfo.ArbitrationRule != ArbitrationRule.None)
|
||||
// {
|
||||
|
||||
//---单重有序阅片配置有误(不应该有仲裁对象配置),请核查!
|
||||
//---单重有序阅片配置有误(不应该有仲裁对象配置),请核查!
|
||||
// throw new BusinessValidationFailedException(_localizer["TrialEmailN_SingleBlindedSet"]);
|
||||
// }
|
||||
|
||||
|
@ -687,7 +702,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// }
|
||||
// else
|
||||
// {
|
||||
//---单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!
|
||||
//---单重有序阅片 该类型的任务不应进入此处逻辑,请联系后台开发核查!
|
||||
// throw new BusinessValidationFailedException(_localizer["TrialEmailN_SingleBlindedSequenced"]);
|
||||
// }
|
||||
|
||||
|
@ -697,7 +712,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//}
|
||||
//else
|
||||
//{
|
||||
//---有序阅片配置有误(应为单重或者双重阅片),请核查!
|
||||
//---有序阅片配置有误(应为单重或者双重阅片),请核查!
|
||||
// throw new BusinessValidationFailedException(_localizer["TrialEmailN_BlindedSequencedReading"]);
|
||||
//}
|
||||
|
||||
|
@ -788,7 +803,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//先预先生成了邮件,发送预先生成的邮件
|
||||
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
|
||||
{
|
||||
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(emailConfig.FileName)}.pdf",
|
||||
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? emailConfig.AttachName : emailConfig.AttachNameCN)}.pdf",
|
||||
|
||||
FileStream = File.OpenRead(phyPath),
|
||||
});
|
||||
|
@ -812,7 +827,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
};
|
||||
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId,true);
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId, true);
|
||||
|
||||
if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
|
||||
{
|
||||
|
@ -823,7 +838,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
MiniSoftware.MiniWord.SaveAsByTemplate(wordMemoryStream, path, value);
|
||||
|
||||
document.LoadFromStream(wordMemoryStream,FileFormat.Docx);
|
||||
document.LoadFromStream(wordMemoryStream, FileFormat.Docx);
|
||||
|
||||
document.SaveToFile(serverFilePath, FileFormat.PDF);
|
||||
|
||||
|
@ -856,7 +871,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
|
||||
{
|
||||
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(emailConfig.FileName)}.pdf",
|
||||
FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(_userInfo.IsEn_Us ? emailConfig.AttachName : emailConfig.AttachNameCN)}.pdf",
|
||||
|
||||
FileStream = pdfMemoryStream
|
||||
});
|
||||
|
@ -900,19 +915,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
//找到入组确认 或者Pd 进展 已生成任务的 访视
|
||||
var subjectVisitList = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId & t.CheckState == CheckStateEnum.CVPassed && (t.IsEnrollmentConfirm == true || t.PDState == PDStateEnum.PDProgress)).ToListAsync();
|
||||
|
||||
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
|
||||
if (businessScenarioEnum == EmailBusinessScenario.EnrollConfirmed)
|
||||
{
|
||||
|
||||
if (trialConfig.IsEnrollementQualificationConfirm == false)
|
||||
{
|
||||
//---项目未配置入组确认!
|
||||
//---项目未配置入组确认!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_InCons"]);
|
||||
|
||||
}
|
||||
var exisitBaseline = subjectVisitList.FirstOrDefault(t => t.IsEnrollmentConfirm);
|
||||
if (exisitBaseline == null)
|
||||
{
|
||||
//---不存在配置了入组确认的并且生成任务的基线访视
|
||||
//---不存在配置了入组确认的并且生成任务的基线访视
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoBaseLine"]);
|
||||
}
|
||||
else
|
||||
|
@ -933,7 +948,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (task == null)
|
||||
{
|
||||
//---做入组确认的阅片人基线任务没有阅片完!
|
||||
//---做入组确认的阅片人基线任务没有阅片完!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_IncompBase"]);
|
||||
}
|
||||
else
|
||||
|
@ -942,7 +957,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
//---邮件手动生成失败,请联系开发核实该场景失败原因
|
||||
//---邮件手动生成失败,请联系开发核实该场景失败原因
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_EmailFail"]);
|
||||
}
|
||||
else
|
||||
|
@ -956,7 +971,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
//---当前未有阅片人读完基线任务!
|
||||
//---当前未有阅片人读完基线任务!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoReader"]);
|
||||
}
|
||||
|
||||
|
@ -967,12 +982,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
||||
else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed)
|
||||
{
|
||||
|
||||
if (trialConfig.IsPDProgressView == false)
|
||||
{
|
||||
//---项目未配置PD进展!
|
||||
//---项目未配置PD进展!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoPDConfig"]);
|
||||
}
|
||||
|
||||
|
@ -982,7 +997,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (pdSubjectVisitIdList.Count == 0)
|
||||
{
|
||||
//---不存在配置了PD进展的并且生成任务的访视
|
||||
//---不存在配置了PD进展的并且生成任务的访视
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoPDTasks"]);
|
||||
}
|
||||
|
||||
|
@ -1027,7 +1042,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
//---当前受试者最新PD访视阅片任务完成状态不符合发送条件
|
||||
//---当前受试者最新PD访视阅片任务完成状态不符合发送条件
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_PDNotFinished"]);
|
||||
}
|
||||
|
||||
|
@ -1040,7 +1055,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (existReadModule == null)
|
||||
{
|
||||
//---项目配置了阅片期仲裁,但是当前受试者最新PD访视没有影像学阅片期
|
||||
//---项目配置了阅片期仲裁,但是当前受试者最新PD访视没有影像学阅片期
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_PDNoImaging"]);
|
||||
}
|
||||
else
|
||||
|
@ -1075,7 +1090,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
else
|
||||
{
|
||||
//---当前受试者最新PD访视阅片期任务完成状态不符合发送条件
|
||||
//---当前受试者最新PD访视阅片期任务完成状态不符合发送条件
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_PDPhaseNotFinished"]);
|
||||
}
|
||||
}
|
||||
|
@ -1084,7 +1099,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
//---未定义该仲裁规则发送业务逻辑!
|
||||
//---未定义该仲裁规则发送业务逻辑!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoRuleDefined"]);
|
||||
}
|
||||
}
|
||||
|
@ -1143,7 +1158,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
else
|
||||
{
|
||||
//---当前项目配置,不满足双重有序阅片,不满足发送条件!
|
||||
//---当前项目配置,不满足双重有序阅片,不满足发送条件!
|
||||
return ResponseOutput.NotOk(_localizer["TrialEmailN_NoDoubleOrder"]);
|
||||
}
|
||||
|
||||
|
@ -1233,7 +1248,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//}
|
||||
else
|
||||
{
|
||||
//---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑
|
||||
//---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidTaskTypeForEmailSending"]);
|
||||
}
|
||||
|
||||
|
@ -1273,7 +1288,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//}
|
||||
else
|
||||
{
|
||||
//---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑
|
||||
//---不应有 除访视、裁判、全局其他类型的任务进行发送邮件,请核查业务逻辑
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidTaskTypeForEmailSending"]);
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1326,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
case CriterionType.IMWG2016:
|
||||
default:
|
||||
|
||||
//---该标准任务还未定义PD获取逻辑,联系业务和后台开发协商后补充
|
||||
//---该标准任务还未定义PD获取逻辑,联系业务和后台开发协商后补充
|
||||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_PDLogicNotDefined"]);
|
||||
}
|
||||
|
||||
|
@ -1335,19 +1350,127 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.User.UserTypeRole).Distinct()
|
||||
|
||||
.ProjectTo<TrialUserType>(_mapper.ConfigurationProvider);
|
||||
.ProjectTo<TrialUserType>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 黑名单用户Id 列表
|
||||
/// </summary>
|
||||
/// <param name="trialEmailNoticeConfigId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<TrialSelectUser>> GetTrialUserIdSelectList(Guid trialEmailNoticeConfigId)
|
||||
{
|
||||
|
||||
var trialEmailNoticeConfig = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId).Include(t => t.TrialEmailNoticeUserList).FirstNotNullAsync();
|
||||
|
||||
var trialId = trialEmailNoticeConfig.TrialId;
|
||||
|
||||
var userTypeList = trialEmailNoticeConfig.TrialEmailNoticeUserList.Select(t => t.UserType).ToList();
|
||||
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.User.UserTypeEnum), false, true).IgnoreQueryFilters()
|
||||
.Select(t => new TrialSelectUser()
|
||||
{
|
||||
UserId = t.UserId,
|
||||
UserName = t.User.UserName,
|
||||
RealName = t.User.FullName,
|
||||
UserTypeEnum = t.User.UserTypeEnum
|
||||
}).Distinct();
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统 邮件配置 勾选列表
|
||||
/// </summary>
|
||||
/// <param name="queryEmailNoticeConfig"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PageOutput<TrialSelectEmailNoticeConfigView>> GetSysEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig)
|
||||
{
|
||||
var emailNoticeConfigQueryable = _emailNoticeConfigRepository
|
||||
.WhereIf(queryEmailNoticeConfig.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryEmailNoticeConfig.BusinessScenarioEnum)
|
||||
.WhereIf(queryEmailNoticeConfig.IsReturnRequired != null, t => t.IsReturnRequired == queryEmailNoticeConfig.IsReturnRequired)
|
||||
.WhereIf(queryEmailNoticeConfig.IsEnable != null, t => t.IsEnable == queryEmailNoticeConfig.IsEnable)
|
||||
|
||||
.ProjectTo<TrialSelectEmailNoticeConfigView>(_mapper.ConfigurationProvider, new { trialId = queryEmailNoticeConfig.TrialId });
|
||||
|
||||
return await emailNoticeConfigQueryable.ToPagedListAsync(queryEmailNoticeConfig.PageIndex, queryEmailNoticeConfig.PageSize, queryEmailNoticeConfig.SortField, queryEmailNoticeConfig.Asc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量勾选 传递列表每行数据,后台进行处理转换,建立关联关系
|
||||
/// </summary>
|
||||
/// <param name="batchAddList"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> BatchAddSysEmailConfig(List<BatchAddTrialEmailNoticeConfig> batchAddList)
|
||||
{
|
||||
|
||||
var first = batchAddList.First();
|
||||
var trialId = first.TrialId;
|
||||
|
||||
var emailConfig = await _trialRepository.Where(t => t.Id == trialId).Select(x => new
|
||||
{
|
||||
TrialId = x.Id,
|
||||
EmailAuthorizationCode = x.EmailAuthorizationCode,
|
||||
EmailSMTPServerAddress = x.EmailSMTPServerAddress,
|
||||
EmailFromEmail = x.EmailFromEmail,
|
||||
EmailFromName = x.EmailFromName,
|
||||
IsConfigureEmail = x.IsConfigureEmail,
|
||||
EmailSMTPServerPort = x.EmailSMTPServerPort
|
||||
|
||||
}).FirstNotNullAsync();
|
||||
|
||||
var list = await _repository.Where<ReadingQuestionCriterionTrial>(t => t.TrialId == trialId && t.IsConfirm).Select(t => new { t.CriterionType, TrialReadingCriterionId = t.Id }).ToListAsync();
|
||||
|
||||
|
||||
var addList = _mapper.Map<List<TrialEmailNoticeConfig>>(batchAddList);
|
||||
|
||||
|
||||
foreach (var item in addList)
|
||||
{
|
||||
item.SysEmailNoticeConfigId = item.Id;
|
||||
item.Id = Guid.Empty;
|
||||
|
||||
item.AuthorizationCode = emailConfig.EmailAuthorizationCode;
|
||||
item.FromEmail = emailConfig.EmailFromEmail;
|
||||
item.SMTPServerAddress = emailConfig.EmailSMTPServerAddress;
|
||||
item.FromName = emailConfig.EmailFromName;
|
||||
item.SMTPServerPort = emailConfig.EmailSMTPServerPort;
|
||||
item.IsAutoSend = false;
|
||||
item.IsEnable = false;
|
||||
|
||||
item.TrialReadingCriterionId = list.FirstOrDefault(t => t.CriterionType == item.CriterionTypeEnum)?.TrialReadingCriterionId;
|
||||
|
||||
item.TrialEmailNoticeUserList.AddRange(batchAddList.Where(t => t.Id == item.SysEmailNoticeConfigId)
|
||||
.SelectMany(t => t.ToUserTypeList).Select(t => new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = t }));
|
||||
|
||||
item.TrialEmailNoticeUserList.AddRange(batchAddList.Where(t => t.Id == item.SysEmailNoticeConfigId)
|
||||
.SelectMany(t => t.CopyUserTypeList).Select(t => new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = t }));
|
||||
|
||||
|
||||
await _trialEmailNoticeConfigRepository.AddAsync(item);
|
||||
|
||||
}
|
||||
|
||||
await _trialEmailNoticeConfigRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<List<TrialEmailNoticeConfigView>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery)
|
||||
{
|
||||
await SyncSystemEmainCofigDocListAsync(inQuery.TrialId);
|
||||
//await SyncSystemEmainCofigDocListAsync(inQuery.TrialId);
|
||||
|
||||
var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.IsDistinguishCriteria == false, t => t.TrialReadingCriterionId == null)
|
||||
.WhereIf(inQuery.IsDistinguishCriteria == true, t => t.CriterionTypeEnum != null)
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
|
||||
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
|
||||
|
@ -1355,6 +1478,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
return await trialEmailNoticeConfigQueryable.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig)
|
||||
{
|
||||
|
@ -1379,6 +1503,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
foreach (var userid in addOrEditTrialEmailNoticeConfig.BlackUserIdList)
|
||||
{
|
||||
entity.TrialEmailBlackUserList.Add(new TrialEmailBlackUser() { UserId = userid });
|
||||
}
|
||||
|
||||
await _trialEmailNoticeConfigRepository.AddAsync(entity, true);
|
||||
|
||||
|
@ -1387,10 +1515,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
var id = (Guid)addOrEditTrialEmailNoticeConfig.Id;
|
||||
|
||||
await _repository.BatchDeleteAsync<TrialEmailNoticeUser>(t => t.TrialEmailNoticeConfigId == addOrEditTrialEmailNoticeConfig.Id);
|
||||
|
||||
|
||||
var entity = (await _trialEmailNoticeConfigRepository.Where(t => t.Id == addOrEditTrialEmailNoticeConfig.Id, true, true).Include(t => t.TrialEmailNoticeUserList).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
await _repository.BatchDeleteAsync<TrialEmailBlackUser>(t => t.TrialEmailNoticeConfigId == addOrEditTrialEmailNoticeConfig.Id);
|
||||
|
||||
|
||||
List<TrialEmailNoticeUser> trialEmailNoticeUsers = new List<TrialEmailNoticeUser>();
|
||||
|
@ -1398,31 +1526,51 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
foreach (var item in addOrEditTrialEmailNoticeConfig.ToUserTypeList)
|
||||
{
|
||||
trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = item, TrialEmailNoticeConfigId = entity.Id });
|
||||
trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.To, UserType = item, TrialEmailNoticeConfigId = id });
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in addOrEditTrialEmailNoticeConfig.CopyUserTypeList)
|
||||
{
|
||||
trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = item, TrialEmailNoticeConfigId = entity.Id });
|
||||
trialEmailNoticeUsers.Add(new TrialEmailNoticeUser() { EmailUserType = EmailUserType.Copy, UserType = item, TrialEmailNoticeConfigId = id });
|
||||
|
||||
}
|
||||
await _repository.AddRangeAsync(trialEmailNoticeUsers);
|
||||
|
||||
foreach (var userid in addOrEditTrialEmailNoticeConfig.BlackUserIdList)
|
||||
{
|
||||
await _trialEmailBlackUserRepository.AddAsync(new TrialEmailBlackUser() { UserId = userid, TrialEmailNoticeConfigId = id });
|
||||
|
||||
}
|
||||
|
||||
await _trialEmailNoticeConfigRepository.UpdateFromDTOAsync(addOrEditTrialEmailNoticeConfig);
|
||||
|
||||
|
||||
await _trialEmailNoticeConfigRepository.SaveChangesAsync();
|
||||
|
||||
var jobId = $"{addOrEditTrialEmailNoticeConfig.TrialId}_{id}";
|
||||
|
||||
if (addOrEditTrialEmailNoticeConfig.IsAutoSend)
|
||||
{
|
||||
HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, addOrEditTrialEmailNoticeConfig.TrialId, addOrEditTrialEmailNoticeConfig.BusinessScenarioEnum, addOrEditTrialEmailNoticeConfig.EmailCron);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
HangfireJobHelper.RemoveCronJob(jobId);
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task TestEmailConfigAsync(TrialEmailNoticeConfigAddOrEdit config)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (!config.FromEmail.Contains("@") || string.IsNullOrEmpty(config.FromEmail))
|
||||
{
|
||||
|
@ -1449,7 +1597,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidSenderEmailConfig"] + ex.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 人员还未加入,可以先配置邮件 历史废弃
|
||||
|
@ -1522,6 +1670,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpDelete("{trialEmailNoticeConfigId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId)
|
||||
{
|
||||
var trialId = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId).Select(t => t.TrialId).FirstOrDefaultAsync();
|
||||
var jobId = $"{trialId}_{trialEmailNoticeConfigId}";
|
||||
|
||||
HangfireJobHelper.RemoveCronJob(jobId);
|
||||
|
||||
var success = await _trialEmailNoticeConfigRepository.DeleteFromQueryAsync(t => t.Id == trialEmailNoticeConfigId, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
public List<UserTypeGroupInfo> UserTypeGroupList { get; set; } = new List<UserTypeGroupInfo>();
|
||||
|
||||
public new List<Guid> UserTypeGroupIdList => UserTypeGroupList.Select(t=>t.DictionaryId).ToList();
|
||||
public new List<Guid> UserTypeGroupIdList => UserTypeGroupList.Select(t => t.DictionaryId).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public Guid DictionaryId { get; set; }
|
||||
|
||||
public string GroupName { get; set; }=string.Empty;
|
||||
public string GroupName { get; set; } = string.Empty;
|
||||
|
||||
public string GroupNameCN { get; set; } = string.Empty;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class UserTypeMenuAddOrEdit: UserTypeRoleAddOrEdit
|
||||
public class UserTypeMenuAddOrEdit : UserTypeRoleAddOrEdit
|
||||
{
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
|
@ -64,6 +64,16 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class TrialSelectUser
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string RealName { get; set; }
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
}
|
||||
|
||||
public class TrialUserType
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace IRaCIS.Core.Domain.Share
|
|||
}
|
||||
|
||||
|
||||
public enum CommonDocumentBusinessScenario
|
||||
public enum EmailBusinessScenario
|
||||
{
|
||||
|
||||
EnrollConfirmed = 1,
|
||||
|
@ -44,6 +44,12 @@ namespace IRaCIS.Core.Domain.Share
|
|||
Trial=3,
|
||||
|
||||
Reviewer=4,
|
||||
|
||||
QCTask = 5,
|
||||
|
||||
QCQuestion = 6,
|
||||
|
||||
ImageQuestion = 7
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
public CommonDocumentFileType FileTypeEnum { get; set; }
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
|
||||
//[Required]
|
||||
|
|
|
@ -16,11 +16,59 @@ namespace IRaCIS.Core.Domain.Models
|
|||
///EmailNoticeConfig
|
||||
///</summary>
|
||||
[Table("EmailNoticeConfig")]
|
||||
public class EmailNoticeConfig : Entity, IAuditUpdate, IAuditAdd,ISoftDelete
|
||||
public class EmailNoticeConfig : Entity, IAuditUpdate, IAuditAdd, ISoftDelete
|
||||
{
|
||||
[JsonIgnore]
|
||||
public List<TrialEmailNoticeConfig> TrialEmailNoticeConfigList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<EmailNoticeUserType> EmailNoticeUserTypeList { get; set; } = new List<EmailNoticeUserType>();
|
||||
public string Code { get; set; } = String.Empty;
|
||||
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
/// <summary> 标准类型 /// </summary>
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 业务模块 /// </summary>
|
||||
public int BusinessModuleEnum { get; set; }
|
||||
|
||||
/// <summary> 业务层级 /// </summary>
|
||||
public int BusinessLevelEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件类型 /// </summary>
|
||||
public int EmailTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件加急类型 /// </summary>
|
||||
public int EmailUrgentEnum { get; set; }
|
||||
|
||||
/// <summary> 定时周期 /// </summary>
|
||||
public string EmailCron { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 邮件主题 /// </summary>
|
||||
public string EmailTopic { get; set; } = string.Empty;
|
||||
|
||||
public string EmailTopicCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 附件 /// </summary>
|
||||
public string AttachPath { get; set; } = string.Empty;
|
||||
|
||||
public string AttachCNPath { get; set; } = string.Empty;
|
||||
|
||||
public string EmailHtmlContent { get; set; } = string.Empty;
|
||||
|
||||
public string EmailHtmlContentCN { get; set; } = string.Empty;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string AttachName { get; set; } = string.Empty;
|
||||
public string AttachNameCN { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否区分标准
|
||||
|
@ -34,10 +82,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
[Required]
|
||||
public bool IsReturnRequired { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public bool IsUrgent { get; set; }
|
||||
|
||||
public bool IsAutoSend { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
@ -61,14 +105,21 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Table("EmailNoticeUserType")]
|
||||
|
||||
public class EmailNoticeUserType : Entity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public EmailNoticeConfig EmailNoticeConfig { get; set; }
|
||||
|
||||
public Guid EmailNoticeConfigId { get; set; }
|
||||
|
||||
|
||||
public UserTypeEnum UserType { get; set; }
|
||||
|
||||
public EmailUserType EmailUserType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,93 +12,138 @@ using System.Linq;
|
|||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
///<summary>
|
||||
///TrialEmailNoticeConfig
|
||||
///</summary>
|
||||
[Table("TrialEmailNoticeConfig")]
|
||||
public class TrialEmailNoticeConfig : Entity, IAuditUpdate, IAuditAdd
|
||||
{
|
||||
///<summary>
|
||||
///TrialEmailNoticeConfig
|
||||
///</summary>
|
||||
[Table("TrialEmailNoticeConfig")]
|
||||
public class TrialEmailNoticeConfig : Entity, IAuditUpdate, IAuditAdd, ISoftDelete
|
||||
{
|
||||
[JsonIgnore]
|
||||
|
||||
[Required]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
public string SMTPServerAddress { get; set; } = string.Empty;
|
||||
|
||||
public int SMTPServerPort { get; set; }
|
||||
|
||||
[Required]
|
||||
public string AuthorizationCode { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string FromName { get; set; } = string.Empty;
|
||||
public List<TrialEmailNoticeUser> TrialEmailNoticeUserList { get; set; } = new List<TrialEmailNoticeUser>();
|
||||
|
||||
|
||||
//[Required]
|
||||
|
||||
//public string ReceiveEmailsStr { get; set; } = string.Empty;
|
||||
//public string CopyEmailsStr { get; set; } = string.Empty;
|
||||
|
||||
//[NotMapped]
|
||||
//public List<string> ReceiveEmailList => ReceiveEmailsStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t)).Select(t=>t.Trim()).ToList();
|
||||
|
||||
//[NotMapped]
|
||||
//public List<string> CopyEmailList => CopyEmailsStr.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t=> !string.IsNullOrEmpty(t)).Select(t => t.Trim()).ToList();
|
||||
|
||||
|
||||
|
||||
public string FromEmail { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public bool IsUrgent { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
[Required]
|
||||
public bool IsReturnRequired { get; set; }
|
||||
|
||||
|
||||
|
||||
[Required]
|
||||
public bool IsAutoSend { get; set; }
|
||||
|
||||
|
||||
|
||||
public CommonDocumentBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
[ForeignKey("TrialReadingCriterionId")]
|
||||
[JsonIgnore]
|
||||
public ReadingQuestionCriterionTrial TrialReadingCriterion { get; set; }
|
||||
public Trial Trial { get; set; }
|
||||
|
||||
[Required]
|
||||
public string FilePath { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public string SMTPServerAddress { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
public int SMTPServerPort { get; set; }
|
||||
|
||||
[Required]
|
||||
public string AuthorizationCode { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string FromName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string FromEmail { get; set; } = string.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialEmailNoticeUser> TrialEmailNoticeUserList { get; set; } = new List<TrialEmailNoticeUser>();
|
||||
|
||||
public List<TrialEmailBlackUser> TrialEmailBlackUserList { get; set; } = new List<TrialEmailBlackUser>();
|
||||
|
||||
|
||||
/// <summary> 业务模块 /// </summary>
|
||||
public int BusinessModuleEnum { get; set; }
|
||||
|
||||
/// <summary> 业务层级 /// </summary>
|
||||
public int BusinessLevelEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件类型 /// </summary>
|
||||
public int EmailTypeEnum { get; set; }
|
||||
|
||||
/// <summary> 邮件加急类型 /// </summary>
|
||||
public int EmailUrgentEnum { get; set; }
|
||||
|
||||
/// <summary> 定时周期 /// </summary>
|
||||
public string EmailCron { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 邮件主题 /// </summary>
|
||||
public string EmailTopic { get; set; } = string.Empty;
|
||||
|
||||
public string EmailTopicCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary> 附件 /// </summary>
|
||||
public string AttachPath { get; set; } = string.Empty;
|
||||
|
||||
public string AttachCNPath { get; set; } = string.Empty;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string AttachName { get; set; }
|
||||
public string AttachNameCN { get; set; }
|
||||
|
||||
|
||||
public string EmailHtmlContent { get; set; } = string.Empty;
|
||||
public string EmailHtmlContentCN { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
public EmailNoticeConfig SysEmailNoticeConfig { get; set; }
|
||||
public Guid? SysEmailNoticeConfigId { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public bool IsReturnRequired { get; set; }
|
||||
[Required]
|
||||
public bool IsAutoSend { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
|
||||
public EmailBusinessScenario BusinessScenarioEnum { get; set; }
|
||||
|
||||
public CriterionType? CriterionTypeEnum { get; set; }
|
||||
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
[ForeignKey("TrialReadingCriterionId")]
|
||||
[JsonIgnore]
|
||||
public ReadingQuestionCriterionTrial TrialReadingCriterion { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class TrialEmailBlackUser : Entity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public TrialEmailNoticeConfig TrialEmailNoticeConfig { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public User User { get; set; }
|
||||
|
||||
|
||||
public Guid TrialEmailNoticeConfigId { get; set; }
|
||||
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// <summary>
|
||||
/// SMTP端口
|
||||
/// </summary>
|
||||
public int? EmailSMTPServerPort { get; set; }
|
||||
public int EmailSMTPServerPort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否配置过邮箱
|
||||
|
|
|
@ -34,7 +34,9 @@ namespace IRaCIS.Core.Domain.Share
|
|||
|
||||
public string FromName { get; set; }
|
||||
|
||||
public string AuthorizationCode { get; set; }
|
||||
public string AuthorizationCode { get; set; }
|
||||
|
||||
public string SiteUrl { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -513,7 +513,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
public virtual DbSet<UserLog> UserLog { get; set; }
|
||||
|
||||
|
||||
|
||||
public virtual DbSet<EmailNoticeUserType> EmailNoticeUserType { get; set; }
|
||||
public virtual DbSet<TrialEmailBlackUser> TrialEmailBlackUser { get; set; }
|
||||
|
||||
|
||||
#region 废弃
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
|
||||
public static IResponseOutput<string> DBNotExistIfNUll(object businessObject)
|
||||
{
|
||||
return new ResponseOutput<string>().NotOk("The business object{businessObject.GetType().Name} does not exist in the database, or was deleted by someone else, or an incorrect parameter query caused");
|
||||
return new ResponseOutput<string>().NotOk($"The business object{businessObject.GetType().Name} does not exist in the database, or was deleted by someone else, or an incorrect parameter query caused");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue