增加稽查记录修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
48c9721ab4
commit
447e916564
|
@ -1483,12 +1483,33 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditDocument},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditRecord},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditRecordPermission},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.AuditRecordIdentityUser},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
|
||||||
<summary>
|
<summary>
|
||||||
稽查文档
|
稽查文档
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.GetAuditRecordList(IRaCIS.Core.Application.ViewModel.AuditRecordQuery)">
|
||||||
|
<summary>
|
||||||
|
稽查记录 列表
|
||||||
|
</summary>
|
||||||
|
<param name="inQuery"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.DeleteAuditRecord(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
删除稽查记录
|
||||||
|
</summary>
|
||||||
|
<param name="auditRecordId"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.SetAuditRecordPermission(IRaCIS.Core.Application.ViewModel.SetAuditRecordPermissionCommand)">
|
||||||
|
<summary>
|
||||||
|
设置授权
|
||||||
|
</summary>
|
||||||
|
<param name="inCommand"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.GetAuditDocumentList(IRaCIS.Core.Application.ViewModel.AuditDocumentQuery)">
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.GetAuditDocumentList(IRaCIS.Core.Application.ViewModel.AuditDocumentQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
获取稽查文档
|
获取稽查文档
|
||||||
|
|
|
@ -19,6 +19,7 @@ using MassTransit;
|
||||||
using NPOI.POIFS.Properties;
|
using NPOI.POIFS.Properties;
|
||||||
using Org.BouncyCastle.Crypto;
|
using Org.BouncyCastle.Crypto;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using IRaCIS.Core.Application.Contracts;
|
||||||
namespace IRaCIS.Core.Application.Service;
|
namespace IRaCIS.Core.Application.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,10 +28,123 @@ namespace IRaCIS.Core.Application.Service;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[ApiExplorerSettings(GroupName = "FileRecord")]
|
[ApiExplorerSettings(GroupName = "FileRecord")]
|
||||||
public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepository,
|
public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepository, IRepository<AuditRecord> _auditRecordRepository,
|
||||||
|
IRepository<AuditRecordPermission> _auditRecordPermissionRepository, IRepository<AuditRecordIdentityUser> _auditRecordIdentityUserRepository,
|
||||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#region 稽查新增需求
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 稽查记录 列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inQuery"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<PageOutput<AuditRecordView>> GetAuditRecordList(AuditRecordQuery inQuery)
|
||||||
|
{
|
||||||
|
|
||||||
|
var auditRecordQueryable = _auditRecordRepository
|
||||||
|
.WhereIf(inQuery.BeginAuditTime != null, t => t.AuditTime >= inQuery.BeginAuditTime)
|
||||||
|
.WhereIf(inQuery.EndAuditTime != null, t => t.AuditTime <= inQuery.EndAuditTime)
|
||||||
|
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
|
||||||
|
.WhereIf(inQuery.BeginTime != null, t => t.BeginTime >= inQuery.BeginTime)
|
||||||
|
.WhereIf(inQuery.EndTime != null, t => t.EndTime <= inQuery.EndTime)
|
||||||
|
.WhereIf(inQuery.CompanyName.IsNotNullOrEmpty(), t => t.CompanyName.Contains(inQuery.CompanyName))
|
||||||
|
.WhereIf(inQuery.AuditContent.IsNotNullOrEmpty(), t => t.AuditContent.Contains(inQuery.AuditContent))
|
||||||
|
.ProjectTo<AuditRecordView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
|
var pageList = await auditRecordQueryable.ToPagedListAsync(inQuery);
|
||||||
|
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> AddOrUpdateAuditRecord(AuditRecordAddOrEdit addOrEditAuditRecord)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (addOrEditAuditRecord.Id == null)
|
||||||
|
{
|
||||||
|
var entity = _mapper.Map<AuditRecord>(addOrEditAuditRecord);
|
||||||
|
|
||||||
|
|
||||||
|
if (await _auditRecordRepository.AnyAsync(t => t.CompanyName == addOrEditAuditRecord.CompanyName && t.AuditContent == addOrEditAuditRecord.AuditContent && t.AuditTime == addOrEditAuditRecord.AuditTime, true))
|
||||||
|
{
|
||||||
|
//---重复的稽查记录。
|
||||||
|
return ResponseOutput.NotOk(_localizer["AuditDocument_RepeatAuditRecord"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _auditRecordRepository.AddAsync(entity, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (await _auditRecordRepository.AnyAsync(t => t.CompanyName == addOrEditAuditRecord.CompanyName && t.AuditContent == addOrEditAuditRecord.AuditContent && t.AuditTime == addOrEditAuditRecord.AuditTime
|
||||||
|
&& t.Id != addOrEditAuditRecord.Id, true))
|
||||||
|
{
|
||||||
|
//---重复的稽查记录。
|
||||||
|
return ResponseOutput.NotOk(_localizer["AuditDocument_RepeatAuditRecord"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var find = _auditRecordRepository.Where(t => t.Id == addOrEditAuditRecord.Id, true).FirstOrDefault();
|
||||||
|
|
||||||
|
_mapper.Map(addOrEditAuditRecord, find);
|
||||||
|
find.UpdateTime = DateTime.Now;
|
||||||
|
|
||||||
|
var success = await _auditRecordRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(find.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除稽查记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="auditRecordId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("{auditRecordId:guid}")]
|
||||||
|
public async Task<IResponseOutput> DeleteAuditRecord(Guid auditRecordId)
|
||||||
|
{
|
||||||
|
if (await _auditRecordRepository.Where(t => t.Id == auditRecordId).AnyAsync(u => u.AuditState != AuditState.NotStart))
|
||||||
|
{
|
||||||
|
//未开始的才允许删除
|
||||||
|
return ResponseOutput.NotOk(_localizer["AuditDocument_CannotDeleteStartRecod"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var success = await _auditRecordRepository.DeleteFromQueryAsync(t => t.Id == auditRecordId, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置授权
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inCommand"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> SetAuditRecordPermission(SetAuditRecordPermissionCommand inCommand)
|
||||||
|
{
|
||||||
|
if (_auditRecordPermissionRepository.Any(t => t.AuditRecordId == inCommand.AuditRecordId && t.AuditDocumentId == inCommand.AuditDocumentId))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取稽查文档
|
/// 获取稽查文档
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -103,7 +217,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
var result = await AddOrUpdateAuditDocument(item);
|
var result = await AddOrUpdateAuditDocument(item);
|
||||||
|
|
||||||
resultData.Add(result.Id);
|
resultData.Add(result.Id);
|
||||||
item.Children.ForEach(x => {
|
item.Children.ForEach(x =>
|
||||||
|
{
|
||||||
x.ParentId = result.Id;
|
x.ParentId = result.Id;
|
||||||
x.IsUpdate = false;
|
x.IsUpdate = false;
|
||||||
|
|
||||||
|
@ -217,7 +332,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
var data = (await _auditDocumentRepository
|
var data = (await _auditDocumentRepository
|
||||||
.Where(x => x.AuditDocumentTypeEnum != AuditDocumentType.HistoricalVersion)
|
.Where(x => x.AuditDocumentTypeEnum != AuditDocumentType.HistoricalVersion)
|
||||||
.WhereIf(inDto.IsAuthorization != null, x => x.IsAuthorization == inDto.IsAuthorization)
|
.WhereIf(inDto.IsAuthorization != null, x => x.IsAuthorization == inDto.IsAuthorization)
|
||||||
.ProjectTo<AuditDocumentData>(_mapper.ConfigurationProvider).ToPagedListAsync(new PageInput() {
|
.ProjectTo<AuditDocumentData>(_mapper.ConfigurationProvider).ToPagedListAsync(new PageInput()
|
||||||
|
{
|
||||||
PageIndex = 1,
|
PageIndex = 1,
|
||||||
PageSize = 999999,
|
PageSize = 999999,
|
||||||
}, defalutSortArray)).CurrentPageData.ToList();
|
}, defalutSortArray)).CurrentPageData.ToList();
|
||||||
|
@ -296,7 +412,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> DeleteAuditDocument(DeleteAuditDocumentInDto inDto)
|
public async Task<IResponseOutput> DeleteAuditDocument(DeleteAuditDocumentInDto inDto)
|
||||||
{
|
{
|
||||||
var data = await _auditDocumentRepository.Select(x => new DeleteAudit (){
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
||||||
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
ParentId = x.ParentId,
|
ParentId = x.ParentId,
|
||||||
MainFileId = x.MainFileId
|
MainFileId = x.MainFileId
|
||||||
|
@ -426,7 +543,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
})).CurrentPageData;
|
})).CurrentPageData;
|
||||||
|
|
||||||
List<AuditDocumentAddOrEdit> auditDocumentAddOrEdits = _mapper.Map<List<AuditDocumentAddOrEdit>>(data);
|
List<AuditDocumentAddOrEdit> auditDocumentAddOrEdits = _mapper.Map<List<AuditDocumentAddOrEdit>>(data);
|
||||||
auditDocumentAddOrEdits.ForEach(x => {
|
auditDocumentAddOrEdits.ForEach(x =>
|
||||||
|
{
|
||||||
x.IsUpdate = false;
|
x.IsUpdate = false;
|
||||||
x.Id = null;
|
x.Id = null;
|
||||||
x.ParentId = inDto.ParentId;
|
x.ParentId = inDto.ParentId;
|
||||||
|
@ -441,7 +559,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
item.Id = null;
|
item.Id = null;
|
||||||
var result = await AddOrUpdateAuditDocument(item);
|
var result = await AddOrUpdateAuditDocument(item);
|
||||||
|
|
||||||
item.Children.ForEach(x => {
|
item.Children.ForEach(x =>
|
||||||
|
{
|
||||||
x.ParentId = result.Id;
|
x.ParentId = result.Id;
|
||||||
x.IsUpdate = false;
|
x.IsUpdate = false;
|
||||||
x.Id = null;
|
x.Id = null;
|
||||||
|
@ -494,7 +613,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
var historicalVersionIds = await _auditDocumentRepository.Where(x => x.MainFileId == mainFile.Id && x.Id != inDto.Id).OrderBy(x => x.Version).Select(x => x.Id).ToListAsync();
|
var historicalVersionIds = await _auditDocumentRepository.Where(x => x.MainFileId == mainFile.Id && x.Id != inDto.Id).OrderBy(x => x.Version).Select(x => x.Id).ToListAsync();
|
||||||
|
|
||||||
historicalVersionIds.Add(mainFile.Id);
|
historicalVersionIds.Add(mainFile.Id);
|
||||||
await _auditDocumentRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new AuditDocument() {
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new AuditDocument()
|
||||||
|
{
|
||||||
MainFileId = null,
|
MainFileId = null,
|
||||||
ParentId = mainFile.ParentId,
|
ParentId = mainFile.ParentId,
|
||||||
AuditDocumentTypeEnum = AuditDocumentType.File,
|
AuditDocumentTypeEnum = AuditDocumentType.File,
|
||||||
|
@ -542,7 +662,8 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
findParent(allid, inDto.Ids, data);
|
findParent(allid, inDto.Ids, data);
|
||||||
}
|
}
|
||||||
allid = allid.Distinct().ToList();
|
allid = allid.Distinct().ToList();
|
||||||
await _auditDocumentRepository.UpdatePartialFromQueryAsync(t => allid.Contains(t.Id), x => new AuditDocument() {
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(t => allid.Contains(t.Id), x => new AuditDocument()
|
||||||
|
{
|
||||||
|
|
||||||
IsAuthorization = inDto.IsAuthorization
|
IsAuthorization = inDto.IsAuthorization
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,76 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace IRaCIS.Core.Application.ViewModel;
|
namespace IRaCIS.Core.Application.ViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
public class AuditRecordView : AuditRecordAddOrEdit
|
||||||
|
{
|
||||||
|
public Guid CreateUserId { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public Guid UpdateUserId { get; set; }
|
||||||
|
public DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public new List<Guid> IdnetityUserIdList => IdentityUserList.Select(t => t.Id).ToList();
|
||||||
|
public List<AuditIdentiUserInfo> IdentityUserList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuditIdentiUserInfo
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
public string FullName { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuditRecordAddOrEdit
|
||||||
|
{
|
||||||
|
public Guid? Id { get; set; }
|
||||||
|
public string CompanyName { get; set; }
|
||||||
|
|
||||||
|
public string AuditContent { get; set; }
|
||||||
|
|
||||||
|
public DateOnly AuditTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime? BeginTime { get; set; }
|
||||||
|
|
||||||
|
public DateTime? EndTime { get; set; }
|
||||||
|
|
||||||
|
public AuditState AuditState { get; set; }
|
||||||
|
|
||||||
|
public AuditType AuditType { get; set; }
|
||||||
|
|
||||||
|
public List<Guid> IdnetityUserIdList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuditRecordQuery : PageInput
|
||||||
|
{
|
||||||
|
public string? CompanyName { get; set; }
|
||||||
|
|
||||||
|
public string? AuditContent { get; set; }
|
||||||
|
|
||||||
|
public DateOnly? BeginAuditTime { get; set; }
|
||||||
|
public DateOnly? EndAuditTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime? BeginTime { get; set; }
|
||||||
|
|
||||||
|
public DateTime? EndTime { get; set; }
|
||||||
|
|
||||||
|
public AuditState? AuditState { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SetAuditRecordPermissionCommand
|
||||||
|
{
|
||||||
|
public Guid AuditDocumentId { get; set; }
|
||||||
|
|
||||||
|
public Guid AuditRecordId { get; set; }
|
||||||
|
|
||||||
|
public bool IsAuthorization { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class DeleteAudit
|
public class DeleteAudit
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
|
@ -94,7 +94,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
CreateMap<AddOrEditSystemDocument, SystemDocument>().ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList));
|
CreateMap<AddOrEditSystemDocument, SystemDocument>().ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList));
|
||||||
CreateMap<Guid, SystemDocNeedConfirmedUserType>().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
|
CreateMap<Guid, SystemDocNeedConfirmedUserType>()
|
||||||
|
.EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
|
||||||
.ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t))
|
.ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t))
|
||||||
.ForMember(d => d.SystemDocumentId, c => c.Ignore());
|
.ForMember(d => d.SystemDocumentId, c => c.Ignore());
|
||||||
|
|
||||||
|
@ -146,6 +147,26 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileView>();
|
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileView>();
|
||||||
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileAddOrEdit>().ReverseMap();
|
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CreateMap<AuditRecord, AuditRecordView>()
|
||||||
|
.ForMember(d => d.IdentityUserList, c => c.MapFrom(t => t.AuditRecordIdentityUserList));
|
||||||
|
|
||||||
|
CreateMap<AuditRecordAddOrEdit, AuditRecord>()
|
||||||
|
.ForMember(d => d.AuditRecordIdentityUserList, c => c.MapFrom(t => t.IdnetityUserIdList));
|
||||||
|
|
||||||
|
CreateMap<Guid, AuditRecordIdentityUser>()
|
||||||
|
.EqualityComparison((odto, o) => odto == o.IdentityUserId)
|
||||||
|
.ForMember(d => d.AuditRecordId, c => c.Ignore())
|
||||||
|
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t));
|
||||||
|
|
||||||
|
|
||||||
|
CreateMap<AuditRecordIdentityUser, AuditIdentiUserInfo>()
|
||||||
|
.ForMember(d => d.Id, c => c.MapFrom(t => t.IdentityUser.Id))
|
||||||
|
.ForMember(d => d.UserName, c => c.MapFrom(t => t.IdentityUser.UserName))
|
||||||
|
.ForMember(d => d.FullName, c => c.MapFrom(t => t.IdentityUser.FullName));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,4 +80,83 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
HistoricalVersion = 2,
|
HistoricalVersion = 2,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class AuditRecord : BaseFullAuditEntity
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public List<AuditRecordIdentityUser> AuditRecordIdentityUserList { get; set; }
|
||||||
|
|
||||||
|
public string CompanyName { get; set; }
|
||||||
|
|
||||||
|
public string AuditContent { get; set; }
|
||||||
|
|
||||||
|
[Comment("稽查日期")]
|
||||||
|
public DateOnly AuditTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime? BeginTime { get; set; }
|
||||||
|
|
||||||
|
public DateTime? EndTime { get; set; }
|
||||||
|
|
||||||
|
[Comment("稽查状态")]
|
||||||
|
public AuditState AuditState { get; set; }
|
||||||
|
|
||||||
|
[Comment("稽查形式")]
|
||||||
|
public AuditType AuditType { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class AuditRecordIdentityUser : BaseAddAuditEntity
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public IdentityUser IdentityUser { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public AuditRecord AuditRecord { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Guid IdentityUserId { get; set; }
|
||||||
|
|
||||||
|
public Guid AuditRecordId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class AuditRecordPermission : BaseAddAuditEntity
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public AuditRecord AuditRecord { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public AuditDocument AuditDocument { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid AuditRecordId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid AuditDocumentId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum AuditState
|
||||||
|
{
|
||||||
|
NotStart = 0,
|
||||||
|
|
||||||
|
Ongoing = 1,
|
||||||
|
|
||||||
|
End = 2
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AuditType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
Online = 1,
|
||||||
|
|
||||||
|
OnSite = 2
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class IRaCISDBContext : DbContext
|
||||||
configurationBuilder.Conventions.Add(_ => new DefaultStringLengthConvention(400));
|
configurationBuilder.Conventions.Add(_ => new DefaultStringLengthConvention(400));
|
||||||
|
|
||||||
//https://learn.microsoft.com/zh-cn/ef/core/modeling/relationships/conventions?utm_source=chatgpt.com
|
//https://learn.microsoft.com/zh-cn/ef/core/modeling/relationships/conventions?utm_source=chatgpt.com
|
||||||
configurationBuilder.Conventions.Remove(typeof(ForeignKeyIndexConvention));
|
//configurationBuilder.Conventions.Remove(typeof(ForeignKeyIndexConvention));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
@ -674,6 +674,12 @@ public class IRaCISDBContext : DbContext
|
||||||
|
|
||||||
public virtual DbSet<SubjectVisitImageBackRecord> SubjectVisitImageBackRecord { get; set; }
|
public virtual DbSet<SubjectVisitImageBackRecord> SubjectVisitImageBackRecord { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public virtual DbSet<AuditRecord> AuditRecord { get; set; }
|
||||||
|
public virtual DbSet<AuditRecordIdentityUser> AuditRecordIdentityUser { get; set; }
|
||||||
|
public virtual DbSet<AuditRecordPermission> AuditRecordPermission { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestLength : Entity
|
public class TestLength : Entity
|
||||||
|
|
20275
IRaCIS.Core.Infra.EFCore/Migrations/20250926101203_auditRecord.Designer.cs
generated
Normal file
20275
IRaCIS.Core.Infra.EFCore/Migrations/20250926101203_auditRecord.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,157 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class auditRecord : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AuditRecord",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CompanyName = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
AuditContent = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||||
|
AuditTime = table.Column<DateOnly>(type: "date", nullable: false, comment: "稽查日期"),
|
||||||
|
BeginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
AuditState = table.Column<int>(type: "int", nullable: false, comment: "稽查状态"),
|
||||||
|
AuditType = table.Column<int>(type: "int", nullable: false, comment: "稽查形式"),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AuditRecord", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecord_User_CreateUserId",
|
||||||
|
column: x => x.CreateUserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AuditRecordIdentityUser",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
IdentityUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
AuditRecordId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AuditRecordIdentityUser", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordIdentityUser_AuditRecord_AuditRecordId",
|
||||||
|
column: x => x.AuditRecordId,
|
||||||
|
principalTable: "AuditRecord",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordIdentityUser_IdentityUser_IdentityUserId",
|
||||||
|
column: x => x.IdentityUserId,
|
||||||
|
principalTable: "IdentityUser",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordIdentityUser_User_CreateUserId",
|
||||||
|
column: x => x.CreateUserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "AuditRecordPermission",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
AuditRecordId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
AuditDocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_AuditRecordPermission", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordPermission_AuditDocument_AuditDocumentId",
|
||||||
|
column: x => x.AuditDocumentId,
|
||||||
|
principalTable: "AuditDocument",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordPermission_AuditRecord_AuditRecordId",
|
||||||
|
column: x => x.AuditRecordId,
|
||||||
|
principalTable: "AuditRecord",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AuditRecordPermission_User_CreateUserId",
|
||||||
|
column: x => x.CreateUserId,
|
||||||
|
principalTable: "User",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecord_CreateUserId",
|
||||||
|
table: "AuditRecord",
|
||||||
|
column: "CreateUserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordIdentityUser_AuditRecordId",
|
||||||
|
table: "AuditRecordIdentityUser",
|
||||||
|
column: "AuditRecordId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordIdentityUser_CreateUserId",
|
||||||
|
table: "AuditRecordIdentityUser",
|
||||||
|
column: "CreateUserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordIdentityUser_IdentityUserId",
|
||||||
|
table: "AuditRecordIdentityUser",
|
||||||
|
column: "IdentityUserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordPermission_AuditDocumentId",
|
||||||
|
table: "AuditRecordPermission",
|
||||||
|
column: "AuditDocumentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordPermission_AuditRecordId",
|
||||||
|
table: "AuditRecordPermission",
|
||||||
|
column: "AuditRecordId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AuditRecordPermission_CreateUserId",
|
||||||
|
table: "AuditRecordPermission",
|
||||||
|
column: "CreateUserId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AuditRecordIdentityUser");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AuditRecordPermission");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "AuditRecord");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -155,6 +155,114 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecord", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("AuditContent")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<int>("AuditState")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("稽查状态");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("AuditTime")
|
||||||
|
.HasColumnType("date")
|
||||||
|
.HasComment("稽查日期");
|
||||||
|
|
||||||
|
b.Property<int>("AuditType")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasComment("稽查形式");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("BeginTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("CompanyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("EndTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("UpdateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
|
b.ToTable("AuditRecord");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecordIdentityUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AuditRecordId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("IdentityUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AuditRecordId");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
|
b.HasIndex("IdentityUserId");
|
||||||
|
|
||||||
|
b.ToTable("AuditRecordIdentityUser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecordPermission", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AuditDocumentId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AuditRecordId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<Guid>("CreateUserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AuditDocumentId");
|
||||||
|
|
||||||
|
b.HasIndex("AuditRecordId");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
|
b.ToTable("AuditRecordPermission");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
@ -15264,6 +15372,71 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecord", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecordIdentityUser", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.AuditRecord", "AuditRecord")
|
||||||
|
.WithMany("AuditRecordIdentityUserList")
|
||||||
|
.HasForeignKey("AuditRecordId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("IdentityUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("AuditRecord");
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
|
b.Navigation("IdentityUser");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecordPermission", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.AuditDocument", "AuditDocument")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AuditDocumentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.AuditRecord", "AuditRecord")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AuditRecordId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CreateUserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("AuditDocument");
|
||||||
|
|
||||||
|
b.Navigation("AuditRecord");
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CRO", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||||
|
@ -19629,6 +19802,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Navigation("CreateUserRole");
|
b.Navigation("CreateUserRole");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.AuditRecord", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AuditRecordIdentityUserList");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b =>
|
modelBuilder.Entity("IRaCIS.Core.Domain.Models.ClinicalDataTrialSet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("ReadingClinicalDataList");
|
b.Navigation("ReadingClinicalDataList");
|
||||||
|
|
Loading…
Reference in New Issue