From fafe6a76a0c0c8abb73cf83c91f75016e35b93b5 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 17 May 2022 14:07:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E9=80=9A?= =?UTF-8?q?=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/SystemNoticeService.cs | 11 +++++++++++ .../DTO/PersonalWorkstationViewModel.cs | 6 ++++++ .../TrialSiteUser/PersonalWorkstation.cs | 17 +++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs index e2e626e43..45f3ddc49 100644 --- a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs +++ b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs @@ -93,6 +93,7 @@ namespace IRaCIS.Core.Application.Service public async Task DeleteSystemNotice(Guid systemNoticeId) { var success = await _systemNoticeRepository.BatchDeleteNoTrackingAsync(t => t.Id == systemNoticeId); + return ResponseOutput.Result(success); } @@ -131,5 +132,15 @@ namespace IRaCIS.Core.Application.Service } + public async Task> GetUserNoticeList() + { + var query = _systemNoticeRepository + .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id)) + .Where(t=>t.EndDate==null || t.EndDate != null && t.EndDate< DateTime.Now) + .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); + + return await query.ToListAsync(); + } + } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index a539994b9..ad6e0cb8b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -43,6 +43,12 @@ namespace IRaCIS.Core.Application.Contracts public int? TotalApprovalRequiredCount { get; set; } + + + public int? TotalSystemNoticeCount { get; set; } + + public int? NeedReadSystemNoticeCount { get; set; } + } public class TrialSiteSurveyStatQuery : PageInput diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 314ff36a4..4273797d8 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -11,13 +11,16 @@ namespace IRaCIS.Core.Application private readonly IRepository _trialUserRepository; private readonly IRepository _trialDocumentRepository; private readonly IRepository _systemDocumentRepository; + private readonly IRepository _systemNoticeRepository; - public PersonalWorkstation(IRepository trialRepository, IRepository trialUserRepository, IRepository trialDocumentRepository, IRepository systemDocumentRepository) + public PersonalWorkstation(IRepository trialRepository, IRepository trialUserRepository, IRepository trialDocumentRepository, + IRepository systemDocumentRepository,IRepository systemNoticeRepository) { _trialRepository = trialRepository; _trialUserRepository = trialUserRepository; _trialDocumentRepository = trialDocumentRepository; _systemDocumentRepository = systemDocumentRepository; + _systemNoticeRepository = systemNoticeRepository; } /// @@ -77,7 +80,17 @@ namespace IRaCIS.Core.Application _trialRepository.Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)).SelectMany(t=>t.TrialSiteSurveyList).Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() : _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM ? _trialRepository.Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)).SelectMany(t => t.TrialSiteSurveyList).Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() - :0 + :0, + + + TotalSystemNoticeCount= _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin + ? 0:await _systemNoticeRepository.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum== Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished).CountAsync(), + + NeedReadSystemNoticeCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin + ? 0 : await _systemNoticeRepository.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished + && !t.NoticeUserReadList.Any(t=>t.CreateUserId==_userInfo.Id)).CountAsync(), + + }; }