修改代码
This commit is contained in:
@@ -86,6 +86,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
/// </summary>
|
||||
public string ObjectType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 标识
|
||||
/// </summary>
|
||||
public string Identification { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
////需要单独处理
|
||||
//public string IP { get; set; }
|
||||
|
||||
@@ -46,35 +46,29 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
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
|
||||
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
|
||||
|
||||
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
|
||||
from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
|
||||
//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
|
||||
//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
|
||||
from leftObjectType in objectTypetemp.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
|
||||
//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
|
||||
from leftOptType in optTypetemp.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
|
||||
//from leftOptType in optTypetemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp
|
||||
from lefttrialSign in trialSigntemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
join frontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M") on new
|
||||
join frontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&!x.Identification.IsNullOrEmpty()) on new
|
||||
{
|
||||
ModuleTypeId = leftmoduleTypec.Id.ToString(),
|
||||
ChildrenTypeId = leftchildrenTypec.Id.ToString(),
|
||||
ObjectTypeId = leftObjectType.Id.ToString(),
|
||||
OptTypeId = leftOptType.Id.ToString(),
|
||||
data.Identification
|
||||
} equals new
|
||||
{
|
||||
frontAuditConfig.ModuleTypeId,
|
||||
frontAuditConfig.ChildrenTypeId,
|
||||
frontAuditConfig.ObjectTypeId,
|
||||
frontAuditConfig.OptTypeId,
|
||||
frontAuditConfig.Identification,
|
||||
|
||||
} into frontAuditConfigtemp
|
||||
from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty()
|
||||
@@ -254,12 +248,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
/// <param name="signId">签名Id</param>
|
||||
/// <param name="Statusdata">初始化状态对象</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null)
|
||||
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null, object? Statusdata = null)
|
||||
{
|
||||
await SetEnum(addDto);
|
||||
var add = _mapper.Map<DataInspection>(addDto);
|
||||
Guid? parentId = null;
|
||||
parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ModuleType==add.ModuleType&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
add.ParentId = parentId;
|
||||
add.CreateTime = DateTime.Now;
|
||||
add.CreateUserId = _userInfo.Id;
|
||||
@@ -269,8 +263,6 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
await _repository.AddAsync(add);
|
||||
if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null)
|
||||
{
|
||||
|
||||
|
||||
DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection();
|
||||
ststus.CreateTime = add.CreateTime.AddSeconds(1);
|
||||
ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata);
|
||||
@@ -309,7 +301,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
{
|
||||
guids.Add(Guid.Parse(x.ToString()));
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.Value).ToListAsync());
|
||||
JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,7 +317,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
parent = b
|
||||
}).SelectMany(a => a.parent, (m, n) => new
|
||||
{
|
||||
value = n.Value
|
||||
value = n.ValueCN
|
||||
}).Select(x => x.value).ToListAsync()
|
||||
);
|
||||
}
|
||||
@@ -335,13 +327,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
if (item.Type.ToLower() == "id".ToLower())
|
||||
{
|
||||
Guid guid = Guid.Parse(value.ToString());
|
||||
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.Value).FirstOrDefaultAsync();
|
||||
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable<Dictionary>().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value=b.Value
|
||||
value=b.ValueCN
|
||||
}).Select(x=>x.value).FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
|
||||
|
||||
Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null, object? Statusdata = null);
|
||||
|
||||
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null);
|
||||
|
||||
Task SetEnum(DataInspectionAddDTO Data);
|
||||
|
||||
|
||||
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null, object? Statusdata = null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user