.net10 -合并编译错误

This commit is contained in:
2026-06-04 13:19:17 +08:00
136 changed files with 251650 additions and 1484 deletions
+9 -8
View File
@@ -8,6 +8,7 @@ using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.SCP.Service;
using MassTransit;
using Medallion.Threading;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
using Microsoft.Extensions.DependencyInjection;
@@ -95,7 +96,7 @@ namespace IRaCIS.Core.SCP.Service
public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
{
_upload = new SCPImageUpload() { StartTime = DateTime.Now, CallingAE = association.CallingAE, CalledAE = association.CalledAE, CallingAEIP = association.RemoteHost };
_upload = new SCPImageUpload() { Id = NewId.NextSequentialGuid(), StartTime = DateTime.Now, CallingAE = association.CallingAE, CalledAE = association.CalledAE, CallingAEIP = association.RemoteHost };
Log.Logger.Warning($"接收到来自{association.CallingAE}的连接");
@@ -540,12 +541,12 @@ namespace IRaCIS.Core.SCP.Service
//保留原始偏移表
if (originOffsetTable.Count == pixelData.NumberOfFrames)
{
newFragments.OffsetTable.AddRange(originOffsetTable.ToArray());
//if (originOffsetTable.Count == pixelData.NumberOfFrames)
//{
// newFragments.OffsetTable.AddRange(originOffsetTable.ToArray());
}
else
//}
//else
{
newFragments.OffsetTable.AddRange(bot.ToArray());
@@ -644,7 +645,7 @@ namespace IRaCIS.Core.SCP.Service
ms.Position = 0;
//irc 从路径最后一截取Guid
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive, UploadBatchId = _upload.Id.ToString() });
fileSize = ms.Length;
@@ -674,7 +675,7 @@ namespace IRaCIS.Core.SCP.Service
// 上传缩略图到 OSS
var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false,uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
series.ImageResizePath = seriesPath;
@@ -63,6 +63,8 @@ public class FileUploadRecordAddOrEdit
public bool? IsNeedSync { get; set; }
public string UploadRegion { get; set; }
public string TargetRegion { get; set; }
public bool? IsSync { get; set; }
}
public interface IFileUploadRecordService
{
@@ -113,6 +115,19 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
}
}
//SCP推送过来IP为空,后端归档的,设置区域
if (_userInfo.IP.IsNullOrEmpty() && _userInfo.Domain.IsNullOrEmpty())
{
var apiDefalut = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.UploadRegion == ObjectStoreServiceConfig.ApiDeployRegion);
if (apiDefalut != null)
{
addOrEditFileUploadRecord.UploadRegion = apiDefalut.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = apiDefalut.TargetRegion;
}
}
if (addOrEditFileUploadRecord.TrialId != null)
{
@@ -129,9 +144,9 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
{
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority ?? 0;
addOrEditFileUploadRecord.IsSync = false;
}
else
{
@@ -147,7 +162,9 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
//系统文件,默认同步
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
addOrEditFileUploadRecord.IsSync = false;
addOrEditFileUploadRecord.Priority = addOrEditFileUploadRecord.Priority ?? 0;
}
var entity = await _fileUploadRecordRepository.InsertOrUpdateAsync(addOrEditFileUploadRecord, true);
+101 -38
View File
@@ -194,7 +194,7 @@ public interface IOSSService
List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null);
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null);
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
@@ -825,10 +825,12 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
var fileType = Path.GetExtension(returnPath).TrimStart('.');
uploadInfo.FileSize = fileStream.CanSeek ? fileStream.Length : 0;
uploadInfo.Path = returnPath;
uploadInfo.FileName = fileRealName;
uploadInfo.FileType = Path.GetExtension(returnPath);
uploadInfo.FileType = fileType.IsNullOrEmpty()?"dcm": fileType;
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
@@ -964,10 +966,14 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
var fileType = Path.GetExtension(returnPath).TrimStart('.');
uploadInfo.FileSize = fileSize;
uploadInfo.Path = returnPath;
uploadInfo.FileName = Path.GetFileName(localFilePath);
uploadInfo.FileType = Path.GetExtension(returnPath);
uploadInfo.FileType = fileType.IsNullOrEmpty() ? "dcm" : fileType;
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
@@ -1856,23 +1862,39 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null)
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null)
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
string objectStoreUse = string.Empty;
//使用指定配置
if (objectUse != null)
{
var userDomain = domain?.Trim();
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
if (find != null)
objectStoreUse = objectUse?.Trim() ?? string.Empty;
}
//根据域名动态判断
else
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty() && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.Domain == domain))
{
ObjectStoreServiceOptions.ObjectStoreUse = find.Primary;
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == domain);
if (find != null)
{
objectStoreUse = find.Primary;
}
}
else
{
//兜底,如果是本地测试环境,那就使用部署默认配置
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
}
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (objectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
@@ -1920,11 +1942,11 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AliyunOSS = tempToken;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
if (objectStoreUse == "MinIO")
{
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS" || isGetAllTempToken == true)
if (objectStoreUse == "AWS" || isGetAllTempToken == true)
{
var awsOptions = ObjectStoreServiceOptions.AWS;
@@ -1969,7 +1991,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
objectStoreDTO.AWS = tempToken;
}
else
if (objectStoreUse.IsNullOrEmpty())
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
@@ -1980,7 +2003,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public async Task SyncFileAsync(string objectKey, ObjectStoreUse source, ObjectStoreUse destination, CancellationToken ct = default)
{
GetObjectStoreTempToken(isGetAllTempToken: true);
var tempConfig = GetObjectStoreTempToken(isGetAllTempToken: true);
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
@@ -1999,36 +2022,76 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
// ⭐ 关键变量
IDisposable? owner = null;
Stream sourceStream;
long contentLength;
// 根据源选择流式下载
Stream sourceStream = source switch
// ========= 获取流 + 长度 =========
switch (source)
{
ObjectStoreUse.AliyunOSS => _ossClient.GetObject(aliConfig.BucketName, objectKey).Content,
ObjectStoreUse.AWS => (await amazonS3Client.GetObjectAsync(awsConfig.BucketName, objectKey, ct)).ResponseStream,
_ => throw new BusinessValidationFailedException("未定义的同步类型")
};
case ObjectStoreUse.AliyunOSS:
{
if (source == ObjectStoreUse.AliyunOSS)
var obj = _ossClient.GetObject(
aliConfig.BucketName,
objectKey);
owner = obj;
sourceStream = obj.Content;
contentLength = obj.ContentLength;
break;
}
case ObjectStoreUse.AWS:
{
var response = await amazonS3Client.GetObjectAsync(
awsConfig.BucketName,
objectKey,
ct);
owner = response;
sourceStream = response.ResponseStream;
contentLength = response.Headers.ContentLength;
break;
}
default:
throw new BusinessValidationFailedException("未定义的同步类型");
}
try
{
var putRequest = new Amazon.S3.Model.PutObjectRequest
// ========= 上传 =========
if (destination == ObjectStoreUse.AWS)
{
BucketName = awsConfig.BucketName,
Key = objectKey,
InputStream = sourceStream
};
var putRequest = new Amazon.S3.Model.PutObjectRequest
{
BucketName = awsConfig.BucketName,
Key = objectKey,
InputStream = sourceStream,
Headers = { ContentLength = contentLength }
};
await amazonS3Client.PutObjectAsync(putRequest, ct);
await amazonS3Client.PutObjectAsync(putRequest, ct);
}
else if (destination == ObjectStoreUse.AliyunOSS)
{
_ossClient.PutObject(
aliConfig.BucketName,
objectKey,
sourceStream);
}
else
{
throw new BusinessValidationFailedException("未定义的同步类型");
}
}
else if (source == ObjectStoreUse.AWS)
finally
{
_ossClient.PutObject(aliConfig.BucketName, objectKey, sourceStream);
// ⭐⭐⭐ 真正释放 HTTP 连接
owner?.Dispose();
}
else
{
throw new BusinessValidationFailedException("未定义的同步类型");
}
await sourceStream.DisposeAsync(); // 释放流
}
}
+16
View File
@@ -0,0 +1,16 @@
using AutoMapper;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.SCP.Service;
namespace IRaCIS.Core.Application.Service
{
public class CommonConfig : Profile
{
public CommonConfig()
{
CreateMap<FileUploadRecordAddOrEdit, FileUploadRecord>().ReverseMap();
}
}
}
@@ -8,6 +8,26 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "eiirc.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@@ -19,6 +39,18 @@
"ViewEndpoint": "https://zy-irc-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/lili_s3_access",
"AccessKeyId": "AKIAW3MEAFJXZ2TZK7GM",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-irc-store",
"ViewEndpoint": "https://ei-med-s3-irc-store.s3.amazonaws.com",
"DurationSeconds": 7200
}
},
@@ -7,7 +7,28 @@
}
},
"ObjectStoreService": {
// 使用的对象存储服务类型
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.test.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.test.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@@ -29,6 +50,27 @@
"secretKey": "TzgvyA3zGXMUnpilJNUlyMYHfosl1hBMl6lxPmjy",
"bucketName": "hir-test",
"viewEndpoint": "http://106.14.89.110:9001/hir-test/"
},
// AWS S3 对象存储服务的配置
"AWS": {
// AWS S3 的Region
"Region": "us-east-1",
// AWS S3 的内部访问端点
"EndPoint": "s3.us-east-1.amazonaws.com",
// 是否使用 SSL
"UseSSL": true,
// AWS S3 的角色 ARN
"RoleArn": "arn:aws:iam::471112624751:role/uat_s3_access",
// AWS S3 的访问密钥 ID
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
// AWS S3 的访问密钥 Secret
"SecretAccessKey": "Pgrg3le5jPxZQ7MR1yYNS30J0XRyJeKVyIIjElXc",
// AWS S3 的Bucket名称
"BucketName": "ei-med-s3-lili-uat-store",
// AWS S3 的访问端点
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com",
// AWS S3 的持续数秒
"DurationSeconds": 7200
}
},
+32
View File
@@ -8,6 +8,38 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AWS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "US",
"SyncConfigList": [
{
"Domain": "eilili.elevateimaging.ai",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.elevateimaging.ai",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tNRTsqL6aWmHkDmTwoH",
"AccessKeySecret": "7mtGz3qrYWI6JMMBZiLeC119VWicZH",
"RoleArn": "acs:ram::1899121822495495:role/irc-oss-access",
"BucketName": "zy-lili-store",
"ViewEndpoint": "https://zy-lili-cache.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
+46 -5
View File
@@ -8,17 +8,58 @@
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.uat.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.uat.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tFUCCmz5TwghZHsj45Y",
"AccessKeySecret": "8evrBy1fVfzJG25i67Jm0xqn9Xcw2T",
"RoleArn": "acs:ram::1078130221702011:role/uat-oss-access",
"BucketName": "tl-med-irc-uat-store",
"ViewEndpoint": "https://tl-med-irc-uat-store.oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tRRZehUp2V9pyTPtAJm",
"AccessKeySecret": "FLizxkHsMm4CGYHtkV8E3PNJJZU7oV",
"RoleArn": "acs:ram::1899121822495495:role/dev-oss-access",
"BucketName": "zy-irc-test-store",
"ViewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
// AWS S3 对象存储服务的配置
"AWS": {
// AWS S3 的Region
"Region": "us-east-1",
// AWS S3 的内部访问端点
"EndPoint": "s3.us-east-1.amazonaws.com",
// 是否使用 SSL
"UseSSL": true,
// AWS S3 的角色 ARN
"RoleArn": "arn:aws:iam::471112624751:role/uat_s3_access",
// AWS S3 的访问密钥 ID
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
// AWS S3 的访问密钥 Secret
"SecretAccessKey": "Pgrg3le5jPxZQ7MR1yYNS30J0XRyJeKVyIIjElXc",
// AWS S3 的Bucket名称
"BucketName": "ei-med-s3-lili-uat-store",
// AWS S3 的访问端点
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com",
// AWS S3 的持续数秒
"DurationSeconds": 7200
}
},
"ConnectionStrings": {