diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 93700823d..b2a47a637 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -976,6 +976,12 @@ + + + 获取需要签署的系统文档列表 + + + TrialDocumentService @@ -1009,6 +1015,20 @@ + + + 项目下面的参与用户下拉 + + + + + + + 项目+系统的文档类型 下拉 + + + + 已签名的文档 不允许删除 @@ -1471,6 +1491,26 @@ 映射配置 + + + 个人面板 统计值 + + + + + + Site 调研 每个项目 处理任务数 + + + + + + + 需要签署数量 + + + + 获取签名文本 diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index 1238d2353..4af16b93a 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Infra.EFCore; +using User = IRaCIS.Core.Domain.Models.User; namespace IRaCIS.Core.Application.Services { @@ -22,12 +23,12 @@ namespace IRaCIS.Core.Application.Services { private readonly IWebHostEnvironment _hostEnvironment; - private readonly IRepository systemDocumentRepository; + private readonly IRepository _systemDocumentRepository; public SystemDocumentService(IWebHostEnvironment hostEnvironment, IRepository systemDocumentRepository) { _hostEnvironment = hostEnvironment; - this.systemDocumentRepository = systemDocumentRepository; + _systemDocumentRepository = systemDocumentRepository; } /// @@ -36,9 +37,9 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpPost] - public async Task> GetSystemDocumentListAsync(SystemDocumentQuery querySystemDocument) + public async Task> GetSystemDocumentListAsync(SystemDocumentQuery querySystemDocument) { - var systemDocumentQueryable = systemDocumentRepository + var systemDocumentQueryable = _systemDocumentRepository .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Type), t => t.Type.Contains(querySystemDocument.Type)) .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); @@ -53,23 +54,23 @@ namespace IRaCIS.Core.Application.Services var entity = _mapper.Map(addOrEditSystemDocument); - if (await systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name)) + if (await _systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name)) { return ResponseOutput.NotOk("同类型已存在该文件名"); } - await systemDocumentRepository.AddAsync(entity,true); + await _systemDocumentRepository.AddAsync(entity, true); return ResponseOutput.Ok(entity.Id.ToString()); } else { - var document = await systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync(); + var document = await _systemDocumentRepository.Where(t => t.Id == addOrEditSystemDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefaultAsync(); if (document == null) return Null404NotFound(document); - if (await systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id)) + if (await _systemDocumentRepository.AnyAsync(t => t.Type == addOrEditSystemDocument.Type && t.Name == addOrEditSystemDocument.Name && t.Id != addOrEditSystemDocument.Id)) { return ResponseOutput.NotOk("同类型已存在该文件名"); } @@ -118,5 +119,49 @@ namespace IRaCIS.Core.Application.Services } + /// + /// 获取需要签署的系统文档列表 + /// + /// + + public async Task> GetWaitSignSysDocList() + { + + + var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + + join confirm in _repository.GetQueryable() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc + from confirm in cc.DefaultIfEmpty() + + join user in _repository.GetQueryable() on _userInfo.Id equals user.Id + + select new UnionDocumentWithConfirmInfoView() + { + IsSystemDoc = true, + + Id = sysDoc.Id, + CreateTime = sysDoc.CreateTime, + IsAbandon = sysDoc.IsAbandon, + SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes, + Name = sysDoc.Name, + Path = sysDoc.Path, + Type = sysDoc.Type, + UpdateTime = sysDoc.UpdateTime, + + FullFilePath = sysDoc.Path + "?access_token=" + _userInfo.UserToken, + + ConfirmUserId = confirm.ConfirmUserId, + ConfirmTime = confirm.ConfirmTime, + RealName = user.LastName + " / " + user.FirstName, + UserName = user.UserName, + UserTypeShortName = user.UserTypeRole.UserTypeShortName + }; + + return await query.Where(t=>t.ConfirmTime==null).ToListAsync(); + + + + } + } } diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 8c77260e3..de0f8a378 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -361,7 +361,11 @@ namespace IRaCIS.Core.Application.Services } - + /// + /// 项目下面的参与用户下拉 + /// + /// + /// [HttpGet("{trialId:guid}")] public async Task> GetTrialUserSelect(Guid trialId) { @@ -371,13 +375,17 @@ namespace IRaCIS.Core.Application.Services } - + /// + /// 项目+系统的文档类型 下拉 + /// + /// + /// [HttpGet("{trialId:guid}")] public async Task> GetTrialDocAndSystemDocType(Guid trialId) { - return await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.Type).Union(_repository.GetQueryable().Select(t => t.Type)).Distinct() - - .ToListAsync(); + return await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.Type) + .Union(_repository.GetQueryable().Select(t => t.Type)).Distinct() + .ToListAsync(); } public async Task AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument) @@ -565,6 +573,7 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpGet("{trialId:guid}")] + [Obsolete] public List GetTrialUserDocumentList(Guid trialId) { var query = _repository.Where(t => t.TrialId == trialId) @@ -593,6 +602,7 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpPost] + [Obsolete] public PageOutput GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument) { var systemDocumentQueryable = _repository diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index ab3e606a3..fc609650b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -55,6 +55,9 @@ namespace IRaCIS.Core.Application.Contracts public class DocSignStat : TrialSelectDTO { + + public bool IsSystemDoc { get; set; } = false; + public int? WaitSignCount { get; set; } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 04e924bcb..b3e7ec5f4 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application private readonly IRepository _trialDocumentRepository; private readonly IRepository _systemDocumentRepository; - public PersonalWorkstation(IRepository trialRepository, IRepository trialUserRepository, IRepository trialDocumentRepository,IRepository systemDocumentRepository) + public PersonalWorkstation(IRepository trialRepository, IRepository trialUserRepository, IRepository trialDocumentRepository, IRepository systemDocumentRepository) { _trialRepository = trialRepository; _trialUserRepository = trialUserRepository; @@ -20,11 +20,13 @@ namespace IRaCIS.Core.Application _systemDocumentRepository = systemDocumentRepository; } - - public async Task GetBasicStat() + /// + /// 个人面板 统计值 + /// + /// + public async Task GetBasicStat() { - return new PersonalStataDTO() { //正参与的数量 @@ -72,17 +74,55 @@ namespace IRaCIS.Core.Application }; - - } + /// + /// Site 调研 每个项目 处理任务数 + /// + /// + /// + [HttpPost] public async Task> GetSiteSurveyApprovalList(TrialSiteSurveyStatQuery query) { return await _trialRepository.ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }) .ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField, query.Asc); + } + + + /// + /// 需要签署文件数量 系统级别的在第一行 + /// + /// + /// + [HttpPost] + public async Task> GetTrialDocStatList(TrialSiteSurveyStatQuery query) + { + var trialDocStat = await _trialRepository.ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, userTypeId = _userInfo.UserTypeId }) + .ToPagedListAsync(query.PageIndex, query.PageSize - 1, query.SortField, query.Asc); + + + var sysDocStat = new DocSignStat() + { + IsSystemDoc = true, + WaitSignCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin + ? 0 + : await _systemDocumentRepository + .Where(t => + t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && + !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)) + .CountAsync() + + }; + + var list = trialDocStat.CurrentPageData.ToList(); + + list.Insert(0,sysDocStat); + + trialDocStat.CurrentPageData= list; + return trialDocStat; } @@ -90,5 +130,6 @@ namespace IRaCIS.Core.Application + } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index b8639d5be..f7d49e140 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -227,7 +227,17 @@ namespace IRaCIS.Core.Application.Service u.MapFrom( c => userTypeEnumInt == (int)UserTypeEnum.SuperAdmin|| userTypeEnumInt == (int)UserTypeEnum.APM ? c.TrialSiteSurveyList.Where(t=> t.State==TrialSiteSurveyEnum.SPMApproved).Count() : c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count()) - ); + ); + + var userTypeId = Guid.Empty; + CreateMap() + .ForMember(t => t.WaitSignCount, u => + u.MapFrom(c => userTypeEnumInt == (int)UserTypeEnum.SuperAdmin ? 0 + + : c.TrialDocumentList.Where(t => t.NeedConfirmedUserTypeList.Any(t=>t.NeedConfirmUserTypeId== userTypeId) && !t.TrialDocConfirmedUserList.Any(t=>t.ConfirmUserId==userId)).Count()) + ); + + }