From 3adf23f67799980ce45005633ba272aae491093c Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 10 Jun 2022 17:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Inspection/DTO/InspectionModel.cs | 2 +- .../Inspection/FrontAuditConfigService.cs | 76 +++++++++++-------- .../Service/Inspection/InspectionService.cs | 4 +- .../Common/Dto/SetDictionaryValueDto.cs | 13 ++++ 4 files changed, 61 insertions(+), 34 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 9497e9d0b..281d0cc68 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -355,7 +355,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public string VisitName { get; set; } = string.Empty; - public string ParentJson { get; set; } = string.Empty; + //public string ParentJson { get; set; } = string.Empty; public string CreateUser { get; set; } = string.Empty; public string UserFirstName { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index ef39e10b8..6b8d768c7 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -175,41 +175,55 @@ namespace IRaCIS.Core.Application.Service await _frontAuditConfigRepository.AddRangeAsync(fronts); } - ///// - ///// 翻译稽查数据 - ///// - ///// - ///// - //[HttpPost] - //public async Task> SetInspectionEnumValue(SetInspectionEnumValueDto dto) - //{ - // return await SetInspectionEnumValueDataList(dto); - //} + /// + /// 翻译稽查数据 + /// + /// + /// + [HttpPost] + public async Task> SetInspectionEnumValue(SetInspectionEnumValueDto dto) + { + return await SetInspectionEnumValueDataList(dto); + } - ///// - ///// 翻译稽查数据 - ///// - ///// 传入Dto - ///// - //private async Task> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto) - //{ - // var audits= _dataInspectionRepository.Where(x= dto.AuditDataIds.Contains(OfficeOpenXml=>)) + /// + /// 翻译稽查数据 + /// + /// 传入Dto + /// + private async Task> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto) + { + var auditDatas = _dataInspectionRepository.AsQueryable().Where(x => dto.AuditDataIds.Contains(x.Id)).Select(x=> new SetInspectionEnumDataDto() { + Id=x.Id, + JsonStr=x.JsonDetail, + Identification=x.Identification + }); - // var listIdentification = dto.Items.Select(x => x.Identification).ToList(); - // foreach (var item in dto.Items) - // { - // if (item.Identification == string.Empty || item.Json == string.Empty) - // { - // continue; - // } - // item.Json = await GetInspectionEnumValue(listIdentification, item.Json); - // item.Json = await SetEnum(dto.TrialId, listIdentification, item.Json); - // item.Json = await SetDataInspectionDateType(listIdentification, item.Json); - // } - // return dto.Items.Select(x => x.Json).ToList(); - //} + var listIdentification = auditDatas.Select(x => x.Identification).ToList(); + foreach (var item in auditDatas) + { + if (item.Identification == string.Empty || item.JsonStr == string.Empty) + { + continue; + } + item.JsonStr = await GetInspectionEnumValue(listIdentification, item.JsonStr); + item.JsonStr = await SetEnum(dto.TrialId, listIdentification, item.JsonStr); + item.JsonStr = await SetDataInspectionDateType(listIdentification, item.JsonStr); + } + + var resultJsonStrList = new List(); + + dto.AuditDataIds.ForEach(x => + { + var auditData = auditDatas.FirstOrDefault(y => y.Id == x); + resultJsonStrList.Add(auditData?.JsonStr); + }); + + + return resultJsonStrList; + } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 88d0b49b0..c453aa619 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -101,13 +101,13 @@ namespace IRaCIS.Core.Application.Service.Inspection SignId = data.SignId, ParentId = data.ParentId, ChildrenType = data.ChildrenType, - JsonDetail = data.JsonDetail, + //JsonDetail = data.JsonDetail, //SiteName = data.SiteName, //ExperimentName = data.TrialName, FirstName = leftsubject.FirstName, LastName = leftsubject.LastName, Id = data.Id, - ParentJson = leftparent.JsonDetail, + //ParentJson = leftparent.JsonDetail, VisitName = leftsubjectVisit.VisitName, CreateUser = leftuser.UserName, UserFirstName = leftuser.FirstName, diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs index beaa51cfc..45cdced0a 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs @@ -13,12 +13,25 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto [NotDefault] public Guid TrialId { get; set; } + [NotDefault] public List AuditDataIds { get; set; } } + public class SetInspectionEnumDataDto + { + public Guid Id { get; set; } + + public string Identification { get; set; } + + public string JsonStr { get; set; } + } + + + + public class AddInterface { public Guid ParentId { get; set; }