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

IRC_NewDev
he 2024-11-07 10:01:50 +08:00
commit 5b3beea8fa
14 changed files with 18218 additions and 34 deletions

View File

@ -79,6 +79,9 @@ namespace IRaCIS.Core.API
triggerOptions.AddTrigger<UserLogTrigger>();
triggerOptions.AddTrigger<UserAddTrigger>();
});
});

View File

@ -5,6 +5,7 @@
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.Contracts
{
public class TrialSelectEmailNoticeConfigView : EmailNoticeConfigView
@ -71,6 +72,8 @@ namespace IRaCIS.Core.Application.Contracts
public UserTypeEnum? CopyUserType { get; set; }
}
///<summary> EmailNoticeConfigAddOrEdit 列表查询参数模型</summary>

View File

@ -1607,11 +1607,11 @@ namespace IRaCIS.Core.Application.Service.Common
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskAllocationState==TaskAllocationState.Allocated && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskAllocationState == TaskAllocationState.Allocated && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
//一致性分析
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == null? t.Subject.SubjectVisitTaskList.Any(u=>u.IsSelfAnalysis==true &&u.DoctorUserId==t.DoctorUserId ):true)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == null ? t.Subject.SubjectVisitTaskList.Any(u => u.IsSelfAnalysis == true && u.DoctorUserId == t.DoctorUserId && u.TrialReadingCriterionId == t.TrialReadingCriterionId) : true)
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfInterReaderAnalysisResults, t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null)
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
@ -1732,7 +1732,7 @@ namespace IRaCIS.Core.Application.Service.Common
{
foreach (var qItem in selfAnalysisTask.QuestionAnswerList)
{
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "")}";
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "()")}";
}
item.QuestionAnswerList = item.QuestionAnswerList.Union(selfAnalysisTask?.QuestionAnswerList).ToList();
@ -1763,8 +1763,9 @@ namespace IRaCIS.Core.Application.Service.Common
//非一致性分析任务
var cloneObj = subjectVisitTaskArm.Clone();
var otherTaskQuestionAnserList = otherTask.QuestionAnswerList.Clone();
foreach (var qItem in otherTask.QuestionAnswerList)
foreach (var qItem in otherTaskQuestionAnserList)
{
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "()")}";
}
@ -1776,7 +1777,7 @@ namespace IRaCIS.Core.Application.Service.Common
addQuestionList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Reviwer Role(Again)" : "阅片人角色(再次)", QuestionValue = ((int)otherTask.ArmEnum).ToString(), TranslateDicName = "ArmEnum" });
cloneObj.QuestionAnswerList = cloneObj.QuestionAnswerList.Union(otherTask.QuestionAnswerList).ToList();
cloneObj.QuestionAnswerList = cloneObj.QuestionAnswerList.Union(addQuestionList).Union(otherTaskQuestionAnserList).ToList();
cloneObj.IsGroupAnalysisDiffToOriginalData = cloneObj.ArmEnum == Arm.DoubleReadingArm1 ? otherTask.IsGroupDiffArm1 : otherTask.IsGroupDiffArm2;
@ -1785,6 +1786,7 @@ namespace IRaCIS.Core.Application.Service.Common
}
}
}
translateDicNameList.Add("ArmEnum");
list = newList;

View File

