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
continuous-integration/drone/push Build is passing
Details
commit
b203c891a4
|
@ -136,7 +136,7 @@ namespace IRaCIS.Api.Controllers
|
|||
|
||||
var loginReturn = new LoginReturnDTO() { BasicInfo = basicInfo };
|
||||
|
||||
loginReturn.JWTStr = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = basicInfo.IdentityUserId });
|
||||
loginReturn.JWTStr = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = basicInfo.IdentityUserId });
|
||||
|
||||
|
||||
// 创建一个 CookieOptions 对象,用于设置 Cookie 的属性
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//---[来自展影IRC] 关于创建账户的提醒
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id });
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token });
|
||||
|
||||
|
@ -507,7 +507,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = sysUserInfo.Id });
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
|
|
|
@ -389,8 +389,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
objectLsit.Add(newNamepDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId3, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
|
@ -401,7 +399,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//用户的数据稽查没有 临时处理
|
||||
|
||||
|
||||
var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync();
|
||||
var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.IdentityUser.FullName, t.IdentityUser.Phone, t.IdentityUser.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.IdentityUser.EMail, t.IdentityUser.OrganizationName }).FirstOrDefaultAsync();
|
||||
|
||||
if (userObj != null)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public string? ActionUserName { get; set; }
|
||||
|
||||
public UserTypeEnum? ActionUserTypeEnum { get; set; }
|
||||
public string ActionUserRoleShortName { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
@ -25,9 +25,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public string TargetIdentityUserName { get; set; }
|
||||
|
||||
|
||||
public UserTypeEnum? OptUserTypeEnum { get; set; }
|
||||
|
||||
public UserLogJsonObj JsonObj { get; set; }
|
||||
public string JsonObj { get; set; }
|
||||
|
||||
public string IPRegion { get; set; }
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
if (!string.IsNullOrEmpty(editPwModel.NewUserName))
|
||||
{
|
||||
|
||||
await VerifyUserNameAsync(_userInfo.UserRoleId, editPwModel.NewUserName);
|
||||
await VerifyUserNameAsync(_userInfo.IdentityUserId, editPwModel.NewUserName);
|
||||
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == _userInfo.IdentityUserId, u => new IdentityUser()
|
||||
{
|
||||
|
@ -556,6 +556,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
addRole.UserTypeEnum = role.UserTypeEnum;
|
||||
addRole.UserTypeId = role.UserTypeId;
|
||||
addRole.IsUserRoleDisabled = role.IsUserRoleDisabled;
|
||||
|
||||
addRoleList.Add(addRole);
|
||||
}
|
||||
|
@ -685,6 +686,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
addRole.IdentityUserId = user.Id;
|
||||
addRole.UserTypeEnum = role.UserTypeEnum;
|
||||
addRole.UserTypeId = role.UserTypeId;
|
||||
addRole.IsUserRoleDisabled = role.IsUserRoleDisabled;
|
||||
|
||||
user.UserRoleList.Add(addRole);
|
||||
}
|
||||
|
@ -906,13 +908,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var userLogQueryable =
|
||||
_userLogRepository.AsQueryable().IgnoreQueryFilters()
|
||||
.WhereIf(inQuery.TrialId != null, t => t.CreateUserRole.UserRoleTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId)))
|
||||
.WhereIf(inQuery.TrialId != null, t => t.ActionIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId))
|
||||
.WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime)
|
||||
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)
|
||||
.WhereIf(inQuery.UserId != null, t => t.LoginUserId == inQuery.UserId)
|
||||
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
|
||||
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.CreateUserRole.UserName.Contains(inQuery.LoginUserName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.LoginFaildName.Contains(inQuery.LoginFaildName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))
|
||||
.WhereIf(inQuery.LoginUserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.LoginUserTypeEnum)
|
||||
|
@ -1129,7 +1130,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IsZhiZhun = t.IdentityUser.IsZhiZhun,
|
||||
FullName = t.IdentityUser.FullName,
|
||||
PermissionStr = t.UserTypeRole.PermissionStr,
|
||||
UserName = t.UserName,
|
||||
UserName = t.IdentityUser.UserName,
|
||||
UserTypeShortName = t.UserTypeRole.UserTypeShortName,
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
|
@ -1139,8 +1140,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var jwt = _tokenService.GetToken(userTokenInfo);
|
||||
|
||||
|
||||
|
||||
return jwt;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -123,8 +123,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<UserLog, UserLogView>()
|
||||
.ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName))
|
||||
.ForMember(d => d.ActionUserTypeEnum, c => c.MapFrom(t => t.CreateUserRole.UserTypeEnum));
|
||||
.ForMember(d => d.ActionUserRoleShortName, c => c.MapFrom(t => t.CreateUserRole.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName));
|
||||
|
||||
|
||||
CreateMap<UserFeedBack, UserFeedBackView>()
|
||||
|
@ -162,7 +162,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<UserBasicInfoCommand, IdentityUser>();
|
||||
|
||||
CreateMap<UserRole, IdentityUser>();
|
||||
CreateMap<UserRole, IdentityUser>().ReverseMap();
|
||||
|
||||
CreateMap<UserCommand, UserRole>();
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
result.ReviewStatus = info.ReviewStatus;
|
||||
}
|
||||
|
||||
result.Token = _tokenService.GetToken(new UserTokenInfo() { UserRoleId = Guid.NewGuid() });
|
||||
result.Token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = Guid.NewGuid() });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Application.Interfaces;
|
|||
using IRaCIS.Core.Application.Contracts.DTO;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MassTransit.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
|
@ -174,23 +175,33 @@ namespace IRaCIS.Core.Application.Service
|
|||
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
|
||||
{
|
||||
|
||||
foreach (var item in userTrialCommands.GroupBy(t => t.IdentityUserId))
|
||||
{
|
||||
var currentUserRoleList = item.ToList();
|
||||
|
||||
var first = currentUserRoleList.FirstOrDefault();
|
||||
|
||||
var currentUser = new TrialIdentityUser()
|
||||
var findTrialuser = await _trialIdentityUserRepository.Where(t => t.TrialId == first.TrialId && t.IdentityUserId == item.Key, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync();
|
||||
|
||||
if (findTrialuser == null)
|
||||
{
|
||||
TrialId = first.TrialId,
|
||||
IdentityUserId = item.Key,
|
||||
JoinTime = DateTime.Now,
|
||||
TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList()
|
||||
};
|
||||
var currentUser = new TrialIdentityUser()
|
||||
{
|
||||
TrialId = first.TrialId,
|
||||
IdentityUserId = item.Key,
|
||||
JoinTime = DateTime.Now,
|
||||
TrialUserRoleList = currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId }).ToList()
|
||||
};
|
||||
|
||||
|
||||
await _trialIdentityUserRepository.AddAsync(currentUser);
|
||||
}
|
||||
else
|
||||
{
|
||||
findTrialuser.TrialUserRoleList.AddRange(currentUserRoleList.Select(t => new TrialUserRole() { UserId = t.UserId, TrialId = t.TrialId, TrialUserId = findTrialuser.Id }).ToList());
|
||||
}
|
||||
|
||||
|
||||
await _trialIdentityUserRepository.AddAsync(currentUser);
|
||||
|
||||
var success = await _trialIdentityUserRepository.SaveChangesAsync();
|
||||
|
||||
|
|
|
@ -41,11 +41,20 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger
|
|||
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
userlog.JsonObj = obj;
|
||||
|
||||
await _identityUserRepository.SaveChangesAsync();
|
||||
|
||||
userlog.JsonObj = obj.ToJsonStr();
|
||||
|
||||
}
|
||||
|
||||
if (userlog.ActionIdentityUserId != null && userlog.ActionUserName.IsNullOrWhiteSpace())
|
||||
{
|
||||
userlog.ActionUserName = await _identityUserRepository.Where(t => t.Id == userlog.ActionIdentityUserId).Select(t => t.UserName).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
await _identityUserRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public enum UserOptType
|
|||
Login = 1,
|
||||
|
||||
[Description("选择登录角色")]
|
||||
LoginSelectRole =11,
|
||||
LoginSelectRole =18,
|
||||
|
||||
[Description("更新用户角色")]
|
||||
UpdateUserRole =15,
|
||||
|
@ -44,8 +44,6 @@ public enum UserOptType
|
|||
//admin 重置密码
|
||||
ResetPassword = 9,
|
||||
|
||||
DeleteUser = 10,
|
||||
|
||||
UpdateUser = 11,
|
||||
|
||||
MFALogin = 12,
|
||||
|
|
|
@ -115,6 +115,10 @@ public class UserRole : BaseFullAuditEntity
|
|||
[Table("IdentityUser")]
|
||||
public class IdentityUser: BaseFullAuditEntity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public List<TrialIdentityUser> UserTrialList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<UserRole> UserRoleList { get; set; } = new List<UserRole>();
|
||||
|
||||
[Projectable]
|
||||
|
|
|
@ -10,6 +10,10 @@ public class UserLog : BaseAddAuditEntity
|
|||
[JsonIgnore]
|
||||
public IdentityUser TargetIdentityUser { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public IdentityUser ActionIdentityUser { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public string IP { get; set; } = string.Empty;
|
||||
|
@ -27,7 +31,7 @@ public class UserLog : BaseAddAuditEntity
|
|||
public string ActionUserName { get; set; }
|
||||
|
||||
[MaxLength]
|
||||
public UserLogJsonObj JsonObj { get; set; }
|
||||
public string JsonObj { get; set; }
|
||||
|
||||
|
||||
[Comment("被操作的对象 admin 修改张三信息 张三是被操作对象")]
|
||||
|
@ -66,7 +70,6 @@ public class UserLogJsonObj
|
|||
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public List<UserRoleLogObj> UserRoleList { get; set; }
|
||||
|
||||
}
|
||||
|
|
|
@ -63,15 +63,6 @@ public class IRaCISDBContext : DbContext
|
|||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
modelBuilder.Entity<UserLog>(entity =>
|
||||
{
|
||||
entity.OwnsOne(x => x.JsonObj, ownedNavigationBuilder =>
|
||||
{
|
||||
ownedNavigationBuilder.ToJson();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TestLength>(entity =>
|
||||
{
|
||||
// 使用部分加密值转换器,前 2 个字符不加密,方便模糊搜索
|
||||
|
|
Loading…
Reference in New Issue