账户稽查修改
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-11-06 15:15:32 +08:00
parent b5e26da1ff
commit c48803ca0c
10 changed files with 18183 additions and 10 deletions

View File

@ -1269,17 +1269,23 @@ namespace IRaCIS.Core.Application.Service
var emailNoticeConfigQueryable = _emailNoticeConfigRepository
.WhereIf(trialConfig.IsEnrollementQualificationConfirm == true, t => t.BusinessModuleEnum == BusinessModule.EligibilityVerification)
.WhereIf(trialConfig.IsPDProgressView == true, t => t.BusinessModuleEnum == BusinessModule.PDVerification)
.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.EligibilityVerification || t.BusinessModuleEnum == BusinessModule.Eligibility_PDVerification)
.ProjectTo<TrialSelectEmailNoticeConfigView>(_mapper.ConfigurationProvider);
var list = await emailNoticeConfigQueryable.ToListAsync();
var addList = _mapper.Map<List<BatchAddTrialEmailNoticeConfig>>(list.Where(t => t.IsHaveSelected == false).ToList());
return await BatchAddSysEmailConfig(_mapper.Map<List<BatchAddTrialEmailNoticeConfig>>(list.Where(t => t.IsHaveSelected == false).ToList()));
foreach (var item in addList)
{
item.TrialId = trialId;
}
return await BatchAddSysEmailConfig(addList);
}
/// <summary>
@ -1289,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;
@ -1351,7 +1361,7 @@ namespace IRaCIS.Core.Application.Service
{
//await SyncSystemEmainCofigDocListAsync(inQuery.TrialId);
var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First();
var trialEmailNoticeConfigQueryable = _trialEmailNoticeConfigRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.IsDistinguishCriteria == false, t => t.TrialReadingCriterionId == null)

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");