统一修改邮件配置
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-07 14:47:22 +08:00
parent 7fff48b07a
commit ce47776f19
7 changed files with 130 additions and 63 deletions
@@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Office2019.Excel.ThreadedComments;
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Application.Contracts;
using IRaCIS.Application.Interfaces;
using IRaCIS.Core.Application.Helper;
@@ -231,9 +232,9 @@ namespace IRaCIS.Core.Application.Service
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<(DoctorSummarize,bool)> AddOrUpdateGneralSituation(SummarizeInfoDto inDto)
public async Task<(DoctorSummarize, bool)> AddOrUpdateGneralSituation(SummarizeInfoDto inDto)
{
if (inDto.TrialId != null&&inDto.Id==null)
if (inDto.TrialId != null && inDto.Id == null)
{
var systemCount = await _doctorSummarizeRepository.Where(x => x.DoctorId == inDto.DoctorId && x.TrialId == null).CountAsync();
if (systemCount == 0)
@@ -242,7 +243,7 @@ namespace IRaCIS.Core.Application.Service
var dictionery = await _dictionaryRepository.Where(x => x.Parent.Code == "Indication" && x.Code == trialinfo.IndicationEnum.ToString()).FirstNotNullAsync();
inDto.IndicationEn = dictionery.Value;
inDto.Indication = dictionery.ValueCN;
var system= inDto.Clone();
var system = inDto.Clone();
system.TrialId = null;
system.IsMain = true;
await _doctorSummarizeRepository.InsertOrUpdateAsync(system, true);
@@ -255,7 +256,7 @@ namespace IRaCIS.Core.Application.Service
if (systemCount == 0)
{
inDto.IsMain = true;
}
if (inDto.Indication.IsNullOrEmpty() && inDto.IndicationEn.IsNullOrEmpty())
{
@@ -263,19 +264,19 @@ namespace IRaCIS.Core.Application.Service
inDto.IndicationEn = "Default";
}
var exists = await _doctorSummarizeRepository
.Where(x=> x.IndicationEn!=string.Empty && x.Indication!=string.Empty)
.Where( x => x.IndicationEn == inDto.IndicationEn|| x.Indication == inDto.Indication)
.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null&&x.Id!=inDto.Id);
.Where(x => x.IndicationEn != string.Empty && x.Indication != string.Empty)
.Where(x => x.IndicationEn == inDto.IndicationEn || x.Indication == inDto.Indication)
.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null && x.Id != inDto.Id);
if (exists)
{
throw new BusinessValidationFailedException(_localizer["DoctorSummarize_repeat"]);
}
}
if (inDto.TrialId != null && inDto.SaveSummarizeInfoType!= SaveSummarizeInfo.SaveSelf)
if (inDto.TrialId != null && inDto.SaveSummarizeInfoType != SaveSummarizeInfo.SaveSelf)
{
switch (inDto.SaveSummarizeInfoType)
{
@@ -313,16 +314,16 @@ namespace IRaCIS.Core.Application.Service
if (inDto.TrialId == null && inDto.IsMain)
{
await _doctorSummarizeRepository.BatchUpdateNoTrackingAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null,
await _doctorSummarizeRepository.BatchUpdateNoTrackingAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null,
x => new DoctorSummarize()
{
IsMain = false
});
{
IsMain = false
});
}
var entity = await _doctorSummarizeRepository.InsertOrUpdateAsync(inDto, true);
return (entity,true);
return (entity, true);
}
/// <summary>
@@ -333,7 +334,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<bool> DeleteSummarizeInfo(DeleteSummarizeInfoInDto inDto)
{
var result = await _doctorSummarizeRepository.DeleteFromQueryAsync(x=>x.Id==inDto.Id);
var result = await _doctorSummarizeRepository.DeleteFromQueryAsync(x => x.Id == inDto.Id);
return await _doctorSummarizeRepository.SaveChangesAsync();
}
@@ -345,7 +346,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<UpdateGneralSituationDto> GetSummarizeInfo(GetSummarizeInfoInDto inDto)
{
if (inDto.TrialId != null)
{
var doctorInfo = await trialExperienceService.GetTrialDoctorInfo(new GetTrialDoctorInfoInDto()
@@ -357,8 +358,9 @@ namespace IRaCIS.Core.Application.Service
}
var result = await _doctorSummarizeRepository.Where(t => t.DoctorId == inDto.DoctorId && t.TrialId == inDto.TrialId)
.ProjectTo<SummarizeInfoDto>(_mapper.ConfigurationProvider).ToListAsync();
return new UpdateGneralSituationDto() {
SummarizeList= result
return new UpdateGneralSituationDto()
{
SummarizeList = result
};
}
@@ -378,30 +380,36 @@ namespace IRaCIS.Core.Application.Service
messageToSend.To.Add(new MailboxAddress(String.Empty, item));
}
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
;
var topicStr = string.Format(input.topicStr,string.Empty);
;
var topicStr = string.Format(input.topicStr, string.Empty);
var htmlBodyStr = string.Format(
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
_systemEmailConfig.SiteUrl.Replace("login",string.Empty)+inDto.Url
_systemEmailConfig.SiteUrl.Replace("login", string.Empty) + inDto.Url
);
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository,
EmailBusinessScenario.Reviewer_CV_Collection,
var scenario = EmailBusinessScenario.Reviewer_CV_Collection;
var emailConfig = _emailNoticeConfigrepository.Where(t => t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
if (emailConfig != null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
return true;
}
@@ -491,7 +499,7 @@ namespace IRaCIS.Core.Application.Service
var doctorBasicInfo = (await _doctorRepository.Where(t => t.Id == doctorId)
.ProjectTo<DoctorBasicInfoDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
doctorBasicInfo.IsHaveAccount =await _userRoleRepository.AnyAsync(x => x.DoctorId == doctorId);
doctorBasicInfo.IsHaveAccount = await _userRoleRepository.AnyAsync(x => x.DoctorId == doctorId);
return doctorBasicInfo;