From 14d9d8e7a523ab9dc1b3ce8de0846cf6137761e7 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 28 Oct 2024 17:36:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E8=A3=81=E5=88=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.csproj | 4 ---- .../IRaCIS.Core.Application.xml | 22 +++++++++---------- .../JudgeVisitTaskTrigger.cs | 14 +++++++----- 3 files changed, 20 insertions(+), 20 deletions(-) rename IRaCIS.Core.Application/Triggers/{AfterSaveTrigger => }/JudgeVisitTaskTrigger.cs (83%) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 95ba61119..0ee518934 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -69,8 +69,4 @@ - - - - diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 0e8920bc6..9a5bcf707 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -16653,17 +16653,6 @@ - - - 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下 - - 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id (申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理) - 比如: 申请裁判任务重阅,事务里面本来设置了任务上的裁判id,但是因为下面的逻辑,导致设置的值又被清理了,只能重新设置下 - - - - - 因为可能先一致性核查通过,生成其他标准的任务了,新签名的标准也需要产生任务 @@ -16684,6 +16673,17 @@ 维护 IsFrontTaskNeedSignButNotSign 字段 另外附加评估结果 + + + 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下 + + 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id (申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理) + 比如: 申请裁判任务重阅,事务里面本来设置了任务上的裁判id,但是因为下面的逻辑,导致设置的值又被清理了,只能重新设置下 + + + + + 添加访视计划 要给改项目下的所有Subject 添加该访视 diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs b/IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs similarity index 83% rename from IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs rename to IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs index cbade7176..c2cfb43b5 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs @@ -6,11 +6,9 @@ namespace IRaCIS.Core.Application.Triggers public class JudgeVisitTaskTrigger( IRepository _visitTaskRepository, - IRepository _readingJudgeInfoRepository) : IAfterSaveTrigger + IRepository _readingJudgeInfoRepository) : IAfterSaveTrigger,IBeforeSaveTrigger { - - /// /// 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下 /// @@ -39,7 +37,14 @@ namespace IRaCIS.Core.Application.Triggers } } - else if (context.ChangeType == ChangeType.Modified) + } + + //这个放在save 之前,不然可能先执行添加的修改为正确的,再执行修改的,又重置为空了 所以这里需要调整下 (裁判重阅,会修改裁判需要充值, 同时也会新增裁判任务) + public async Task BeforeSave(ITriggerContext context, CancellationToken cancellationToken) + { + var visitTask = context.Entity; + + if (context.ChangeType == ChangeType.Modified) { if (visitTask.ReadingCategory == ReadingCategory.Judge && (visitTask.TaskState == TaskState.Adbandon || visitTask.TaskState == TaskState.HaveReturned)) { @@ -53,6 +58,5 @@ namespace IRaCIS.Core.Application.Triggers } } } - } } \ No newline at end of file From 9f95dc90bb3bfd5ad7e6765624cc117b73216d17 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 29 Oct 2024 09:42:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E8=A3=81=E5=88=A4=E5=AF=BC=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/ExcelExportService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 9d2695a99..a2437c97d 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1663,7 +1663,7 @@ namespace IRaCIS.Core.Application.Service.Common if (judegeList.Count > 0) { - var maxFinishedJudge = judegeList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).FirstOrDefault(); + var maxFinishedJudge = judegeList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderByDescending(t=>t.VisitTaskNum).FirstOrDefault(); var maxNotFinishedJudge = judegeList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned).FirstOrDefault(); From 969d22fdae8f90a33f0721a2390c8828cc6aba7c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 29 Oct 2024 11:42:17 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A3=81=E5=88=A4?= =?UTF-8?q?=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExtraController.cs | 73 ++++++++----------- IRaCIS.Core.API/IRaCIS.Core.API.xml | 16 ++++ .../Service/Common/ExcelExportService.cs | 3 +- 3 files changed, 48 insertions(+), 44 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index e24c7e99c..7ee7324aa 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -356,49 +356,6 @@ namespace IRaCIS.Api.Controllers } - #region aliyun-net-sdk-sts 之前 - //[HttpGet("user/GenerateSTS")] - //public IResponseOutput GenerateSTS([FromServices] IOptionsMonitor options) - //{ - // var ossOptions = options.CurrentValue; - - - // IClientProfile profile = DefaultProfile.GetProfile(ossOptions.regionId, ossOptions.accessKeyId, ossOptions.accessKeySecret); - // DefaultAcsClient client = new DefaultAcsClient(profile); - - - // // 创建一个STS请求 - // AssumeRoleRequest request = new AssumeRoleRequest - // { - // RoleArn = ossOptions.roleArn, // 角色ARN,需要替换为你的角色ARN - // RoleSessionName = $"session-name-{NewId.NextGuid()}", // 角色会话名称,可自定义 - // DurationSeconds = 900, // 令牌有效期(单位:秒),这里设置为1小时 - // }; - - - // AssumeRoleResponse response = client.GetAcsResponse(request); - - // // 返回STS令牌信息给前端 - // var stsToken = new - // { - // AccessKeyId = response.Credentials.AccessKeyId, - // AccessKeySecret = response.Credentials.AccessKeySecret, - // SecurityToken = response.Credentials.SecurityToken, - // Expiration = response.Credentials.Expiration, - - // Region = ossOptions.region, - // BucketName = ossOptions.bucketName, - // ViewEndpoint = ossOptions.viewEndpoint, - - // }; - - // return ResponseOutput.Ok(stsToken); - - //} - #endregion - - - [HttpGet("User/UserRedirect")] @@ -430,7 +387,34 @@ namespace IRaCIS.Api.Controllers + #region 项目支持Oauth 对接修改 + /// + /// 回调到前端,前端调用后端的接口 + /// 参考链接:https://www.ruanyifeng.com/blog/2019/04/oauth-grant-types.html + /// 后端通过这个code ,带上客户端信息,和授权类型 可以向单点登录提供商,获取厂商token + /// + /// 但是单点登录提供商提供的token 和我们系统的token 是有区别的,我们的token里面有我们业务系统的UserId,涉及到很多业务操作,所以在此出现了两种方案 + /// 1、前段使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, + /// 但是除了UserId外,后端还有其他信息也是从Token取的,所以在请求头也需要带上,此外后端认证Token的方式也需要变化,改造成本稍大(如果是微服务,做这种处理还是可以的)。 + /// 2、前段还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 + /// (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造陈本也是最低的) + /// + /// 回调的厂商类型 比如github, google, 我们用的logto ,不同的厂商回调到前端的地址可以不同的,但是请求后端的接口可以是同一个 + /// 在第三方平台登录成功后,回调前端的时候会返回一个code + /// + [HttpGet("User/OAuthCallBack")] + public async Task OAuthCallBack(string type, string code) + { + + + return ResponseOutput.Ok(); + } + + + #endregion + + #region 测试获取用户 ip [HttpGet, Route("ip")] [AllowAnonymous] public IResponseOutput Get([FromServices] IHttpContextAccessor _context) @@ -471,6 +455,9 @@ namespace IRaCIS.Api.Controllers } return ResponseOutput.Ok(sb.ToString()); } + #endregion + + } } diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 4b4186d94..f1145cb26 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -32,6 +32,22 @@ 系统用户登录接口[New] + + + 回调到前端,前端调用后端的接口 + 参考链接:https://www.ruanyifeng.com/blog/2019/04/oauth-grant-types.html + 后端通过这个code ,带上客户端信息,和授权类型 可以向单点登录提供商,获取厂商token + + 但是单点登录提供商提供的token 和我们系统的token 是有区别的,我们的token里面有我们业务系统的UserId,涉及到很多业务操作,所以在此出现了两种方案 + 1、前段使用厂商的Token。 后端通过code 获取厂商的Token 返回前端的同时返回我们系统的UserId,前段在http 请求头加上一个自定义参数,带上UserId 后端取用户Id的地方变动下, + 但是除了UserId外,后端还有其他信息也是从Token取的,所以在请求头也需要带上,此外后端认证Token的方式也需要变化,改造成本稍大(如果是微服务,做这种处理还是可以的)。 + 2、前段还是使用我们后台自己的Token。后端通过code 获取厂商Token的同时,后端做一个隐藏登录,返回厂商的Token的同时,也返回我们系统的Token。 + (像我们单体,这种方式最简单,我们用单点登录,无非就是不想记多个系统的密码,自动登录而已,其他不支持的项目改造陈本也是最低的) + + 回调的厂商类型 比如github, google, 我们用的logto ,不同的厂商回调到前端的地址可以不同的,但是请求后端的接口可以是同一个 + 在第三方平台登录成功后,回调前端的时候会返回一个code + + 添加实验项目-返回新增Id[AUTH] 新记录Id diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index a2437c97d..f16898812 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -2341,6 +2341,7 @@ namespace IRaCIS.Core.Application.Service.Common var doctor2List = _visitTaskRepository.Where(comonTaskFilter).Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) .GroupBy(t => new { t.DoctorUserId, t.DoctorUser.UserName, t.DoctorUser.FullName }) + //有全局裁判 .Where(g => g.Any(t => t.ReadingCategory == ReadingCategory.Global && t.JudgeVisitTaskId != null)) .Select(g => new DoctorJudgeRatio() { @@ -2349,7 +2350,7 @@ namespace IRaCIS.Core.Application.Service.Common FullName = g.Key.FullName, //触发裁判的阅片期的数量 - TotalJudgeCount = g.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.SouceReadModuleId != null).Select(t => t.SouceReadModuleId).Distinct().Count(), + TotalJudgeCount = g.Where(t => t.ReadingCategory == ReadingCategory.Global && t.SouceReadModuleId != null && t.JudgeVisitTaskId != null).Select(t => t.SouceReadModuleId).Distinct().Count(), JudgeAgreeCount = g.Where(t => t.ReadingCategory == ReadingCategory.Global && t.JudgeVisitTaskId != null && t.JudgeVisitTask.JudgeResultTaskId == t.Id) .Select(t => t.SouceReadModuleId).Distinct().Count(),