中心调研拒绝邮件模板

Uat_Study
hang 2022-05-23 16:33:11 +08:00
parent f0f99ce647
commit 6e45be1f56
3 changed files with 85 additions and 47 deletions

View File

@ -109,6 +109,9 @@
<Content Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\EmailTemplate\TrialSiteSurveyReject.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\EmailTemplate\TrialUserExistJoin.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<title>Title</title>
</head>
<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
<div style='padding-left: 40px;background: #f6f6f6'>
<div style='padding-top: 20px;'>
<div style='line-height: 40px;font-size: 18px'>
尊敬的 {0} ,您好:
</div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
您好, 您填写的中心调研表被驳回,详细信息如下:
</div>
<span style="color: #00D1B2"></span>
<div style='border: 1px solid #eee;box-sizing:border-box;width: 50%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
<div>
项目编号: {1}
</div>
<div>
试验方案号: {2}
</div>
<div>
试验名称: {3}
</div>
<div>
中心编号: {4}
</div>
<div>
中心名称: {5}
</div>
<div>
驳回原因: {6}
</div>
</div>
<a href='{7}' style='margin-left:60px;font-size:14px;padding: 10px;text-decoration: none;display:{8} ;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
登陆并查看
</a>
<div style='line-height: 24px;font-size: 14px;color:#333;margin-top: 20px;padding-bottom: 40px;'>
<div>祝您顺利!/Best Regards</div>
<div style="font-size: 14px;">上海展影医疗科技有限公司</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Contracts
private readonly IRepository<TrialUser> _trialUserRepository;
private readonly ITokenService _tokenService;
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository,IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
IRepository<User> userRepository, IRepository<TrialSite> trialSiteRepository, ITokenService tokenService)
{
_trialSiteSurveyRepository = trialSiteSurveyRepository;
@ -373,7 +373,7 @@ namespace IRaCIS.Core.Application.Contracts
else
{
var entity = await _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteSurvey.Id, true).Include(x=>x.ReviewerUser).Include(x=>x.PreliminaryUser).FirstOrDefaultAsync();
var entity = await _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteSurvey.Id, true).Include(x => x.ReviewerUser).Include(x => x.PreliminaryUser).FirstOrDefaultAsync();
_mapper.Map(addOrEditTrialSiteSurvey, entity);
await _trialSiteSurveyRepository.SaveChangesAsync();
@ -567,44 +567,30 @@ namespace IRaCIS.Core.Application.Contracts
//主题
messageToSend.Subject = $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 关于中心调研审批的提醒";
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
<div style='padding-left: 40px;background: #f6f6f6'>
<div style='padding-top: 20px;'>
<div style='line-height: 40px;font-size: 18px'>
{ (user == null ? survey.UserName : user.LastName + "/ " + user.FirstName)}:
</div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
,
</div>
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
<div>
: {trialInfo.TrialCode}
</div>
<div>
: {trialInfo.ResearchProgramNo}
</div>
<div>
: {trialInfo.ExperimentName}
</div>
<div>
: {siteInfo.TrialSiteCode}
</div>
<div>
: {siteInfo.TrialSiteAliasName}
</div>
<div>
: {survey.LatestBackReason}
</div>
<div>
var pathToFile = _hostEnvironment.WebRootPath
+ Path.DirectorySeparatorChar.ToString()
+ "EmailTemplate"
+ Path.DirectorySeparatorChar.ToString()
+ "TrialSiteSurveyReject.html";
<a href='{ trialSiteSubmitBackCommand.RouteUrl}' style='margin-left:60px;font-size:14px;padding: 10px;text-decoration: none;display:{(survey.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")} ;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
</a>
</div>
</div>
</div>
</div>
</body>";
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
{
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
(user == null ? survey.UserName : user.LastName + "/ " + user.FirstName),
trialInfo.TrialCode,
trialInfo.ResearchProgramNo,
trialInfo.ExperimentName,
siteInfo.TrialSiteCode,
siteInfo.TrialSiteAliasName,
survey.LatestBackReason,
trialSiteSubmitBackCommand.RouteUrl,
(survey.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")
);
}
messageToSend.Body = builder.ToMessageBody();
@ -732,7 +718,7 @@ namespace IRaCIS.Core.Application.Contracts
await GenerateAccountAsync(needGenerateList);
await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId= trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList });
await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList });
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
@ -835,7 +821,7 @@ namespace IRaCIS.Core.Application.Contracts
trialInfo.TrialCode,
sysUserInfo.UserName,
sysUserInfo.UserTypeRole.UserTypeShortName,
sysUserInfo.IsFirstAdd ? routeUrl:joinCommand.BaseUrl
sysUserInfo.IsFirstAdd ? routeUrl : joinCommand.BaseUrl
);
}
@ -851,7 +837,7 @@ namespace IRaCIS.Core.Application.Contracts
var siteId = trialSiteSurvey.SiteId;
//判断TrialUser中是否存在 不存在就插入
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId,true))
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
{
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId });