Merge branch 'Test.Study' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test.Study
continuous-integration/drone/push Build is passing Details

Uat_Study
he 2024-01-03 14:24:57 +08:00
commit b1608812ec
9 changed files with 155 additions and 110 deletions

View File

@ -1,4 +1,4 @@
using Autofac; using Autofac;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
@ -53,7 +53,7 @@ namespace IRaCIS.Core.API
containerBuilder.RegisterModule<AutofacModuleSetup>(); containerBuilder.RegisterModule<AutofacModuleSetup>();
#region Test #region Test
//containerBuilder.RegisterType<ClinicalDataService>().PropertiesAutowired().InstancePerLifetimeScope();//注册仓储 //containerBuilder.RegisterType<ClinicalDataService>().PropertiesAutowired().InstancePerLifetimeScope();//注册仓储
//var container = containerBuilder.Build(); //var container = containerBuilder.Build();
@ -75,12 +75,12 @@ namespace IRaCIS.Core.API
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
//健康检查 //健康检查
services.AddHealthChecks(); services.AddHealthChecks();
//本地化 //本地化
services.AddJsonLocalization(options => options.ResourcesPath = "Resources"); services.AddJsonLocalization(options => options.ResourcesPath = "Resources");
// 异常、参数统一验证过滤器、Json序列化配置、字符串参数绑型统一Trim() // 异常、参数统一验证过滤器、Json序列化配置、字符串参数绑型统一Trim()
services.AddControllers(options => services.AddControllers(options =>
{ {
//options.Filters.Add<LogActionFilter>(); //options.Filters.Add<LogActionFilter>();
@ -95,7 +95,7 @@ namespace IRaCIS.Core.API
}) })
.AddNewtonsoftJsonSetup(); // NewtonsoftJson 序列化 处理 .AddNewtonsoftJsonSetup(); // NewtonsoftJson 序列化 处理
services.AddOptions().Configure<SystemEmailSendConfig>(_configuration.GetSection("SystemEmailSendConfig")); services.AddOptions().Configure<SystemEmailSendConfig>(_configuration.GetSection("SystemEmailSendConfig"));
services.AddOptions().Configure<ServiceVerifyConfigOption>(_configuration.GetSection("BasicSystemConfig")); services.AddOptions().Configure<ServiceVerifyConfigOption>(_configuration.GetSection("BasicSystemConfig"));
@ -103,62 +103,62 @@ namespace IRaCIS.Core.API
services.AddOptions().Configure<ObjectStoreServiceOptions>(_configuration.GetSection("ObjectStoreService")); services.AddOptions().Configure<ObjectStoreServiceOptions>(_configuration.GetSection("ObjectStoreService"));
//动态WebApi + UnifiedApiResultFilter 省掉控制器代码 //动态WebApi + UnifiedApiResultFilter 省掉控制器代码
services.AddDynamicWebApiSetup(); services.AddDynamicWebApiSetup();
//AutoMapper //AutoMapper
services.AddAutoMapperSetup(); services.AddAutoMapperSetup();
//EF ORM QueryWithNoLock //EF ORM QueryWithNoLock
services.AddEFSetup(_configuration); services.AddEFSetup(_configuration);
//Http 响应压缩 //Http 响应压缩
services.AddResponseCompressionSetup(); services.AddResponseCompressionSetup();
//Swagger Api 文档 //Swagger Api 文档
services.AddSwaggerSetup(); services.AddSwaggerSetup();
//JWT Token 验证 //JWT Token 验证
services.AddJWTAuthSetup(_configuration); services.AddJWTAuthSetup(_configuration);
// MediatR 进程内消息 事件解耦 从程序集中 注册命令和handler对应关系 // MediatR 进程内消息 事件解耦 从程序集中 注册命令和handler对应关系
services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<ConsistencyVerificationHandler>()); services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<ConsistencyVerificationHandler>());
// EasyCaching 缓存 // EasyCaching 缓存
services.AddEasyCachingSetup(_configuration); services.AddEasyCachingSetup(_configuration);
//services.AddDistributedMemoryCache(); //services.AddDistributedMemoryCache();
// hangfire 定时任务框架 有界面,更友好~ // hangfire 定时任务框架 有界面,更友好~
services.AddhangfireSetup(_configuration); services.AddhangfireSetup(_configuration);
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好 // QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
services.AddQuartZSetup(_configuration); services.AddQuartZSetup(_configuration);
// 保护上传文件 // 保护上传文件
//services.AddStaticFileAuthorizationSetup(); //services.AddStaticFileAuthorizationSetup();
////HttpReports 暂时废弃 ////HttpReports 暂时废弃
//services.AddHttpReports().AddHttpTransport(); //services.AddHttpReports().AddHttpTransport();
//Serilog 日志可视化 LogDashboard日志 //Serilog 日志可视化 LogDashboard日志
services.AddLogDashboardSetup(); services.AddLogDashboardSetup();
//上传限制 配置 //上传限制 配置
services.Configure<FormOptions>(options => services.Configure<FormOptions>(options =>
{ {
options.MultipartBodyLengthLimit = int.MaxValue; options.MultipartBodyLengthLimit = int.MaxValue;
options.ValueCountLimit = int.MaxValue; options.ValueCountLimit = int.MaxValue;
options.ValueLengthLimit = int.MaxValue; options.ValueLengthLimit = int.MaxValue;
}); });
//IP 限流 可设置白名单 或者黑名单 //IP 限流 可设置白名单 或者黑名单
//services.AddIpPolicyRateLimitSetup(_configuration); //services.AddIpPolicyRateLimitSetup(_configuration);
// 用户类型 策略授权 // 用户类型 策略授权
//services.AddAuthorizationPolicySetup(_configuration); //services.AddAuthorizationPolicySetup(_configuration);
services.AddJsonConfigSetup(_configuration); services.AddJsonConfigSetup(_configuration);
//转发头设置 获取真实IP //转发头设置 获取真实IP
services.Configure<ForwardedHeadersOptions>(options => services.Configure<ForwardedHeadersOptions>(options =>
{ {
options.ForwardedHeaders = options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
}); });
//Dicom影像渲染图片 跨平台 //Dicom影像渲染图片 跨平台
services.AddDicomSetup(); services.AddDicomSetup();
// 实时应用 // 实时应用
services.AddSignalR(); services.AddSignalR();
@ -175,17 +175,17 @@ namespace IRaCIS.Core.API
{ {
//app.UsePathBase(PathString.FromUriComponent("/api")); //app.UsePathBase(PathString.FromUriComponent("/api"));
//本地化 //本地化
app.UseLocalization(); app.UseLocalization();
app.UseForwardedHeaders(); app.UseForwardedHeaders();
//响应压缩 //响应压缩
app.UseResponseCompression(); app.UseResponseCompression();
//app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); //app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
//不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication. //不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
app.UseStaticFiles(); app.UseStaticFiles();
@ -195,10 +195,10 @@ namespace IRaCIS.Core.API
//hangfire //hangfire
app.UseHangfireConfig(env); app.UseHangfireConfig(env);
////暂时废弃 ////暂时废弃
//app.UseHttpReports(); //app.UseHttpReports();
////限流 中间件 ////限流 中间件
//app.UseIpRateLimiting(); //app.UseIpRateLimiting();
@ -211,18 +211,18 @@ namespace IRaCIS.Core.API
{ {
//app.UseHsts(); //app.UseHsts();
} }
Console.WriteLine("当前环境: " + env.EnvironmentName); Console.WriteLine("当前环境: " + env.EnvironmentName);
//app.UseMiddleware<AuthMiddleware>(); //app.UseMiddleware<AuthMiddleware>();
// 特殊异常处理 比如 404 // 特殊异常处理 比如 404
app.UseStatusCodePagesWithReExecute("/Error/{0}"); app.UseStatusCodePagesWithReExecute("/Error/{0}");
SwaggerSetup.Configure(app, env); SwaggerSetup.Configure(app, env);
////serilog 记录请求的用户信息 ////serilog 记录请求的用户信息
app.UseSerilogConfig(env); app.UseSerilogConfig(env);
app.UseRouting(); app.UseRouting();
@ -237,7 +237,7 @@ namespace IRaCIS.Core.API
//app.UseJwtBearerQueryString(); //app.UseJwtBearerQueryString();
app.UseAuthorization(); app.UseAuthorization();
////文件伺服 必须带Token 访问 ////文件伺服 必须带Token 访问
////app.UseIRacisHostStaticFileStore(env); ////app.UseIRacisHostStaticFileStore(env);
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
@ -253,7 +253,7 @@ namespace IRaCIS.Core.API
var hangfireJobService = app.ApplicationServices.GetRequiredService<IIRaCISHangfireJob>(); var hangfireJobService = app.ApplicationServices.GetRequiredService<IIRaCISHangfireJob>();
await hangfireJobService.InitHangfireJobTaskAsync(); await hangfireJobService.InitHangfireJobTaskAsync();
//有的时候每调用 //有的时候每调用
//HangfireJobHelper.NotImmediatelyOnceOnlyJob<IIRaCISHangfireJob>(t => t.InitHangfireJobTaskAsync(),TimeSpan.FromSeconds(1)); //HangfireJobHelper.NotImmediatelyOnceOnlyJob<IIRaCISHangfireJob>(t => t.InitHangfireJobTaskAsync(),TimeSpan.FromSeconds(1));

View File

@ -158,7 +158,7 @@ namespace IRaCIS.Application.Services
messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress)); messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress));
//主题 //主题
//---[来自展影IRC] 关于重置密码的提醒 //---[来自展影IRC] 关于重置密码的提醒
messageToSend.Subject = _localizer["Mail_IRCResettingPassword "]; messageToSend.Subject = _localizer["Mail_IRCResettingPassword"];
@ -178,7 +178,7 @@ namespace IRaCIS.Application.Services
builder.HtmlBody = string.Format(templateInfo, builder.HtmlBody = string.Format(templateInfo,
//---您正在进行邮箱重置密码操作 //---您正在进行邮箱重置密码操作
_localizer["Mail_ResettingPassword "], _localizer["Mail_ResettingPassword"],
verificationCode verificationCode
); );
} }

View File

@ -658,7 +658,7 @@ namespace IRaCIS.Core.Application.Services
/// <param name="isSystemDoc"></param> /// <param name="isSystemDoc"></param>
/// <returns></returns> /// <returns></returns>
[HttpPut("{documentId:guid}/{isSystemDoc:bool}")] [HttpPut("{documentId:guid}/{isSystemDoc:bool}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId" })]
public async Task<IResponseOutput> UserAbandonDoc(Guid documentId, bool isSystemDoc) public async Task<IResponseOutput> UserAbandonDoc(Guid documentId, bool isSystemDoc)
{ {
if (isSystemDoc) if (isSystemDoc)

View File

@ -1383,6 +1383,10 @@ namespace IRaCIS.Core.Application.Contracts
public DateTime? SubmitTime { get; set; } public DateTime? SubmitTime { get; set; }
public string SubmitUserName { get; set; } = String.Empty;
public string SubmitUserRealName { get; set; } = String.Empty;
public string CurrentActionUserName { get; set; } = String.Empty; public string CurrentActionUserName { get; set; } = String.Empty;
public string PreliminaryAuditUserName { get; set; } = String.Empty; public string PreliminaryAuditUserName { get; set; } = String.Empty;

View File

@ -364,6 +364,10 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
.ForMember(d => d.SubjectStatus, u => u.MapFrom(s => s.Subject.Status)) .ForMember(d => d.SubjectStatus, u => u.MapFrom(s => s.Subject.Status))
.ForMember(d => d.StudyCount, u => u.MapFrom(s => s.StudyList.Count())) .ForMember(d => d.StudyCount, u => u.MapFrom(s => s.StudyList.Count()))
.ForMember(d => d.SubmitUserName, u => u.MapFrom(s => s.SubmitUser.UserName))
.ForMember(d => d.SubmitUserRealName, u => u.MapFrom(s => s.SubmitUser.FullName))
.ForMember(d => d.CurrentActionUserName, u => u.MapFrom(s => s.CurrentActionUser.UserName)) .ForMember(d => d.CurrentActionUserName, u => u.MapFrom(s => s.CurrentActionUser.UserName))
.ForMember(d => d.PreliminaryAuditUserName, u => u.MapFrom(s => s.PreliminaryAuditUser.UserName)) .ForMember(d => d.PreliminaryAuditUserName, u => u.MapFrom(s => s.PreliminaryAuditUser.UserName))
.ForMember(d => d.ReviewAuditUserName, u => u.MapFrom(s => s.ReviewAuditUser.UserName)) .ForMember(d => d.ReviewAuditUserName, u => u.MapFrom(s => s.ReviewAuditUser.UserName))

View File

@ -694,7 +694,8 @@ namespace IRaCIS.Core.Application
//待领取量 //待领取量
ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(), ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState!=AuditStateEnum.QCPassed)
.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(),
//待审核通过统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) //待审核通过统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了)
ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count()
@ -709,7 +710,7 @@ namespace IRaCIS.Core.Application
var toBeClaimedCount = _subjectVisitRepository var toBeClaimedCount = _subjectVisitRepository
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)&& t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed)
.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(); .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count();

View File

@ -108,7 +108,7 @@ namespace IRaCIS.Core.Application.Triggers
if (find != null) if (find != null)
{ {
var ids = new Guid[] { find.TaskIdOne, find.TaskIdTwo }; var ids = new Guid[] { find.TaskIdOne, find.TaskIdTwo };
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => ids.Contains(t.Id), u => new VisitTask() { JudgeResultTaskId = null }); await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => ids.Contains(t.Id), u => new VisitTask() { JudgeVisitTaskId = null });
} }
} }
} }

View File

@ -82,6 +82,8 @@ namespace IRaCIS.Core.Domain.Models
public DateTime? PreliminaryAuditTime { get; set; } public DateTime? PreliminaryAuditTime { get; set; }
public Guid? ForwardUserId { get; set; } public Guid? ForwardUserId { get; set; }
public DateTime? ForwardTime { get; set; } public DateTime? ForwardTime { get; set; }
// 质控领取人
public Guid? CurrentActionUserId { get; set; } public Guid? CurrentActionUserId { get; set; }
public DateTime? CurrentActionUserExpireTime { get; set; } public DateTime? CurrentActionUserExpireTime { get; set; }

View File

@ -2,105 +2,139 @@ kind: pipeline
type: docker type: docker
name: irc-netcore-api name: irc-netcore-api
steps: clone:
- name: docker-build disable: true #禁用默认克隆
image: docker
pull: if-not-exists steps:
volumes: - name: clone-repo
- name: dockersock image: alpine/git
path: /var/run/docker.sock pull: if-not-exists
- name: cached_nuget_packages volumes:
path: /drone/nuget_packages - name: irc-test-work
commands: path: /work
- date +%H:%M:%S commands:
- pwd - if [ ! -e /work/netcore-repo/.git ]; then
- docker build -t Test_Study . git clone -b Test.IRC http://192.168.3.68:2000/XCKJ/irc-netcore-api.git /work/netcore-repo;
- date +%H:%M:%S else
cd /work/netcore-repo;
git pull;
fi
- |
if [ ! -e Dockerfile ]; then
echo 'FROM mcr.microsoft.com/dotnet/aspnet:6.0
EXPOSE 80
WORKDIR /app
COPY publish .
ENTRYPOINT ["dotnet", "IRaCIS.Core.API.dll"]' > /work/Dockerfile
fi
- name: restore-publish
image: mcr.microsoft.com/dotnet/sdk:6.0
pull: if-not-exists
depends_on:
- clone-repo
volumes:
- name: nuget-packages
path: /root/.nuget/packages
- name: irc-test-work
path: /work
commands:
- cd /work/netcore-repo/IRaCIS.Core.API
- dotnet restore ./IRaCIS.Core.API.csproj
- rm -rf /work/publish
- cd /work/netcore-repo/IRaCIS.Core.API
- dotnet publish ./IRaCIS.Core.API.csproj -c Release --no-restore -o /work/publish
- name: docker-build
image: docker
pull: if-not-exists
depends_on:
- restore-publish
commands:
- cd /work
- docker build -t test-irc:v${DRONE_BUILD_NUMBER} .
volumes:
- name: irc-test-work
path: /work
- name: dockersock
path: /var/run/docker.sock
- name: docker-deploy
image: docker
pull: if-not-exists
depends_on:
- docker-build
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- date +%H:%M:%S
- docker rm -f test-study-container
- docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test_Study
- date +%H:%M:%S
volumes: volumes:
- name: cached_nuget_packages - name: nuget-packages
host: host:
path: /mnt/d/docker_publish/nuget_packages path: /opt/cicd/nuget/packages
- name: irc-test-work
host:
path: /opt/cicd/irc-test
- name: dockersock - name: dockersock
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
trigger: trigger:
branch: branch:
- master - master
---
kind: pipeline
type: ssh
name: ssh-linux-test-irc-publish
platform:
os: Linux
arch: 386
clone:
disable: true #禁用默认克隆
server:
host: 123.56.94.154
user: root
password:
from_secret: test_ssh_pwd
steps:
- name: publish-test-irc
commands:
- echo start publish test-irc-api
- cd /opt/1panel/hang/devops/test-irc
- sh test-irc.sh v${DRONE_BUILD_NUMBER}
trigger:
branch:
- Test.IRC
--- ---
kind: pipeline kind: pipeline
type: ssh type: ssh
name: ssh-windows-test-study-publish name: ssh-linux-test-study-publish
platform: platform:
os: windows os: Linux
arch: amd64 arch: 386
clone: clone:
disable: true #禁用默认克隆 disable: true #禁用默认克隆
server: server:
host: 123.56.94.154 host: 123.56.94.154
user: Administrator user: root
password: WHxckj2019 password:
from_secret: test_ssh_pwd
steps: steps:
- name: publish-test-study - name: publish-test-study
commands: commands:
#拉取代码 并停止服务 - echo start publish test-study-api
- Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait - cd /opt/1panel/hang/devops/test-study
- cd C:\CICD\Test.Study\netcore_repo - sh test-study.sh v${DRONE_BUILD_NUMBER}
- dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages
- dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API
- Start-Service -Name "Test_Study_API"
trigger: trigger:
branch: branch:
- Test.Study - Test.Study
---
kind: pipeline
type: ssh
name: ssh-windows-test-irc-publish
platform:
os: windows
arch: amd64
clone:
disable: true #禁用默认克隆
server:
host: 123.56.94.154
user: Administrator
password: WHxckj2019
steps:
- name: publish-test-irc
commands:
- Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait
trigger:
branch:
- Test.IRC