Compare commits
No commits in common. "fd79df810c3e22af1e4f20d3560185b4a1cb2c07" and "f39e013eca9cf8315a90f8a21d7eb56b26da4671" have entirely different histories.
fd79df810c
...
f39e013eca
|
|
@ -93,9 +93,7 @@ namespace IRaCIS.Core.Application.Helper
|
||||||
|
|
||||||
public void DownLoadFromOSS(string ossRelativePath, string localFilePath);
|
public void DownLoadFromOSS(string ossRelativePath, string localFilePath);
|
||||||
|
|
||||||
public AliyunOSSOptions _OSSConfig { get; set; }
|
|
||||||
|
|
||||||
public OssClient _ossClient { get; set; }
|
|
||||||
}
|
}
|
||||||
public class OSSService : IOSSService
|
public class OSSService : IOSSService
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13896,12 +13896,6 @@
|
||||||
<param name="outEnrollTime"></param>
|
<param name="outEnrollTime"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.TestService.OldLocalImageResizeJpg(IRaCIS.Core.Application.Helper.IOSSService,IRaCIS.Core.Infra.EFCore.IRepository,Microsoft.AspNetCore.Hosting.IWebHostEnvironment)">
|
|
||||||
<summary>
|
|
||||||
维护OSS 影像数据
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Application.Services.TestService.ModifyClinicalDataTable">
|
<member name="M:IRaCIS.Application.Services.TestService.ModifyClinicalDataTable">
|
||||||
<summary>
|
<summary>
|
||||||
维护临床数据 --一定要在同步表前同步数据才行
|
维护临床数据 --一定要在同步表前同步数据才行
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
using Aliyun.OSS;
|
using BeetleX;
|
||||||
using BeetleX;
|
|
||||||
using BeetleX.BNR;
|
using BeetleX.BNR;
|
||||||
using Castle.DynamicProxy.Generators.Emitters.SimpleAST;
|
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.Service;
|
using IRaCIS.Core.Application.Service;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
|
@ -17,9 +15,7 @@ using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
using Minio;
|
using Minio;
|
||||||
using NPOI.HPSF;
|
|
||||||
using NPOI.POIFS.Crypt;
|
using NPOI.POIFS.Crypt;
|
||||||
using Spire.Doc;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
@ -33,7 +29,7 @@ namespace IRaCIS.Application.Services
|
||||||
public class TestService : BaseService
|
public class TestService : BaseService
|
||||||
{
|
{
|
||||||
|
|
||||||
public static int IntValue = 100;
|
public static int IntValue = 100;
|
||||||
private readonly IRepository<Dictionary> _dicRepository;
|
private readonly IRepository<Dictionary> _dicRepository;
|
||||||
private readonly IRepository<Trial> _trialRepository;
|
private readonly IRepository<Trial> _trialRepository;
|
||||||
|
|
||||||
|
|
@ -48,7 +44,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
private readonly ILogger<TestService> _logger;
|
private readonly ILogger<TestService> _logger;
|
||||||
|
|
||||||
public TestService(IRepository<Dictionary> dicRepository, IRepository<Trial> trialRepository, ILogger<TestService> logger
|
public TestService(IRepository<Dictionary> dicRepository, IRepository<Trial> trialRepository,ILogger<TestService> logger
|
||||||
|
|
||||||
, IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig, IOptionsMonitor<ServiceVerifyConfigOption> basicConfig, IRepository<VisitTask> visitTaskRepository, IDistributedLockProvider distributedLockProvider)
|
, IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig, IOptionsMonitor<ServiceVerifyConfigOption> basicConfig, IRepository<VisitTask> visitTaskRepository, IDistributedLockProvider distributedLockProvider)
|
||||||
{
|
{
|
||||||
|
|
@ -60,102 +56,12 @@ namespace IRaCIS.Application.Services
|
||||||
_dicRepository = dicRepository;
|
_dicRepository = dicRepository;
|
||||||
_trialRepository = trialRepository;
|
_trialRepository = trialRepository;
|
||||||
|
|
||||||
_distributedLockProvider = distributedLockProvider;
|
_distributedLockProvider= distributedLockProvider;
|
||||||
|
|
||||||
_logger = logger;
|
_logger= logger;
|
||||||
//_cache = cache;
|
//_cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 维护OSS 影像数据
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
[UnitOfWork]
|
|
||||||
public async Task<IResponseOutput> OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
|
|
||||||
{
|
|
||||||
|
|
||||||
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
|
||||||
|
|
||||||
var studyList = _repository.Where<DicomStudy>(t => t.SeriesList.Any(t=>t.ImageResizePath.Length < 10)).Select(t => new { t.TrialId, t.SiteId, t.SubjectId, t.SubjectVisitId, t.Id }).ToList();
|
|
||||||
|
|
||||||
foreach (var studyitem in studyList)
|
|
||||||
{
|
|
||||||
|
|
||||||
var relativePath = $"{studyitem.TrialId}/{studyitem.SiteId}/{studyitem.SubjectId}/{studyitem.SubjectVisitId}/{StaticData.Folder.DicomFolder}/{studyitem.Id}/";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string nextMarker = null;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// 使用 prefix 模拟目录结构,设置 MaxKeys 和 NextMarker
|
|
||||||
var objectListing = oSSService._ossClient.ListObjects(new ListObjectsRequest(oSSService._OSSConfig.bucketName)
|
|
||||||
{
|
|
||||||
Prefix = relativePath,
|
|
||||||
MaxKeys = 1000,
|
|
||||||
Marker = nextMarker
|
|
||||||
});
|
|
||||||
|
|
||||||
var jpgInfoList = objectListing.ObjectSummaries
|
|
||||||
.Where(summary => summary.Key.EndsWith(".jpg"))
|
|
||||||
.Select(summary =>
|
|
||||||
{
|
|
||||||
string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
|
|
||||||
return new
|
|
||||||
{
|
|
||||||
|
|
||||||
Key = summary.Key,
|
|
||||||
InstanceId = Guid.TryParse(
|
|
||||||
fileName.Split('.')[0],
|
|
||||||
out Guid instanceId)
|
|
||||||
? instanceId
|
|
||||||
: Guid.Empty
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.Where(info => info.InstanceId != Guid.Empty)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach ( var jpg in jpgInfoList)
|
|
||||||
{
|
|
||||||
var seriesId= _repository.Where<DicomInstance>(t=>t.Id==jpg.InstanceId).Select(t=>t.SeriesId).FirstOrDefault();
|
|
||||||
|
|
||||||
await _repository.BatchUpdateAsync<DicomSeries>(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath ="/" +jpg.Key });
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置 NextMarker 以获取下一页的数据
|
|
||||||
nextMarker = objectListing.NextMarker;
|
|
||||||
|
|
||||||
} while (!string.IsNullOrEmpty(nextMarker));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error: {ex.Message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IResponseOutput> TestEFcore8()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
await _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdateAsync(t => t
|
|
||||||
.SetProperty(c => EF.Property<DateTime>(c, "UpdateTime"), u => DateTime.Now)
|
|
||||||
.SetProperty(c => c.FirstName, u => "NewUserName"));
|
|
||||||
|
|
||||||
await _repository.BatchUpdateAsync<Subject>(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss" });
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
// 设置 Ne
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IResponseOutput> TestMinIO([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options)
|
public async Task<IResponseOutput> TestMinIO([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options)
|
||||||
{
|
{
|
||||||
|
|
@ -164,32 +70,32 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}")
|
var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}")
|
||||||
.WithCredentials(minIO.accessKey, minIO.secretKey)
|
.WithCredentials(minIO.accessKey,minIO.secretKey)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ResponseOutput.Ok(options)
|
//ResponseOutput.Ok(options)
|
||||||
return await Task.FromResult<IResponseOutput>(ResponseOutput.Ok(options));
|
return await Task.FromResult<IResponseOutput>(ResponseOutput.Ok(options)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IResponseOutput> TestDistributedLock()
|
public async Task<IResponseOutput> TestDistributedLock( )
|
||||||
{
|
{
|
||||||
|
|
||||||
await _repository.Where<User>().Select(t => t.FullName).FirstNotNullAsync();
|
await _repository.Where<User>().Select(t => t.FullName).FirstNotNullAsync();
|
||||||
|
|
||||||
Console.WriteLine($"我进来了当前值是:" + IntValue);
|
Console.WriteLine($"我进来了当前值是:" + IntValue);
|
||||||
_logger.LogWarning($"我进来了当前值是:" + IntValue);
|
_logger.LogWarning($"我进来了当前值是:" + IntValue);
|
||||||
|
|
||||||
var @lock = _distributedLockProvider.CreateLock($"UserAccount");
|
var @lock = _distributedLockProvider.CreateLock($"UserAccount");
|
||||||
|
|
||||||
using (await @lock.AcquireAsync())
|
using (await @lock.AcquireAsync())
|
||||||
{
|
{
|
||||||
await Task.Delay(4);
|
await Task.Delay(4);
|
||||||
IntValue--;
|
IntValue--;
|
||||||
|
|
||||||
_logger.LogWarning(IntValue.ToString());
|
_logger.LogWarning( IntValue.ToString());
|
||||||
Console.WriteLine(IntValue);
|
Console.WriteLine(IntValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue