周期性任务事件根据环境配置,增加默认语言,方便触发的时候,后台知道以什么语言发送邮件
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
010367d018
commit
bbcab237d4
|
|
@ -22,6 +22,7 @@ using Newtonsoft.Json;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
@ -29,6 +30,10 @@ using System.Runtime.InteropServices;
|
||||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||||
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("Startup Culture: " + CultureInfo.CurrentCulture.Name);
|
||||||
|
Console.WriteLine("Startup UI Culture: " + CultureInfo.CurrentUICulture.Name);
|
||||||
|
|
||||||
#region 获取环境变量
|
#region 获取环境变量
|
||||||
//以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数)
|
//以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数)
|
||||||
var config = new ConfigurationBuilder()
|
var config = new ConfigurationBuilder()
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@
|
||||||
//"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
//"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
||||||
//"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
//"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
||||||
},
|
},
|
||||||
|
"WeComNoticeConfig": {
|
||||||
|
"IsOpenWeComNotice": true,
|
||||||
|
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
||||||
|
"APINoticeUserList": [ "u", "wait..." ],
|
||||||
|
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
||||||
|
},
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
"ObjectStoreUse": "AliyunOSS",
|
"ObjectStoreUse": "AliyunOSS",
|
||||||
"AliyunOSS": {
|
"AliyunOSS": {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@
|
||||||
// Hangfire 定时任务数据库链接字符串
|
// Hangfire 定时任务数据库链接字符串
|
||||||
"Hangfire": "Server=106.14.89.110,1435;Database=Test_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
"Hangfire": "Server=106.14.89.110,1435;Database=Test_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
||||||
},
|
},
|
||||||
|
"WeComNoticeConfig": {
|
||||||
|
"IsOpenWeComNotice": true,
|
||||||
|
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
||||||
|
"APINoticeUserList": [ "u", "wait..." ],
|
||||||
|
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
||||||
|
},
|
||||||
// 对象存储服务配置
|
// 对象存储服务配置
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
// 使用的对象存储服务类型
|
// 使用的对象存储服务类型
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,12 @@
|
||||||
//"RemoteNew": "Server=44.210.231.169,1435;Database=US_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
//"RemoteNew": "Server=44.210.231.169,1435;Database=US_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||||
//"Hangfire": "Server=44.210.231.169,1435;Database=US_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
//"Hangfire": "Server=44.210.231.169,1435;Database=US_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||||
},
|
},
|
||||||
|
"WeComNoticeConfig": {
|
||||||
|
"IsOpenWeComNotice": true,
|
||||||
|
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
||||||
|
"APINoticeUserList": [ "u", "wait..." ],
|
||||||
|
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
||||||
|
},
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
"ObjectStoreUse": "AWS",
|
"ObjectStoreUse": "AWS",
|
||||||
"MinIO": {
|
"MinIO": {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,12 @@
|
||||||
"RemoteNew": "Server=3.226.182.187,1435;Database=US_Uat_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
"RemoteNew": "Server=3.226.182.187,1435;Database=US_Uat_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||||
"Hangfire": "Server=3.226.182.187,1435;Database=US_Uat_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
"Hangfire": "Server=3.226.182.187,1435;Database=US_Uat_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
||||||
},
|
},
|
||||||
|
"WeComNoticeConfig": {
|
||||||
|
"IsOpenWeComNotice": true,
|
||||||
|
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
||||||
|
"APINoticeUserList": [ "u", "wait..." ],
|
||||||
|
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
||||||
|
},
|
||||||
|
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,12 @@
|
||||||
"RemoteNew": "Server=101.132.253.119,1435;Database=Uat_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
"RemoteNew": "Server=101.132.253.119,1435;Database=Uat_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||||
"Hangfire": "Server=101.132.253.119,1435;Database=Uat_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
"Hangfire": "Server=101.132.253.119,1435;Database=Uat_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
||||||
},
|
},
|
||||||
|
"WeComNoticeConfig": {
|
||||||
|
"IsOpenWeComNotice": true,
|
||||||
|
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
||||||
|
"APINoticeUserList": [ "u", "wait..." ],
|
||||||
|
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
||||||
|
},
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
|
|
||||||
"ObjectStoreUse": "AliyunOSS",
|
"ObjectStoreUse": "AliyunOSS",
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"WeComNoticeConfig": {
|
|
||||||
"IsOpenWeComNotice": true,
|
|
||||||
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
|
|
||||||
"APINoticeUserList": [ "u","wait..." ],
|
|
||||||
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
|
|
||||||
},
|
|
||||||
"IRaCISImageStore": {
|
"IRaCISImageStore": {
|
||||||
"SwitchingMode": "RemainingDiskCapacity",
|
"SwitchingMode": "RemainingDiskCapacity",
|
||||||
"SwitchingRatio": 80,
|
"SwitchingRatio": 80,
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ public static class WeComNotifier
|
||||||
if (!string.IsNullOrWhiteSpace(stack))
|
if (!string.IsNullOrWhiteSpace(stack))
|
||||||
{
|
{
|
||||||
stack = stack.Replace("\n", "\n> ");
|
stack = stack.Replace("\n", "\n> ");
|
||||||
if (stack.Length > 1200)
|
if (stack.Length > 600)
|
||||||
stack = stack[..1200] + "...(已截断)";
|
stack = stack[..600] + "...(已截断)";
|
||||||
}
|
}
|
||||||
|
|
||||||
var markdown = $@"## 🚨 系统告警
|
var markdown = $@"## 🚨 系统告警
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ public class ConsumeExceptionFilter<T>(ILogger<ConsumeExceptionFilter<T>> _logge
|
||||||
Env = baseUrl,
|
Env = baseUrl,
|
||||||
UserName = "MassTransit 自动触发邮件",
|
UserName = "MassTransit 自动触发邮件",
|
||||||
Api = "",
|
Api = "",
|
||||||
Message = $"异常信息:{exception.Message} 堆栈信息:[{exception.StackTrace}",
|
Message = $"异常信息:{exception.Message} ",
|
||||||
|
Stack = exception.StackTrace,
|
||||||
AtUsers = userList ?? []
|
AtUsers = userList ?? []
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,12 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
public async Task Consume(ConsumeContext<UrgentIRUnReadTaskRecurringEvent> context)
|
public async Task Consume(ConsumeContext<UrgentIRUnReadTaskRecurringEvent> context)
|
||||||
{
|
{
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var trialId = context.Message.TrialId;
|
var trialId = context.Message.TrialId;
|
||||||
|
|
||||||
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
|
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using MassTransit.Scheduling;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -34,7 +35,11 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
||||||
{
|
{
|
||||||
var trialId = context.Message.TrialId;
|
var trialId = context.Message.TrialId;
|
||||||
|
|
||||||
var isEn_us = false;
|
var isEn_us = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
||||||
|
|
||||||
|
|
@ -102,7 +107,12 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
||||||
{
|
{
|
||||||
var trialId = context.Message.TrialId;
|
var trialId = context.Message.TrialId;
|
||||||
|
|
||||||
var isEn_us = false;
|
var isEn_us = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr, t.DeclarationTypeEnumList }).FirstNotNullAsync();
|
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr, t.DeclarationTypeEnumList }).FirstNotNullAsync();
|
||||||
|
|
||||||
//找到 该项目的IQC 用户Id
|
//找到 该项目的IQC 用户Id
|
||||||
|
|
@ -173,7 +183,11 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||||
{
|
{
|
||||||
var trialId=context.Message.TrialId;
|
var trialId=context.Message.TrialId;
|
||||||
|
|
||||||
var isEn_us = false;
|
var isEn_us = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,12 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
Console.WriteLine("发送定时过期提醒");
|
Console.WriteLine("发送定时过期提醒");
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var systemDocQuery =
|
var systemDocQuery =
|
||||||
from sysDoc in _systemDocumentRepository.AsQueryable(false)
|
from sysDoc in _systemDocumentRepository.AsQueryable(false)
|
||||||
from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||||
|
|
@ -150,7 +155,11 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
public async Task Consume(ConsumeContext<SystemDocumentPublishEvent> context)
|
public async Task Consume(ConsumeContext<SystemDocumentPublishEvent> context)
|
||||||
{
|
{
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
// 记录是否只发送给新增角色的日志
|
// 记录是否只发送给新增角色的日志
|
||||||
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,11 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
Console.WriteLine("发送定时项目过期提醒");
|
Console.WriteLine("发送定时项目过期提醒");
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
var trialDocQuery =
|
var trialDocQuery =
|
||||||
from trialDoc in _trialDocumentRepository.AsQueryable(true)
|
from trialDoc in _trialDocumentRepository.AsQueryable(true)
|
||||||
|
|
||||||
|
|
@ -177,7 +181,11 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
public async Task Consume(ConsumeContext<TrialDocumentPublishEvent> context)
|
public async Task Consume(ConsumeContext<TrialDocumentPublishEvent> context)
|
||||||
{
|
{
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = context.Message.CultureInfoName == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
//设置当前事件传递过来的语言
|
||||||
|
var culture = context.Message.CultureInfoName;
|
||||||
|
CultureInfo.CurrentCulture = new CultureInfo(culture);
|
||||||
|
|
||||||
// 记录是否只发送给新增角色的日志
|
// 记录是否只发送给新增角色的日志
|
||||||
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue