整理仓储
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-23 13:51:58 +08:00
parent e81e270d69
commit 7867a82e6e
37 changed files with 403 additions and 368 deletions
@@ -13,6 +13,15 @@ namespace IRaCIS.Core.Application.Service.Inspection
[NonDynamicWebApi]
public class InspectionService(
IRepository<DataInspection> _dataInspectionRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<TrialSign> _trialSignRepository,
IRepository<User> _userRepository,
IRepository<TrialSite> _trialSiteRepository,
IRepository<Trial> _trialRepository,
IRepository<Subject> _subjectRepository,
IRepository<SubjectVisit> _subjectVisitRepository,
IRepository<UserType> _userTypeRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<FrontAuditConfig> _frontAuditConfigRepository) : BaseService, IInspectionService
{
@@ -23,66 +32,66 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
//_repository.GetQueryable.GetQueryable < DataInspection >
var trialData = await _repository.GetQueryable<Trial>().Where(x => x.Id == inQuery.TrialId).AsNoTracking().FirstNotNullAsync();
var trialData = await _trialRepository.Where(x => x.Id == inQuery.TrialId).AsNoTracking().FirstNotNullAsync();
trialData.TrialFinishTime = trialData.TrialFinishTime == null ? DateTime.Now : trialData.TrialFinishTime;
#region
var query = from data in _repository.GetQueryable<DataInspection>()
var query = from data in _dataInspectionRepository.Where()
//.Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime>= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime))
join trial in _repository.GetQueryable<Trial>().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp
join trial in _trialRepository.Where().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp
from leftrial in trialtemp.DefaultIfEmpty()
join trialSite in _repository.GetQueryable<TrialSite>().IgnoreQueryFilters() on data.TrialSiteId equals trialSite.Id into trialSitetemp
join trialSite in _trialSiteRepository.Where().IgnoreQueryFilters() on data.TrialSiteId equals trialSite.Id into trialSitetemp
from lefttrialSite in trialSitetemp.DefaultIfEmpty()
join subject in _repository.GetQueryable<Subject>().IgnoreQueryFilters() on data.SubjectId equals subject.Id into subtemp
join subject in _subjectRepository.Where().IgnoreQueryFilters() on data.SubjectId equals subject.Id into subtemp
from leftsubject in subtemp.DefaultIfEmpty()
join subjectVisit in _repository.GetQueryable<SubjectVisit>().IgnoreQueryFilters() on data.SubjectVisitId equals subjectVisit.Id into subjectVisittemp
join subjectVisit in _subjectVisitRepository.Where().IgnoreQueryFilters() on data.SubjectVisitId equals subjectVisit.Id into subjectVisittemp
from leftsubjectVisit in subjectVisittemp.DefaultIfEmpty()
join parent in _repository.GetQueryable<DataInspection>() on data.ParentId equals parent.Id into parenttemp
join parent in _dataInspectionRepository.Where() on data.ParentId equals parent.Id into parenttemp
from leftparent in parenttemp.DefaultIfEmpty()
join user in _repository.GetQueryable<User>().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp
join user in _userRepository.Where().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp
from leftuser in usertemp.DefaultIfEmpty()
join usertype in _repository.GetQueryable<UserType>().IgnoreQueryFilters() on leftuser.UserTypeId equals usertype.Id into usertypetemp
join usertype in _userTypeRepository.Where().IgnoreQueryFilters() on leftuser.UserTypeId equals usertype.Id into usertypetemp
from leftusertype in usertypetemp.DefaultIfEmpty()
join visttask in _repository.GetQueryable<VisitTask>().IgnoreQueryFilters() on data.VisitTaskId equals visttask.Id into visttasktemp
join visttask in _visitTaskRepository.Where().IgnoreQueryFilters() on data.VisitTaskId equals visttask.Id into visttasktemp
from leftvisttask in visttasktemp.DefaultIfEmpty()
//join trialCriterion in _repository.GetQueryable<ReadingQuestionCriterionTrial>().IgnoreQueryFilters() on data.TrialReadingCriterionId equals trialCriterion.Id into criterion
//from leftCriterion in criterion.DefaultIfEmpty()
//join moduleTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ModuleType") on 1 equals 1
//join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = moduleTyped.Id, ModuleType = data.ModuleType } equals new { ParentId = moduleTypec.ParentId.Value, ModuleType = moduleTypec.Value } into moduleTypectemp
//join moduleTyped in _dictionaryRepository.Where().Where(x => x.Code == "ModuleType") on 1 equals 1
//join moduleTypec in _dictionaryRepository.Where() on new { ParentId = moduleTyped.Id, ModuleType = data.ModuleType } equals new { ParentId = moduleTypec.ParentId.Value, ModuleType = moduleTypec.Value } into moduleTypectemp
//join childrenTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ChildrenType") on 1 equals 1
//join childrenTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp
//join childrenTyped in _dictionaryRepository.Where().Where(x => x.Code == "ChildrenType") on 1 equals 1
//join childrenTypec in _dictionaryRepository.Where() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp
//from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
//join ObjectTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ObjectType") on 1 equals 1
//join ObjectTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp
//join ObjectTyped in _dictionaryRepository.Where().Where(x => x.Code == "ObjectType") on 1 equals 1
//join ObjectTypec in _dictionaryRepository.Where() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp
//from leftObjectType in objectTypetemp.DefaultIfEmpty()
//join OptTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "OptType") on 1 equals 1
//join OptTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp
//join OptTyped in _dictionaryRepository.Where().Where(x => x.Code == "OptType") on 1 equals 1
//join OptTypec in _dictionaryRepository.Where() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp
//from leftOptType in optTypetemp.DefaultIfEmpty()
join trialSign in _repository.GetQueryable<TrialSign>().IgnoreQueryFilters() on data.SignId equals trialSign.Id into trialSigntemp
join trialSign in _trialSignRepository.Where().IgnoreQueryFilters() on data.SignId equals trialSign.Id into trialSigntemp
from lefttrialSign in trialSigntemp.DefaultIfEmpty()
join leftfrontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x => x.ConfigType == "M" && x.Identification != null && x.IsEnable == true) on
join leftfrontAuditConfig in _frontAuditConfigRepository.Where().Where(x => x.ConfigType == "M" && x.Identification != null && x.IsEnable == true) on
data.Identification.ToLower()
equals
leftfrontAuditConfig.Identification.ToLower()
join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ModuleType = leftfrontAuditConfig.ModuleTypeId!.Value } equals new { ModuleType = moduleTypec.Id } into moduleTypectemp
join moduleTypec in _dictionaryRepository.Where() on new { ModuleType = leftfrontAuditConfig.ModuleTypeId!.Value } equals new { ModuleType = moduleTypec.Id } into moduleTypectemp
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
join OptTypec in _repository.GetQueryable<Dictionary>() on new { ModuleType = leftfrontAuditConfig.OptTypeId!.Value } equals new { ModuleType = OptTypec.Id } into optTypetemp
join OptTypec in _dictionaryRepository.Where() on new { ModuleType = leftfrontAuditConfig.OptTypeId!.Value } equals new { ModuleType = OptTypec.Id } into optTypetemp
from leftOptType in optTypetemp.DefaultIfEmpty()
select new GetDataInspectionOutDto()
@@ -242,7 +251,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
if (response.IsSuccess)
{
await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
await _trialSignRepository.BatchUpdateNoTrackingAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
}
}
@@ -268,7 +277,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <summary> 添加签名记录 </summary> ///
public async Task<Guid> AddSignRecordAsync(SignDTO signDTO)
{
var add = await _repository.AddAsync(_mapper.Map<TrialSign>(signDTO));
var add = await _trialSignRepository.AddAsync(_mapper.Map<TrialSign>(signDTO));
var success = await _repository.SaveChangesAsync();