Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
6c1c46601c
|
|
@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -20,40 +21,50 @@ public class SyncFileRecoveryService(IServiceScopeFactory _scopeFactory, FileSyn
|
||||||
|
|
||||||
private readonly int _pageSize = 500;
|
private readonly int _pageSize = 500;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多个程序,如果恢复同一份数据,造成重复同步,SCP服务不恢复任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stoppingToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
using var scope = _scopeFactory.CreateScope();
|
|
||||||
var fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
|
|
||||||
|
|
||||||
// 延迟启动,保证主机快速启动
|
await Task.CompletedTask;
|
||||||
await Task.Delay(5000, stoppingToken);
|
|
||||||
|
|
||||||
int page = 0;
|
//using var scope = _scopeFactory.CreateScope();
|
||||||
|
//var fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
|
||||||
|
|
||||||
|
//// 延迟启动,保证主机快速启动
|
||||||
|
//await Task.Delay(5000, stoppingToken);
|
||||||
|
|
||||||
|
//int page = 0;
|
||||||
|
|
||||||
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
//while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
//{
|
||||||
// 分页获取未入队任务
|
// // 分页获取未入队任务
|
||||||
var pending = await fileUploadRecordRepository
|
// var pending = await fileUploadRecordRepository
|
||||||
.Where(x => x.IsNeedSync == true && (x.IsSync == false || x.IsSync == null))
|
// .Where(x => x.IsNeedSync == true && (x.IsSync == false || x.IsSync == null))
|
||||||
.OrderByDescending(x => x.Priority)
|
// .OrderByDescending(x => x.Priority)
|
||||||
.Select(t => new { t.Id, t.Priority })
|
// .Select(t => new { t.Id, t.Priority })
|
||||||
.Skip(page * _pageSize)
|
// .Skip(page * _pageSize)
|
||||||
.Take(_pageSize)
|
// .Take(_pageSize)
|
||||||
.ToListAsync(stoppingToken);
|
// .ToListAsync(stoppingToken);
|
||||||
|
|
||||||
if (!pending.Any())
|
// if (!pending.Any())
|
||||||
break; // 扫描完毕,退出循环
|
// break; // 扫描完毕,退出循环
|
||||||
|
|
||||||
|
// foreach (var file in pending)
|
||||||
|
// {
|
||||||
|
// //file.IsQueued = true; // 避免重复入队
|
||||||
|
// _fileSyncQueue.Enqueue(file.Id, file.Priority ?? 0); // 放入队列
|
||||||
|
// }
|
||||||
|
|
||||||
|
// page++; // 下一页
|
||||||
|
// await Task.Delay(200, stoppingToken); // 缓解数据库压力
|
||||||
|
//}
|
||||||
|
|
||||||
foreach (var file in pending)
|
|
||||||
{
|
|
||||||
//file.IsQueued = true; // 避免重复入队
|
|
||||||
_fileSyncQueue.Enqueue(file.Id, file.Priority ?? 0); // 放入队列
|
|
||||||
}
|
|
||||||
|
|
||||||
page++; // 下一页
|
|
||||||
await Task.Delay(200, stoppingToken); // 缓解数据库压力
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,12 +96,29 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
using var scope = _scopeFactory.CreateScope();
|
using var scope = _scopeFactory.CreateScope();
|
||||||
var _fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
|
var _fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
|
||||||
var _uploadFileSyncRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<UploadFileSyncRecord>>();
|
var _uploadFileSyncRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<UploadFileSyncRecord>>();
|
||||||
|
|
||||||
|
var syncConfig = (scope.ServiceProvider.GetRequiredService<IOptionsMonitor<ObjectStoreServiceOptions>>()).CurrentValue;
|
||||||
|
|
||||||
var oss = scope.ServiceProvider.GetRequiredService<IOSSService>();
|
var oss = scope.ServiceProvider.GetRequiredService<IOSSService>();
|
||||||
|
|
||||||
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
|
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
|
||||||
|
|
||||||
if (file == null || file.IsNeedSync != true)
|
// ✅ 不要 return
|
||||||
|
if (file == null || file.IsNeedSync != true || syncConfig.IsOpenStoreSync == false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果发现系统配置某一边同步进行了关闭,那么就直接返回,不执行任务
|
||||||
|
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var log = new UploadFileSyncRecord
|
var log = new UploadFileSyncRecord
|
||||||
{
|
{
|
||||||
|
|
@ -107,7 +135,7 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
|
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
|
||||||
|
|
||||||
file.IsSync = true;
|
file.IsSync = true;
|
||||||
file.SyncFinishedTime = DateTime.UtcNow;
|
file.SyncFinishedTime = DateTime.Now;
|
||||||
|
|
||||||
log.JobState = jobState.SUCCESS;
|
log.JobState = jobState.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +146,7 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
log.Msg = ex.Message[..300];
|
log.Msg = ex.Message[..300];
|
||||||
}
|
}
|
||||||
|
|
||||||
log.EndTime = DateTime.UtcNow;
|
log.EndTime = DateTime.Now;
|
||||||
|
|
||||||
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
|
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
@ -126,6 +154,11 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Sync failed {Id}", id);
|
_logger.LogError(ex, "Sync failed {Id}", id);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// ⭐⭐⭐ 永远执行
|
||||||
|
_fileSyncQueue.Complete(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public class FileUploadRecordAddOrEdit
|
||||||
public string UploadBatchId { get; set; }
|
public string UploadBatchId { get; set; }
|
||||||
public BatchDataType BatchDataType { get; set; }
|
public BatchDataType BatchDataType { get; set; }
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
public Guid? TrialId { get; set; }
|
public Guid? TrialId { get; set; }
|
||||||
|
|
||||||
|
|
@ -98,6 +99,18 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
addOrEditFileUploadRecord.TargetRegion = find.TargetRegion;
|
addOrEditFileUploadRecord.TargetRegion = find.TargetRegion;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//前后端调试的时候,上传的时候域名不对应,自动按照后端配置设置上传区域和同步区域
|
||||||
|
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)
|
if (addOrEditFileUploadRecord.TrialId != null)
|
||||||
|
|
@ -122,7 +135,9 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addOrEditFileUploadRecord.TargetRegion = "";
|
addOrEditFileUploadRecord.IsNeedSync = false;
|
||||||
|
|
||||||
|
//addOrEditFileUploadRecord.TargetRegion = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,40 +169,149 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
public sealed class FileSyncQueue
|
||||||
/// 同步队列 信号量
|
|
||||||
/// </summary>
|
|
||||||
public class FileSyncQueue
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级队列(仅负责排序)
|
||||||
|
/// </summary>
|
||||||
private readonly PriorityQueue<Guid, int> _queue = new();
|
private readonly PriorityQueue<Guid, int> _queue = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前等待中的任务(唯一真实数据)
|
||||||
|
/// key = Guid
|
||||||
|
/// value = 最新 priority
|
||||||
|
/// </summary>
|
||||||
|
private readonly Dictionary<Guid, int> _waiting = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 正在执行的任务(防止重复执行)
|
||||||
|
/// </summary>
|
||||||
|
private readonly HashSet<Guid> _running = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// worker 等待信号
|
||||||
|
/// </summary>
|
||||||
private readonly SemaphoreSlim _signal = new(0);
|
private readonly SemaphoreSlim _signal = new(0);
|
||||||
|
|
||||||
|
|
||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Enqueue
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入队(同 Guid 会覆盖优先级)
|
||||||
|
/// </summary>
|
||||||
public void Enqueue(Guid id, int priority)
|
public void Enqueue(Guid id, int priority)
|
||||||
{
|
{
|
||||||
|
bool needSignal = false;
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
// priority 越大越优先
|
// 如果正在执行,忽略(防止重复)
|
||||||
|
if (_running.Contains(id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 是否新任务(用于减少 signal 风暴)
|
||||||
|
if (!_waiting.ContainsKey(id))
|
||||||
|
needSignal = true;
|
||||||
|
|
||||||
|
// 更新为最新优先级(最后一次为准)
|
||||||
|
_waiting[id] = priority; //等价于添加或者更新
|
||||||
|
|
||||||
|
// PriorityQueue 无法更新节点
|
||||||
|
// 允许旧节点存在,Dequeue 时过滤
|
||||||
_queue.Enqueue(id, -priority);
|
_queue.Enqueue(id, -priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
//类似于计数器,不会产生通知风暴,可消费资源 +1
|
// 只有新增任务才唤醒 worker
|
||||||
//if (有等待线程) 唤醒一个 else 仅增加计数
|
if (needSignal)
|
||||||
_signal.Release(); // 唤醒一个 worker
|
_signal.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Dequeue
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
|
/// 获取一个待执行任务(无任务时自动等待)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ct"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<Guid> DequeueAsync(CancellationToken ct)
|
public async Task<Guid> DequeueAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
await _signal.WaitAsync(ct);
|
await _signal.WaitAsync(ct);
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
return _queue.Dequeue();
|
while (_queue.Count > 0)
|
||||||
|
{
|
||||||
|
var id = _queue.Dequeue();
|
||||||
|
|
||||||
|
// 已被覆盖或取消
|
||||||
|
if (!_waiting.TryGetValue(id, out _))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 标记为运行中
|
||||||
|
_waiting.Remove(id);
|
||||||
|
_running.Add(id);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Complete
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务执行完成(必须调用)
|
||||||
|
/// </summary>
|
||||||
|
public void Complete(Guid id)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_running.Remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Snapshot
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前等待中的任务快照
|
||||||
|
/// </summary>
|
||||||
|
public Guid[] Snapshot()
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
return _waiting.Keys.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 状态信息(调试用)
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
public int WaitingCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
return _waiting.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RunningCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
return _running.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,6 +20,11 @@ public class SyncFileRecoveryService(IServiceScopeFactory _scopeFactory, FileSyn
|
||||||
|
|
||||||
private readonly int _pageSize = 500;
|
private readonly int _pageSize = 500;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多个程序,如果恢复同一份数据,造成重复同步,SCP服务不恢复任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stoppingToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
using var scope = _scopeFactory.CreateScope();
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
|
@ -73,7 +78,6 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task WorkerLoop(CancellationToken stoppingToken)
|
private async Task WorkerLoop(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
|
@ -92,8 +96,16 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
|
|
||||||
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
|
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
|
||||||
|
|
||||||
|
// ✅ 不要 return
|
||||||
if (file == null || file.IsNeedSync != true || syncConfig.IsOpenStoreSync == false)
|
if (file == null || file.IsNeedSync != true || syncConfig.IsOpenStoreSync == false)
|
||||||
return;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//如果发现系统配置某一边同步进行了关闭,那么就直接返回,不执行任务
|
//如果发现系统配置某一边同步进行了关闭,那么就直接返回,不执行任务
|
||||||
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
|
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
|
||||||
|
|
@ -116,7 +128,7 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
|
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
|
||||||
|
|
||||||
file.IsSync = true;
|
file.IsSync = true;
|
||||||
file.SyncFinishedTime = DateTime.UtcNow;
|
file.SyncFinishedTime = DateTime.Now;
|
||||||
|
|
||||||
log.JobState = jobState.SUCCESS;
|
log.JobState = jobState.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +139,7 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
log.Msg = ex.Message[..300];
|
log.Msg = ex.Message[..300];
|
||||||
}
|
}
|
||||||
|
|
||||||
log.EndTime = DateTime.UtcNow;
|
log.EndTime = DateTime.Now;
|
||||||
|
|
||||||
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
|
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +147,11 @@ public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSync
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Sync failed {Id}", id);
|
_logger.LogError(ex, "Sync failed {Id}", id);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// ⭐⭐⭐ 永远执行
|
||||||
|
_fileSyncQueue.Complete(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Amazon.S3;
|
||||||
using Amazon.S3.Model;
|
using Amazon.S3.Model;
|
||||||
using Amazon.SecurityToken;
|
using Amazon.SecurityToken;
|
||||||
using Amazon.SecurityToken.Model;
|
using Amazon.SecurityToken.Model;
|
||||||
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Interfaces;
|
using IRaCIS.Core.Application.Interfaces;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
|
@ -1506,22 +1507,22 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
|
|
||||||
GetObjectStoreTempToken(objectUse: config.Primary);
|
GetObjectStoreTempToken(objectUse: config.Primary);
|
||||||
|
|
||||||
await DeleteFromPrefixInternal(prefix, isCache);
|
await DeleteFromPrefixInternal(config.Primary,prefix, isCache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetObjectStoreTempToken();
|
GetObjectStoreTempToken();
|
||||||
|
|
||||||
await DeleteFromPrefixInternal(prefix, isCache);
|
await DeleteFromPrefixInternal(ObjectStoreServiceOptions.ObjectStoreUse,prefix, isCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task DeleteFromPrefixInternal(string prefix, bool isCache = false)
|
private async Task DeleteFromPrefixInternal(string objectUse ,string prefix, bool isCache = false)
|
||||||
{
|
{
|
||||||
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
|
if (objectUse == "AliyunOSS")
|
||||||
{
|
{
|
||||||
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
|
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
|
||||||
|
|
||||||
|
|
@ -1577,7 +1578,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
else if (objectUse == "MinIO")
|
||||||
{
|
{
|
||||||
var minIOConfig = ObjectStoreServiceOptions.MinIO;
|
var minIOConfig = ObjectStoreServiceOptions.MinIO;
|
||||||
|
|
||||||
|
|
@ -1614,7 +1615,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
|
else if (objectUse == "AWS")
|
||||||
{
|
{
|
||||||
|
|
||||||
var awsConfig = ObjectStoreServiceOptions.AWS;
|
var awsConfig = ObjectStoreServiceOptions.AWS;
|
||||||
|
|
|
||||||
|
|
@ -1556,31 +1556,75 @@
|
||||||
<param name="_attachmentrepository"></param>
|
<param name="_attachmentrepository"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetSubjectUploadRecordList(IRaCIS.Core.Application.ViewModel.SubjectFileUploadRecordQuery)">
|
||||||
|
<summary>
|
||||||
|
按照 subject visit studyCode 三个维度进行分组的查询列表 (subject相关)
|
||||||
|
</summary>
|
||||||
|
<param name="inQuery"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetFileUploadRecordList(IRaCIS.Core.Application.ViewModel.FileUploadRecordQuery)">
|
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetFileUploadRecordList(IRaCIS.Core.Application.ViewModel.FileUploadRecordQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
上传记录表--里面包含待同步任务
|
上传记录表--里面包含待同步任务 DataFileType= 0 :代表系统文件 1:Subject相关 2:项目相关,但是和subject 没关系
|
||||||
</summary>
|
</summary>
|
||||||
<param name="inQuery"></param>
|
<param name="inQuery"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetUploadFileSyncRecordList(IRaCIS.Core.Application.ViewModel.UploadFileSyncRecordQuery)">
|
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetUploadFileSyncRecordList(IRaCIS.Core.Application.ViewModel.UploadFileSyncRecordQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
任务具体执行记录表 (需要同步的才可以点击)
|
任务具体执行记录表
|
||||||
</summary>
|
</summary>
|
||||||
<param name="inQuery"></param>
|
<param name="inQuery"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.Service.FileSyncQueue">
|
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.BatchAddSyncFileTask(IRaCIS.Core.Application.ViewModel.BatchAddSyncFileCommand)">
|
||||||
<summary>
|
<summary>
|
||||||
同步队列 信号量
|
批量设置为需要同步,并且设置优先级
|
||||||
|
</summary>
|
||||||
|
<param name="inComand"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._queue">
|
||||||
|
<summary>
|
||||||
|
优先级队列(仅负责排序)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._waiting">
|
||||||
|
<summary>
|
||||||
|
当前等待中的任务(唯一真实数据)
|
||||||
|
key = Guid
|
||||||
|
value = 最新 priority
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._running">
|
||||||
|
<summary>
|
||||||
|
正在执行的任务(防止重复执行)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._signal">
|
||||||
|
<summary>
|
||||||
|
worker 等待信号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Enqueue(System.Guid,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
入队(同 Guid 会覆盖优先级)
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.DequeueAsync(System.Threading.CancellationToken)">
|
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.DequeueAsync(System.Threading.CancellationToken)">
|
||||||
<summary>
|
<summary>
|
||||||
如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
|
获取一个待执行任务(无任务时自动等待)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Complete(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
任务执行完成(必须调用)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Snapshot">
|
||||||
|
<summary>
|
||||||
|
当前等待中的任务快照
|
||||||
</summary>
|
</summary>
|
||||||
<param name="ct"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.SyncQueueUseChannel.Enqueue(System.Guid,System.Int32)">
|
<member name="M:IRaCIS.Core.Application.Service.SyncQueueUseChannel.Enqueue(System.Guid,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
|
|
@ -17086,17 +17130,17 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
质疑
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
||||||
<summary>
|
<summary>
|
||||||
һ<EFBFBD><EFBFBD><EFBFBD>Ժ˲<EFBFBD>
|
一致性核查
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
复制
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,31 @@ 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 SubjectFileUploadRecordView
|
||||||
|
{
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
|
public Guid? SubjectId { get; set; }
|
||||||
|
|
||||||
|
public Guid? SubjectVisitId { get; set; }
|
||||||
|
|
||||||
|
public int FileCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string? UploadRegion { get; set; }
|
||||||
|
public string? TargetRegion { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public DateTime? SyncFinishedTime { get; set; }
|
||||||
|
|
||||||
|
public bool IsSync { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class FileUploadRecordView : FileUploadRecordAddOrEdit
|
public class FileUploadRecordView : FileUploadRecordAddOrEdit
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -16,12 +41,16 @@ public class FileUploadRecordView : FileUploadRecordAddOrEdit
|
||||||
|
|
||||||
public DateTime UpdateTime { get; set; }
|
public DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
public bool? IsSync { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
[Comment("同步结束时间-最后一个任务的时间")]
|
[Comment("同步结束时间-最后一个任务的时间")]
|
||||||
public DateTime? SyncFinishedTime { get; set; }
|
public DateTime? SyncFinishedTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -42,6 +71,7 @@ public class FileUploadRecordAddOrEdit
|
||||||
public string UploadBatchId { get; set; }
|
public string UploadBatchId { get; set; }
|
||||||
public BatchDataType BatchDataType { get; set; }
|
public BatchDataType BatchDataType { get; set; }
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
public Guid? TrialId { get; set; }
|
public Guid? TrialId { get; set; }
|
||||||
|
|
||||||
|
|
@ -62,15 +92,49 @@ public class FileUploadRecordAddOrEdit
|
||||||
public bool? IsNeedSync { get; set; }
|
public bool? IsNeedSync { get; set; }
|
||||||
public string UploadRegion { get; set; }
|
public string UploadRegion { get; set; }
|
||||||
public string TargetRegion { get; set; }
|
public string TargetRegion { get; set; }
|
||||||
|
|
||||||
|
public bool? IsSync { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class SubjectFileUploadRecordQuery : PageInput
|
||||||
|
{
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
|
public string? StudyCode { get; set; }
|
||||||
|
|
||||||
|
public string? UploadRegion { get; set; }
|
||||||
|
public string? TargetRegion { get; set; }
|
||||||
|
|
||||||
|
public bool? IsSync { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileUploadRecordQuery : PageInput
|
public class FileUploadRecordQuery : PageInput
|
||||||
{
|
{
|
||||||
|
|
||||||
public BatchDataType? BatchDataType { get; set; }
|
public BatchDataType? BatchDataType { get; set; }
|
||||||
|
|
||||||
public Guid? TrialId { get; set; }
|
public Guid? TrialId { get; set; }
|
||||||
|
|
||||||
public bool? IsSystermFile { get; set; }
|
public int? DataFileType { get; set; }
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid? SubjectId { get; set; }
|
||||||
|
|
||||||
|
public Guid? SubjectVisitId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public string? FileMarkId { get; set; }
|
public string? FileMarkId { get; set; }
|
||||||
|
|
@ -112,6 +176,7 @@ public class FileUploadRecordQuery : PageInput
|
||||||
|
|
||||||
public class UploadFileSyncRecordView
|
public class UploadFileSyncRecordView
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public DateTime? StartTime { get; set; }
|
public DateTime? StartTime { get; set; }
|
||||||
|
|
@ -122,13 +187,48 @@ public class UploadFileSyncRecordView
|
||||||
|
|
||||||
|
|
||||||
public string Msg { get; set; }
|
public string Msg { get; set; }
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
public DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid? FileUploadRecordId { get; set; }
|
||||||
|
public string? FileName { get; set; }
|
||||||
|
|
||||||
|
public string? FileType { get; set; }
|
||||||
|
|
||||||
|
public string? Path { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UploadFileSyncRecordQuery:PageInput
|
public class UploadFileSyncRecordQuery : PageInput
|
||||||
{
|
{
|
||||||
|
|
||||||
public Guid? FileUploadRecordId { get; set; }
|
public Guid? FileUploadRecordId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public jobState? JobState { get; set; }
|
public jobState? JobState { get; set; }
|
||||||
|
|
||||||
|
public string? SubjectCode { get; set; }
|
||||||
|
|
||||||
|
public string? VisitName { get; set; }
|
||||||
|
|
||||||
|
public string? StudyCode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BatchAddSyncFileCommand
|
||||||
|
{
|
||||||
|
public List<Guid> FileUploadRecordIdList { get; set; }
|
||||||
|
|
||||||
|
public int? Priority { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -29,8 +29,57 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
|
|
||||||
ObjectStoreServiceOptions ObjectStoreServiceConfig = options.CurrentValue;
|
ObjectStoreServiceOptions ObjectStoreServiceConfig = options.CurrentValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传记录表--里面包含待同步任务
|
/// 按照 subject visit studyCode 三个维度进行分组的查询列表 (subject相关)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inQuery"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<PageOutput<SubjectFileUploadRecordView>> GetSubjectUploadRecordList(SubjectFileUploadRecordQuery inQuery)
|
||||||
|
{
|
||||||
|
|
||||||
|
var query = _fileUploadRecordRepository.Where(t => t.TrialId == inQuery.TrialId && t.SubjectId != null)
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.SubjectVisit.VisitName.Contains(inQuery.VisitName))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadRegion), t => t.UploadRegion == inQuery.UploadRegion)
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.TargetRegion), t => t.TargetRegion == inQuery.TargetRegion)
|
||||||
|
.WhereIf(inQuery.IsSync != null, t => t.IsSync == inQuery.IsSync)
|
||||||
|
.GroupBy(t => new { t.StudyCode, SubjectCode = t.Subject.Code, t.SubjectVisit.VisitName, t.SubjectId, t.SubjectVisitId })
|
||||||
|
.Select(g => new SubjectFileUploadRecordView()
|
||||||
|
{
|
||||||
|
SubjectCode = g.Key.SubjectCode,
|
||||||
|
VisitName = g.Key.VisitName,
|
||||||
|
StudyCode = g.Key.StudyCode,
|
||||||
|
SubjectId = g.Key.SubjectId,
|
||||||
|
SubjectVisitId = g.Key.SubjectVisitId,
|
||||||
|
|
||||||
|
FileCount = g.Count(),
|
||||||
|
|
||||||
|
CreateTime = g.Max(t => t.CreateTime),
|
||||||
|
|
||||||
|
SyncFinishedTime = g.Max(t => t.SyncFinishedTime),
|
||||||
|
|
||||||
|
UploadRegion = g.First().UploadRegion,
|
||||||
|
|
||||||
|
TargetRegion = g.First().TargetRegion,
|
||||||
|
|
||||||
|
IsSync = !g.Any(t => t.IsSync == false || t.IsSync == null)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var pageList = await query.ToPagedListAsync(inQuery);
|
||||||
|
|
||||||
|
return pageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传记录表--里面包含待同步任务 DataFileType= 0 :代表系统文件 1:Subject相关 2:项目相关,但是和subject 没关系
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inQuery"></param>
|
/// <param name="inQuery"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -39,16 +88,32 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
{
|
{
|
||||||
|
|
||||||
var fileUploadRecordQueryable = _fileUploadRecordRepository
|
var fileUploadRecordQueryable = _fileUploadRecordRepository
|
||||||
.WhereIf(inQuery.BatchDataType != null, t => t.BatchDataType == inQuery.BatchDataType)
|
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName))
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.FileType), t => t.FileType.Contains(inQuery.FileType))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.FileType), t => t.FileType.Contains(inQuery.FileType))
|
||||||
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
||||||
.WhereIf(inQuery.IsSystermFile == true, t => t.TrialId == null)
|
|
||||||
|
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
|
||||||
|
.WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectVisitId == inQuery.SubjectVisitId)
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.SubjectVisit.VisitName.Contains(inQuery.VisitName))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
|
||||||
|
|
||||||
|
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectId != null && inQuery.SubjectVisitId == null, t => t.SubjectVisitId == null)
|
||||||
|
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectVisitId != null && inQuery.StudyCode == "", t => t.StudyCode == "")
|
||||||
|
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectCode.IsNotNullOrEmpty() && inQuery.VisitName.IsNullOrEmpty(), t => t.SubjectVisitId == null)
|
||||||
|
.WhereIf(inQuery.DataFileType == 1 && inQuery.VisitName.IsNotNullOrEmpty() && inQuery.StudyCode == "", t => t.StudyCode == "")
|
||||||
|
|
||||||
|
.WhereIf(inQuery.DataFileType == 0, t => t.TrialId == null)
|
||||||
|
.WhereIf(inQuery.DataFileType == 1, t => t.SubjectId != null)
|
||||||
|
.WhereIf(inQuery.DataFileType == 2, t => t.SubjectId == null)
|
||||||
|
|
||||||
|
.WhereIf(inQuery.IsNeedSync != null, t => t.IsNeedSync == inQuery.IsNeedSync)
|
||||||
|
|
||||||
.WhereIf(inQuery.IsSync != null, t => t.IsSync == inQuery.IsSync)
|
.WhereIf(inQuery.IsSync != null, t => t.IsSync == inQuery.IsSync)
|
||||||
.WhereIf(inQuery.Priority != null, t => t.Priority == inQuery.Priority)
|
.WhereIf(inQuery.Priority != null, t => t.Priority == inQuery.Priority)
|
||||||
.WhereIf(inQuery.BatchDataType != null, t => t.BatchDataType == inQuery.BatchDataType)
|
.WhereIf(inQuery.BatchDataType != null, t => t.BatchDataType == inQuery.BatchDataType)
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadRegion), t => t.UploadRegion.Contains(inQuery.UploadRegion))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadRegion), t => t.UploadRegion == inQuery.UploadRegion)
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TargetRegion), t => t.TargetRegion.Contains(inQuery.TargetRegion))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.TargetRegion), t => t.TargetRegion == inQuery.TargetRegion)
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadBatchId), t => t.UploadBatchId.Contains(inQuery.UploadBatchId))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadBatchId), t => t.UploadBatchId.Contains(inQuery.UploadBatchId))
|
||||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Path), t => t.Path.Contains(inQuery.Path))
|
.WhereIf(!string.IsNullOrEmpty(inQuery.Path), t => t.Path.Contains(inQuery.Path))
|
||||||
.WhereIf(inQuery.UploadStartTime != null, t => t.CreateTime >= inQuery.UploadStartTime)
|
.WhereIf(inQuery.UploadStartTime != null, t => t.CreateTime >= inQuery.UploadStartTime)
|
||||||
|
|
@ -64,7 +129,7 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务具体执行记录表 (需要同步的才可以点击)
|
/// 任务具体执行记录表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inQuery"></param>
|
/// <param name="inQuery"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -73,9 +138,11 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
{
|
{
|
||||||
|
|
||||||
var fileUploadRecordQueryable = _uploadFileSyncRecordRepository
|
var fileUploadRecordQueryable = _uploadFileSyncRecordRepository
|
||||||
|
.WhereIf(inQuery.JobState != null, t => t.JobState == inQuery.JobState)
|
||||||
.WhereIf(inQuery.FileUploadRecordId != null, t => t.FileUploadRecordId >= inQuery.FileUploadRecordId)
|
.WhereIf(inQuery.FileUploadRecordId != null, t => t.FileUploadRecordId == inQuery.FileUploadRecordId)
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.FileUploadRecord.StudyCode.Contains(inQuery.StudyCode))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.FileUploadRecord.SubjectVisit.VisitName.Contains(inQuery.VisitName))
|
||||||
|
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.FileUploadRecord.Subject.Code.Contains(inQuery.SubjectCode))
|
||||||
|
|
||||||
.ProjectTo<UploadFileSyncRecordView>(_mapper.ConfigurationProvider);
|
.ProjectTo<UploadFileSyncRecordView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
|
|
@ -85,6 +152,29 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量设置为需要同步,并且设置优先级
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inComand"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> BatchAddSyncFileTask(BatchAddSyncFileCommand inComand)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => inComand.FileUploadRecordIdList.Contains(t.Id), u => new FileUploadRecord() { IsNeedSync = true, Priority = inComand.Priority ?? 0 });
|
||||||
|
|
||||||
|
foreach (var item in inComand.FileUploadRecordIdList)
|
||||||
|
{
|
||||||
|
_fileSyncQueue.Enqueue(item, inComand.Priority ?? 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await _fileUploadRecordRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -134,11 +224,13 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
|
|
||||||
addOrEditFileUploadRecord.Priority = 0;
|
addOrEditFileUploadRecord.Priority = 0;
|
||||||
|
|
||||||
|
addOrEditFileUploadRecord.IsSync = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addOrEditFileUploadRecord.TargetRegion = "";
|
addOrEditFileUploadRecord.IsNeedSync = false;
|
||||||
|
|
||||||
|
//addOrEditFileUploadRecord.TargetRegion = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +240,8 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
//系统文件,默认同步
|
//系统文件,默认同步
|
||||||
addOrEditFileUploadRecord.IsNeedSync = true;
|
addOrEditFileUploadRecord.IsNeedSync = true;
|
||||||
|
|
||||||
|
addOrEditFileUploadRecord.IsSync = false;
|
||||||
|
|
||||||
addOrEditFileUploadRecord.Priority = 0;
|
addOrEditFileUploadRecord.Priority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,45 +270,206 @@ public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRe
|
||||||
#region 同步队列
|
#region 同步队列
|
||||||
|
|
||||||
|
|
||||||
|
public sealed class FileSyncQueue
|
||||||
/// <summary>
|
|
||||||
/// 同步队列 信号量
|
|
||||||
/// </summary>
|
|
||||||
public class FileSyncQueue
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级队列(仅负责排序)
|
||||||
|
/// </summary>
|
||||||
private readonly PriorityQueue<Guid, int> _queue = new();
|
private readonly PriorityQueue<Guid, int> _queue = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前等待中的任务(唯一真实数据)
|
||||||
|
/// key = Guid
|
||||||
|
/// value = 最新 priority
|
||||||
|
/// </summary>
|
||||||
|
private readonly Dictionary<Guid, int> _waiting = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 正在执行的任务(防止重复执行)
|
||||||
|
/// </summary>
|
||||||
|
private readonly HashSet<Guid> _running = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// worker 等待信号
|
||||||
|
/// </summary>
|
||||||
private readonly SemaphoreSlim _signal = new(0);
|
private readonly SemaphoreSlim _signal = new(0);
|
||||||
|
|
||||||
|
|
||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Enqueue
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入队(同 Guid 会覆盖优先级)
|
||||||
|
/// </summary>
|
||||||
public void Enqueue(Guid id, int priority)
|
public void Enqueue(Guid id, int priority)
|
||||||
{
|
{
|
||||||
|
bool needSignal = false;
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
// priority 越大越优先
|
// 如果正在执行,忽略(防止重复)
|
||||||
|
if (_running.Contains(id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 是否新任务(用于减少 signal 风暴)
|
||||||
|
if (!_waiting.ContainsKey(id))
|
||||||
|
needSignal = true;
|
||||||
|
|
||||||
|
// 更新为最新优先级(最后一次为准)
|
||||||
|
_waiting[id] = priority; //等价于添加或者更新
|
||||||
|
|
||||||
|
// PriorityQueue 无法更新节点
|
||||||
|
// 允许旧节点存在,Dequeue 时过滤
|
||||||
_queue.Enqueue(id, -priority);
|
_queue.Enqueue(id, -priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
//类似于计数器,不会产生通知风暴,可消费资源 +1
|
// 只有新增任务才唤醒 worker
|
||||||
//if (有等待线程) 唤醒一个 else 仅增加计数
|
if (needSignal)
|
||||||
_signal.Release(); // 唤醒一个 worker
|
_signal.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Dequeue
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
|
/// 获取一个待执行任务(无任务时自动等待)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ct"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<Guid> DequeueAsync(CancellationToken ct)
|
public async Task<Guid> DequeueAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
await _signal.WaitAsync(ct);
|
await _signal.WaitAsync(ct);
|
||||||
|
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
return _queue.Dequeue();
|
while (_queue.Count > 0)
|
||||||
|
{
|
||||||
|
var id = _queue.Dequeue();
|
||||||
|
|
||||||
|
// 已被覆盖或取消 如果这个任务已经不是“当前最新版任务”,那它只是 PriorityQueue 里的垃圾数据,直接跳过。
|
||||||
|
if (!_waiting.TryGetValue(id, out _)) //能从等待任务中取到,那么就是有效的,不能取到那么就是覆盖的
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 标记为运行中
|
||||||
|
_waiting.Remove(id);
|
||||||
|
_running.Add(id);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Complete
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务执行完成(必须调用)
|
||||||
|
/// </summary>
|
||||||
|
public void Complete(Guid id)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_running.Remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// Snapshot
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前等待中的任务快照
|
||||||
|
/// </summary>
|
||||||
|
public Guid[] Snapshot()
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
return _waiting.Keys.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 状态信息(调试用)
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
public int WaitingCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
return _waiting.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RunningCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
return _running.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 同步队列 信号量
|
||||||
|
///// </summary>
|
||||||
|
//public class FileSyncQueue
|
||||||
|
//{
|
||||||
|
// private readonly PriorityQueue<Guid, int> _queue = new();
|
||||||
|
// private readonly SemaphoreSlim _signal = new(0);
|
||||||
|
// private readonly object _lock = new();
|
||||||
|
|
||||||
|
// public void Enqueue(Guid id, int priority)
|
||||||
|
// {
|
||||||
|
// lock (_lock)
|
||||||
|
// {
|
||||||
|
// // priority 越大越优先
|
||||||
|
// _queue.Enqueue(id, -priority);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //类似于计数器,不会产生通知风暴,可消费资源 +1
|
||||||
|
// //if (有等待线程) 唤醒一个 else 仅增加计数
|
||||||
|
// _signal.Release(); // 唤醒一个 worker
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// 如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="ct"></param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public async Task<Guid> DequeueAsync(CancellationToken ct)
|
||||||
|
// {
|
||||||
|
// await _signal.WaitAsync(ct);
|
||||||
|
|
||||||
|
// lock (_lock)
|
||||||
|
// {
|
||||||
|
// return _queue.Dequeue();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// 获取队列任务Id
|
||||||
|
// /// </summary>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public Guid[] Snapshot()
|
||||||
|
// {
|
||||||
|
// lock (_lock)
|
||||||
|
// {
|
||||||
|
// return _queue.UnorderedItems
|
||||||
|
// .Select(x => x.Element)
|
||||||
|
// .ToArray();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
#region 这里不用 SyncQueueUseChannel 和调度器 SyncScheduler
|
#region 这里不用 SyncQueueUseChannel 和调度器 SyncScheduler
|
||||||
public class SyncQueueUseChannel
|
public class SyncQueueUseChannel
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
|
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
|
||||||
|
|
||||||
|
|
||||||
CreateMap<TumorExportBaseModel , TU_Export>();
|
CreateMap<TumorExportBaseModel, TU_Export>();
|
||||||
CreateMap<TumorExportBaseModel, TR_Export>();
|
CreateMap<TumorExportBaseModel, TR_Export>();
|
||||||
CreateMap<TumorExportBaseModel, RS_Export>();
|
CreateMap<TumorExportBaseModel, RS_Export>();
|
||||||
CreateMap<TumorExportBaseModel, CO_Export>();
|
CreateMap<TumorExportBaseModel, CO_Export>();
|
||||||
|
|
@ -125,11 +125,19 @@ namespace IRaCIS.Core.Application.Service
|
||||||
CreateMap<IVUS_OCTBaseDto, OctExportDto>();
|
CreateMap<IVUS_OCTBaseDto, OctExportDto>();
|
||||||
|
|
||||||
|
|
||||||
CreateMap<FileUploadRecord, FileUploadRecordView>();
|
CreateMap<FileUploadRecord, FileUploadRecordView>()
|
||||||
|
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code))
|
||||||
|
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName));
|
||||||
CreateMap<FileUploadRecord, FileUploadRecordAddOrEdit>().ReverseMap();
|
CreateMap<FileUploadRecord, FileUploadRecordAddOrEdit>().ReverseMap();
|
||||||
|
|
||||||
|
|
||||||
CreateMap<UploadFileSyncRecord, UploadFileSyncRecordView>();
|
CreateMap<UploadFileSyncRecord, UploadFileSyncRecordView>()
|
||||||
|
.ForMember(d => d.FileName, u => u.MapFrom(s => s.FileUploadRecord.FileName))
|
||||||
|
.ForMember(d => d.FileType, u => u.MapFrom(s => s.FileUploadRecord.FileType))
|
||||||
|
.ForMember(d => d.Path, u => u.MapFrom(s => s.FileUploadRecord.Path))
|
||||||
|
.ForMember(d => d.StudyCode, u => u.MapFrom(s => s.FileUploadRecord.StudyCode))
|
||||||
|
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.FileUploadRecord.Subject.Code))
|
||||||
|
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.FileUploadRecord.SubjectVisit.VisitName));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid StudyMonitorId { get; set; }
|
public Guid StudyMonitorId { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public string UploadBatchId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int FailedFileCount { get; set; }
|
public int FailedFileCount { get; set; }
|
||||||
|
|
||||||
public string RecordPath { get; set; } = string.Empty;
|
public string RecordPath { get; set; } = string.Empty;
|
||||||
|
|
@ -289,6 +294,10 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid StudyMonitorId { get; set; }
|
public Guid StudyMonitorId { get; set; }
|
||||||
|
|
||||||
|
[NotDefault]
|
||||||
|
public string UploadBatchId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public int FailedFileCount { get; set; }
|
public int FailedFileCount { get; set; }
|
||||||
|
|
||||||
public string RecordPath { get; set; } = string.Empty;
|
public string RecordPath { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
IRepository<VisitTask> _visitTaskRepository,
|
IRepository<VisitTask> _visitTaskRepository,
|
||||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||||
IOSSService _oSSService,
|
IOSSService _oSSService,
|
||||||
|
IRepository<FileUploadRecord> _fileUploadRecordRepository,
|
||||||
IRepository<Dictionary> _dictionaryRepository,
|
IRepository<Dictionary> _dictionaryRepository,
|
||||||
IRepository<Trial> _trialRepository,
|
IRepository<Trial> _trialRepository,
|
||||||
IRepository<StudyMonitor> _studyMonitorRepository,
|
IRepository<StudyMonitor> _studyMonitorRepository,
|
||||||
|
|
@ -803,6 +804,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
await _taskStudyRepository.SaveChangesAsync();
|
await _taskStudyRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
IRepository<Trial> _trialRepository,
|
IRepository<Trial> _trialRepository,
|
||||||
IRepository<VisitTask> _visitTaskRepository,
|
IRepository<VisitTask> _visitTaskRepository,
|
||||||
IRepository<SCPStudy> _scpStudyRepository,
|
IRepository<SCPStudy> _scpStudyRepository,
|
||||||
|
IRepository<FileUploadRecord> _fileUploadRecordRepository,
|
||||||
IRepository<Subject> _subjectRepository,
|
IRepository<Subject> _subjectRepository,
|
||||||
IRepository<StudyMonitor> _studyMonitorRepository,
|
IRepository<StudyMonitor> _studyMonitorRepository,
|
||||||
IRepository<SystemAnonymization> _systemAnonymizationRepository,
|
IRepository<SystemAnonymization> _systemAnonymizationRepository,
|
||||||
|
|
@ -332,6 +333,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
await _dicomInstanceRepository.SaveChangesAsync();
|
await _dicomInstanceRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1191,7 +1191,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
var userEmail = item.Key;
|
var userEmail = item.Key;
|
||||||
|
|
||||||
var userTypeIdList = item.Select(t => t.UserTypeId).ToList();
|
var userTypeIdList = item.Select(t => t.UserTypeId).Distinct().ToList();
|
||||||
|
|
||||||
var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();
|
var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ public class FileUploadRecord : BaseFullAuditEntity
|
||||||
|
|
||||||
public Guid? NoneDicomStudyId { get; set; }
|
public Guid? NoneDicomStudyId { get; set; }
|
||||||
|
|
||||||
|
public string StudyCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Comment("文件标识ID")]
|
[Comment("文件标识ID")]
|
||||||
public string FileMarkId { get; set; }
|
public string FileMarkId { get; set; }
|
||||||
|
|
|
||||||
22019
IRaCIS.Core.Infra.EFCore/Migrations/20260402090118_addStudyCode.Designer.cs
generated
Normal file
22019
IRaCIS.Core.Infra.EFCore/Migrations/20260402090118_addStudyCode.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addStudyCode : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "StudyCode",
|
||||||
|
table: "FileUploadRecord",
|
||||||
|
type: "nvarchar(400)",
|
||||||
|
maxLength: 400,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "StudyCode",
|
||||||
|
table: "FileUploadRecord");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3163,6 +3163,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
.HasComment("同步优先级");
|
.HasComment("同步优先级");
|
||||||
|
|
||||||
|
b.Property<string>("StudyCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<Guid?>("SubjectId")
|
b.Property<Guid?>("SubjectId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue