From 6543aba53fa2adcf68ba656b717f923e6eb2ceb8 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 10 Apr 2025 11:50:20 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=AD=BE=E7=BD=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 22 ++++-
.../Document/DTO/SystemDocumentViewModel.cs | 36 +++++++
.../Service/Document/TrialDocumentService.cs | 94 +++++++++++++++++--
3 files changed, 145 insertions(+), 7 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index f8d55064a..84315adeb 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -15815,6 +15815,26 @@
SystemDocumentQuery 列表查询参数模型
+
+
+ 课时状态
+
+
+
+
+ 用户名
+
+
+
+
+ 开始时间
+
+
+
+
+ 结束时间
+
+
课时状态
@@ -16972,7 +16992,7 @@
TrialDocumentService
-
+
TrialDocumentService
diff --git a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs
index af6e3765c..0809ef1ba 100644
--- a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs
@@ -170,6 +170,42 @@ namespace IRaCIS.Core.Application.Contracts
public string SignText { get; set; } = string.Empty;
}
+
+ public class SystemDocQuery:PageInput
+ {
+ public Guid? FileTypeId { get; set; }
+
+
+ public string Name { get; set; } = string.Empty;
+
+ public bool? IsSign { get; set; }
+
+ public Guid? UserTypeId { get; set; }
+ public Guid? UserId { get; set; }
+
+ public bool? IsConfirmed { get; set; }
+
+ ///
+ /// 课时状态
+ ///
+ public bool? IsDeleted { get; set; }
+
+ ///
+ /// 用户名
+ ///
+ public string? UserName { get; set; }
+
+ ///
+ /// 开始时间
+ ///
+ public DateTime? StartConfirmTime { get; set; }
+
+ ///
+ /// 结束时间
+ ///
+ public DateTime? EndConfirmTime { get; set; }
+ }
+
public class DocumentTrialUnionQuery : TrialUserDocUnionQuery
{
diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
index b60504a4b..933e5895e 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
@@ -8,6 +8,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
+using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using NPOI.SS.Formula.Functions;
@@ -29,6 +30,7 @@ namespace IRaCIS.Core.Application.Services
IRepository _systemDocumentRepository,
IRepository _trialIdentityUserRepository,
IRepository _trialUserRoleRepository,
+ IRepository _identityUserRepository,
IRepository _trialDocConfirmedUserRepository,
IRepository _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService
{
@@ -473,12 +475,12 @@ namespace IRaCIS.Core.Application.Services
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)
- .Where(t => inQuery.UserTypeId != null ? t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == 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)
+ .Where(t => inQuery.UserTypeId != null ? t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == inQuery.UserTypeId) : 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
@@ -749,6 +751,86 @@ namespace IRaCIS.Core.Application.Services
}
+ [HttpPost]
+ public async Task>> GetSysDocumentConfirmList(SystemDocQuery inQuery)
+ {
+ var systemDocQuery =
+ from sysDoc in _systemDocumentRepository.AsQueryable(false)
+ .Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true)
+ from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
+ .Where(t => inQuery.UserId != null ? t.Id == inQuery.UserId : true)
+ .Where(t => inQuery.UserTypeId != null ? t.UserRoleList.Any(t => t.UserTypeId == inQuery.UserTypeId && t.IsUserRoleDisabled == false) : true)
+ join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = identityUser.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
+ from confirm in cc.DefaultIfEmpty()
+ select new UnionDocumentWithConfirmInfoView()
+ {
+ IsSystemDoc = true,
+
+ Id = sysDoc.Id,
+ CreateTime = sysDoc.CreateTime,
+ IsDeleted = sysDoc.IsDeleted,
+ SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
+ Name = sysDoc.Name,
+ Path = sysDoc.Path,
+ FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
+ FileTypeId = sysDoc.FileTypeId,
+ UpdateTime = sysDoc.UpdateTime,
+ //IsConfirmed = confirm.ConfirmTime != null,
+
+ ConfirmUserId = identityUser.Id,
+ ConfirmTime = confirm.ConfirmTime,
+
+ RealName = identityUser.FullName,
+ UserName = identityUser.UserName,
+
+ //UserTypeId = trialUser.UserRole.UserTypeId,
+ //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
+
+ FullFilePath = sysDoc.Path
+ };
+
+ var unionQuery = 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.StartConfirmTime != null, t => t.ConfirmTime >= inQuery.StartConfirmTime.Value)
+ .WhereIf(inQuery.EndConfirmTime != null, t => t.ConfirmTime <= inQuery.EndConfirmTime.Value)
+ .WhereIf(!string.IsNullOrEmpty(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName))
+ .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted);
+
+ 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 identityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
+
+
+ var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
+
+ var identityUserUserTypeList = _identityUserRepository.Where(t => identityUserIdList.Contains(t.Id)).IgnoreQueryFilters().Select(t => new { IdentityUserId = t.Id, UserTypeList = t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Select(c => c.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();
+ }
+
+
+ item.IdentityUserTypeList = identityUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
+ }
+
+
+ #endregion
+
+ return ResponseOutput.Ok(result);
+ }
///
/// 项目下面的参与用户下拉