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

Uat_IRC_Net8
he 2025-01-14 13:20:54 +08:00
commit 5c97f37a75
12 changed files with 18708 additions and 57 deletions

View File

@ -2369,16 +2369,15 @@ namespace IRaCIS.Core.Application.Service.Common
list.Add(item); list.Add(item);
} }
} }
} }
// CDISC 导出 和自定义导出 都会配置到表格问题层级,随意配置,所见即所得 // 非肿瘤标准 包括自定义,以及系统非肿瘤 会配置到表格层级 问题名称是 表格名称_表格子问题名
else /*if (inQuery.ReadingExportType == ExportResult.CDISC)*/ else if (
criterion.CriterionGroup == CriterionGroup.Nontumorous && inQuery.ReadingExportType != ExportResult.CDISC
)
{ {
// 配置在外层问题 或者表格问题上 // 配置在外层问题 或者表格问题上
var taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider, var taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
new new
@ -2402,19 +2401,32 @@ namespace IRaCIS.Core.Application.Service.Common
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum)) foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
{ {
if (item.LesionList.Count > 0) //有病灶,并且至少配置了一个病灶问题
if (item.LesionList.Count > 0 && item.LesionList.SelectMany(t => t.LessionAnswerList).Any())
{ {
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode)) foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
{ {
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode }); //病灶配置了问题 才进行导出
if (lession.LessionAnswerList.Count > 0)
{
var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault();
var addLessionInfoList = new List<CommonQuesionInfo>();
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Table Name" : "表格名称", QuestionValue = firstLessionAnser.TableQuestionName });
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.TableQuestionName + "_" + t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
//有三部分组成 外层问题+ 固定列表格名称 + 动态的表格问题
var dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
//有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题
var dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
var cloneItem = item.Clone(); var cloneItem = item.Clone();
cloneItem.QuestionAnswerList = dynamicLessionInfoList; cloneItem.QuestionAnswerList = dynamicLessionInfoList;
list.Add(cloneItem); list.Add(cloneItem);
} }
}
} }
else else
{ {
@ -2425,6 +2437,20 @@ namespace IRaCIS.Core.Application.Service.Common
} }
}
// CDISC 导出 只管到 外层问题层级 和阅片结果表是保持一致
else if (inQuery.ReadingExportType == ExportResult.CDISC)
{
list = await query.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider,
new
{
readingExportType = inQuery.ReadingExportType,
criterionType = criterion.CriterionType,
arbitrationRule = criterion.ArbitrationRule,
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
isEn_Us = _userInfo.IsEn_Us
}).ToListAsync();
} }
#endregion #endregion

View File

@ -24,6 +24,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string TargetIdentityUserName { get; set; } public string TargetIdentityUserName { get; set; }
public bool IsLoginUncommonly { get; set; }
public string JsonObj { get; set; } public string JsonObj { get; set; }
@ -60,6 +62,8 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid? IdentityUserId { get; set; } public Guid? IdentityUserId { get; set; }
public bool? IsLoginUncommonly { get; set; }
} }

View File

@ -782,7 +782,6 @@ namespace IRaCIS.Core.Application.Service
//检查数据库是否存在该验证码 //检查数据库是否存在该验证码
if (verificationRecord == null) if (verificationRecord == null)
{ {
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALoginFail }, true);
//---验证码错误。 //---验证码错误。
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_WrongVerificationCode"]); throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
} }
@ -791,7 +790,6 @@ namespace IRaCIS.Core.Application.Service
//检查验证码是否失效 //检查验证码是否失效
if (verificationRecord.ExpirationTime < DateTime.Now) if (verificationRecord.ExpirationTime < DateTime.Now)
{ {
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALoginFail }, true);
//---验证码已经过期。 //---验证码已经过期。
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
} }
@ -930,6 +928,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType) .WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate) .WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate) .WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
.WhereIf(inQuery.IsLoginUncommonly != null, t => t.IsLoginUncommonly == inQuery.IsLoginUncommonly)
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!)) .WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))
@ -997,9 +996,11 @@ namespace IRaCIS.Core.Application.Service
await _fusionCache.SetAsync<int?>(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes)); await _fusionCache.SetAsync<int?>(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes));
var userLog = new UserLog();
if (failCount >= maxFailures) if (failCount >= maxFailures)
{ {
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.AccountLocked }, true); await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginPassword = password, OptType = UserOptType.TempLockLogin }, true);
//$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。" //$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"
throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]); throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]);
@ -1025,16 +1026,11 @@ namespace IRaCIS.Core.Application.Service
} }
if (loginUser.Status == 0) //登录用户是系统用户的时候,就要要记录异地登录
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = userName, OptType = UserOptType.LoginLockedAccount }, true); #region 处理用户状态
//---该用户已经被禁用。
return ResponseOutput.NotOk(_localizer["User_Disabled"], new IRCLoginReturnDTO());
}
//登录成功 清除缓存
await _fusionCache.SetAsync(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes));
var ipinfo = _searcher.Search(_userInfo.IP); var ipinfo = _searcher.Search(_userInfo.IP);
var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3)); var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
@ -1047,20 +1043,33 @@ namespace IRaCIS.Core.Application.Service
if (loginUser.LastLoginIP != string.Empty) if (loginUser.LastLoginIP != string.Empty)
{ {
// 与上一次IP不一致 // 与上一次区域不一致
if (SplitAndConcatenate(loginUser.LastLoginIP) !=SplitAndConcatenate(iPRegion)) if (SplitAndConcatenate(loginUser.LastLoginIP) != SplitAndConcatenate(iPRegion))
{ {
loginUser.LoginState = 2; loginUser.LoginState = 2;
} }
} }
//超过90天没修改密码 //超过90天没修改密码
if (_verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value) if (_verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value)
{ {
loginUser.LoginState = 1; loginUser.LoginState = 1;
} }
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, OptType = UserOptType.Login }, true); #endregion
if (loginUser.Status == 0)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = userName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = (loginUser.LoginState == 2) }, true);
//---该用户已经被禁用。
return ResponseOutput.NotOk(_localizer["User_Disabled"], new IRCLoginReturnDTO());
}
//登录成功 清除缓存
await _fusionCache.SetAsync(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes));
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, OptType = UserOptType.Login, IsLoginUncommonly = (loginUser.LoginState == 2) }, true);
userLoginReturnModel.BasicInfo = loginUser; userLoginReturnModel.BasicInfo = loginUser;

View File

@ -1269,20 +1269,34 @@ namespace IRaCIS.Core.Application.Contracts
public class CommonLessionQuestionAnswerInfo public class CommonLessionQuestionAnswerInfo
{ {
#region 肿瘤评估标准的时候需要
public string LessionCode { get; set; } public string LessionCode { get; set; }
public string LessionType { get; set; } public string LessionType { get; set; }
public QuestionMark? QuestionMark { get; set; } public QuestionMark? QuestionMark { get; set; }
#endregion
#region CDISC导出
public string CDISCCode { get; set; }
#endregion
#region 自定义表格名 特殊处理
public string TableQuestionName { get; set; }
#endregion
public string QuestionName { get; set; } public string QuestionName { get; set; }
public string QuestionValue { get; set; } public string QuestionValue { get; set; }
public string TranslateDicName { get; set; } public string TranslateDicName { get; set; }
public string CDISCCode { get; set; }
} }

View File

@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<VisitTask, CommonLessionExport>() CreateMap<VisitTask, CommonLessionExport>()
.IncludeBase<VisitTask, CommonEvaluationExport>() .IncludeBase<VisitTask, CommonEvaluationExport>()
.ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList.Where(c => c.ReadingQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString())))); .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList/*.Where(c => c.ReadingQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString()))*/ ));
CreateMap<ReadingTableAnswerRowInfo, CommonLessionInfo>() CreateMap<ReadingTableAnswerRowInfo, CommonLessionInfo>()
.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark)) .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark))
@ -300,6 +300,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.QuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingTableQuestionTrial.QuestionEnName : u.ReadingTableQuestionTrial.QuestionName)) .ForMember(o => o.QuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingTableQuestionTrial.QuestionEnName : u.ReadingTableQuestionTrial.QuestionName))
.ForMember(o => o.QuestionValue, t => t.MapFrom(u => u.Answer)) .ForMember(o => o.QuestionValue, t => t.MapFrom(u => u.Answer))
.ForMember(o => o.CDISCCode, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CDISCCode)) .ForMember(o => o.CDISCCode, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CDISCCode))
.ForMember(o => o.TableQuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingQuestionTrial.QuestionEnName : u.ReadingQuestionTrial.QuestionName))
.ForMember(o => o.TranslateDicName, t => t.MapFrom(u => u.ReadingTableQuestionTrial.DictionaryCode)) .ForMember(o => o.TranslateDicName, t => t.MapFrom(u => u.ReadingTableQuestionTrial.DictionaryCode))
; ;

View File

