入项记录上传与修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
08f1998e61
commit
b9bc1f6da0
|
@ -32,6 +32,23 @@ public class TrialFileTypeData
|
|||
public List<TrialFileTypeView> TrialFileTypeList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class GetTrialFileTypeFileInDto
|
||||
{
|
||||
public Guid TrialFileTypeId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class UploadTrialFileTypeFileInDto
|
||||
{
|
||||
public Guid TrialFileTypeId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 文件
|
||||
/// </summary>
|
||||
public TrialFileDto? FileRecord { get; set; }
|
||||
}
|
||||
public class SetAuthorizedViewInDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace IRaCIS.Core.Application.Service;
|
|||
/// <param name="_localizer"></param>
|
||||
[ApiExplorerSettings(GroupName = "FileRecord")]
|
||||
public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepository,
|
||||
|
||||
IRepository<TrialFile> _trialFileRepository,
|
||||
IRepository<SysFileType> _sysFileTypeRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialFileTypeService
|
||||
{
|
||||
|
@ -172,6 +174,48 @@ public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepos
|
|||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传同意入项记录
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> UploadTrialFileTypeFile(UploadTrialFileTypeFileInDto inDto)
|
||||
{
|
||||
var trialFileType = await _trialFileTypeRepository.Where(x => x.Id == inDto.TrialFileTypeId).FirstNotNullAsync();
|
||||
|
||||
if (trialFileType.FileRecordId != null)
|
||||
{
|
||||
await _trialFileRepository.BatchDeleteNoTrackingAsync(x => x.Id == trialFileType.FileRecordId);
|
||||
}
|
||||
|
||||
inDto.FileRecord.TrialFileTypeId = inDto.TrialFileTypeId;
|
||||
var entity = await _trialFileRepository.InsertFromDTOAsync(inDto.FileRecord, true);
|
||||
await _trialFileTypeRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.TrialFileTypeId, x => new TrialFileType()
|
||||
{
|
||||
|
||||
FileRecordId = entity.Id
|
||||
});
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取入项记录
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<TrialFileDto> GetTrialFileTypeFile(GetTrialFileTypeFileInDto inDto)
|
||||
{
|
||||
var trialFileType = await _trialFileTypeRepository.Where(x => x.Id == inDto.TrialFileTypeId).FirstNotNullAsync();
|
||||
if (trialFileType.FileRecordId == null)
|
||||
{
|
||||
return new TrialFileDto() { } ;
|
||||
}
|
||||
var file = await _trialFileRepository.Where(x => x.Id == trialFileType.FileRecordId).ProjectTo<TrialFileDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ public class TrialFileType : BaseFullAuditEntity
|
|||
public int ShowOrder { get; set; }
|
||||
|
||||
|
||||
|
||||
[Comment("文件Id")]
|
||||
public Guid? FileRecordId { get; set; }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue