用户角色签名修改
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net8
hang 2024-12-31 09:26:05 +08:00
parent f97df34b65
commit c9c38b5053
2 changed files with 91 additions and 57 deletions

View File

@ -65,12 +65,10 @@ namespace IRaCIS.Core.Application.Contracts
//public string DocNeedSignUserTypes { get; set; } //public string DocNeedSignUserTypes { get; set; }
//public List<string> UserConfirmedUserTypeList => IdentityUserTypeList.Intersect(DocNeedSignUserTypeList).ToList(); public List<string> UserConfirmedUserTypeList => (DocNeedSignUserTypeList != null && IdentityUserTypeList != null) ? IdentityUserTypeList.Intersect(DocNeedSignUserTypeList).ToList() : new List<string>();
[JsonIgnore]
public IEnumerable<string> IdentityUserTypeList { get; set; } public IEnumerable<string> IdentityUserTypeList { get; set; }
[JsonIgnore]
public IEnumerable<string> DocNeedSignUserTypeList { get; set; } public IEnumerable<string> DocNeedSignUserTypeList { get; set; }
} }

View File

@ -258,6 +258,7 @@ namespace IRaCIS.Core.Application.Services
//UserTypeId = trialUser.UserRole.UserTypeId, //UserTypeId = trialUser.UserRole.UserTypeId,
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
//DocNeedSignUserTypeList = sysDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
FullFilePath = sysDoc.Path FullFilePath = sysDoc.Path
}; };
@ -294,6 +295,8 @@ namespace IRaCIS.Core.Application.Services
RealName = trialUser.IdentityUser.FullName, RealName = trialUser.IdentityUser.FullName,
UserName = trialUser.IdentityUser.UserName, UserName = trialUser.IdentityUser.UserName,
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
//UserTypeId = trialUser.UserRole.UserTypeId, //UserTypeId = trialUser.UserRole.UserTypeId,
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
@ -392,7 +395,7 @@ namespace IRaCIS.Core.Application.Services
#region 报错 奇怪的bug #region 报错 奇怪的bug
var unionQuery = systemDocQuery.Union(trialDocQuery) var unionQuery = systemDocQuery.Concat(trialDocQuery)
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
.WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null) .WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null)
@ -489,13 +492,14 @@ namespace IRaCIS.Core.Application.Services
ConfirmUserId = confirm.ConfirmUserId, ConfirmUserId = trialUser.IdentityUserId,
ConfirmTime = confirm.ConfirmTime, ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.IdentityUser.FullName, RealName = trialUser.IdentityUser.FullName,
UserName = trialUser.IdentityUser.UserName, UserName = trialUser.IdentityUser.UserName,
//UserTypeId = trialUser.UserRole.UserTypeId, //UserTypeId = trialUser.UserRole.UserTypeId,
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
FullFilePath = trialDoc.Path FullFilePath = trialDoc.Path
}; };
@ -525,7 +529,7 @@ namespace IRaCIS.Core.Application.Services
UpdateTime = sysDoc.UpdateTime, UpdateTime = sysDoc.UpdateTime,
//IsConfirmed = confirm.ConfirmTime != null, //IsConfirmed = confirm.ConfirmTime != null,
ConfirmUserId = confirm.ConfirmUserId, ConfirmUserId = trialUser.IdentityUserId,
ConfirmTime = confirm.ConfirmTime, ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.IdentityUser.FullName, RealName = trialUser.IdentityUser.FullName,
@ -537,7 +541,7 @@ namespace IRaCIS.Core.Application.Services
FullFilePath = sysDoc.Path FullFilePath = sysDoc.Path
}; };
var tt = await trialDocQuery.ToPagedListAsync(inQuery); //var tt = await trialDocQuery.ToPagedListAsync(inQuery);
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null)) var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
@ -546,7 +550,39 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null) .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted); .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted);
var result = await trialDocQuery.ToPagedListAsync(inQuery); var result = await unionQuery.ToPagedListAsync(inQuery);
#region 处理文档 需要签署的角色类型 和每个人的角色信息
var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
var sysDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
var trialIdentityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
var trialDocUserTypeList = _trialDocNeedConfirmedUserTypeRepository.Where(t => trialDocIdList.Contains(t.TrialDocumentId)).Select(t => new { t.TrialDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
var trialUserUserTypeList = _trialIdentityUserRepository.Where(t => t.TrialId==inQuery.TrialId && trialIdentityUserIdList.Contains(t.IdentityUserId)).Select(t => new { t.IdentityUserId, UserTypeList = t.TrialUserRoleList.Select(c => c.UserRole.UserTypeRole.UserTypeShortName).ToList() });
foreach (var item in result.CurrentPageData)
{
if (item.IsSystemDoc)
{
item.DocNeedSignUserTypeList = sysDocUserTypeList.Where(t => t.SystemDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
}
else
{
item.DocNeedSignUserTypeList = trialDocUserTypeList.Where(t => t.TrialDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
}
item.IdentityUserTypeList = trialUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
}
#endregion
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true) var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId)) .Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))