修改触发事件
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f67ebce739
commit
f7fd880388
|
@ -41,8 +41,6 @@ public class UserSiteSurveySubmitedEventConsumer(
|
|||
|
||||
var trialSiteSurveyId = context.Message.TrialSiteSurveyId;
|
||||
|
||||
return;
|
||||
|
||||
var siteSurveyInfo = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
var trialId = siteSurveyInfo.TrialId;
|
||||
|
@ -197,16 +195,14 @@ public class SiteSurverRejectedEventConsumer(
|
|||
|
||||
var trialId = siteSurveyInfo.TrialId;
|
||||
|
||||
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == siteSurveyInfo.TrialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
|
||||
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
|
||||
var name = siteSurveyInfo.UserName;
|
||||
|
||||
if (hasSPMOrCPM)
|
||||
if (context.Message.IsHaveSPMOrCPM)
|
||||
{
|
||||
//PM 驳回
|
||||
//PM 驳回到SPM
|
||||
if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
|
||||
{
|
||||
var user = await _userRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId);
|
||||
|
@ -215,15 +211,16 @@ public class SiteSurverRejectedEventConsumer(
|
|||
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, user.EMail));
|
||||
}
|
||||
//SPM 驳回
|
||||
//SPM 驳回到CRC
|
||||
else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
|
||||
{
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, siteSurveyInfo.Email));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有SPM 给填表人发
|
||||
//没有SPM PM驳回到CRC
|
||||
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, siteSurveyInfo.Email));
|
||||
}
|
||||
|
|
|
@ -22,4 +22,6 @@ public class SiteSurveySPMSubmitedEvent : DomainEvent
|
|||
public class SiteSurverRejectedEvent : DomainEvent
|
||||
{
|
||||
public Guid TrialSiteSurveyId { get; set; }
|
||||
|
||||
public bool IsHaveSPMOrCPM { get; set; }
|
||||
}
|
||||
|
|
|
@ -43,10 +43,14 @@ public static class DBContext_Ext
|
|||
trialSiteSurvey.AddDomainEvent(new SiteSurveySPMSubmitedEvent() { TrialSiteSurveyId = trialSiteSurvey.Id });
|
||||
}
|
||||
|
||||
//PM 驳回 (在消费者中具体判断 是驳回给谁发邮件)
|
||||
//PM 驳回
|
||||
else if ((trialSiteSurvey.State == TrialSiteSurveyEnum.CRCSubmitted || trialSiteSurvey.State == TrialSiteSurveyEnum.ToSubmit) && originState == TrialSiteSurveyEnum.SPMApproved)
|
||||
{
|
||||
trialSiteSurvey.AddDomainEvent(new SiteSurverRejectedEvent() { TrialSiteSurveyId = trialSiteSurvey.Id });
|
||||
trialSiteSurvey.AddDomainEvent(new SiteSurverRejectedEvent() { TrialSiteSurveyId = trialSiteSurvey.Id, IsHaveSPMOrCPM = trialSiteSurvey.State == TrialSiteSurveyEnum.CRCSubmitted });
|
||||
}
|
||||
else if (trialSiteSurvey.State == TrialSiteSurveyEnum.ToSubmit && originState == TrialSiteSurveyEnum.CRCSubmitted)
|
||||
{
|
||||
trialSiteSurvey.AddDomainEvent(new SiteSurverRejectedEvent() { TrialSiteSurveyId = trialSiteSurvey.Id, IsHaveSPMOrCPM = true });
|
||||
}
|
||||
|
||||
//添加进记录
|
||||
|
|
Loading…
Reference in New Issue