|
|
@@ -24,6 +24,8 @@ namespace IRaCIS.Core.Application.Service;
|
|
|
|
/// <param name="_localizer"></param>
|
|
|
|
/// <param name="_localizer"></param>
|
|
|
|
[ApiExplorerSettings(GroupName = "FileRecord")]
|
|
|
|
[ApiExplorerSettings(GroupName = "FileRecord")]
|
|
|
|
public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepository,
|
|
|
|
public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepository,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IRepository<TrialFile> _trialFileRepository,
|
|
|
|
IRepository<SysFileType> _sysFileTypeRepository,
|
|
|
|
IRepository<SysFileType> _sysFileTypeRepository,
|
|
|
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialFileTypeService
|
|
|
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialFileTypeService
|
|
|
|
{
|
|
|
|
{
|
|
|
@@ -83,7 +85,7 @@ public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (await _trialFileTypeRepository.AnyAsync(u =>u.TrialId==addOrEditTrialFileType.TrialId&& u.Id != addOrEditTrialFileType.Id && u.IsEnable == addOrEditTrialFileType.IsEnable && (u.Name == addOrEditTrialFileType.Name || u.NameCN == addOrEditTrialFileType.NameCN)))
|
|
|
|
if (await _trialFileTypeRepository.AnyAsync(u => u.TrialId == addOrEditTrialFileType.TrialId && u.Id != addOrEditTrialFileType.Id && u.IsEnable == addOrEditTrialFileType.IsEnable && (u.Name == addOrEditTrialFileType.Name || u.NameCN == addOrEditTrialFileType.NameCN)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new BusinessValidationFailedException(_localizer["TrialFileType_NameRepeat"]);
|
|
|
|
throw new BusinessValidationFailedException(_localizer["TrialFileType_NameRepeat"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -139,9 +141,9 @@ public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepos
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TrialId = inDto.TrialId
|
|
|
|
TrialId = inDto.TrialId
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var trialFileTypeList = await _trialFileTypeRepository.Where(x=>x.TrialId==inDto.TrialId)
|
|
|
|
var trialFileTypeList = await _trialFileTypeRepository.Where(x => x.TrialId == inDto.TrialId)
|
|
|
|
.WhereIf(inDto.IsEnable, x => x.IsEnable)
|
|
|
|
.WhereIf(inDto.IsEnable, x => x.IsEnable)
|
|
|
|
.OrderBy(x=>x.ShowOrder)
|
|
|
|
.OrderBy(x => x.ShowOrder)
|
|
|
|
.ProjectTo<TrialFileTypeView>(_mapper.ConfigurationProvider)
|
|
|
|
.ProjectTo<TrialFileTypeView>(_mapper.ConfigurationProvider)
|
|
|
|
.ToListAsync();
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
@@ -151,7 +153,7 @@ public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepos
|
|
|
|
result.Add(new TrialFileTypeData()
|
|
|
|
result.Add(new TrialFileTypeData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ArchiveTypeEnum = type,
|
|
|
|
ArchiveTypeEnum = type,
|
|
|
|
TrialFileTypeList = trialFileTypeList.Where(x => x.ArchiveTypeEnum == type).OrderByDescending(x=>x.SysFileTypeId==null).ThenBy(x=>x.ShowOrder).ToList()
|
|
|
|
TrialFileTypeList = trialFileTypeList.Where(x => x.ArchiveTypeEnum == type).OrderByDescending(x => x.SysFileTypeId == null).ThenBy(x => x.ShowOrder).ToList()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -172,6 +174,48 @@ public class TrialFileTypeService(IRepository<TrialFileType> _trialFileTypeRepos
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|