diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index e85dd43f9..a2f4e3ef9 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -60,7 +60,7 @@ namespace IRaCIS.Core.Application.ViewModel public class GetDescriptionByModuleTypeDto { - public string ModuleType { get; set; } = string.Empty; + public Guid? ModuleType { get; set; } } ///FrontAuditConfigQuery 列表查询参数模型 @@ -79,14 +79,14 @@ namespace IRaCIS.Core.Application.ViewModel public string Code { get; set; } = string.Empty; /// OptTypeId - public string OptTypeId { get; set; } = string.Empty; + public Guid? OptTypeId { get; set; } /// ChildrenTypeId - public string ChildrenTypeId { get; set; } = string.Empty; + public Guid? ChildrenTypeId { get; set; } - public string ModuleTypeId { get; set; } = string.Empty; + public Guid? ModuleTypeId { get; set; } - public string ObjectTypeId { get; set; } = string.Empty; + public Guid? ObjectTypeId { get; set; } public string ConfigType { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index a027fa872..8adf6aacf 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -10,6 +10,7 @@ using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; using Castle.Core.Internal; using IRaCIS.Core.Infra.EFCore.Dto; +using MassTransit; namespace IRaCIS.Core.Application.Service { @@ -47,6 +48,35 @@ namespace IRaCIS.Core.Application.Service return await _frontAuditConfigRepository._dbContext.GetTableColumn(tableName).ToListAsync(); } + /// + /// + /// + /// + /// + public async Task CopyFrontAuditConfigItem(CopyFrontAuditConfigItemDto input) + { + var id = NewId.NextGuid(); + List frontAudits= new List(); + + var frontAuditConfig = (await _frontAuditConfigRepository.FirstOrDefaultAsync(x => x.Id == input.ChildId)).Clone(); + var fronts = await _frontAuditConfigRepository.Where(x => x.ParentId == frontAuditConfig.Id).ToListAsync(); + + fronts.ForEach(x => + { + x.Id = NewId.NextGuid(); + x.ParentId = id; + }); + frontAuditConfig.ParentId = input.ParentId; + frontAuditConfig.Id = id; + + frontAudits.Add(frontAuditConfig); + frontAudits.AddRange(fronts); + + await _frontAuditConfigRepository.AddRangeAsync(frontAudits); + await _frontAuditConfigRepository.SaveChangesAsync(); + + + } /// /// 批量添加字段 @@ -200,13 +230,13 @@ namespace IRaCIS.Core.Application.Service { var query = from data in _repository.GetQueryable() - join childrenType in _repository.GetQueryable() on data.ChildrenTypeId equals childrenType.Id.ToString() into childrenTypetemp + join childrenType in _repository.GetQueryable() on data.ChildrenTypeId equals childrenType.Id into childrenTypetemp from leftchildrenType in childrenTypetemp.DefaultIfEmpty() - join ModuleType in _repository.GetQueryable() on data.ModuleTypeId equals ModuleType.Id.ToString() into ModuleTypetemp + join ModuleType in _repository.GetQueryable() on data.ModuleTypeId equals ModuleType.Id into ModuleTypetemp from leftModuleType in ModuleTypetemp.DefaultIfEmpty() - join OptTypeId in _repository.GetQueryable() on data.OptTypeId equals OptTypeId.Id.ToString() into OptTypeIdtemp + join OptTypeId in _repository.GetQueryable() on data.OptTypeId equals OptTypeId.Id into OptTypeIdtemp from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty() - join ObjectTypeId in _repository.GetQueryable() on data.ObjectTypeId equals ObjectTypeId.Id.ToString() into ObjectTypeIdtemp + join ObjectTypeId in _repository.GetQueryable() on data.ObjectTypeId equals ObjectTypeId.Id into ObjectTypeIdtemp from leftObjectTypeIdtemp in ObjectTypeIdtemp.DefaultIfEmpty() select new FrontAuditConfigView() { @@ -263,11 +293,11 @@ namespace IRaCIS.Core.Application.Service .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) .WhereIf(!iq.ValueCN.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) .WhereIf(!iq.Description.IsNullOrEmpty(), x => x.Description == iq.Description) - .WhereIf(!iq.OptTypeId.IsNullOrEmpty(), 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.ChildrenTypeId.IsNullOrEmpty(), x => x.ChildrenTypeId == iq.ChildrenTypeId) - .WhereIf(!iq.ModuleTypeId.IsNullOrEmpty(), x => x.ModuleTypeId == iq.ModuleTypeId) - .WhereIf(!iq.ObjectTypeId.IsNullOrEmpty(), x => x.ObjectTypeId == iq.ObjectTypeId) + .WhereIf(iq.ChildrenTypeId != null, x => x.ChildrenTypeId == iq.ChildrenTypeId) + .WhereIf(iq.ModuleTypeId != null, x => x.ModuleTypeId == iq.ModuleTypeId) + .WhereIf(iq.ObjectTypeId != null, x => x.ObjectTypeId == iq.ObjectTypeId) .WhereIf(!iq.ConfigType.IsNullOrEmpty(), x => x.ConfigType == iq.ConfigType); return await query.OrderBy(x=>x.Sort).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index fbbd3db9d..096f4725a 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -86,76 +86,6 @@ namespace IRaCIS.Application.Services await _repository.SaveChangesAsync(); - - var createtime = DateTime.Now.AddSeconds(1); - // 添加稽查记录 - if (isadd) - { - List datas = new List(); - - // 移到仓储了 - - //datas.Add(new DataInspection() - //{ - // TrialId = subjectCommand.TrialId, - // SiteId = subjectCommand.SiteId, - // SubjectId = mapedSubject.Id, - // SubjectCode = subjectCommand.Code, - // IsSign=false, - // CreateTime = createtime, - // Identification = "Init|Subject|Status|Subject", - // JsonDetail= JsonConvert.SerializeObject(new { - // Status= "新增", - // }) - //}); - - - JsonSerializerSettings settings = new JsonSerializerSettings(); - settings.PreserveReferencesHandling = PreserveReferencesHandling.Objects; - settings.ReferenceLoopHandling = ReferenceLoopHandling.Serialize; - //var jsonData = JsonConvert.SerializeObject(info, settings); - - var visittime = createtime.AddSeconds(1); - foreach (var item in svlist) - { - // 添加访视 - datas.Add(new DataInspection() - { - TrialId = subjectCommand.TrialId, - SiteId = subjectCommand.SiteId, - SubjectId = mapedSubject.Id, - SubjectCode = subjectCommand.Code, - SubjectVisitId = item.Id, - SubjectVisitName = item.VisitName, - BlindName = item.BlindName, - IsSign = false, - CreateTime = visittime, - Identification = "Add|Visit|Info|Visit-Image Upload", - JsonDetail = item.ToJcJson() - }); - - // 初始化访视 - datas.Add(new DataInspection() - { - TrialId = subjectCommand.TrialId, - SiteId = subjectCommand.SiteId, - SubjectId = mapedSubject.Id, - SubjectCode = subjectCommand.Code, - SubjectVisitId = item.Id, - - BlindName = item.BlindName, - SubjectVisitName = item.VisitName, - IsSign = false, - CreateTime = visittime.AddSeconds(1), - Identification = "Init|Visit|Status|Visit-Image Upload", - JsonDetail = item.ToJcJson() - }); - } - - - await _inspectionService.AddListInspectionRecordAsync(datas); - } - return ResponseOutput.Ok(mapedSubject.Id.ToString()); } diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 380b2536c..d8cd9751a 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -79,21 +79,21 @@ namespace IRaCIS.Core.Domain.Models /// public bool? IsConfig { get; set; } - + /// - /// ModuleTypeId - /// - public string ModuleTypeId { get; set; } - + /// ModuleTypeId + /// + public Guid? ModuleTypeId { get; set; } + /// - /// OptTypeId - /// - public string OptTypeId { get; set; } - + /// OptTypeId + /// + public Guid? OptTypeId { get; set; } + /// - /// ChildrenTypeId - /// - public string ChildrenTypeId { get; set; } + /// ChildrenTypeId + /// + public Guid? ChildrenTypeId { get; set; } public bool? IsShowParent { get; set; } @@ -109,7 +109,7 @@ namespace IRaCIS.Core.Domain.Models public string EnumType { get; set; } - public string ObjectTypeId { get; set; } + public Guid? ObjectTypeId { get; set; } public bool? IsShowByTrialConfig { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/DataInspection.cs b/IRaCIS.Core.Domain/Trial/DataInspection.cs index 59a6fba9d..823d6842f 100644 --- a/IRaCIS.Core.Domain/Trial/DataInspection.cs +++ b/IRaCIS.Core.Domain/Trial/DataInspection.cs @@ -28,7 +28,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 功能模块 /// - public string ModuleType { get; set; } + public Guid? ModuleType { get; set; } /// /// 盲态访视名 @@ -59,7 +59,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 操作类型 /// - public string OptType { get; set; } + public Guid? OptType { get; set; } /// /// IP地址 @@ -91,7 +91,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 子类 /// - public string ChildrenType { get; set; } + public Guid? ChildrenType { get; set; } /// /// Json 对象 @@ -142,7 +142,7 @@ namespace IRaCIS.Core.Domain.Models /// /// 对象名称 /// - public string ObjectType { get; set; } + public Guid? ObjectType { get; set; } /// /// 标识 diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index cc4b85772..d5e8c40ac 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -96,7 +96,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common { await InsertInspection(item, type, x => new DataInspection() { - SubjectId = x.Id + SubjectVisitId = x.Id }); } #endregion diff --git a/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs index fa8691efa..c19d8b891 100644 --- a/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs +++ b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs @@ -17,6 +17,17 @@ namespace IRaCIS.Core.Infra.EFCore.Dto } + + /// + /// 复制 + /// + public class CopyFrontAuditConfigItemDto + { + public Guid ParentId { get; set; } + + public Guid ChildId { get; set; } + } + /// /// 稽查数据 ///