diff --git a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs index 99ec49653..6706cc580 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs @@ -46,19 +46,19 @@ namespace IRaCIS.Core.API var emailConfig = new SystemEmailSendConfig(); configuration.GetSection("SystemEmailSendConfig").Bind(emailConfig); - if (emailConfig.IsOpenErrorNoticeEmail) - { - config.WriteTo.Email(options: new Serilog.Sinks.Email.EmailSinkOptions() - { - From = emailConfig.FromEmail, - To = emailConfig.ErrorNoticeEmailList, - Host = emailConfig.Host, - Port = emailConfig.Port, - Subject = new MessageTemplateTextFormatter("Log Alert - 系统发生了异常,请核查"), - Credentials = new NetworkCredential(emailConfig.FromEmail, emailConfig.AuthorizationCode) + //if (emailConfig.IsOpenErrorNoticeEmail) + //{ + // config.WriteTo.Email(options: new Serilog.Sinks.Email.EmailSinkOptions() + // { + // From = emailConfig.FromEmail, + // To = emailConfig.ErrorNoticeEmailList, + // Host = emailConfig.Host, + // Port = emailConfig.Port, + // Subject = new MessageTemplateTextFormatter("Log Alert - 系统发生了异常,请核查"), + // Credentials = new NetworkCredential(emailConfig.FromEmail, emailConfig.AuthorizationCode) - }, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error); - } + // }, restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error); + //} #endregion Log.Logger = config.CreateLogger(); diff --git a/IRaCIS.Core.API/appsettings.Prod_IRC.json b/IRaCIS.Core.API/appsettings.Prod_IRC.json index 5d8bb58bb..f41e258ba 100644 --- a/IRaCIS.Core.API/appsettings.Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.Prod_IRC.json @@ -85,10 +85,8 @@ "CompanyShortName": "Extensive Imaging", "CompanyShortNameCN": "展影医疗", "IsEnv_US": false, - "IsOpenErrorNoticeEmail": false, "EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", - "CronEmailDefaultCulture": "zh-CN", - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + "CronEmailDefaultCulture": "zh-CN" }, "SystemPacsConfig": { "Port": "11113", diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index f8ddeda2f..3e3eea57b 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -149,14 +149,15 @@ }, // 邮件服务配置(用于系统通知、找回密码、错误报警等) "SystemEmailSendConfig": { - // SMTP端口 - "Port": 465, + // 企业邮箱SMTP服务器地址 "Host": "smtp.qiye.aliyun.com", + // SMTP端口 + "Port": 465, "Imap": "imap.qiye.aliyun.com", - "ImapPort": 993, + // 发件人邮箱地址 "FromEmail": "test@extimaging.com", // 发件人显示名称 @@ -166,14 +167,16 @@ // 系统对外访问地址 "SiteUrl": "http://irc.test.extimaging.com/login", - "PlatformName": "EICS", - "PlatformNameCN": "展影云平台", - // 系统简称一致性核查使用 + + // 系统简称 - 一致性核查使用 "SystemShortName": "IRC", - // 组织英文名称 + // 组织英文名称-添加用户默认值 "OrganizationName": "ExtImaging", // 组织中文名称 "OrganizationNameCN": "ExtImaging", + + "PlatformName": "EICS", + "PlatformNameCN": "展影云平台", // 公司英文全称 "CompanyName": "Extensive Imaging", // 公司中文全称 @@ -182,15 +185,14 @@ "CompanyShortName": "Extensive Imaging", // 公司中文简称 "CompanyShortNameCN": "展影医疗", - // 是否为国际版环境 + + // 是否为国际版环境 方便前端区分,用于区分lili 还是irc 做一些事情 "IsEnv_US": false, - // 是否开启系统异常邮件报警 - "IsOpenErrorNoticeEmail": false, // 邮箱格式校验正则表达式 "EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", - "CronEmailDefaultCulture": "zh-CN", - // 接收系统异常报警的邮箱列表 - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + + //后端周期性邮件默认语言 + "CronEmailDefaultCulture": "zh-CN" }, // PACS 连接配置 "SystemPacsConfig": { diff --git a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json index 8a695d472..41720417e 100644 --- a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json @@ -90,10 +90,8 @@ "CompanyShortNameCN": "展影医疗", "SiteUrl": "https://lili.elevateimaging.ai/login", "IsEnv_US": true, - "IsOpenErrorNoticeEmail": false, "EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", - "CronEmailDefaultCulture": "en-US", - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + "CronEmailDefaultCulture": "en-US" }, "SystemPacsConfig": { diff --git a/IRaCIS.Core.API/appsettings.US_Test_IRC.json b/IRaCIS.Core.API/appsettings.US_Test_IRC.json index 367320716..b455bdf8c 100644 --- a/IRaCIS.Core.API/appsettings.US_Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Test_IRC.json @@ -93,9 +93,7 @@ "CompanyShortName": "Elevate Imaging", "CompanyShortNameCN": "展影医疗", "SiteUrl": "https://lili.test.elevateimaging.ai/login", - "IsEnv_US": true, - "IsOpenErrorNoticeEmail": false, - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + "IsEnv_US": true }, "SystemPacsConfig": { diff --git a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json index 7305f27d3..d9408c07b 100644 --- a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json @@ -97,10 +97,8 @@ "CompanyShortNameCN": "展影医疗", "SiteUrl": "https://lili.uat.elevateimaging.ai/login", "IsEnv_US": true, - "IsOpenErrorNoticeEmail": false, "EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", - "CronEmailDefaultCulture": "en-US", - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + "CronEmailDefaultCulture": "en-US" }, "SystemPacsConfig": { diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index cb743d7a1..a229b776b 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -104,10 +104,8 @@ "CompanyShortName": "Extensive Imaging", "CompanyShortNameCN": "展影医疗", "IsEnv_US": false, - "IsOpenErrorNoticeEmail": false, "EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", - "CronEmailDefaultCulture": "zh-CN", - "ErrorNoticeEmailList": [ "872297557@qq.com" ] + "CronEmailDefaultCulture": "zh-CN" }, "SystemPacsConfig": { diff --git a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs index ac487b773..757a1d7ae 100644 --- a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs @@ -79,11 +79,12 @@ public class SystemEmailSendConfig public bool IsEnv_US { get; set; } - public bool IsOpenErrorNoticeEmail { get; set; } - public string EmailRegexStr { get; set; } - public List ErrorNoticeEmailList { get; set; } = new List(); + //public bool IsOpenErrorNoticeEmail { get; set; } + + + //public List ErrorNoticeEmailList { get; set; } = new List(); } public class SystemEmailSendConfigView diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 702177b2d..04108be07 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -566,6 +566,27 @@ + + + 更新系统基础配置 + + + + + + + 获取系统邮件配置信息 + + + + + + + 更新系统邮件配置 + + + + 方案编号 STUDYID diff --git a/IRaCIS.Core.Application/Service/Common/DeployConfigService.cs b/IRaCIS.Core.Application/Service/Common/DeployConfigService.cs index 2c47a87a5..6edfeeac6 100644 --- a/IRaCIS.Core.Application/Service/Common/DeployConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/DeployConfigService.cs @@ -13,64 +13,118 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace IRaCIS.Core.Application.Service.Common +namespace IRaCIS.Core.Application.Service.Common; + +[ApiExplorerSettings(GroupName = "Common")] +public class DeployConfigService(IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService { - public class DeployConfigService(IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService + + /// + /// 获取系统基础配置信息 + /// + /// + /// + public async Task GetSystemBasicConfigInfo([FromServices] IOptionsMonitor options) { - - /// - /// 获取系统基础配置信息 - /// - /// - /// - public async Task GetSystemBasicConfigInfo([FromServices] IOptionsMonitor options) - { - return options.CurrentValue; - } - - [HttpPost] - public async Task UpdateSystemBasicConfig(ServiceVerifyConfigOption basicSystemConfigOption) - { - var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json"; - - string text = System.IO.File.ReadAllText(path); - - // 修改 - JObject obj = JObject.Parse(text); - // QCRiskControl 相关配置 - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.QCRiskControl)] = basicSystemConfigOption.QCRiskControl; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenUserComplexPassword)] = basicSystemConfigOption.OpenUserComplexPassword; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenSignDocumentBeforeWork)] = basicSystemConfigOption.OpenSignDocumentBeforeWork; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenTrialRelationDelete)] = basicSystemConfigOption.OpenTrialRelationDelete; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginLimit)] = basicSystemConfigOption.OpenLoginLimit; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginMaxFailCount)] = basicSystemConfigOption.LoginMaxFailCount; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginFailLockMinutes)] = basicSystemConfigOption.LoginFailLockMinutes; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.AutoLoginOutMinutes)] = basicSystemConfigOption.AutoLoginOutMinutes; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginMFA)] = basicSystemConfigOption.OpenLoginMFA; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ContinuousReadingTimeMin)] = basicSystemConfigOption.ContinuousReadingTimeMin; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ReadingRestTimeMin)] = basicSystemConfigOption.ReadingRestTimeMin; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.IsNeedChangePassWord)] = basicSystemConfigOption.IsNeedChangePassWord; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ChangePassWordDays)] = basicSystemConfigOption.ChangePassWordDays; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.TemplateType)] = ((int)basicSystemConfigOption.TemplateType).ToString(); // 枚举需要转换为字符串 - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ThirdPdfUrl)] = basicSystemConfigOption.ThirdPdfUrl; - obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.UserMFAVerifyMinutes)] = basicSystemConfigOption.UserMFAVerifyMinutes; - - - // 重新写入appsettings.json - string result = obj.ToString(); - System.IO.File.WriteAllText(path, result); - - - return ResponseOutput.Ok(); - } - - public async Task GetEmailConfigInfo([FromServices] IOptionsMonitor options) - { - return options.CurrentValue; - } - - - - + return options.CurrentValue; } + + /// + /// 更新系统基础配置 + /// + /// + /// + [HttpPost] + public async Task UpdateSystemBasicConfig(ServiceVerifyConfigOption basicSystemConfigOption) + { + var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json"; + + string text = System.IO.File.ReadAllText(path); + + // 修改 + JObject obj = JObject.Parse(text); + // QCRiskControl 相关配置 + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.QCRiskControl)] = basicSystemConfigOption.QCRiskControl; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenUserComplexPassword)] = basicSystemConfigOption.OpenUserComplexPassword; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenSignDocumentBeforeWork)] = basicSystemConfigOption.OpenSignDocumentBeforeWork; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenTrialRelationDelete)] = basicSystemConfigOption.OpenTrialRelationDelete; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginLimit)] = basicSystemConfigOption.OpenLoginLimit; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginMaxFailCount)] = basicSystemConfigOption.LoginMaxFailCount; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.LoginFailLockMinutes)] = basicSystemConfigOption.LoginFailLockMinutes; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.AutoLoginOutMinutes)] = basicSystemConfigOption.AutoLoginOutMinutes; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.OpenLoginMFA)] = basicSystemConfigOption.OpenLoginMFA; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ContinuousReadingTimeMin)] = basicSystemConfigOption.ContinuousReadingTimeMin; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ReadingRestTimeMin)] = basicSystemConfigOption.ReadingRestTimeMin; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.IsNeedChangePassWord)] = basicSystemConfigOption.IsNeedChangePassWord; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ChangePassWordDays)] = basicSystemConfigOption.ChangePassWordDays; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.TemplateType)] = ((int)basicSystemConfigOption.TemplateType); // 枚举需要转换为字符串 + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.ThirdPdfUrl)] = basicSystemConfigOption.ThirdPdfUrl; + obj["BasicSystemConfig"][nameof(ServiceVerifyConfigOption.UserMFAVerifyMinutes)] = basicSystemConfigOption.UserMFAVerifyMinutes; + + + // 重新写入appsettings.json + string result = obj.ToString(); + System.IO.File.WriteAllText(path, result); + + + return ResponseOutput.Ok(); + } + + /// + /// 获取系统邮件配置信息 + /// + /// + /// + public async Task GetEmailConfigInfo([FromServices] IOptionsMonitor options) + { + return options.CurrentValue; + } + + + /// + /// 更新系统邮件配置 + /// + /// + /// + [HttpPost] + public async Task UpdateSystemEmailConfig(SystemEmailSendConfig emailConfig) + { + var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json"; + + string text = System.IO.File.ReadAllText(path); + + // 修改 + JObject obj = JObject.Parse(text); + + // SystemEmailSendConfig 相关配置 + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Port)] = emailConfig.Port; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Host)] = emailConfig.Host; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.Imap)] = emailConfig.Imap; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.ImapPort)] = emailConfig.ImapPort; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.FromEmail)] = emailConfig.FromEmail; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.FromName)] = emailConfig.FromName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.AuthorizationCode)] = emailConfig.AuthorizationCode; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.SiteUrl)] = emailConfig.SiteUrl; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.PlatformName)] = emailConfig.PlatformName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.PlatformNameCN)] = emailConfig.PlatformNameCN; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.SystemShortName)] = emailConfig.SystemShortName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.OrganizationName)] = emailConfig.OrganizationName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.OrganizationNameCN)] = emailConfig.OrganizationNameCN; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyName)] = emailConfig.CompanyName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyNameCN)] = emailConfig.CompanyNameCN; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyShortName)] = emailConfig.CompanyShortName; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.CompanyShortNameCN)] = emailConfig.CompanyShortNameCN; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.IsEnv_US)] = emailConfig.IsEnv_US; + obj["SystemEmailSendConfig"][nameof(SystemEmailSendConfig.EmailRegexStr)] = emailConfig.EmailRegexStr; + + + + // 重新写入appsettings.json + string result = obj.ToString(); + System.IO.File.WriteAllText(path, result); + + + return ResponseOutput.Ok(); + } + } diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index e316f01fa..1c61b12fc 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -141,7 +141,16 @@ namespace IRaCIS.Core.Application.Service { var extralConfig = JsonConvert.DeserializeObject(item.TrialExtraConfigJsonStr); - extralConfig.EquipmentControlFieldList = trialExtalConfig.EquipmentControlFieldList; + if (extralConfig.ModifyFiledList.Count > 0) + { + extralConfig.EquipmentControlFieldList = trialExtalConfig.EquipmentControlFieldList.Where(t => t.ShowOrder != 2).ToList(); + + } + else + { + extralConfig.EquipmentControlFieldList = trialExtalConfig.EquipmentControlFieldList; + + } var jsonInfo = extralConfig.ToJsonStr(); @@ -156,7 +165,7 @@ namespace IRaCIS.Core.Application.Service await _trialRepository.BatchUpdateNoTrackingAsync(t => idQuery.Contains(t.Id), u => new Trial() { TrialExtraConfigJsonStr = info }); - + return ResponseOutput.Ok();