@ -173,7 +173,14 @@ namespace IRaCIS.Core.Application.Service
var identityUserId = NewId.NextSequentialGuid(); var identityUserId = NewId.NextSequentialGuid();
var identityUser = _mapper.Map<IdentityUser>(item.FirstOrDefault()); var selectUser = item.OrderByDescending(t => t.Status).FirstOrDefault();
var identityUser = _mapper.Map<IdentityUser>(selectUser);
if (identityUser.IsFirstAdd)
{
identityUser.UserName = "";
}
identityUser.Id = identityUserId; identityUser.Id = identityUserId;

View File

@ -48,7 +48,7 @@ public enum UserOptType
MFALogin = 12, MFALogin = 12,
MFALoginFail = 13, TempLockLogin = 13,
AddUser = 14 AddUser = 14
} }

View File

@ -41,6 +41,9 @@ public class UserLog : BaseAddAuditEntity
#endregion #endregion
[Comment("异地登录")]
public bool IsLoginUncommonly { get; set; }
#region 后续删除 #region 后续删除

View File

@ -1729,17 +1729,20 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}); });
} }
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(UserRole))) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(IdentityUser)))
{ {
var type = GetEntityAuditOpt(item); var type = GetEntityAuditOpt(item);
var entity = item.Entity as UserRole; var entity = item.Entity as IdentityUser;
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
await InsertInspection<UserRole>(entity, type, x => new InspectionConvertDTO if (!_userInfo.IsNotNeedInspection)
{
await InsertInspection<IdentityUser>(entity, type, x => new InspectionConvertDTO
{ {
IsDistinctionInterface = type == AuditOpt.Update ? true : false, IsDistinctionInterface = type == AuditOpt.Update ? true : false,
}); });
} }
}
// 项目参与人员 // 项目参与人员
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialIdentityUser))) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialIdentityUser)))
@ -1764,7 +1767,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
ObjectRelationParentId = x.TrialId, ObjectRelationParentId = x.TrialId,
ExtraIndentification = extraIndentification, ExtraIndentification = extraIndentification,
//ObjectRelationParentId2 = x.IdentityUserId, //ObjectRelationParentId2 = x.IdentityUserId,
},new { }, new
{
identityUser.FullName, identityUser.FullName,
identityUser.EMail, identityUser.EMail,
@ -1797,8 +1801,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
ObjectRelationParentId = x.TrialId, ObjectRelationParentId = x.TrialId,
ExtraIndentification = extraIndentification, ExtraIndentification = extraIndentification,
ObjectRelationParentId2 = x.UserId, ObjectRelationParentId2 = x.UserId,
}, new { }, new
UserTypeEnum= userTypeEnum, {
UserTypeEnum = userTypeEnum,
}); });
} }
@ -3061,7 +3066,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
var entity = item.Entity as ReadingTaskQuestionMark; var entity = item.Entity as ReadingTaskQuestionMark;
var answer = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionAnswer)).Select(x => x.Entity as ReadingTableQuestionAnswer) var answer = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionAnswer)).Select(x => x.Entity as ReadingTableQuestionAnswer)
.Where(x => x.RowId == entity.RowId&&x.TableQuestionId== entity.TableQuestionId).Select(x => x.Answer).FirstOrDefault(); .Where(x => x.RowId == entity.RowId && x.TableQuestionId == entity.TableQuestionId).Select(x => x.Answer).FirstOrDefault();
var liverSegmentation = await _dbContext.ReadingTableQuestionAnswer.Where(x => x.RowId == entity.RowId && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.liverSegmentation).Select(x => x.Answer).FirstOrDefaultAsync(); var liverSegmentation = await _dbContext.ReadingTableQuestionAnswer.Where(x => x.RowId == entity.RowId && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.liverSegmentation).Select(x => x.Answer).FirstOrDefaultAsync();
@ -3402,7 +3407,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}; };
var extraIdentification = string.Empty; var extraIdentification = string.Empty;
var isDistinctionInterface = true ; var isDistinctionInterface = true;
#region 标识区分 #region 标识区分
if (type == AuditOpt.Add) if (type == AuditOpt.Add)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class UserlogIsLoginUncommonly : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsLoginUncommonly",
table: "UserLog",
type: "bit",
nullable: false,
defaultValue: false,
comment: "异地登录");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsLoginUncommonly",
table: "UserLog");
}
}
}

View File

@ -12979,6 +12979,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasMaxLength(400) .HasMaxLength(400)
.HasColumnType("nvarchar(400)"); .HasColumnType("nvarchar(400)");
b.Property<bool>("IsLoginUncommonly")
.HasColumnType("bit")
.HasComment("异地登录");
b.Property<string>("JsonObj") b.Property<string>("JsonObj")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");