修改问题

Uat_Study
he 2022-04-20 13:16:01 +08:00
parent fa33be9718
commit ee0ead7017
13 changed files with 121 additions and 13 deletions

View File

@ -286,7 +286,7 @@ namespace IRaCIS.Core.API.Controllers
[UnitOfWork] [UnitOfWork]
public async Task<IResponseOutput> QCPassedOrFailed(DataInspectionDto<QCPassedOrFailedDto> opt) public async Task<IResponseOutput> QCPassedOrFailed(DataInspectionDto<QCPassedOrFailedDto> opt)
{ {
var fun = await _qCOperationService.QCPassedOrFailed(opt.OptCommand.trialId, opt.OptCommand.subjectVisitId, opt.OptCommand.signId, opt.OptCommand.auditState); var fun = await _qCOperationService.QCPassedOrFailed(opt.OptCommand.trialId, opt.OptCommand.subjectVisitId, opt.OptCommand.auditState);
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun);
} }
@ -385,7 +385,7 @@ namespace IRaCIS.Core.API.Controllers
{ {
return ResponseOutput.NotOk(fun.ErrorMessage); return ResponseOutput.NotOk(fun.ErrorMessage);
} }
opt.AuditInfo.NeedSava = false;
return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo,null, fun); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo,null, fun);
} }

View File

@ -485,6 +485,11 @@
是否为特殊类型 是否为特殊类型
</summary> </summary>
</member> </member>
<member name="P:IRaCIS.Core.Application.ViewModel.FrontAuditConfigAddOrEdit.DateType">
<summary>
日期类型
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemAnonymizationView"> <member name="T:IRaCIS.Core.Application.ViewModel.SystemAnonymizationView">
<summary> SystemAnonymizationView 列表视图模型 </summary> <summary> SystemAnonymizationView 列表视图模型 </summary>
</member> </member>
@ -1508,7 +1513,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Image.QA.QCOperationService.QCPassedOrFailed(System.Guid,System.Guid,System.Guid,IRaCIS.Core.Domain.Share.AuditStateEnum)"> <member name="M:IRaCIS.Core.Application.Image.QA.QCOperationService.QCPassedOrFailed(System.Guid,System.Guid,IRaCIS.Core.Domain.Share.AuditStateEnum)">
<summary> <summary>
设置QC 通过或者不通过 7:QC failed 8QC passed 设置QC 通过或者不通过 7:QC failed 8QC passed
</summary> </summary>

View File

@ -192,6 +192,13 @@ namespace IRaCIS.Core.Application.ViewModel
public bool? IsSpecialType { get; set; } public bool? IsSpecialType { get; set; }
/// <summary>
/// 日期类型
/// </summary>
public string DateType { get; set; }
} }

View File

@ -78,6 +78,7 @@ namespace IRaCIS.Core.Application.Service
ModuleTypeId = additem?.ModuleTypeId, ModuleTypeId = additem?.ModuleTypeId,
ObjectTypeId = additem?.ObjectTypeId, ObjectTypeId = additem?.ObjectTypeId,
OptTypeId = additem?.OptTypeId, OptTypeId = additem?.OptTypeId,
DateType = lst.Select(x => x.DateType).FirstOrDefault(),
Id =Guid.NewGuid(), Id =Guid.NewGuid(),
}).ToList(); }).ToList();
@ -188,6 +189,7 @@ namespace IRaCIS.Core.Application.Service
ChildDataLabel=data.ChildDataLabel, ChildDataLabel=data.ChildDataLabel,
ChildDataValue=data.ChildDataValue, ChildDataValue=data.ChildDataValue,
IsSpecialType=data.IsSpecialType, IsSpecialType=data.IsSpecialType,
DateType=data.DataType,
}; };
query = query query = query

View File

@ -112,6 +112,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public bool NeedSava { get; set; } = true;
} }
@ -187,7 +189,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
{ {
public Guid trialId { get; set; } public Guid trialId { get; set; }
public Guid subjectVisitId { get; set; } public Guid subjectVisitId { get; set; }
public Guid signId { get; set; }
public AuditStateEnum auditState { get; set; } public AuditStateEnum auditState { get; set; }
} }

View File

@ -216,7 +216,11 @@ namespace IRaCIS.Core.Application.Service.Inspection
} }
// 判断是否需要前面 // 判断是否需要前面
if (AuditInfo.NeedSava)
{
await AddInspectionRecordAsync(AuditInfo, signId); await AddInspectionRecordAsync(AuditInfo, signId);
}
return bResult; return bResult;
} }
@ -282,7 +286,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="addDto">添加对象</param> /// <param name="addDto">添加对象</param>
/// <param name="signId">签名Id</param> /// <param name="signId">签名Id</param>
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null) public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null)
{ {
if (addDto == new DataInspectionAddDTO()) if (addDto == new DataInspectionAddDTO())
{ {
@ -292,13 +296,17 @@ namespace IRaCIS.Core.Application.Service.Inspection
var add = _mapper.Map<DataInspection>(addDto); var add = _mapper.Map<DataInspection>(addDto);
await SetInspectionNameValue(add); await SetInspectionNameValue(add);
Guid? parentId = null; Guid? parentId = null;
parentId = (await _repository.GetQueryable<DataInspection>().Where( x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType&&x.VisitStageId==add.VisitStageId&&x.GeneralId==add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.ChildrenType == add.ChildrenType && x.ObjectType == add.ObjectType && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
add.ParentId = parentId; add.ParentId = parentId;
add.CreateTime = DateTime.Now; add.CreateTime = DateTime.Now;
add.CreateUserId = _userInfo.Id; add.CreateUserId = _userInfo.Id;
add.SignId = signId; add.SignId = signId;
add.IP = _userInfo.IP; add.IP = _userInfo.IP;
add =await _dataInspectionRepository.SetDataInspectionDateType(add);
await _repository.AddAsync(add); await _repository.AddAsync(add);

View File

@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Image.QA
{ {
Task<IResponseOutput> CheckBack(Guid subjectVisitId); Task<IResponseOutput> CheckBack(Guid subjectVisitId);
Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid qcChallengeId); Task<IResponseOutput> SetNeedReupload(Guid trialId, Guid qcChallengeId);
Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, Guid signId, [FromRoute] AuditStateEnum auditState); Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState);
Task<IResponseOutput> SetCheckPass(Guid subjectVisitId); Task<IResponseOutput> SetCheckPass(Guid subjectVisitId);

View File

@ -1382,7 +1382,7 @@ namespace IRaCIS.Core.Application.Image.QA
[HttpPost("{trialId:guid}/{subjectVisitId:guid}/{signId:guid}/{auditState:int}")] [HttpPost("{trialId:guid}/{subjectVisitId:guid}/{signId:guid}/{auditState:int}")]
[TypeFilter(typeof(TrialResourceFilter))] [TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, Guid signId, [FromRoute] AuditStateEnum auditState) public async Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState)
{ {
if (!await _repository.AnyAsync<TrialUser>(t => t.TrialId == trialId && t.UserId == _userInfo.Id)) if (!await _repository.AnyAsync<TrialUser>(t => t.TrialId == trialId && t.UserId == _userInfo.Id))
@ -1546,9 +1546,9 @@ namespace IRaCIS.Core.Application.Image.QA
await _repository.SaveChangesAsync(); await _repository.SaveChangesAsync();
var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); //var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
return ResponseOutput.Result(success); return ResponseOutput.Result(true);
} }

View File

@ -27,3 +27,5 @@ public class SignDTO
} }

View File

@ -174,6 +174,13 @@ namespace IRaCIS.Core.Domain.Models
public bool? IsSpecialType { get; set; } public bool? IsSpecialType { get; set; }
/// <summary>
/// 日期类型
/// </summary>
public string DateType { get; set; }
} }
} }

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Infra.EFCore.Dto
{
public class DateDto
{
public string Code { get; set; }
public string DateType { get; set; }
}
}

View File

@ -31,6 +31,14 @@ namespace IRaCIS.Core.Infra.EFCore
/// <param name="datas"></param> /// <param name="datas"></param>
/// <returns></returns> /// <returns></returns>
Task AddListInspectionRecordAsync(List<DataInspection> datas); Task AddListInspectionRecordAsync(List<DataInspection> datas);
/// <summary>
/// 格式化日期和时间
/// </summary>
/// <param name="Data"></param>
/// <returns></returns>
Task<DataInspection> SetDataInspectionDateType(DataInspection Data);
} }

View File

@ -17,6 +17,7 @@ using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
using IRaCIS.Core.Infra.EFCore.Dto;
namespace IRaCIS.Core.Infra.EFCore namespace IRaCIS.Core.Infra.EFCore
{ {
@ -183,6 +184,7 @@ namespace IRaCIS.Core.Infra.EFCore
add.CreateTime = DateTime.Now; add.CreateTime = DateTime.Now;
} }
add.JsonDetail = JsonConvert.SerializeObject(JsonData); add.JsonDetail = JsonConvert.SerializeObject(JsonData);
await SetDataInspectionDateType(add);
} }
await _dbContext.DataInspection.AddRangeAsync(datas); await _dbContext.DataInspection.AddRangeAsync(datas);
@ -207,6 +209,55 @@ namespace IRaCIS.Core.Infra.EFCore
} }
} }
/// <summary>
/// 格式化日期和时间
/// </summary>
/// <param name="Data"></param>
/// <returns></returns>
public async Task<DataInspection> SetDataInspectionDateType(DataInspection Data)
{
var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == Data.Identification)
join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.DateType != null && x.DateType != string.Empty) on parent.Id equals child.ParentId
select new DateDto()
{
Code= child.Code,
DateType= child.DateType,
}).ToListAsync();
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(Data.JsonDetail);
foreach (var item in JsonData.Keys)
{
var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower());
if (datefirst != null&& !IsNullOrEmpty(JsonData[item]))
{
try
{
if (datefirst.DateType == "Date")
{
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd");
}
if (datefirst.DateType == "DateTime")
{
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
}
}
catch (Exception)
{
continue;
}
}
}
Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
return Data;
}
/// <summary> /// <summary>