irc-netcore-api/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsu...

181 lines
6.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.BaseModel;
using IRaCIS.Core.Infra.EFCore.Common;
using MassTransit;
using Microsoft.Extensions.Options;
using MimeKit;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.MassTransit.Consumer;
/// <summary>
/// CRC 提交了 通知QC进行质控 Code005006
/// </summary>
public class CRCSubmitedAndQCToAuditEventConsumer(
IRepository<User> _userRepository,
IRepository<TrialUser> _trialUseRepository,
IRepository<SubjectVisit> _subjectVisitRepository,
IRepository<Trial> _trialRepository,
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig) : IConsumer<CRCSubmitedAndQCToAuditEvent>
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
public async Task Consume(ConsumeContext<CRCSubmitedAndQCToAuditEvent> context)
{
//Console.WriteLine("发送(005,006) 【加急项目所有IQC待领取质控任务】邮件");
//var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
//var subjectVisitId = context.Message.SubjectVisitId;
//var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x=>x.Subject).FirstOrDefaultAsync();
//var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
//var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList();
//var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId);
//foreach (var userinfo in userinfoList)
//{
// var messageToSend = new MimeMessage();
// //发件地址
// messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
// messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail));
// var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
// var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
// {
// DictionaryRepository = _dictionaryRepository,
// IsEn_US = isEn_US,
// DictionaryList = new List<DictionaryDto>()
// {
// new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=subjectVisit.AuditState.GetEnumInt(), }, //审核状态
// }
// });
// Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
// {
// var subjectCode = subjectVisit.Subject.Code;
// var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, taskInfo.TaskBlindName);
// var htmlBodyStr = string.Format(
// CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
// userinfo.FullName, // 用户名 {0}
// trialInfo.ExperimentName, // 项目 {1}
// subjectCode, // 受试者 {2}
// subjectVisit.VisitName, // 访视 {3}
// dictionValue[0], // 审核状态 {4}
// _systemEmailConfig.SiteUrl // 链接 {5}
// );
// return (topicStr, htmlBodyStr);
// };
// await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository,
// context.Message.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed ? EmailBusinessScenario.ReReadFromPMApproval : EmailBusinessScenario.ReReadFromIRApproval,
// messageToSend, emailConfigFunc);
// await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
//}
}
}
/// <summary>
/// CRC 回复质控质疑 通知QC
/// </summary>
public class CRCRepliedQCChallengeEventConsumer : IConsumer<CRCRepliedQCChallengeEvent>
{
public Task Consume(ConsumeContext<CRCRepliedQCChallengeEvent> context)
{
throw new NotImplementedException();
}
}
/// <summary>
/// QC回复 质控质疑通知CRC
/// </summary>
public class QCRepliedQCChallengeEventConsumer : IConsumer<QCRepliedQCChallengeEvent>
{
public Task Consume(ConsumeContext<QCRepliedQCChallengeEvent> context)
{
throw new NotImplementedException();
}
}
/// <summary>
/// CRC 回复一致性核查质疑 通知PM
/// </summary>
public class CRCRepliedCheckChallengeEventConsumer : IConsumer<CRCRepliedCheckChallengeEvent>
{
public Task Consume(ConsumeContext<CRCRepliedCheckChallengeEvent> context)
{
throw new NotImplementedException();
}
}
/// <summary>
/// PM 一致性核查 通知CRC
/// </summary>
public class PMRepliedCheckChallengeEventConsumer : IConsumer<PMRepliedCheckChallengeEvent>
{
public Task Consume(ConsumeContext<PMRepliedCheckChallengeEvent> context)
{
throw new NotImplementedException();
}
}
/// <summary>
/// 通知PM 进行一致性核查
/// </summary>
public class CheckStateChangedToAuditEventConsumer : IConsumer<CheckStateChangedToAuditEvent>
{
public Task Consume(ConsumeContext<CheckStateChangedToAuditEvent> context)
{
throw new NotImplementedException();
}
}
/// <summary>
/// QC 领取了质控任务
/// </summary>
public class QCClaimTaskEventConsumer : IConsumer<QCClaimTaskEvent>
{
public Task Consume(ConsumeContext<QCClaimTaskEvent> context)
{
throw new NotImplementedException();
}
}