中心调研邮件初步修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7535d49844
commit
25116a9f0e
|
@ -1,6 +1,7 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MailKit;
|
||||
|
@ -31,7 +32,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
|
||||
|
||||
Task ExternalUserJoinEmail(Guid trialId, Guid userId, Guid userTypeId, string baseUrl, string rootUrl);
|
||||
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
|
||||
|
||||
Task<Guid> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
|
||||
|
||||
|
@ -428,13 +429,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
//外部用户 加入项目
|
||||
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, Guid userTypeId, string baseUrl, string rootUrl)
|
||||
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException();
|
||||
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var userType = await _userTypeRepository.FirstAsync(t => t.Id == userTypeId);
|
||||
var userTypes = await _userRoleRepository.Where(t => t.IdentityUserId == sysUserInfo.Id).Select(t => t.UserTypeRole.UserTypeShortName).ToListAsync();
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
|
@ -454,7 +455,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
|
||||
|
||||
|
@ -472,7 +473,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.UserName,
|
||||
userType.UserTypeShortName,
|
||||
string.Join(',', userTypes),
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
|
@ -487,16 +488,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Site调研 用户加入项目
|
||||
public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl)
|
||||
{
|
||||
var sysUserInfo = (await _userRoleRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var userTypes = await _userRoleRepository.Where(t => t.IdentityUserId == sysUserInfo.Id).Select(t => t.UserTypeRole.UserTypeShortName).ToListAsync();
|
||||
|
||||
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
|
||||
|
||||
|
@ -513,10 +511,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new UserRole() { EmailToken = token });
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
|
||||
}
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
|
@ -535,8 +533,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
trialInfo.ExperimentName,
|
||||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.UserName,
|
||||
sysUserInfo.UserTypeRole.UserTypeShortName,
|
||||
sysUserInfo.UserName,
|
||||
string.Join(',', userTypes),
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
|
@ -553,6 +551,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//医生生成账号加入 或者已存在账号加入到项目中
|
||||
|
|
|
@ -205,6 +205,8 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public string FullName { get; set; } = String.Empty;
|
||||
|
||||
public string UserTypeShortName { get; set; }
|
||||
|
||||
public bool IsSelect { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ using IRaCIS.Core.Domain.Share;
|
|||
using IRaCIS.Core.Infrastructure;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -276,15 +278,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
//判断TrialUser中是否存在 不存在就插入 注意退出了,也不能再加进来
|
||||
|
||||
}
|
||||
|
||||
await _mailVerificationService.ExternalUserJoinEmail(trialId, userId,userTypeId, sendEmail.BaseUrl, sendEmail.RouteUrl);
|
||||
foreach (var item in sendEmail.SendUsers.GroupBy(t=>t.SystemUserId))
|
||||
{
|
||||
await _mailVerificationService.ExternalUserJoinEmail(trialId, item.Key, sendEmail.BaseUrl, sendEmail.RouteUrl);
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
OrganizationName = t.IdentityUser.OrganizationName,
|
||||
Phone = t.IdentityUser.Phone,
|
||||
UserName = t.IdentityUser.UserName,
|
||||
|
||||
UserTypeShortName=t.UserTypeRole.UserTypeShortName,
|
||||
IsSelect = t.UserRoleTrials.Any(t => t.TrialId == inQuery.TrialId),
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue