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-08 17:09:18 +08:00
commit 67dbf7c701
4 changed files with 194 additions and 68 deletions

View File

@ -722,7 +722,7 @@
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.PMTrainingRecordList_Export(IRaCIS.Core.Application.Contracts.DocumentTrialUnionQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.PMTrainingRecordList_Export(IRaCIS.Core.Application.Contracts.DocumentTrialUnionQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SystemDocument})">
<summary>
getDocumentConfirmList 培训记录导出--new
</summary>

View File

@ -20,6 +20,7 @@ using System.Globalization;
using System.Linq;
using static IRaCIS.Core.Application.Service.ExcelExportHelper;
using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService;
using TrialIdentityUser = IRaCIS.Core.Domain.Models.TrialIdentityUser;
namespace IRaCIS.Core.Application.Service.Common
{
@ -359,91 +360,208 @@ namespace IRaCIS.Core.Application.Service.Common
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
[FromServices] IDictionaryService _dictionaryService,
[FromServices] IRepository<SubjectVisit> _subjectVisitRepository,
[FromServices] IRepository<Trial> _trialRepository
[FromServices] IRepository<Trial> _trialRepository,
[FromServices] IRepository<TrialDocument> _trialDocumentRepository,
[FromServices] IRepository<TrialIdentityUser> _trialIdentityUserRepository,
[FromServices] IRepository<SystemDocument> _systemDocumentRepository
)
{
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
.WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
select new TrainingRecordExportDTO()
{
IsSystemDoc = false,
#region 导表新
Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
//SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
//Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
//UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
//IsConfirmed= confirm.ConfirmTime!=null,
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
var trialDocQuery =
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId)
.Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true)
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
&& t.TrialUserRoleList.AsQueryable().Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId))
)
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
select new TrainingRecordExportDTO()
{
IsSystemDoc = false,
Id = trialDoc.Id,
CreateTime = trialDoc.CreateTime,
IsDeleted = trialDoc.IsDeleted,
Name = trialDoc.Name,
FileTypeId = trialDoc.FileTypeId,
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
//IsConfirmed= confirm.ConfirmTime!=null,
ConfirmUserId = trialUser.IdentityUserId,
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.IdentityUser.FullName,
UserName = trialUser.IdentityUser.UserName,
//UserTypeId = trialUser.UserRole.UserTypeId,
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
};
//ConfirmUserId = confirm.ConfirmUserId,
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.UserRole.FullName,
UserName = trialUser.UserRole.IdentityUser.UserName,
UserTypeId = trialUser.UserRole.UserTypeId,
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
var systemDocQuery =
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true)
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
//FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
};
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
select new TrainingRecordExportDTO()
{
IsSystemDoc = true,
Id = sysDoc.Id,
CreateTime = sysDoc.CreateTime,
IsDeleted = sysDoc.IsDeleted,
Name = sysDoc.Name,
FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
FileTypeId = sysDoc.FileTypeId,
//IsConfirmed = confirm.ConfirmTime != null,
ConfirmUserId = trialUser.IdentityUserId,
ConfirmTime = confirm.ConfirmTime,
var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
RealName = trialUser.IdentityUser.FullName,
UserName = trialUser.IdentityUser.UserName,
join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
from confirm in cc.DefaultIfEmpty()
select new TrainingRecordExportDTO()
{
IsSystemDoc = true,
//UserTypeId = trialUser.UserRole.UserTypeId,
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
Id = needConfirmEdUserType.SystemDocument.Id,
CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
//SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
Name = needConfirmEdUserType.SystemDocument.Name,
//Path = needConfirmEdUserType.SystemDocument.Path,
FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
//UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
//IsConfirmed = confirm.ConfirmTime != null,
};
//ConfirmUserId = confirm.ConfirmUserId,
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.UserRole.FullName,
UserName = trialUser.UserRole.IdentityUser.UserName,
UserTypeId = trialUser.UserRole.UserTypeId,
UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
//var tt = await trialDocQuery.ToPagedListAsync(inQuery);
//FullFilePath = needConfirmEdUserType.SystemDocument.Path
};
var unionQuery = trialDocQuery.Union(systemDocQuery)
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmTime == null))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId);
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted);
#endregion
#region 废弃
//var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
//var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
// .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
// .WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
// on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
// join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
// new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
// from confirm in cc.DefaultIfEmpty()
// select new TrainingRecordExportDTO()
// {
// IsSystemDoc = false,
// Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
// CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
// IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
// //SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
// Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
// //Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
// FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
// FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
// //UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
// //IsConfirmed= confirm.ConfirmTime!=null,
// //ConfirmUserId = confirm.ConfirmUserId,
// ConfirmTime = confirm.ConfirmTime,
// RealName = trialUser.UserRole.FullName,
// UserName = trialUser.UserRole.IdentityUser.UserName,
// UserTypeId = trialUser.UserRole.UserTypeId,
// UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
// //FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
// };
//var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
// .WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
// on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
// join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
// from confirm in cc.DefaultIfEmpty()
// select new TrainingRecordExportDTO()
// {
// IsSystemDoc = true,
// Id = needConfirmEdUserType.SystemDocument.Id,
// CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
// IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
// //SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
// Name = needConfirmEdUserType.SystemDocument.Name,
// //Path = needConfirmEdUserType.SystemDocument.Path,
// FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
// FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
// //UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
// //IsConfirmed = confirm.ConfirmTime != null,
// //ConfirmUserId = confirm.ConfirmUserId,
// ConfirmTime = confirm.ConfirmTime,
// RealName = trialUser.UserRole.FullName,
// UserName = trialUser.UserRole.IdentityUser.UserName,
// UserTypeId = trialUser.UserRole.UserTypeId,
// UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
// //FullFilePath = needConfirmEdUserType.SystemDocument.Path
// };
//var unionQuery = trialDocQuery.Union(systemDocQuery)
// .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
// .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
// .WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
// .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
// .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
// .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId);
#endregion
var list = await unionQuery.ToListAsync();
var trialDocIdList = list.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
var sysDocIdList = list.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
var trialIdentityUserIdList = list.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 list)
{
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();
}
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();

View File

@ -545,7 +545,7 @@ namespace IRaCIS.Core.Application.Services
//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.ConfirmTime == null))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)

View File

@ -182,23 +182,31 @@ namespace IRaCIS.Core.Application.Contracts
[DictionaryTranslateAttribute("IsSystemDoc")]
public bool IsSystemDoc { get; set; }
[DictionaryTranslateAttribute("YesOrNo")]
[DictionaryTranslateAttribute("TrainingStatus")]
public bool IsDeleted { get; set; }
//上传时间
public DateTime CreateTime { get; set; }
[DictionaryTranslateAttribute("YesOrNo")]
[DictionaryTranslateAttribute("TrainingStatusEnum")]
public bool IsConfirmed => ConfirmTime != null;
public string RealName { get; set; }
public string UserName { get; set; }
public string UserTypeShortName { get; set; }
public Guid ConfirmUserId { get; set; }
public DateTime? ConfirmTime { get; set; }
public string UserTypes => string.Join(',', UserConfirmedUserTypeList);
public List<string> UserConfirmedUserTypeList => (DocNeedSignUserTypeList != null && IdentityUserTypeList != null) ? IdentityUserTypeList.Intersect(DocNeedSignUserTypeList).ToList() : new List<string>();
public IEnumerable<string> IdentityUserTypeList { get; set; }
public IEnumerable<string> DocNeedSignUserTypeList { get; set; }
}
public class CRCVisitExportDTO