废弃之前的接口,增加统计

IRC_NewDev
hang 2024-03-11 15:56:25 +08:00
parent cd7318dd63
commit 881a5320a8
3 changed files with 68 additions and 68 deletions

View File

@ -11902,12 +11902,6 @@
映射配置
</summary>
</member>
<member name="M:IRaCIS.Core.Application.PersonalWorkstation.GetBasicStat">
<summary>
个人面板 统计值
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.PersonalWorkstation.GetSiteSurveyApprovalList(IRaCIS.Core.Application.Contracts.TrialSiteSurveyStatQuery)">
<summary>
中心调研 每个项目 需要处理的审批统计

View File

@ -386,6 +386,8 @@ namespace IRaCIS.Core.Application.Contracts
public int? TrialSignedDocCount { get; set; }
public int? SysSignedDocCount { get; set; }
public int? SysNoticeUnReadCount { get; set; }
#region PM/APM
public int? PM_SiteSurveryCount { get; set; }
public int? PM_CheckCount { get; set; }

View File

@ -42,82 +42,82 @@ namespace IRaCIS.Core.Application
_systemNoticeRepository = systemNoticeRepository;
}
/// <summary>
/// 个人面板 统计值
/// </summary>
/// <returns></returns>
public async Task<PersonalStataDTO> GetBasicStat()
{
///// <summary>
///// 个人面板 统计值
///// </summary>
///// <returns></returns>
//public async Task<PersonalStataDTO> GetBasicStat()
//{
return new PersonalStataDTO()
{
//正参与的数量
TrialCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? await _trialRepository.CountAsync()
: await _trialUserRepository.Where(t => t.UserId == _userInfo.Id && t.Trial.IsDeleted == false).CountAsync(),
// return new PersonalStataDTO()
// {
// //正参与的数量
// TrialCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? await _trialRepository.CountAsync()
// : await _trialUserRepository.Where(t => t.UserId == _userInfo.Id && t.Trial.IsDeleted == false).CountAsync(),
DeletedCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? await _trialRepository.AsQueryable(true).CountAsync(t => t.IsDeleted)
: await _trialUserRepository.AsQueryable(true).Where(t => t.UserId == _userInfo.Id && t.Trial.IsDeleted)
.CountAsync(),
// DeletedCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? await _trialRepository.AsQueryable(true).CountAsync(t => t.IsDeleted)
// : await _trialUserRepository.AsQueryable(true).Where(t => t.UserId == _userInfo.Id && t.Trial.IsDeleted)
// .CountAsync(),
TotalNeedSignTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
: await _trialDocumentRepository.AsQueryable(true).Where(t => t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
.Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)))
// TotalNeedSignTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? 0
// : await _trialDocumentRepository.AsQueryable(true).Where(t => t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
// .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
// .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)))
.SelectMany(t => t.NeedConfirmedUserTypeList)
.CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),
// .SelectMany(t => t.NeedConfirmedUserTypeList)
// .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),
HaveSignedTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
//废除了 已经签署了也要算进去
: await _trialDocumentRepository.AsQueryable(true).Where(t => t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.SelectMany(t => t.TrialDocConfirmedUserList)
.CountAsync(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null),
// HaveSignedTrialDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? 0
// //废除了 已经签署了也要算进去
// : await _trialDocumentRepository.AsQueryable(true).Where(t => t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
// .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
// .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
// .SelectMany(t => t.TrialDocConfirmedUserList)
// .CountAsync(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null),
TotalNeedSignSystemDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
: await _systemDocumentRepository
.Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)))
.SelectMany(t => t.NeedConfirmedUserTypeList)
.CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),
// TotalNeedSignSystemDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? 0
// : await _systemDocumentRepository
// .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)))
// .SelectMany(t => t.NeedConfirmedUserTypeList)
// .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId),
HaveSignedSystemDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
? 0
: await _systemDocumentRepository
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.SelectMany(t => t.SystemDocConfirmedUserList)
.CountAsync(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null),
// HaveSignedSystemDocCount = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin
// ? 0
// : await _systemDocumentRepository
// .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
// .SelectMany(t => t.SystemDocConfirmedUserList)
// .CountAsync(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null),
TotalApprovalRequiredCount =
_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM ?
_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,
// TotalApprovalRequiredCount =
// _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM ?
// _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,
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)
// 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(),
// .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))
.Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > DateTime.Now)
.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))
// .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > DateTime.Now)
// .CountAsync(),
};
// };
}
//}
/// <summary>
@ -1222,7 +1222,6 @@ namespace IRaCIS.Core.Application
.CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId);
var siteSurveyCount = await _trialRepository
.Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0)
@ -1262,9 +1261,14 @@ namespace IRaCIS.Core.Application
TrialSignedDocCount=signedTrialCount,
SysSignedDocCount=signedSysDocCont,
#region PM
SysNoticeUnReadCount= 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))
.Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > DateTime.Now)
.CountAsync(),
PM_SiteSurveryCount = isPM ? siteSurveyCount : 0,
#region PM
PM_SiteSurveryCount = isPM ? siteSurveyCount : 0,
PM_CheckCount = isPM ? await _trialRepository
.Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))