@ -1242,6 +1242,8 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<PageOutput<TrialSelectEmailNoticeConfigView>> GetSysEmailNoticeConfigList(EmailNoticeConfigQuery inQuery)
{
var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First();
var emailNoticeConfigQueryable = _emailNoticeConfigRepository
.WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys)
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
@ -1252,11 +1254,40 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.EmailUrgentEnum != null, t => t.EmailUrgentEnum == inQuery.EmailUrgentEnum)
.WhereIf(inQuery.ToUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.ToUserType && t.EmailUserType == EmailUserType.To))
.WhereIf(inQuery.CopyUserType != null, t => t.EmailNoticeUserTypeList.Any(t => t.UserType == inQuery.CopyUserType && t.EmailUserType == EmailUserType.Copy))
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.EligibilityVerification)
.WhereIf(trialConfig.IsPDProgressView == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification)
.WhereIf(trialConfig.IsPDProgressView == false && trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification
&& t.BusinessModuleEnum != BusinessModule.EligibilityVerification)
.ProjectTo<TrialSelectEmailNoticeConfigView>(_mapper.ConfigurationProvider, new { trialId = inQuery.TrialId });
return await emailNoticeConfigQueryable.ToPagedListAsync(inQuery);
}
public async Task<IResponseOutput> BatchAddEnrollOrPdEmailConfig(Guid trialId)
{
var trialConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First();
var emailNoticeConfigQueryable = _emailNoticeConfigRepository
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == true && trialConfig.IsPDProgressView == false, t => t.BusinessModuleEnum == BusinessModule.EligibilityVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification)
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == false && trialConfig.IsPDProgressView == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification)
.WhereIf(trialConfig.IsPDProgressView == true && trialConfig.IsEnrollementQualificationConfirm == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification
|| t.BusinessModuleEnum == BusinessModule.EligibilityVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification)
.ProjectTo<TrialSelectEmailNoticeConfigView>(_mapper.ConfigurationProvider, new { trialId = trialId });
var list = await emailNoticeConfigQueryable.ToListAsync();
var addList = _mapper.Map<List<BatchAddTrialEmailNoticeConfig>>(list.Where(t => t.IsHaveSelected == false).ToList());
foreach (var item in addList)
{
item.TrialId = trialId;
}
return await BatchAddSysEmailConfig(addList);
}
/// <summary>
/// 批量勾选 传递列表每行数据,后台进行处理转换,建立关联关系
/// </summary>
@ -1264,6 +1295,10 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
public async Task<IResponseOutput> BatchAddSysEmailConfig(List<BatchAddTrialEmailNoticeConfig> batchAddList)
{
if (!batchAddList.Any())
{
return ResponseOutput.Ok();
}
var first = batchAddList.First();
var trialId = first.TrialId;
@ -1320,25 +1355,6 @@ namespace IRaCIS.Core.Application.Service
}
public async Task<IResponseOutput> BatchAddEnrollOrPdEmailConfig(Guid trialId)
{
var trialConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First();
var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId)
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == true, t => t.BusinessModuleEnum == BusinessModule.EligibilityVerification)
.WhereIf(trialConfig.IsPDProgressView == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification)
.WhereIf(trialConfig.IsPDProgressView == true && trialConfig.IsEnrollementQualificationConfirm == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification
&& t.BusinessModuleEnum == BusinessModule.EligibilityVerification)
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
var list = await trialEmailNoticeConfigQueryable.ToListAsync();
return await BatchAddSysEmailConfig(_mapper.Map<List<BatchAddTrialEmailNoticeConfig>>(list));
}
[HttpPost]
public async Task<IResponseOutput<List<TrialEmailNoticeConfigView>>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery)
@ -1358,10 +1374,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.CopyUserType != null, t => t.TrialEmailNoticeUserList.Any(t => t.UserType == inQuery.CopyUserType && t.EmailUserType == EmailUserType.Copy))
.WhereIf(inQuery.BusinessModuleEnum != null, t => t.BusinessModuleEnum == inQuery.BusinessModuleEnum)
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.EligibilityVerification)
.WhereIf(trialConfig.IsPDProgressView == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification)
.WhereIf(trialConfig.IsPDProgressView == false && trialConfig.IsEnrollementQualificationConfirm == false, t => t.BusinessModuleEnum != BusinessModule.PDVerification
&& t.BusinessModuleEnum != BusinessModule.EligibilityVerification)
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
var sortField = string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialEmailNoticeConfigView.Code) : inQuery.SortField;

View File

