添加接口名
							parent
							
								
									18aca83cd7
								
							
						
					
					
						commit
						f94170dfe4
					
				| 
						 | 
				
			
			@ -255,7 +255,7 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
                         DateType=data.DataType,
 | 
			
		||||
                         DictionaryCode=data.DictionaryCode,
 | 
			
		||||
                         DictionaryType=data.DictionaryType,
 | 
			
		||||
                       
 | 
			
		||||
                         InterfaceName=data.InterfaceName,
 | 
			
		||||
 | 
			
		||||
                     };
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,6 +211,13 @@ namespace IRaCIS.Core.Domain.Models
 | 
			
		|||
		public string ForeignKeyText { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// 接口名
 | 
			
		||||
		/// </summary>
 | 
			
		||||
 | 
			
		||||
		public string InterfaceName { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}	 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,8 @@ namespace IRaCIS.Core.Domain.Models
 | 
			
		|||
		/// <summary>
 | 
			
		||||
		/// 项目iD
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		public Guid? TrialId { get; set; }
 | 
			
		||||
		[Required]
 | 
			
		||||
		public Guid TrialId { get; set; }
 | 
			
		||||
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// 中心
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,21 +65,54 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
        /// <param name="entitys"></param>
 | 
			
		||||
        public async Task InsertAddEntitys(List<EntityEntry> entitys,string type)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            #region 所有
 | 
			
		||||
            //foreach (var item in entitys)
 | 
			
		||||
            //{
 | 
			
		||||
            //    await InsertInspection<TrialUser>(item, type);
 | 
			
		||||
            //}
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region 区分
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            // 项目人员
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialUser)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<TrialUser>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    GeneralId = x.Id
 | 
			
		||||
                });
 | 
			
		||||
                await InsertInspection<TrialUser>(item, type);
 | 
			
		||||
            }
 | 
			
		||||
            // 受试者
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Subject)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<Subject>(item, type, x => new DataInspection() { 
 | 
			
		||||
                 SubjectId=x.Id
 | 
			
		||||
                await InsertInspection<Subject>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    SubjectId = x.Id
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 访视
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<SubjectVisit>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    SubjectId = x.Id
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            // 插入稽查信息
 | 
			
		||||
            //async Task InsertInspectionData<T>(Expression<Func<T, DataInspection>> expression = null)
 | 
			
		||||
            //{
 | 
			
		||||
            //    await InsertInspection<T>(item, type, x => new DataInspection()
 | 
			
		||||
            //    {
 | 
			
		||||
            //        GeneralId = x.Id
 | 
			
		||||
            //    });
 | 
			
		||||
            //}
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -92,14 +125,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
        /// <returns></returns>
 | 
			
		||||
        public async Task InsertInspection<T>(EntityEntry data, string type, Expression<Func<T, DataInspection>> expression = null) where T:class
 | 
			
		||||
        {
 | 
			
		||||
         
 | 
			
		||||
            DataInspection inspection = new DataInspection();
 | 
			
		||||
            inspection.Identification = $"{GetRequestUrl()}/{ data.GetType().ToString().Substring(data.GetType().ToString().LastIndexOf('.') + 1)}/{type}";
 | 
			
		||||
            if (expression != null)
 | 
			
		||||
            {
 | 
			
		||||
                var f = expression.Compile();
 | 
			
		||||
                var entity = data.Entity as T;
 | 
			
		||||
                inspection = f(entity);
 | 
			
		||||
            }
 | 
			
		||||
            inspection.Identification = $"{GetRequestUrl()}/{ data.GetType().ToString().Substring(data.GetType().ToString().LastIndexOf('.') + 1)}/{type}";
 | 
			
		||||
            var originaldata = data.OriginalValues as T;
 | 
			
		||||
            if (originaldata != null)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -109,6 +143,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
            await AddInspectionRecordAsync(inspection, data.Entity);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
     
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取URl参数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +169,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    var i = mapData.GetType().GetProperty(item).GetValue(mapData);
 | 
			
		||||
                    if (i == null)
 | 
			
		||||
                    if (i == null|| i==default(Guid))
 | 
			
		||||
                    {
 | 
			
		||||
                        var value = data.GetType().GetProperty(item).GetValue(data);
 | 
			
		||||
                        mapData.GetType().GetProperty(item).SetValue(mapData, value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue