调研表更新
parent
ab1250a987
commit
d687977383
|
@ -378,6 +378,12 @@
|
|||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SubmissionRejection(IRaCIS.Core.Application.Contracts.TrialSiteSubmitBackCommand)">
|
||||
<summary>
|
||||
驳回 New
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SubmissionRejection(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
驳回
|
||||
|
@ -393,6 +399,12 @@
|
|||
<param name="siteSurvyeSubmit"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.TrialSiteSurveyUserList(IRaCIS.Core.Application.Contracts.TrialSiteUserSurveyAllQuery)">
|
||||
<summary>
|
||||
项目Site调研用户列表 所有site的调研用户 会有重复
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Contracts.TrialSiteUserSurveyService">
|
||||
<summary>
|
||||
TrialSiteUserSurveyService
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public string TrialSiteSurveyEquipmentType { get; set; } = string.Empty;
|
||||
|
||||
public List<TrialSiteForSelect> TrialSiteSelectList { get; set; }=new List<TrialSiteForSelect>();
|
||||
public List<TrialSiteForSelect> TrialSiteSelectList { get; set; } = new List<TrialSiteForSelect>();
|
||||
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,26 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public List<TrialSiteUserSurveyView> TrialSiteUserSurveyList { get; set; } = new List<TrialSiteUserSurveyView>();
|
||||
}
|
||||
|
||||
public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView
|
||||
{
|
||||
public TrialSiteSurveyView TrialSiteSurvey { get; set; }
|
||||
}
|
||||
|
||||
public class TrialSiteUserSurveyAllQuery : PageInput
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
|
||||
|
||||
|
||||
public string FormWriterKeyInfo { get; set; } = string.Empty;
|
||||
|
||||
public string UserKeyInfo { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary> TrialSiteSurveyView 列表视图模型 </summary>
|
||||
public class TrialSiteSurveyView
|
||||
|
@ -88,6 +108,19 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public string LatestBackReason { get; set; } = string.Empty;
|
||||
|
||||
public UserInfoBasic ReviewerUser { get; set; }
|
||||
public UserInfoBasic PreliminaryUser { get; set; }
|
||||
|
||||
public Guid? PreliminaryUserId { get; set; }
|
||||
|
||||
public Guid? ReviewerUserId { get; set; }
|
||||
|
||||
|
||||
public DateTime? PreliminaryTime { get; set; }
|
||||
|
||||
public DateTime? ReviewerTime { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -121,7 +154,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public class SiteSurveySendVerifyCode
|
||||
{
|
||||
public VerifyType verificationType { get; set; }
|
||||
public string EmailOrPhone { get; set; } = string.Empty;
|
||||
public string EmailOrPhone { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
@ -163,12 +196,25 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class TrialSiteSurvyeSubmitDTO
|
||||
|
||||
public class TrialSiteSubmitBackCommand
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
|
||||
public string LatestBackReason { get; set; }
|
||||
|
||||
public string RouteUrl { get; set; }
|
||||
}
|
||||
|
||||
public class TrialSiteSurvyeSubmitDTO
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
|
||||
public string? LoginUrl { get; set; }
|
||||
|
||||
|
@ -186,7 +232,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public class CopyTrialSiteSurveyDTO
|
||||
{
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
|
|
@ -50,8 +50,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public Guid? SystemUserId { get; set; }
|
||||
|
||||
public UserInfoBasic ReviewerUser { get; set; }
|
||||
public UserInfoBasic PreliminaryUser { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +91,6 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string LastName { get; set; } = string.Empty;
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public bool IsCorrect { get; set; }
|
||||
public bool IsGenerateAccount { get; set; }
|
||||
|
||||
public string OrganizationName { get; set; } = string.Empty;
|
||||
|
|
|
@ -27,12 +27,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
private readonly IRepository<TrialSiteSurvey> _trialSiteSurveyRepository;
|
||||
private readonly IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository;
|
||||
private readonly IRepository<User> _userRepository;
|
||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||
|
||||
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository,IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,IRepository<User> userRepository)
|
||||
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository, IRepository<User> userRepository,IRepository<TrialSite> trialSiteRepository)
|
||||
{
|
||||
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
||||
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
|
||||
_userRepository = userRepository;
|
||||
_trialSiteRepository = trialSiteRepository;
|
||||
}
|
||||
|
||||
private object lockObj { get; set; } = new object();
|
||||
|
@ -344,7 +346,6 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public async Task<IResponseOutput> DeleteTrialSiteSurvey(Guid trialSiteSurveyId)
|
||||
{
|
||||
|
||||
|
||||
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||
{
|
||||
return ResponseOutput.NotOk("已锁定,不允许操作");
|
||||
|
@ -376,27 +377,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
return await trialSiteSurveyQueryable.ToListAsync();
|
||||
}
|
||||
|
||||
//[HttpPut("{trialId:guid}/{isReplaceUser:bool}")]
|
||||
//public async Task<IResponseOutput> CopyTrialSurveyInitInfo(CopyTrialSiteSurveyDTO copyDto, bool isReplaceUser)
|
||||
//{
|
||||
// var survey = await _repository.Where<TrialSiteSurvey>(t => t.Id == copyDto.TrialSiteSurveyId).FirstOrDefaultAsync();
|
||||
|
||||
// if (survey == null) return Null404NotFound(survey);
|
||||
|
||||
// survey.Id = Guid.Empty;
|
||||
// if (isReplaceUser)
|
||||
// {
|
||||
// survey.UserName = copyDto.UserName;
|
||||
// survey.Email = copyDto.Email;
|
||||
// survey.Phone = copyDto.Phone;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// return ResponseOutput.Ok();
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
@ -415,6 +396,146 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 驳回 New
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> SubmissionRejection(TrialSiteSubmitBackCommand trialSiteSubmitBackCommand)
|
||||
{
|
||||
var trialSiteSurveyId = trialSiteSubmitBackCommand.TrialSiteSurveyId;
|
||||
|
||||
var survey = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId);
|
||||
|
||||
survey.LatestBackReason = trialSiteSubmitBackCommand.LatestBackReason;
|
||||
|
||||
User user = null;
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
|
||||
|
||||
//主题
|
||||
messageToSend.Subject = "GRR Site survey ( Rejection )";
|
||||
|
||||
|
||||
if (await _repository.AnyAsync<TrialSiteSurvey>(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId))
|
||||
{
|
||||
return ResponseOutput.NotOk("已锁定,不允许操作");
|
||||
}
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
||||
{
|
||||
|
||||
//SPM 给填表人发
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email));
|
||||
|
||||
survey.State = TrialSiteSurveyEnum.ToSubmit;
|
||||
}
|
||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||
{
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
|
||||
if (hasSPMOrCPM)
|
||||
{
|
||||
|
||||
//PM 给SPM发 (初审人)
|
||||
user = await _userRepository.FirstOrDefaultAsync(t => t.Id == survey.PreliminaryUserId);
|
||||
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, survey.PreliminaryUserId==null? survey.Email: user.EMail));
|
||||
|
||||
survey.State = TrialSiteSurveyEnum.CRCSubmitted;
|
||||
|
||||
survey.ReviewerUserId = null;
|
||||
survey.ReviewerTime = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有SPM 给填表人发
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email));
|
||||
|
||||
survey.State = TrialSiteSurveyEnum.ToSubmit;
|
||||
|
||||
survey.PreliminaryUserId = null;
|
||||
survey.ReviewerUserId = null;
|
||||
survey.PreliminaryTime = null;
|
||||
survey.ReviewerTime = null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var builder = new BodyBuilder();
|
||||
|
||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == trialSiteSubmitBackCommand.TrialId);
|
||||
|
||||
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId&& t.SiteId== survey.SiteId,true);
|
||||
|
||||
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>
|
||||
|
||||
<a href='{ trialSiteSubmitBackCommand.RouteUrl}' style='margin-left:60px;font-size:14px;padding: 10px;text-decoration: none;display:{(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM? "none": "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>
|
||||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
|
||||
messageToSend.Body = builder.ToMessageBody();
|
||||
|
||||
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
|
||||
{
|
||||
|
||||
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
||||
|
||||
|
||||
await smtp.ConnectAsync("smtp.163.com", 25, SecureSocketOptions.StartTls);
|
||||
|
||||
|
||||
await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH");
|
||||
|
||||
|
||||
await smtp.SendAsync(messageToSend);
|
||||
|
||||
|
||||
await smtp.DisconnectAsync(true);
|
||||
}
|
||||
|
||||
await _trialSiteSurveyRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 驳回
|
||||
|
@ -423,6 +544,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
/// <param name="trialSiteSurveyId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
||||
[Obsolete]
|
||||
public async Task<IResponseOutput> SubmissionRejection(Guid trialId, Guid trialSiteSurveyId)
|
||||
{
|
||||
if (await _repository.AnyAsync<TrialSiteSurvey>(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId))
|
||||
|
@ -479,10 +601,10 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
/// <returns></returns>
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> TrialSurveySubmit(TrialSiteSurvyeSubmitDTO siteSurvyeSubmit)
|
||||
public async Task<IResponseOutput> TrialSurveySubmit(TrialSiteSurvyeSubmitDTO siteSurvyeSubmit)
|
||||
{
|
||||
|
||||
var trialId= siteSurvyeSubmit.TrialId;
|
||||
var trialId = siteSurvyeSubmit.TrialId;
|
||||
var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId;
|
||||
|
||||
if (_userInfo.IsAdmin)
|
||||
|
@ -493,11 +615,11 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined)
|
||||
{
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
|
||||
if (hasSPMOrCPM)
|
||||
{
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -510,7 +632,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
||||
{
|
||||
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id,PreliminaryTime=DateTime.Now });
|
||||
|
||||
}
|
||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||
|
@ -525,7 +647,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsGenerateSuccess == false).ToList();
|
||||
|
||||
|
||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == trialId);
|
||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == trialId);
|
||||
|
||||
foreach (var item in needGenerateList)
|
||||
{
|
||||
|
@ -541,14 +663,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
var builder = new BodyBuilder();
|
||||
|
||||
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
||||
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email ).Include(t=>t.UserTypeRole).FirstOrDefaultAsync();
|
||||
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);
|
||||
|
||||
//var baseApiUrl = baseUrl.Remove(baseUrl.IndexOf("#")) + "api";
|
||||
|
||||
|
||||
if (sysUserInfo==null)
|
||||
if (sysUserInfo == null)
|
||||
{
|
||||
|
||||
lock (lockObj)
|
||||
|
@ -592,7 +714,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢!
|
||||
</div>
|
||||
|
||||
<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 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>
|
||||
|
@ -649,7 +771,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
smtp.MessageSent += (sender, args) =>
|
||||
{
|
||||
|
||||
_= _trialSiteUserSurveyRepository.UpdateFromQueryAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id , ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
||||
_ = _trialSiteUserSurveyRepository.UpdateFromQueryAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
||||
|
||||
};
|
||||
|
||||
|
@ -663,12 +785,12 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
await smtp.SendAsync(messageToSend);
|
||||
|
||||
|
||||
await smtp.DisconnectAsync(true);
|
||||
await smtp.DisconnectAsync(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock });
|
||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime=DateTime.Now});
|
||||
|
||||
}
|
||||
|
||||
|
@ -676,6 +798,23 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 项目Site调研用户列表 所有site的调研用户 会有重复
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<PageOutput<TrialSiteUserSurveyAllDTO>> TrialSiteSurveyUserList(TrialSiteUserSurveyAllQuery queryParam)
|
||||
{
|
||||
var query = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == queryParam.TrialId&&t.TrialSiteSurvey.IsAbandon==false)
|
||||
.WhereIf(queryParam.SiteId!=null, t => t.TrialSiteSurvey.SiteId == queryParam.SiteId)
|
||||
.WhereIf(! string.IsNullOrEmpty(queryParam.UserKeyInfo ), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserKeyInfo)||t.Email.Contains(queryParam.UserKeyInfo) ||t.Phone.Contains(queryParam.UserKeyInfo))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.TrialSiteSurvey.UserName).Contains(queryParam.FormWriterKeyInfo) || t.TrialSiteSurvey.Email.Contains(queryParam.FormWriterKeyInfo) || t.TrialSiteSurvey.Phone.Contains(queryParam.FormWriterKeyInfo))
|
||||
|
||||
.ProjectTo<TrialSiteUserSurveyAllDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,12 @@ namespace IRaCIS.Core.Application.AutoMapper
|
|||
CreateMap<User, UserInfoBasic>().ForMember(d => d.RealName, u => u.MapFrom(s => s.LastName + " / " + s.FirstName));
|
||||
|
||||
|
||||
|
||||
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyAllDTO>().ForMember(t=>t.TrialSiteSurvey,u=>u.MapFrom(c=>c.TrialSiteSurvey));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,9 +26,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid SystemUserId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public TrialExternalUserStateEnum InviteState { get; set; }
|
||||
|
||||
|
@ -86,6 +83,13 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public string OrganizationName { get; set; } = String.Empty;
|
||||
|
||||
|
||||
|
||||
public bool IsSendEmail { get; set; }
|
||||
|
||||
|
||||
public string RouteUrl { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
public class TrialExternalUserConfirm
|
||||
{
|
||||
|
@ -133,8 +137,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
|
||||
public string RouteUrl { get; set; } = string.Empty;
|
||||
|
||||
public List<UserEmail> SendUsers { get; set; } = new List<UserEmail>();
|
||||
|
@ -161,7 +163,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace IRaCIS.Application.Contracts
|
|||
public string UserType { get; set; } = String.Empty;
|
||||
public string UserRealName { get; set; } = String.Empty;
|
||||
|
||||
public string OrganizationName { get; set; } = String.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,12 +64,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<IResponseOutput> AddOrUpdateTrialExternalUser(TrialExternalUserAddOrEdit addOrEditTrialExternalUser)
|
||||
{
|
||||
|
||||
//var verifyExp1 = new EntityVerifyExp<TrialExternalUser>()
|
||||
//{
|
||||
// VerifyExp = t => t.Email == addOrEditTrialExternalUser.Email && t.UserTypeId == addOrEditTrialExternalUser.UserTypeId,
|
||||
// VerifyMsg = ""
|
||||
//};
|
||||
//var entity = await _trialExternalUseRepository.InsertOrUpdateAsync(addOrEditTrialExternalUser, false, verifyExp1);
|
||||
|
||||
|
||||
if (addOrEditTrialExternalUser.Id == null)
|
||||
|
@ -136,6 +130,27 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
|
||||
if (addOrEditTrialExternalUser.IsSendEmail)
|
||||
{
|
||||
await SendInviteEmail(new TrialExternalUserSendEmail()
|
||||
{
|
||||
//BaseUrl = addOrEditTrialExternalUser.BaseUrl,
|
||||
RouteUrl = addOrEditTrialExternalUser.RouteUrl,
|
||||
TrialId = addOrEditTrialExternalUser.TrialId,
|
||||
SendUsers = new List<UserEmail>()
|
||||
{
|
||||
new UserEmail()
|
||||
{
|
||||
Id = addEntity.Id,
|
||||
Email=addEntity.Email,
|
||||
IsSystemUser=addEntity.IsSystemUser,
|
||||
SystemUserId=addEntity.SystemUserId
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await _trialExternalUseRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok(addEntity.Id.ToString());
|
||||
|
@ -213,7 +228,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//主题
|
||||
messageToSend.Subject = "GRR External User survey (Invite)";
|
||||
|
||||
var baseApiUrl = sendEmail.BaseUrl.Remove(sendEmail.BaseUrl.IndexOf("#")) + "api";
|
||||
//var baseApiUrl = sendEmail.BaseUrl.Remove(sendEmail.BaseUrl.IndexOf("#")) + "api";
|
||||
|
||||
var builder = new BodyBuilder();
|
||||
|
||||
|
@ -323,14 +338,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||
}
|
||||
|
||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
||||
if (editTrialUserPreparation.IsJoin == true)
|
||||
{
|
||||
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.ResearchProgramNo} IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下:
|
||||
您好,欢迎您参加项目 实验方案号:{trialInfo.ResearchProgramNo}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>
|
||||
|
@ -359,6 +376,43 @@ namespace IRaCIS.Core.Application.Service
|
|||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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.ResearchProgramNo} 项目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.UserTypeRole.UserTypeShortName}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
messageToSend.Body = builder.ToMessageBody();
|
||||
|
||||
|
@ -418,7 +472,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var userId = (Guid)needUpdate.SystemUserId;
|
||||
|
||||
|
||||
if (! await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId))
|
||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId))
|
||||
{
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId });
|
||||
|
||||
|
@ -447,7 +501,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||
}
|
||||
|
||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
||||
if (editInfo.IsJoin == true)
|
||||
{
|
||||
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'>
|
||||
|
@ -483,6 +539,42 @@ namespace IRaCIS.Core.Application.Service
|
|||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
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.ResearchProgramNo} 项目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.UserTypeRole.UserTypeShortName}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
messageToSend.Body = builder.ToMessageBody();
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
|
||||
[StringLength(255)]
|
||||
public string UserName { get; set; }
|
||||
public string UserName { get; set; } = String.Empty;
|
||||
|
||||
[StringLength(255)]
|
||||
public string Password { get; set; }
|
||||
public string Password { get; set; } = String.Empty;
|
||||
[StringLength(255)]
|
||||
|
||||
public string LastName { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; } = String.Empty;
|
||||
public string FirstName { get; set; } = String.Empty;
|
||||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string EMail { get; set; } = string.Empty;
|
||||
|
|
|
@ -128,6 +128,20 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public string LatestBackReason { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
public Guid? PreliminaryUserId { get; set; }
|
||||
|
||||
public Guid? ReviewerUserId { get; set; }
|
||||
|
||||
public DateTime? PreliminaryTime { get; set; }
|
||||
|
||||
public DateTime? ReviewerTime { get; set; }
|
||||
|
||||
public User ReviewerUser { get; set; }
|
||||
|
||||
public User PreliminaryUser { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,13 +106,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent;
|
||||
|
||||
public Guid? PreliminaryUserId { get; set; }
|
||||
|
||||
public Guid? ReviewerUserId { get; set; }
|
||||
|
||||
public User ReviewerUser { get; set; }
|
||||
|
||||
public User PreliminaryUser { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue