外部用户 发送邮件更改
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
/// <summary> TrialSiteUserSurveyView 列表视图模型 </summary>
|
||||
@@ -16,7 +18,33 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
public string UserType { get; set; } = string.Empty;
|
||||
public TrialSiteSurveyEnum State { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public TrialSiteUserStateEnum InviteState { get; set; }
|
||||
|
||||
public DateTime? ExpireTime { get; set; }
|
||||
|
||||
public bool? IsJoin { get; set; }
|
||||
|
||||
public DateTime? ConfirmTime { get; set; }
|
||||
|
||||
public string RejectReason { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public TrialSiteUserStateEnum State
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InviteState == TrialSiteUserStateEnum.HasSend && ExpireTime != null && ExpireTime < DateTime.Now)
|
||||
{
|
||||
return TrialSiteUserStateEnum.OverTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
return InviteState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TrialRoleName { get; set; }
|
||||
|
||||
|
||||
@@ -509,11 +509,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
}
|
||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
||||
{
|
||||
//if (_repository.Where<TrialSiteUserSurvey>(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsCorrect == false).Any())
|
||||
//{
|
||||
// return ResponseOutput.NotOk("人员信息有不正确项,不允许提交");
|
||||
//}
|
||||
|
||||
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
||||
|
||||
}
|
||||
@@ -523,11 +519,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var trialSiteSurvey = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefault();
|
||||
|
||||
if (trialSiteSurvey == null) return Null404NotFound(trialSiteSurvey);
|
||||
|
||||
//if (_trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsCorrect == false).Any())
|
||||
//{
|
||||
// return ResponseOutput.NotOk("人员信息有不正确项,不允许提交");
|
||||
//}
|
||||
|
||||
|
||||
//已生成的不管 管的只需要是 生成失败的并且需要生成账号的
|
||||
var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsGenerateSuccess == false).ToList();
|
||||
@@ -544,14 +536,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, item.Email));
|
||||
//主题
|
||||
messageToSend.Subject = "GRR Site survey (Trial Notice)";
|
||||
messageToSend.Subject = "GRR Site survey (Trial Invite)";
|
||||
|
||||
var builder = new BodyBuilder();
|
||||
|
||||
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
||||
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email ).Include(t=>t.UserTypeRole).FirstOrDefaultAsync();
|
||||
|
||||
int verificationCode = new Random().Next(100000, 1000000);
|
||||
//int verificationCode = new Random().Next(100000, 1000000);
|
||||
|
||||
//var baseApiUrl = baseUrl.Remove(baseUrl.IndexOf("#")) + "api";
|
||||
|
||||
@@ -571,7 +563,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
saveItem.UserTypeEnum = _repository.Where<UserType>(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
|
||||
|
||||
saveItem.Password = MD5Helper.Md5(verificationCode.ToString());
|
||||
//saveItem.Password = MD5Helper.Md5(verificationCode.ToString());
|
||||
|
||||
_ = _repository.AddAsync(saveItem).Result;
|
||||
|
||||
@@ -583,11 +575,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
}
|
||||
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == sysUserInfo.Id,
|
||||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||
}
|
||||
//if (sysUserInfo.IsFirstAdd)
|
||||
//{
|
||||
// await _userRepository.UpdateFromQueryAsync(t => t.Id == sysUserInfo.Id,
|
||||
// u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||
//}
|
||||
|
||||
|
||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
||||
@@ -597,38 +589,55 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
||||
</div>
|
||||
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
||||
您参与的临床试验项目 {trialInfo.ExperimentName} ,独立影像评估相关工作将在网上进行。项目及账号信息为:
|
||||
您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢!
|
||||
</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>
|
||||
用户名: {sysUserInfo.UserName}
|
||||
</div>
|
||||
<div>
|
||||
密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
|
||||
</div>
|
||||
<div>
|
||||
角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
||||
</div>
|
||||
<div>
|
||||
系统登录地址: {siteSurvyeSubmit.LoginUrl} (请确认加入后再登陆)
|
||||
</div>
|
||||
</div>
|
||||
<a href='{siteSurvyeSubmit.RouteUrl + "?Id="+item.Id+ "&IsExternalUser=0"}' style='margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
|
||||
|
||||
<a href=' {siteSurvyeSubmit.RouteUrl + "?Id=" + siteSurvyeSubmit.TrialSiteSurveyId + "&IsExternalUser=0"}' style='margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
|
||||
查看并确认
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
|
||||
//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'>
|
||||
// {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
||||
// </div>
|
||||
// <div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
||||
// 您参与的临床试验项目 {trialInfo.ExperimentName} ,独立影像评估相关工作将在网上进行。项目及账号信息为:
|
||||
// </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>
|
||||
// 用户名: {sysUserInfo.UserName}
|
||||
// </div>
|
||||
// <div>
|
||||
// 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
|
||||
// </div>
|
||||
// <div>
|
||||
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
||||
// </div>
|
||||
// <div>
|
||||
// 系统登录地址: {siteSurvyeSubmit.LoginUrl} (请确认加入后再登陆)
|
||||
// </div>
|
||||
// </div>
|
||||
// <a href='{siteSurvyeSubmit.RouteUrl + "?Id="+item.Id+ "&IsExternalUser=0"}' style='margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
|
||||
// 查看并确认
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </body>";
|
||||
|
||||
|
||||
messageToSend.Body = builder.ToMessageBody();
|
||||
|
||||
@@ -668,24 +677,5 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 锁定
|
||||
///// </summary>
|
||||
///// <param name="trialSiteSurveyId"></param>
|
||||
///// <param name="isLock"></param>
|
||||
///// <returns></returns>
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
//[HttpPost("{trialSiteSurveyId:guid}/{trialId:guid}/{isLock:bool}")]
|
||||
//public async Task<IResponseOutput> TrialSurveyLock(Guid trialSiteSurveyId, bool isLock)
|
||||
//{
|
||||
// if (await _repository.Where<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId).AnyAsync(t => t.TrialSiteUserSurveyList.Any(k => k.IsGenerateAccount && k.IsGenerateSuccess == false)))
|
||||
// {
|
||||
// ResponseOutput.NotOk("有用户账户没生成,不允许锁定");
|
||||
// }
|
||||
|
||||
// await _repository.UpdateFromQueryAsync<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId, k => new TrialSiteSurvey() { State==TrialSiteSurveyEnum.PMCreatedAndLock });
|
||||
|
||||
// return ResponseOutput.Ok();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user