@ -53,7 +53,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<BatchAddTrialEmailNoticeConfig, TrialEmailNoticeConfig>();
CreateMap<TrialEmailNoticeConfigView, BatchAddTrialEmailNoticeConfig > ();
CreateMap<TrialSelectEmailNoticeConfigView, BatchAddTrialEmailNoticeConfig > ();
CreateMap<AddOrEditTrialDocument, TrialDocument>()

View File

@ -135,7 +135,7 @@ namespace IRaCIS.Application.Contracts
public string LastName { get; set; } = string.Empty;
public int? Sex { get; set; } // 1-男 2-女
public int Status { get; set; } = 1; // 0-已删除 1-正常
public UserStateEnum Status { get; set; } = UserStateEnum.Enable;
public string Phone { get; set; } = string.Empty;
public string EMail { get; set; } = string.Empty;

View File

@ -558,6 +558,13 @@ namespace IRaCIS.Core.Application.Service
if (user == null) return Null404NotFound(user);
if (user.Status!=model.Status)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = model.Status == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true);
}
_mapper.Map(model, user);
if (user.IsZhiZhun)
@ -565,7 +572,9 @@ namespace IRaCIS.Core.Application.Service
user.OrganizationName = _userInfo.IsEn_Us ? _systemEmailConfig.OrganizationName : _systemEmailConfig.OrganizationNameCN;
}
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = UserOptType.UpdateUser }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = UserOptType.UpdateUser });
var success = await _userRepository.SaveChangesAsync();
@ -802,7 +811,7 @@ namespace IRaCIS.Core.Application.Service
DateTime? trialCreateTime = inQuery.TrialId != null ? _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.CreateTime).FirstOrDefault() : null;
var userLogQueryable =
_userLogRepository
_userLogRepository.AsQueryable().IgnoreQueryFilters()
.WhereIf(inQuery.TrialId != null, t => t.LoginUser.UserTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId)))
.WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime)
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)

View File

@ -26,4 +26,15 @@ namespace IRaCIS.Core.Application.Triggers
}
}
}
public class UserAddTrigger(IUserInfo _userInfo, IRepository<UserLog> _userLogReposiotry) : IBeforeSaveTrigger<User>
{
public async Task BeforeSave(ITriggerContext<User> context, CancellationToken cancellationToken)
{
var user = context.Entity;
await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.Id, IP = _userInfo.IP });
}
}
}

View File

@ -44,6 +44,8 @@ public enum UserOptType
MFALogin = 12,
MFALoginFail = 13,
AddUser = 14
}
[Description("影像下载打包状态")]

View File

@ -5,7 +5,7 @@ namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 系统账户")]
[Table("User")]
public class User : BaseFullAuditEntity
public class User : BaseFullDeleteAuditEntity
{
#region 导航属性

View File

@ -19,6 +19,7 @@ public class UserLog : BaseAddAuditEntity
public string LoginPassword { get; set; } = string.Empty;
public Guid? LoginUserId { get; set; }
[Comment("被操作的人,自己操作的就是自己")]
public Guid? OptUserId { get; set; }
public string IPRegion { get; set; } = string.Empty;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class UserSoftDelete : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "OptUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
comment: "被操作的人,自己操作的就是自己",
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleteUserId",
table: "User",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletedTime",
table: "User",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "User",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DeleteUserId",
table: "User");
migrationBuilder.DropColumn(
name: "DeletedTime",
table: "User");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "User");
migrationBuilder.AlterColumn<Guid>(
name: "OptUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true,
oldComment: "被操作的人,自己操作的就是自己");
}
}
}

View File

@ -12599,6 +12599,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("DeleteUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("DeletedTime")
.HasColumnType("datetime2");
b.Property<string>("DepartmentName")
.IsRequired()
.HasMaxLength(400)
@ -12623,6 +12629,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<bool>("IsFirstAdd")
.HasColumnType("bit")
.HasComment("首次登录需要修改密码");
@ -12826,7 +12835,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("int");
b.Property<Guid?>("OptUserId")
.HasColumnType("uniqueidentifier");
.HasColumnType("uniqueidentifier")
.HasComment("被操作的人,自己操作的就是自己");
b.HasKey("Id");