增加查询接口

Uat_Study
hang 2022-08-22 11:50:52 +08:00
parent 371261cd0f
commit 071ad5acd5
5 changed files with 186 additions and 90 deletions

View File

@ -692,7 +692,7 @@
<param name="dto"></param> <param name="dto"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetInspectionEnumValueDataList(IRaCIS.Core.Infra.EFCore.Common.Dto.SetInspectionEnumValueDto)"> <member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetInspectionEnumValueDataList(IRaCIS.Core.Infra.EFCore.Common.Dto.SetInspectionEnumValueDto,System.Guid)">
<summary> <summary>
翻译稽查数据 翻译稽查数据
</summary> </summary>

View File

@ -16,7 +16,7 @@ using Newtonsoft.Json.Linq;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Domain.Share.Management; using IRaCIS.Core.Domain.Share.Management;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
/// <summary> /// <summary>
@ -82,9 +82,9 @@ namespace IRaCIS.Core.Application.Service
CreateUserName = x.CreateUser.UserName, CreateUserName = x.CreateUser.UserName,
TalkContent = x.Content, TalkContent = x.Content,
IsTitle = true, IsTitle = true,
}).FirstOrDefaultAsync())?? new AccessToDialogueOutDto(); }).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto();
data =await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select( data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select(
x => new AccessToDialogueOutDto() x => new AccessToDialogueOutDto()
{ {
CreateTime = x.CreateTime, CreateTime = x.CreateTime,
@ -131,7 +131,7 @@ namespace IRaCIS.Core.Application.Service
public async Task CopyFrontAuditConfigItem(CopyFrontAuditConfigItemDto input) public async Task CopyFrontAuditConfigItem(CopyFrontAuditConfigItemDto input)
{ {
var id = NewId.NextGuid(); var id = NewId.NextGuid();
List<FrontAuditConfig> frontAudits= new List<FrontAuditConfig>(); List<FrontAuditConfig> frontAudits = new List<FrontAuditConfig>();
var frontAuditConfig = (await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == input.ChildId)).Clone(); var frontAuditConfig = (await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == input.ChildId)).Clone();
var fronts = await _frontAuditConfigRepository.Where(x => x.ParentId == frontAuditConfig.Id).ToListAsync(); var fronts = await _frontAuditConfigRepository.Where(x => x.ParentId == frontAuditConfig.Id).ToListAsync();
@ -159,7 +159,7 @@ namespace IRaCIS.Core.Application.Service
{ {
var maxSort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort); var maxSort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
List<FrontAuditConfig> fronts=new List<FrontAuditConfig>(); List<FrontAuditConfig> fronts = new List<FrontAuditConfig>();
foreach (var item in data.Columns) foreach (var item in data.Columns)
{ {
maxSort++; maxSort++;
@ -184,22 +184,47 @@ namespace IRaCIS.Core.Application.Service
[HttpPost] [HttpPost]
public async Task<List<string>> SetInspectionEnumValue(SetInspectionEnumValueDto dto) public async Task<List<string>> SetInspectionEnumValue(SetInspectionEnumValueDto dto)
{ {
return await SetInspectionEnumValueDataList(dto); return await SetInspectionEnumValueDataList(dto, dto.AuditDataIds.FirstOrDefault());
} }
public async Task<List<string>> GetInspectionJsonDataList(Guid trialId, Guid id)
{
//找到上一条Id
var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstOrDefaultAsync();
var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId && x.ObjectRelationParentId == currentInspection.ObjectRelationParentId && x.CreateTime <= currentInspection.CreateTime).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
.FirstOrDefaultAsync();
List<Guid> searchGuidList = new List<Guid>() { id };
if (beforeId != Guid.Empty)
{
searchGuidList.Add(beforeId);
}
return await SetInspectionEnumValueDataList(new SetInspectionEnumValueDto() { TrialId = trialId, AuditDataIds = searchGuidList }, id);
}
/// <summary> /// <summary>
/// 翻译稽查数据 /// 翻译稽查数据
/// </summary> /// </summary>
/// <param name="dto">传入Dto</param> /// <param name="dto">传入Dto</param>
/// <returns></returns> /// <returns></returns>
private async Task<List<string>> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto) private async Task<List<string>> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto, Guid currentInspectionId)
{ {
var auditDatas =await _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x=> new SetInspectionEnumDataDto() { var auditDatas = await _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x => new SetInspectionEnumDataDto()
Id=x.Id, {
JsonStr=x.JsonDetail, Id = x.Id,
Identification=x.Identification JsonStr = x.JsonDetail,
Identification = x.Identification,
ObjectRelationParentId = x.ObjectRelationParentId,
CreateTime=x.CreateTime
}).ToListAsync(); }).ToListAsync();
@ -210,7 +235,37 @@ namespace IRaCIS.Core.Application.Service
{ {
Dictionary<string, object> jsonDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(item.JsonStr); Dictionary<string, object> jsonDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(item.JsonStr);
//查询关联父层级数据
if (item.Id == currentInspectionId)
{
//把父层级的数据的 CommonData 数据合并
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.CreateTime);
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
foreach (var commonDataObj in commonDataObjList)
{
var otherDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(commonDataObj.ToJsonStr());
foreach (var valuePair in otherDic)
{
if (currentDic.ContainsKey(valuePair.Key))
{
currentDic[valuePair.Key] = valuePair.Value;
}
else
{
currentDic.Add(valuePair.Key, valuePair.Value);
}
}
}
jsonDict[nameof(InspectionJsonDetail.CommonData)] = currentDic;
}
item.JsonStr = jsonDict[nameof(InspectionJsonDetail.Data)].ToString(); item.JsonStr = jsonDict[nameof(InspectionJsonDetail.Data)].ToString();
if (item.Identification == string.Empty || item.JsonStr == string.Empty) if (item.Identification == string.Empty || item.JsonStr == string.Empty)
{ {
@ -219,7 +274,11 @@ namespace IRaCIS.Core.Application.Service
item.JsonStr = await GetInspectionEnumValue(listIdentification, item.JsonStr); item.JsonStr = await GetInspectionEnumValue(listIdentification, item.JsonStr);
item.JsonStr = await SetEnum(dto.TrialId, listIdentification, item.JsonStr); item.JsonStr = await SetEnum(dto.TrialId, listIdentification, item.JsonStr);
item.JsonStr = await SetDataInspectionDateType(listIdentification, item.JsonStr); item.JsonStr = await SetDataInspectionDateType(listIdentification, item.JsonStr);
jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject<object>(item.JsonStr) ;
jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject<object>(item.JsonStr);
item.JsonStr = JsonConvert.SerializeObject(jsonDict); item.JsonStr = JsonConvert.SerializeObject(jsonDict);
} }
@ -229,6 +288,7 @@ namespace IRaCIS.Core.Application.Service
dto.AuditDataIds.ForEach(x => dto.AuditDataIds.ForEach(x =>
{ {
var auditData = auditDatas.FirstOrDefault(y => y.Id == x); var auditData = auditDatas.FirstOrDefault(y => y.Id == x);
resultJsonStrList.Add(auditData?.JsonStr); resultJsonStrList.Add(auditData?.JsonStr);
}); });
@ -241,6 +301,37 @@ namespace IRaCIS.Core.Application.Service
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, DateTime createTime)
{
var objectLsit = new List<object>();
if (objectRelationParentId != null)
{
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && t.CreateTime <= createTime).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail }).FirstOrDefaultAsync();
if (relationParentInspection != null)
{
Dictionary<string, object> jsonDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(relationParentInspection.JsonDetail);
var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)];
objectLsit.Add(commonDataDicObj);
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime);
}
}
return objectLsit;
}
/// <summary> /// <summary>
@ -252,7 +343,7 @@ namespace IRaCIS.Core.Application.Service
private async Task<string> SetDataInspectionDateType(List<string> identificationList, string jsonStr) private async Task<string> SetDataInspectionDateType(List<string> identificationList, string jsonStr)
{ {
var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification)) var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification))
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable ) on parent.Id equals child.ParentId join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable) on parent.Id equals child.ParentId
select new DateDto() select new DateDto()
{ {
Code = child.Code, Code = child.Code,
@ -578,9 +669,9 @@ namespace IRaCIS.Core.Application.Service
[HttpGet] [HttpGet]
public async Task<List<FrontAuditConfig>> GetAuditConfigChildList(Guid frontAuditConfigId) public async Task<List<FrontAuditConfig>> GetAuditConfigChildList(Guid frontAuditConfigId)
{ {
var list =await (from data in _repository.GetQueryable<FrontAuditConfig>().Where(x => x.Id == frontAuditConfigId) var list = await (from data in _repository.GetQueryable<FrontAuditConfig>().Where(x => x.Id == frontAuditConfigId)
join childrenType in _repository.GetQueryable<FrontAuditConfig>() on data.Id equals childrenType.ParentId join childrenType in _repository.GetQueryable<FrontAuditConfig>() on data.Id equals childrenType.ParentId
select childrenType).OrderBy(x=>x.Sort).ToListAsync(); select childrenType).OrderBy(x => x.Sort).ToListAsync();
return list; return list;
} }
@ -616,12 +707,12 @@ namespace IRaCIS.Core.Application.Service
var lists = _frontAuditConfigRepository.Where(x => x.ParentId == item.AddItemGuid).ToList(); var lists = _frontAuditConfigRepository.Where(x => x.ParentId == item.AddItemGuid).ToList();
var additem = await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == item.AddItemGuid); var additem = await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == item.AddItemGuid);
var alllist = _frontAuditConfigRepository.Where(x => item.DataSourceGuids.Contains(x.ParentId)).ToList().GroupBy(x => new { x.ValueCN }, (key, lst) => new FrontAuditConfig var alllist = _frontAuditConfigRepository.Where(x => item.DataSourceGuids.Contains(x.ParentId)).ToList().GroupBy(x => new { x.ValueCN }, (key, lst) => new FrontAuditConfig
{ {
Sort = lst.Select(x => x.Sort).FirstOrDefault(), Sort = lst.Select(x => x.Sort).FirstOrDefault(),
IsShowByTrialConfig= lst.Select(x => x.IsShowByTrialConfig).FirstOrDefault(), IsShowByTrialConfig = lst.Select(x => x.IsShowByTrialConfig).FirstOrDefault(),
TrialConfigRelyFieldName = lst.Select(x => x.TrialConfigRelyFieldName).FirstOrDefault(), TrialConfigRelyFieldName = lst.Select(x => x.TrialConfigRelyFieldName).FirstOrDefault(),
Code = lst.Max(x => x.Code), Code = lst.Max(x => x.Code),
ConfigType = lst.Select(x => x.ConfigType).FirstOrDefault(), ConfigType = lst.Select(x => x.ConfigType).FirstOrDefault(),
@ -639,7 +730,7 @@ namespace IRaCIS.Core.Application.Service
ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(), ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(),
Value = lst.Max(x => x.Value), Value = lst.Max(x => x.Value),
UpdateUserId = _userInfo.Id, UpdateUserId = _userInfo.Id,
ChildrenTypeId= additem?.ChildrenTypeId, ChildrenTypeId = additem?.ChildrenTypeId,
ModuleTypeId = additem?.ModuleTypeId, ModuleTypeId = additem?.ModuleTypeId,
ObjectTypeId = additem?.ObjectTypeId, ObjectTypeId = additem?.ObjectTypeId,
OptTypeId = additem?.OptTypeId, OptTypeId = additem?.OptTypeId,
@ -650,7 +741,7 @@ namespace IRaCIS.Core.Application.Service
ForeignKeyText = lst.Select(x => x.ForeignKeyText).FirstOrDefault(), ForeignKeyText = lst.Select(x => x.ForeignKeyText).FirstOrDefault(),
ForeignKeyTableName = lst.Select(x => x.ForeignKeyTableName).FirstOrDefault(), ForeignKeyTableName = lst.Select(x => x.ForeignKeyTableName).FirstOrDefault(),
DataType = lst.Select(x => x.DataType).FirstOrDefault(), DataType = lst.Select(x => x.DataType).FirstOrDefault(),
Id =NewId.NextGuid()//新id, Id = NewId.NextGuid()//新id,
}).ToList(); }).ToList();
// 获取已存在的所有名称 // 获取已存在的所有名称
@ -669,15 +760,15 @@ namespace IRaCIS.Core.Application.Service
{ {
var item = alllist.FirstOrDefault(y => y.ValueCN == x.ValueCN); var item = alllist.FirstOrDefault(y => y.ValueCN == x.ValueCN);
if (item != null) if (item != null)
{ {
x.Code=item.Code; x.Code = item.Code;
x.Value = !item.Code.IsNullOrEmpty() ? item.Value : x.Value; x.Value = !item.Code.IsNullOrEmpty() ? item.Value : x.Value;
x.DictionaryType = !item.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType; x.DictionaryType = !item.DictionaryType.IsNullOrEmpty() ? item.DictionaryType : x.DictionaryType;
x.DictionaryCode = !item.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode; x.DictionaryCode = !item.DictionaryCode.IsNullOrEmpty() ? item.DictionaryCode : x.DictionaryCode;
x.DataType = !item.DataType.IsNullOrEmpty() ? item.DataType : x.DataType; x.DataType = !item.DataType.IsNullOrEmpty() ? item.DataType : x.DataType;
x.DateType = !item.DateType.IsNullOrEmpty() ? item.DateType : x.DateType; x.DateType = !item.DateType.IsNullOrEmpty() ? item.DateType : x.DateType;
x.DictionaryKey = !item.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey; x.DictionaryKey = !item.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey;
x.IsShowParent = !item.IsShowParent==null ? item.IsShowParent : x.IsShowParent; x.IsShowParent = !item.IsShowParent == null ? item.IsShowParent : x.IsShowParent;
x.ForeignKeyTableName = !item.ForeignKeyTableName.IsNullOrEmpty() ? item.ForeignKeyTableName : x.ForeignKeyTableName; x.ForeignKeyTableName = !item.ForeignKeyTableName.IsNullOrEmpty() ? item.ForeignKeyTableName : x.ForeignKeyTableName;
x.ForeignKeyText = !item.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText; x.ForeignKeyText = !item.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText;
x.ForeignKeyValue = !item.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue; x.ForeignKeyValue = !item.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue;
@ -687,8 +778,8 @@ namespace IRaCIS.Core.Application.Service
}); });
await _repository.UpdateRange(neewupdate); await _repository.UpdateRange(neewupdate);
await _repository.AddRangeAsync(list); await _repository.AddRangeAsync(list);
await _repository.SaveChangesAsync(); await _repository.SaveChangesAsync();
return ResponseOutput.Ok(); return ResponseOutput.Ok();
@ -703,7 +794,7 @@ namespace IRaCIS.Core.Application.Service
[HttpGet] [HttpGet]
public async Task<List<string>> GetModuleTypeDescriptionList(Guid moduleTypeId) public async Task<List<string>> GetModuleTypeDescriptionList(Guid moduleTypeId)
{ {
var result= await _frontAuditConfigRepository.Where(x=>x.ModuleTypeId== moduleTypeId && x.Description!=string.Empty).Select(x=>x.Description).Distinct().ToListAsync(); var result = await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.Description != string.Empty).Select(x => x.Description).Distinct().ToListAsync();
return result; return result;
} }
@ -716,76 +807,76 @@ namespace IRaCIS.Core.Application.Service
public async Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery iq) public async Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery iq)
{ {
var query = from data in _repository.GetQueryable<FrontAuditConfig>() var query = from data in _repository.GetQueryable<FrontAuditConfig>()
join childrenType in _repository.GetQueryable<Dictionary>() on data.ChildrenTypeId equals childrenType.Id into childrenTypetemp join childrenType in _repository.GetQueryable<Dictionary>() on data.ChildrenTypeId equals childrenType.Id into childrenTypetemp
from leftchildrenType in childrenTypetemp.DefaultIfEmpty() from leftchildrenType in childrenTypetemp.DefaultIfEmpty()
join ModuleType in _repository.GetQueryable<Dictionary>() on data.ModuleTypeId equals ModuleType.Id into ModuleTypetemp join ModuleType in _repository.GetQueryable<Dictionary>() on data.ModuleTypeId equals ModuleType.Id into ModuleTypetemp
from leftModuleType in ModuleTypetemp.DefaultIfEmpty() from leftModuleType in ModuleTypetemp.DefaultIfEmpty()
join OptTypeId in _repository.GetQueryable<Dictionary>() on data.OptTypeId equals OptTypeId.Id into OptTypeIdtemp join OptTypeId in _repository.GetQueryable<Dictionary>() on data.OptTypeId equals OptTypeId.Id into OptTypeIdtemp
from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty() from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty()
join ObjectTypeId in _repository.GetQueryable<Dictionary>() on data.ObjectTypeId equals ObjectTypeId.Id into ObjectTypeIdtemp join ObjectTypeId in _repository.GetQueryable<Dictionary>() on data.ObjectTypeId equals ObjectTypeId.Id into ObjectTypeIdtemp
from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty() from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty()
select new FrontAuditConfigView() select new FrontAuditConfigView()
{ {
IsShowParent = data.IsShowParent, IsShowParent = data.IsShowParent,
ChildrenTypeId = data.ChildrenTypeId, ChildrenTypeId = data.ChildrenTypeId,
Code = data.Code, Code = data.Code,
ConfigType = data.ConfigType, ConfigType = data.ConfigType,
CreateTime = data.CreateTime, CreateTime = data.CreateTime,
CreateUserId = data.CreateUserId, CreateUserId = data.CreateUserId,
Description = data.Description, Description = data.Description,
IsConfig = data.IsConfig, IsConfig = data.IsConfig,
IsEnable = data.IsEnable, IsEnable = data.IsEnable,
ModuleTypeId = data.ModuleTypeId, ModuleTypeId = data.ModuleTypeId,
Id = data.Id, Id = data.Id,
ParentId = data.ParentId, ParentId = data.ParentId,
UpdateTime = data.UpdateTime, UpdateTime = data.UpdateTime,
Value = data.Value, Value = data.Value,
ChildrenTypeValueCN = leftchildrenType.ValueCN, ChildrenTypeValueCN = leftchildrenType.ValueCN,
ModuleTypeValue = leftModuleType.Value, ModuleTypeValue = leftModuleType.Value,
ModuleTypeValueCN = leftModuleType.ValueCN, ModuleTypeValueCN = leftModuleType.ValueCN,
OptTypeId = data.OptTypeId, OptTypeId = data.OptTypeId,
OptTypeValue = leftOptTypeId.Value, OptTypeValue = leftOptTypeId.Value,
OptTypeValueCN = leftOptTypeId.ValueCN, OptTypeValueCN = leftOptTypeId.ValueCN,
UpdateUserId = data.UpdateUserId, UpdateUserId = data.UpdateUserId,
Sort=data.Sort, Sort = data.Sort,
ValueCN = data.ValueCN, ValueCN = data.ValueCN,
ChildrenTypeValue = leftchildrenType.Value, ChildrenTypeValue = leftchildrenType.Value,
DictionaryKey=data.DictionaryKey, DictionaryKey = data.DictionaryKey,
EnumType=data.EnumType, EnumType = data.EnumType,
ObjectTypeId=data.ObjectTypeId, ObjectTypeId = data.ObjectTypeId,
ObjectTypeValue = leftObjectTypeIdtemp.Value, ObjectTypeValue = leftObjectTypeIdtemp.Value,
ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN, ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN,
IsShowByTrialConfig =data.IsShowByTrialConfig, IsShowByTrialConfig = data.IsShowByTrialConfig,
TrialConfigRelyFieldName = data.TrialConfigRelyFieldName, TrialConfigRelyFieldName = data.TrialConfigRelyFieldName,
Identification=data.Identification, Identification = data.Identification,
IsHaveReason=data.IsHaveReason, IsHaveReason = data.IsHaveReason,
IsHaveSign=data.IsHaveSign, IsHaveSign = data.IsHaveSign,
IsFinish=data.IsFinish, IsFinish = data.IsFinish,
IsJoinPlan=data.IsJoinPlan, IsJoinPlan = data.IsJoinPlan,
DataType=data.DataType, DataType = data.DataType,
ChildDataLabel=data.ChildDataLabel, ChildDataLabel = data.ChildDataLabel,
ChildDataValue=data.ChildDataValue, ChildDataValue = data.ChildDataValue,
IsSpecialType=data.IsSpecialType, IsSpecialType = data.IsSpecialType,
DateType=data.DataType, DateType = data.DataType,
DictionaryCode=data.DictionaryCode, DictionaryCode = data.DictionaryCode,
DictionaryType=data.DictionaryType, DictionaryType = data.DictionaryType,
InterfaceName=data.InterfaceName, InterfaceName = data.InterfaceName,
}; };
query = query query = query
.WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value)
.WhereIf(!iq.ValueCN.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) .WhereIf(!iq.ValueCN.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN)
.WhereIf(!iq.Description.IsNullOrEmpty(), x => x.Description == iq.Description) .WhereIf(!iq.Description.IsNullOrEmpty(), x => x.Description == iq.Description)
.WhereIf(iq.OptTypeId!=null, x => x.OptTypeId == iq.OptTypeId) .WhereIf(iq.OptTypeId != null, x => x.OptTypeId == iq.OptTypeId)
.WhereIf(!iq.Code.IsNullOrEmpty(), x => x.Code == iq.Code) .WhereIf(!iq.Code.IsNullOrEmpty(), x => x.Code == iq.Code)
.WhereIf(iq.ChildrenTypeId != null, x => x.ChildrenTypeId == iq.ChildrenTypeId) .WhereIf(iq.ChildrenTypeId != null, x => x.ChildrenTypeId == iq.ChildrenTypeId)
.WhereIf(iq.ModuleTypeId != null, x => x.ModuleTypeId == iq.ModuleTypeId) .WhereIf(iq.ModuleTypeId != null, x => x.ModuleTypeId == iq.ModuleTypeId)
.WhereIf(iq.ObjectTypeId != null, x => x.ObjectTypeId == iq.ObjectTypeId) .WhereIf(iq.ObjectTypeId != null, x => x.ObjectTypeId == iq.ObjectTypeId)
.WhereIf(!iq.ConfigType.IsNullOrEmpty(), x => x.ConfigType == iq.ConfigType); .WhereIf(!iq.ConfigType.IsNullOrEmpty(), x => x.ConfigType == iq.ConfigType);
return await query.OrderBy(x=>x.Sort).ToListAsync(); return await query.OrderBy(x => x.Sort).ToListAsync();
} }
@ -814,8 +905,8 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig) public async Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig)
{ {
if (await _frontAuditConfigRepository.AnyAsync(x =>x.Identification!=string.Empty&& x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M"&& addOrEditFrontAuditConfig.ConfigType== "M")) if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification != string.Empty && x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M" && addOrEditFrontAuditConfig.ConfigType == "M"))
{ {
return ResponseOutput.NotOk("标识重复"); return ResponseOutput.NotOk("标识重复");
} }

View File

@ -166,6 +166,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
//.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) //.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
.WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign); .WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign);
#endregion #endregion
if (dto.VisitPlanInfo != null && dto.VisitPlanInfo.Value != (decimal)1.11) if (dto.VisitPlanInfo != null && dto.VisitPlanInfo.Value != (decimal)1.11)
{ {
query = query.Where(x => x.VisitNum == dto.VisitPlanInfo.Value); query = query.Where(x => x.VisitNum == dto.VisitPlanInfo.Value);

View File

@ -932,7 +932,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
//inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; //inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId==x.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId== inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
} }
inspection.CreateUserId = _userInfo.Id; inspection.CreateUserId = _userInfo.Id;
inspection.IP = _userInfo.IP; inspection.IP = _userInfo.IP;

View File

@ -27,6 +27,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
public string Identification { get; set; } public string Identification { get; set; }
public string JsonStr { get; set; } public string JsonStr { get; set; }
public Guid? ObjectRelationParentId { get; set; }
public DateTime CreateTime { get; set; }
} }