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);
}
}
}
// 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,
new
@ -2402,18 +2401,31 @@ namespace IRaCIS.Core.Application.Service.Common
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))
{
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 cloneItem = item.Clone();
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
list.Add(cloneItem);
}
//有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题
var dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
var cloneItem = item.Clone();
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
list.Add(cloneItem);
}
}
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

View File

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

View File

@ -782,7 +782,6 @@ namespace IRaCIS.Core.Application.Service
//检查数据库是否存在该验证码
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"]);
}
@ -791,7 +790,6 @@ namespace IRaCIS.Core.Application.Service
//检查验证码是否失效
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"]);
}
@ -930,6 +928,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
.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.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!))
.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));
var userLog = new UserLog();
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} 分钟后再试。"
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 iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
@ -1047,20 +1043,33 @@ namespace IRaCIS.Core.Application.Service
if (loginUser.LastLoginIP != string.Empty)
{
// 与上一次IP不一致
if (SplitAndConcatenate(loginUser.LastLoginIP) !=SplitAndConcatenate(iPRegion))
// 与上一次区域不一致
if (SplitAndConcatenate(loginUser.LastLoginIP) != SplitAndConcatenate(iPRegion))
{
loginUser.LoginState = 2;
}
}
//超过90天没修改密码
if (_verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value)
{
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;

View File

@ -1269,20 +1269,34 @@ namespace IRaCIS.Core.Application.Contracts
public class CommonLessionQuestionAnswerInfo
{
#region 肿瘤评估标准的时候需要
public string LessionCode { get; set; }
public string LessionType { 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 QuestionValue { get; set; }
public string TranslateDicName { get; set; }
public string CDISCCode { get; set; }
}

View File

@ -266,7 +266,7 @@ namespace IRaCIS.Core.Application.Service
u.Subject.ReadModuleList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.ReadingSetType == ReadingSetType.ImageReading).Select(c => c.SubjectVisit.VisitNum)))
.ForMember(o => o.ResearchProgramNo, t => t.MapFrom(u => u.Trial.ResearchProgramNo))
.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SourceSubjectVisit.VisitName))
.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SourceSubjectVisit.VisitName))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.LatestScanDate, t => t.MapFrom(u => u.SourceSubjectVisit.LatestScanDate))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<VisitTask, CommonLessionExport>()
.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>()
.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark))
@ -299,7 +299,8 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.QuestionMark, t => t.MapFrom(u => u.ReadingTableQuestionTrial.QuestionMark))
.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.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))
;

View File

@ -173,7 +173,14 @@ namespace IRaCIS.Core.Application.Service
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;
@ -185,15 +192,15 @@ namespace IRaCIS.Core.Application.Service
await _identityUserRepository.SaveChangesAsync();
}
// UPDATE[User]
//SET
// UserName = IdentityUser.UserName,
// FirstName = IdentityUser.FirstName,
//LastName = IdentityUser.LastName,
// EMail = IdentityUser.EMail
//FROM[User]
//INNER JOIN IdentityUser
//ON[User].IdentityUserId = IdentityUser.Id
// UPDATE[User]
//SET
// UserName = IdentityUser.UserName,
// FirstName = IdentityUser.FirstName,
//LastName = IdentityUser.LastName,
// EMail = IdentityUser.EMail
//FROM[User]
//INNER JOIN IdentityUser
//ON[User].IdentityUserId = IdentityUser.Id
@ -365,7 +372,7 @@ namespace IRaCIS.Core.Application.Service
ConfirmTime = confirm.ConfirmTime,
RealName = confirm.ConfirmUser.FullName,
UserName = confirm.ConfirmUser.UserName,
FullFilePath = sysDoc.Path
};

View File

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

View File

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

View File

@ -1729,16 +1729,19 @@ 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 entity = item.Entity as UserRole;
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
await InsertInspection<UserRole>(entity, type, x => new InspectionConvertDTO
var entity = item.Entity as IdentityUser;
if (!_userInfo.IsNotNeedInspection)
{
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
});
await InsertInspection<IdentityUser>(entity, type, x => new InspectionConvertDTO
{
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
});
}
}
// 项目参与人员
@ -1764,7 +1767,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
ObjectRelationParentId = x.TrialId,
ExtraIndentification = extraIndentification,
//ObjectRelationParentId2 = x.IdentityUserId,
},new {
}, new
{
identityUser.FullName,
identityUser.EMail,
@ -1797,8 +1801,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
ObjectRelationParentId = x.TrialId,
ExtraIndentification = extraIndentification,
ObjectRelationParentId2 = x.UserId,
}, new {
UserTypeEnum= userTypeEnum,
}, new
{
UserTypeEnum = userTypeEnum,
});
}
@ -3061,7 +3066,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
var entity = item.Entity as ReadingTaskQuestionMark;
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();
@ -3402,7 +3407,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
};
var extraIdentification = string.Empty;
var isDistinctionInterface = true ;
var isDistinctionInterface = true;
#region 标识区分
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)
.HasColumnType("nvarchar(400)");
b.Property<bool>("IsLoginUncommonly")
.HasColumnType("bit")
.HasComment("异地登录");
b.Property<string>("JsonObj")
.IsRequired()
.HasColumnType("nvarchar(max)");