修改一版

This commit is contained in:
he
2022-05-13 18:12:50 +08:00
parent 894424a00e
commit 6741f11b27
8 changed files with 85 additions and 50 deletions
@@ -194,17 +194,17 @@ namespace IRaCIS.Core.Application.Service
if (item != null)
{
x.Code=item.Code;
x.Value = x.Code.IsNullOrEmpty() ? item.Value : x.Value;
x.DictionaryType = x.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType;
x.DictionaryCode = x.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode;
x.DataType = x.DataType.IsNullOrEmpty() ? item.DataType : x.DataType;
x.DateType = x.DateType.IsNullOrEmpty() ? item.DateType : x.DateType;
x.DictionaryKey = x.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey;
x.IsShowParent = x.IsShowParent==null ? item.IsShowParent : x.IsShowParent;
x.ForeignKeyTable = x.ForeignKeyTable.IsNullOrEmpty() ? item.ForeignKeyTable : x.ForeignKeyTable;
x.ForeignKeyText = x.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText;
x.ForeignKeyValue = x.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue;
x.EnumType = x.EnumType.IsNullOrEmpty() ? item.EnumType : x.EnumType;
x.Value = !item.Code.IsNullOrEmpty() ? item.Value : x.Value;
x.DictionaryType = !item.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType;
x.DictionaryCode = !item.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode;
x.DataType = !item.DataType.IsNullOrEmpty() ? item.DataType : x.DataType;
x.DateType = !item.DateType.IsNullOrEmpty() ? item.DateType : x.DateType;
x.DictionaryKey = !item.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey;
x.IsShowParent = !item.IsShowParent==null ? item.IsShowParent : x.IsShowParent;
x.ForeignKeyTable = !item.ForeignKeyTable.IsNullOrEmpty() ? item.ForeignKeyTable : x.ForeignKeyTable;
x.ForeignKeyText = !item.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText;
x.ForeignKeyValue = !item.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue;
x.EnumType = !item.EnumType.IsNullOrEmpty() ? item.EnumType : x.EnumType;
}
});
@@ -23,10 +23,14 @@ namespace IRaCIS.Core.Application.Services
{
private readonly IRepository<SystemDocument> _systemDocumentRepository;
private readonly IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository;
public SystemDocumentService( IRepository<SystemDocument> systemDocumentRepository)
public SystemDocumentService( IRepository<SystemDocument> systemDocumentRepository,
IRepository<SystemDocNeedConfirmedUserType> systemDocNeedConfirmedUserTypeRepository
)
{
_systemDocumentRepository = systemDocumentRepository;
this._systemDocNeedConfirmedUserTypeRepository = systemDocNeedConfirmedUserTypeRepository;
}
@@ -66,18 +70,20 @@ namespace IRaCIS.Core.Application.Services
}
else
{
var document = await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true,true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync();
var document = await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync();
if (document == null) return Null404NotFound(document);
if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id,true))
if (await _systemDocumentRepository.AnyAsync(t => t.FileTypeId == addOrEditSystemDocument.FileTypeId && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id, true))
{
return ResponseOutput.NotOk("同类型已存在该文件名");
}
_mapper.Map(addOrEditSystemDocument, document);
document.UpdateTime = DateTime.Now;
if (document.FileTypeId != addOrEditSystemDocument.FileTypeId)
{
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName;
@@ -94,7 +100,7 @@ namespace IRaCIS.Core.Application.Services
}
}
var success = _repository.SaveChangesAsync();
var success = await _repository.SaveChangesAsync();
return ResponseOutput.Ok(document.Id.ToString());
}
@@ -574,11 +574,11 @@ namespace IRaCIS.Core.Application.Services
{
if (isSystemDoc)
{
await _repository.BatchUpdateAsync<SystemDocument>(t => t.Id == documentId, u => new SystemDocument() { IsDeleted = true });
await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true });
}
else
{
await _trialDocumentRepository.BatchUpdateNoTrackingAsync(t => t.Id == documentId, u => new TrialDocument() { IsDeleted = true });
await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true });
}
return ResponseOutput.Ok();
}
@@ -36,29 +36,29 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
//_repository.GetQueryable.GetQueryable < DataInspection >
var trialfirst= await _repository.GetQueryable< Trial >().Where(x=>x.Id== dto.TrialId).AsNoTracking().FirstOrDefaultAsync();
trialfirst.TrialFinishTime = trialfirst.TrialFinishTime == null ? DateTime.Now : trialfirst.TrialFinishTime;
#region
var query = from data in _repository.GetQueryable<DataInspection>()
join trial in _repository.GetQueryable<Trial>() on data.TrialId equals trial.Id into trialtemp
var query = from data in _repository.GetQueryable<DataInspection>().Where(x => (x.TrialId == dto.TrialId)||(x.TrialId==null&&x.CreateTime> trialfirst.CreateTime&&x.CreateTime < trialfirst.TrialFinishTime))
join trial in _repository.GetQueryable<Trial>().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp
from leftrial in trialtemp.DefaultIfEmpty()
join site in _repository.GetQueryable<Site>() on data.SiteId equals site.Id into sitetemp
join site in _repository.GetQueryable<Site>().IgnoreQueryFilters() on data.SiteId equals site.Id into sitetemp
from leftsite in sitetemp.DefaultIfEmpty()
join subject in _repository.GetQueryable<Subject>() on data.SubjectId equals subject.Id into subtemp
join subject in _repository.GetQueryable<Subject>().IgnoreQueryFilters() on data.SubjectId equals subject.Id into subtemp
from leftsubject in subtemp.DefaultIfEmpty()
join subjectVisit in _repository.GetQueryable<SubjectVisit>() on data.SubjectVisitId equals subjectVisit.Id into subjectVisittemp
join subjectVisit in _repository.GetQueryable<SubjectVisit>().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
from leftparent in parenttemp.DefaultIfEmpty()
join user in _repository.GetQueryable<User>() on data.CreateUserId equals user.Id into usertemp
join user in _repository.GetQueryable<User>().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp
from leftuser in usertemp.DefaultIfEmpty()
join usertype in _repository.GetQueryable<UserType>() on leftuser.UserTypeId equals usertype.Id into usertypetemp
join usertype in _repository.GetQueryable<UserType>().IgnoreQueryFilters() on leftuser.UserTypeId equals usertype.Id into usertypetemp
from leftusertype in usertypetemp.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
@@ -75,24 +75,14 @@ namespace IRaCIS.Core.Application.Service.Inspection
//from leftOptType in optTypetemp.DefaultIfEmpty()
join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp
join trialSign in _repository.GetQueryable<TrialSign>().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
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
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
join OptTypec in _repository.GetQueryable<Dictionary>() on new { ModuleType = leftfrontAuditConfig.OptTypeId.Value } equals new { ModuleType = OptTypec.Id } into optTypetemp
from leftOptType in optTypetemp.DefaultIfEmpty()
@@ -146,8 +136,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
};
query = query.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId)
.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
.WhereIf(dto.VisitPlanInfo != null, x => x.VisitNum == dto.VisitPlanInfo)
.WhereIf(dto.StartTime != null, x => x.CreateTime >= dto.StartTime)
@@ -224,7 +224,11 @@ namespace IRaCIS.Core.Application
return ResponseOutput.NotOk("项目 基础配置、流程配置、加急配置 、访视计划,有未确认项");
}
}
if (trialStatusStr != "Ongoing")
{
trial.TrialFinishTime = DateTime.Now;
}
trial.TrialStateChangeList.Add(new TrialStateChange() { OriginState = trial.TrialStatusStr, NowState = trialStatusStr, Reason = reason ?? String.Empty, TrialId = trialId });
@@ -276,7 +280,11 @@ namespace IRaCIS.Core.Application
[HttpPut("{trialId:guid}/{isAbandon:bool}")]
public async Task<IResponseOutput> AbandonTrial(Guid trialId, /*Guid? signId,*/ bool isAbandon)
{
await _trialRepository.UpdatePartialNowNoQueryAsync(trialId, u => new Trial() { IsDeleted = isAbandon });
await _trialRepository.UpdatePartialFromQueryAsync(trialId, u => new Trial() {
IsDeleted = isAbandon,
TrialFinishTime= isAbandon?DateTime.Now:null
},true);