修改一版
This commit is contained in:
@@ -156,17 +156,18 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize, "CreateTime", dto.Asc);
|
||||
}
|
||||
|
||||
//public async Task<string>
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传入参数记录ID
|
||||
/// </summary>
|
||||
/// <param name="SignInfo"></param>
|
||||
/// <param name="response"></param>
|
||||
/// <returns></returns>
|
||||
public async Task RecordSing(SignDTO SignInfo)
|
||||
public async Task RecordSing(SignDTO SignInfo, IResponseOutput response)
|
||||
{
|
||||
if (SignInfo != null)
|
||||
if (SignInfo != null&&response.IsSuccess)
|
||||
{
|
||||
var verifyResult = await VerifySignatureAsync(SignInfo);
|
||||
var signId = await AddSignRecordAsync(SignInfo);
|
||||
@@ -176,91 +177,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用逻辑封装
|
||||
/// </summary>
|
||||
/// <param name="OptCommand">方法参数</param>
|
||||
/// <param name="AuditInfo">添加稽查</param>
|
||||
/// <param name="SignInfo">用户签名</param>
|
||||
/// <param name="fun">委托</param>
|
||||
/// <param name="response">方法返回的结果</param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response=null)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (response != null && response.IsSuccess == false)
|
||||
{
|
||||
return response;
|
||||
}
|
||||
Guid? signId = null;
|
||||
MapData(OptCommand, AuditInfo);
|
||||
if (AuditInfo.IsSign)
|
||||
{
|
||||
// 验证用户签名信息
|
||||
var verifyResult = await VerifySignatureAsync(SignInfo);
|
||||
signId = await AddSignRecordAsync(SignInfo);
|
||||
if (verifyResult.IsSuccess == false)
|
||||
{
|
||||
return verifyResult;
|
||||
}
|
||||
//await AddSignRecordAsync(SignInfo);
|
||||
}
|
||||
|
||||
IResponseOutput bResult;
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
bResult = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
bResult = await fun(OptCommand);
|
||||
}
|
||||
|
||||
// 用户 签名某个文档
|
||||
if (bResult.IsSuccess == false)
|
||||
{
|
||||
return bResult;
|
||||
}
|
||||
|
||||
if (AuditInfo.IsSign)
|
||||
{
|
||||
var signSuccess = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 映射 SiteId SubjectId SubjectVisitId TrialId 最开始没有 需要特殊处理
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="mapData"></param>
|
||||
public void MapData(dynamic data, dynamic mapData)
|
||||
{
|
||||
List<string> column = new List<string>() { "TrialId", "SiteId", "SubjectId", "SubjectVisitId" };
|
||||
foreach (var item in column)
|
||||
{
|
||||
try
|
||||
{
|
||||
var i = mapData.GetType().GetProperty(item).GetValue(mapData);
|
||||
if (i == null)
|
||||
{
|
||||
var value = data.GetType().GetProperty(item).GetValue(data);
|
||||
mapData.GetType().GetProperty(item).SetValue(mapData, value);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> 验证用户签名信息 </summary> ///
|
||||
public async Task<IResponseOutput> VerifySignatureAsync(SignDTO signDTO)
|
||||
@@ -288,49 +205,6 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
return add.Id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 往json里面添加属性
|
||||
/// </summary>
|
||||
/// <param name="json">json</param>
|
||||
/// <param name="keyValues">字典</param>
|
||||
/// <returns></returns>
|
||||
public string AddJsonItem(string json, Dictionary<string,object> keyValues)
|
||||
{
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
|
||||
foreach (var item in keyValues)
|
||||
{
|
||||
if (JsonData.ContainsKey(item.Key))
|
||||
{
|
||||
JsonData[item.Key] = item.Value;
|
||||
}
|
||||
else {
|
||||
JsonData.Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
}
|
||||
return JsonConvert.SerializeObject(JsonData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置项目以及名称
|
||||
/// </summary>
|
||||
/// <param name="Data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task SetInspectionNameValue(DataInspection Data)
|
||||
{
|
||||
await _dataInspectionRepository.SetInspectionNameValue(Data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
|
||||
|
||||
Task<PageOutput<GetDataInspectionOutDto>> GetInspectionData(GetDataInspectionDto dto);
|
||||
|
||||
string AddJsonItem(string json, Dictionary<string, object> keyValues);
|
||||
void MapData(dynamic data, dynamic mapData);
|
||||
|
||||
|
||||
Task<IResponseOutput> VerifySignatureAsync(SignDTO signDTO);
|
||||
Task<IResponseOutput> VerifySignatureAsync(SignDTO signDTO, IResponseOutput response);
|
||||
|
||||
Task<Guid> AddSignRecordAsync(SignDTO signDTO);
|
||||
|
||||
Task RecordSing(SignDTO SignInfo);
|
||||
Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null);
|
||||
Task RecordSing(SignDTO SignInfo, IResponseOutput response);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user