From bca9993e68e06fdd94247aa170b118d61804223f Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Fri, 28 Apr 2023 13:45:08 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 14 +++
.../Service/Management/UserService.cs | 94 +++++++++++++++++--
.../SubjectCriteriaEvaluationVisitFilter.cs | 4 +-
.../TrialSiteConfigration.cs | 22 ++---
4 files changed, 111 insertions(+), 23 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 9d5f6a754..0baba4a08 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1492,6 +1492,13 @@
+
+
+ 获取新病灶评估
+
+
+
+
@@ -1501,6 +1508,13 @@
+
+
+ 获取新病灶评估
+
+
+
+
删除病灶获取起始病灶序号
diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs
index 94fb79e87..10a01e0cb 100644
--- a/IRaCIS.Core.Application/Service/Management/UserService.cs
+++ b/IRaCIS.Core.Application/Service/Management/UserService.cs
@@ -8,6 +8,9 @@ using Panda.DynamicWebApi.Attributes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Caching.Memory;
+using IRaCIS.Core.Infra.Common.Cache;
+using Microsoft.Identity.Client;
+using static IRaCIS.Core.Domain.Share.StaticData;
namespace IRaCIS.Application.Services
{
@@ -613,6 +616,38 @@ namespace IRaCIS.Application.Services
[NonDynamicMethod]
public async Task> Login(string userName, string password)
{
+
+ //const string cachePrefix = "login-failures:";
+ //const int maxFailures = 3;
+ //const int lockoutMinutes = 3;
+
+ //// 生成缓存键
+ //string cacheKey = $"{cachePrefix}{userName}";
+
+ //// 从缓存中获取登录失败次数
+ //int? failCount = _cache.Get(cacheKey);
+
+
+ //if (failCount != null)
+ //{
+
+ // _cache.Set(cacheKey + ":locked", true, TimeSpan.FromMinutes(lockoutMinutes));
+
+ // if (failCount >= maxFailures)
+ // {
+ // throw new BusinessValidationFailedException($"账号已被锁定,请等待 {lockoutMinutes} 分钟后再试。");
+ // }
+
+ //}
+
+ //if (failCount >= maxFailures)
+ //{
+ // // 如果登录失败次数达到了 3 次,则锁定用户
+ // _cache.Set(cacheKey + ":locked", true, TimeSpan.FromMinutes(lockoutMinutes));
+ //}
+
+
+
var userLoginReturnModel = new LoginReturnDTO();
@@ -620,21 +655,30 @@ namespace IRaCIS.Application.Services
if (loginUser == null)
{
- //此处下面 代码 为了支持医生也能登录 而且前端不加选择到底是管理用户 还是医生用户 奇怪的需求 无法理解
- var loginDoctor = await _doctorRepository.Where(u => u.Phone == userName && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
+ #region 屏蔽代码,现在没用到
+ ////此处下面 代码 为了支持医生也能登录 而且前端不加选择到底是管理用户 还是医生用户 奇怪的需求 无法理解
- if (loginDoctor == null)
- {
- return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO());
+ //var loginDoctor = await _doctorRepository.Where(u => u.Phone == userName && u.Password == password).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
- }
+ //if (loginDoctor == null)
+ //{
+ // return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO());
+ //}
+ //userLoginReturnModel.BasicInfo = loginDoctor;
+
+ //登录 清除缓存
+ //_cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString());
+ //return ResponseOutput.Ok(userLoginReturnModel);
+
+ #endregion
+
+
+
+
+ return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO());
- userLoginReturnModel.BasicInfo = loginDoctor;
- // 登录 清除缓存
- _cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString());
- return ResponseOutput.Ok(userLoginReturnModel);
}
@@ -652,5 +696,35 @@ namespace IRaCIS.Application.Services
}
+
+
+
+ //private bool loginIsLocked(string userName)
+ //{
+
+ // //if (failCount == null)
+ // //{
+ // // failCount = 0;
+ // //}
+ // //else
+ // //{
+ // // failCount++;
+ // //}
+
+ // //// 更新缓存中的登录失败次数
+ // //_cache.Set(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes));
+
+ // //if (failCount >= maxFailures)
+ // //{
+ // // // 如果登录失败次数达到了 3 次,则锁定用户
+ // // _cache.Set(cacheKey + ":locked", true, TimeSpan.FromMinutes(lockoutMinutes));
+ // //}
+
+
+
+
+ // //return isLocked;
+ //}
+
}
}
diff --git a/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitFilter.cs b/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitFilter.cs
index baeef00f4..b3cf7171b 100644
--- a/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitFilter.cs
+++ b/IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitFilter.cs
@@ -18,9 +18,9 @@ namespace IRaCIS.Core.Domain.Models
public class SubjectCriteriaEvaluationVisitFilter : Entity, IAuditUpdate, IAuditAdd
{
- [JsonIgnore]
+ //[JsonIgnore]
- public List SubjectCriterionTaskList { get; set; }
+ //public List SubjectCriterionTaskList { get; set; }
[JsonIgnore]
[ForeignKey("TrialReadingCriterionId")]
public ReadingQuestionCriterionTrial TrialReadingCriterion { get; set; }
diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs
index 2bfb1dbca..1306cbbf3 100644
--- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs
+++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs
@@ -36,18 +36,18 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
}
}
- public class SubjectCriteriaEvaluationVisitFilterConfigration : IEntityTypeConfiguration
- {
+ //public class SubjectCriteriaEvaluationVisitFilterConfigration : IEntityTypeConfiguration
+ //{
- public void Configure(EntityTypeBuilder builder)
- {
- builder
- .HasMany(s => s.SubjectCriterionTaskList)
- .WithOne(c => c.SubjectCriteriaEvaluationVisitFilter)
- .HasForeignKey(s => new { s.SubjectId, s.TrialReadingCriterionId })
- .HasPrincipalKey(c => new { c.SubjectId, c.TrialReadingCriterionId });
+ // public void Configure(EntityTypeBuilder builder)
+ // {
+ // builder
+ // .HasMany(s => s.SubjectCriterionTaskList)
+ // .WithOne(c => c.SubjectCriteriaEvaluationVisitFilter)
+ // .HasForeignKey(s => new { s.SubjectId, s.TrialReadingCriterionId })
+ // .HasPrincipalKey(c => new { c.SubjectId, c.TrialReadingCriterionId });
- }
- }
+ // }
+ //}
}