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