Merge branch 'Test_IRC_Net10' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net10
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
commit
1053fdc8a8
|
|
@ -117,7 +117,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@
|
||||||
// 是否启用重复请求检测
|
// 是否启用重复请求检测
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
// 重复请求时间窗口(毫秒)
|
// 重复请求时间窗口(毫秒)
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
// 缓存请求时间(秒)
|
// 缓存请求时间(秒)
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
{
|
{
|
||||||
using Database.Api;
|
using Database.Api;
|
||||||
using DocumentFormat.OpenXml.InkML;
|
using DocumentFormat.OpenXml.InkML;
|
||||||
|
using IRaCIS.Core.Application.Helper.OtherTool;
|
||||||
using IRaCIS.Core.Application.Service.Common;
|
using IRaCIS.Core.Application.Service.Common;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
|
|
@ -17,6 +18,7 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
@ -35,7 +37,7 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">logger</param>
|
/// <param name="logger">logger</param>
|
||||||
/// <param name="accessor">loggerHelper</param>
|
/// <param name="accessor">loggerHelper</param>
|
||||||
public class RequestDuplicationFilter(ILogger<RequestDuplicationFilter> logger, IHttpContextAccessor accessor, IUserInfo _userInfo, IStringLocalizer _localizer, IOptionsMonitor<RequestDuplicationOptions> RequestDuplicationOptionsMonitor) : ExceptionFilterAttribute, IAsyncActionFilter
|
public class RequestDuplicationFilter(ILogger<RequestDuplicationFilter> logger, IHttpContextAccessor accessor, IUserInfo _userInfo, IStringLocalizer _localizer, IOptionsMonitor<RequestDuplicationOptions> RequestDuplicationOptionsMonitor, IConfiguration _config) : ExceptionFilterAttribute, IAsyncActionFilter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传入的参数
|
/// 传入的参数
|
||||||
|
|
@ -118,11 +120,51 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
RequestDuplicationOptionsMonitor.CurrentValue.DuplicationWindowMs);
|
RequestDuplicationOptionsMonitor.CurrentValue.DuplicationWindowMs);
|
||||||
if (!isAdded)
|
if (!isAdded)
|
||||||
{
|
{
|
||||||
|
SendRequestDuplicationWeComNotice(requestPath);
|
||||||
|
logger.LogError($"重复请求出现错误:{this.Intoparam}");
|
||||||
throw new BusinessValidationFailedException(_localizer["RequestDuplicationFilter_RequestDuplication"], ApiResponseCodeEnum.BusinessValidationFailed);
|
throw new BusinessValidationFailedException(_localizer["RequestDuplicationFilter_RequestDuplication"], ApiResponseCodeEnum.BusinessValidationFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendRequestDuplicationWeComNotice(string requestPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isOpenWeComNotice = _config.GetValue<bool>("WeComNoticeConfig:IsOpenWeComNotice");
|
||||||
|
|
||||||
|
if (isOpenWeComNotice)
|
||||||
|
{
|
||||||
|
string webhook = _config["WeComNoticeConfig:WebhookUrl"] ?? string.Empty;
|
||||||
|
|
||||||
|
var uri = new Uri(_config["SystemEmailSendConfig:SiteUrl"]);
|
||||||
|
var baseUrl = uri.GetLeftPart(UriPartial.Authority);
|
||||||
|
|
||||||
|
var userList = _config.GetSection("WeComNoticeConfig:APINoticeUserList").Get<string[]>();
|
||||||
|
|
||||||
|
var request = accessor?.HttpContext?.Request;
|
||||||
|
|
||||||
|
_ = WeComNotifier.SendAlertAsync(
|
||||||
|
webhook: webhook,
|
||||||
|
alert: new WeComAlert
|
||||||
|
{
|
||||||
|
Env = baseUrl,
|
||||||
|
UserName = _userInfo.UserName.IsNotNullOrEmpty() ? $"{_userInfo.UserName}({_userInfo.UserTypeShortName})" : "匿名",
|
||||||
|
Api = $"{request?.Method} {requestPath}",
|
||||||
|
Message = "重复请求拦截",
|
||||||
|
JsonData = this.Intoparam,
|
||||||
|
Stack = string.Empty,
|
||||||
|
AtUsers = userList ?? []
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError($"重复请求过滤器里发送企业微信出现错误:{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GenerateParameterHash(string parameters)
|
public string GenerateParameterHash(string parameters)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(parameters))
|
if (string.IsNullOrEmpty(parameters))
|
||||||
|
|
|
||||||
|
|
@ -16282,7 +16282,7 @@
|
||||||
<param name="logger">logger</param>
|
<param name="logger">logger</param>
|
||||||
<param name="accessor">loggerHelper</param>
|
<param name="accessor">loggerHelper</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api.RequestDuplicationFilter.#ctor(Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api.RequestDuplicationFilter},Microsoft.AspNetCore.Http.IHttpContextAccessor,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.RequestDuplicationOptions})">
|
<member name="M:IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api.RequestDuplicationFilter.#ctor(Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.Application.BusinessFilter.LegacyController.Database.Api.RequestDuplicationFilter},Microsoft.AspNetCore.Http.IHttpContextAccessor,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.RequestDuplicationOptions},Microsoft.Extensions.Configuration.IConfiguration)">
|
||||||
<summary>
|
<summary>
|
||||||
请求拦截 请求前后的操作
|
请求拦截 请求前后的操作
|
||||||
</summary>
|
</summary>
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,13 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
var systemDocQuery =
|
var systemDocQuery =
|
||||||
from sysDoc in _systemDocumentRepository.AsQueryable(false)
|
from sysDoc in _systemDocumentRepository.AsQueryable(false)
|
||||||
from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.Status == UserStateEnum.Enable&&!t.IsTestUser).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.Status == UserStateEnum.Enable).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||||
join confirmc in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = identityUser.Id, SystemDocumentId = sysDoc.Id } equals new { confirmc.ConfirmUserId, confirmc.SystemDocumentId } into cc
|
join confirmc in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = identityUser.Id, SystemDocumentId = sysDoc.Id } equals new { confirmc.ConfirmUserId, confirmc.SystemDocumentId } into cc
|
||||||
from confirm in cc.DefaultIfEmpty()
|
from confirm in cc.DefaultIfEmpty()
|
||||||
select new UnionDocumentWithConfirmInfoView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
|
DocLanguageType=sysDoc.DocLanguageType,
|
||||||
|
UserWorkLanguage=identityUser.UserWorkLanguage,
|
||||||
IsSystemDoc = true,
|
IsSystemDoc = true,
|
||||||
Id = sysDoc.Id,
|
Id = sysDoc.Id,
|
||||||
CreateTime = sysDoc.CreateTime,
|
CreateTime = sysDoc.CreateTime,
|
||||||
|
|
@ -79,7 +81,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
};
|
};
|
||||||
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(t => t.IsDeleted == false && t.ConfirmTime == null)
|
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(t => t.IsDeleted == false && t.ConfirmTime == null)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
datalist = datalist.Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date)
|
datalist = datalist
|
||||||
|
.Where(x=>x.DocLanguageType == DocLanguageType.CN_US || (int)x.DocLanguageType == (int)x.UserWorkLanguage)
|
||||||
|
.Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date)
|
||||||
.Where(x => x.IsNeedSendEmial).ToList();
|
.Where(x => x.IsNeedSendEmial).ToList();
|
||||||
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||||
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
||||||
|
|
@ -168,7 +172,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
Console.WriteLine($"只发送给新增的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
|
Console.WriteLine($"只发送给新增的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
|
||||||
}
|
}
|
||||||
// 构建查询
|
// 构建查询
|
||||||
IQueryable<UnionDocumentWithConfirmInfoView> systemDocQuery;
|
IQueryable<TriaAndSystemlSignDocView> systemDocQuery;
|
||||||
|
|
||||||
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
||||||
{
|
{
|
||||||
|
|
@ -176,12 +180,14 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
systemDocQuery =
|
systemDocQuery =
|
||||||
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||||
from identityUser in _identityUserRepository.AsQueryable(false)
|
from identityUser in _identityUserRepository.AsQueryable(false)
|
||||||
.Where(t => t.Status == UserStateEnum.Enable && !t.IsTestUser &&
|
.Where(t => t.Status == UserStateEnum.Enable &&
|
||||||
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
||||||
.Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) &&
|
.Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) &&
|
||||||
sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||||
select new UnionDocumentWithConfirmInfoView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
|
DocLanguageType = sysDoc.DocLanguageType,
|
||||||
|
UserWorkLanguage = identityUser.UserWorkLanguage,
|
||||||
IsSystemDoc = true,
|
IsSystemDoc = true,
|
||||||
Id = sysDoc.Id,
|
Id = sysDoc.Id,
|
||||||
CreateTime = sysDoc.CreateTime,
|
CreateTime = sysDoc.CreateTime,
|
||||||
|
|
@ -204,11 +210,13 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
systemDocQuery =
|
systemDocQuery =
|
||||||
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||||
from identityUser in _identityUserRepository.AsQueryable(false)
|
from identityUser in _identityUserRepository.AsQueryable(false)
|
||||||
.Where(t => t.Status == UserStateEnum.Enable && !t.IsTestUser &&
|
.Where(t => t.Status == UserStateEnum.Enable &&
|
||||||
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
||||||
.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||||
select new UnionDocumentWithConfirmInfoView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
|
DocLanguageType = sysDoc.DocLanguageType,
|
||||||
|
UserWorkLanguage = identityUser.UserWorkLanguage,
|
||||||
IsSystemDoc = true,
|
IsSystemDoc = true,
|
||||||
Id = sysDoc.Id,
|
Id = sysDoc.Id,
|
||||||
CreateTime = sysDoc.CreateTime,
|
CreateTime = sysDoc.CreateTime,
|
||||||
|
|
@ -226,7 +234,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(x => x.IsNeedSendEmial).ToListAsync();
|
var datalist = await systemDocQuery.IgnoreQueryFilters().Where(x => x.IsNeedSendEmial).ToListAsync();
|
||||||
|
datalist = datalist.Where(x => x.DocLanguageType == DocLanguageType.CN_US || (int)x.DocLanguageType == (int)x.UserWorkLanguage).ToList();
|
||||||
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||||
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
var trialDocQuery =
|
var trialDocQuery =
|
||||||
from trialDoc in _trialDocumentRepository.AsQueryable(true)
|
from trialDoc in _trialDocumentRepository.AsQueryable(true)
|
||||||
|
join trial in _trialRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trial.Id
|
||||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||||
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||||
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable && !u.IsTestUser)
|
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable && !u.IsTestUser)
|
||||||
|
|
@ -64,15 +64,18 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
|
|
||||||
from confirm in cc.DefaultIfEmpty()
|
from confirm in cc.DefaultIfEmpty()
|
||||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||||
select new TrialSignDocView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
|
|
||||||
TrialCode = trialDoc.Trial.TrialCode,
|
TrialCode = trialDoc.Trial.TrialCode,
|
||||||
ResearchProgramNo = trialDoc.Trial.ResearchProgramNo,
|
ResearchProgramNo = trialDoc.Trial.ResearchProgramNo,
|
||||||
ExperimentName = trialDoc.Trial.ExperimentName,
|
ExperimentName = trialDoc.Trial.ExperimentName,
|
||||||
CurrentStaffTrainDays = trialDoc.CurrentStaffTrainDays,
|
CurrentStaffTrainDays = trialDoc.CurrentStaffTrainDays,
|
||||||
NewStaffTrainDays = trialDoc.NewStaffTrainDays,
|
NewStaffTrainDays = trialDoc.NewStaffTrainDays,
|
||||||
Id = trialDoc.Id,
|
Id = trialDoc.Id,
|
||||||
TrialId= trialDoc.TrialId,
|
TrialType= trial.TrialType,
|
||||||
|
IsTestUser= identityUser.IsTestUser,
|
||||||
|
TrialId = trialDoc.TrialId,
|
||||||
IsSystemDoc = false,
|
IsSystemDoc = false,
|
||||||
CreateTime = trialDoc.CreateTime,
|
CreateTime = trialDoc.CreateTime,
|
||||||
FullFilePath = trialDoc.Path,
|
FullFilePath = trialDoc.Path,
|
||||||
|
|
@ -94,7 +97,11 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
};
|
};
|
||||||
var datalist = await trialDocQuery.IgnoreQueryFilters().Where(t => t.IsDeleted == false && t.ConfirmTime == null&&t.ConfirmTime==null)
|
var datalist = await trialDocQuery.IgnoreQueryFilters().Where(t => t.IsDeleted == false && t.ConfirmTime == null&&t.ConfirmTime==null)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
datalist = datalist.Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date)
|
|
||||||
|
|
||||||
|
datalist = datalist
|
||||||
|
.Where(x=>((x.TrialType== TrialType.OfficialTrial|| x.TrialType== TrialType.Training) && !x.IsTestUser) || (x.TrialType==TrialType.NoneOfficial &&x.IsTestUser))
|
||||||
|
.Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date)
|
||||||
.ToList();
|
.ToList();
|
||||||
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||||
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
||||||
|
|
@ -203,20 +210,21 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
Console.WriteLine($"只发送给新增项目的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
|
Console.WriteLine($"只发送给新增项目的角色,角色数量: {context.Message.NewUserTypeIds.Count}");
|
||||||
}
|
}
|
||||||
// 构建查询
|
// 构建查询
|
||||||
IQueryable<UnionDocumentWithConfirmInfoView> systemDocQuery;
|
IQueryable<TriaAndSystemlSignDocView> trialDocQuery;
|
||||||
|
|
||||||
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any())
|
||||||
{
|
{
|
||||||
// 只查询新增角色的用户
|
// 只查询新增角色的用户
|
||||||
systemDocQuery =
|
trialDocQuery =
|
||||||
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||||
|
join trial in _trialRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trial.Id
|
||||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x=>x.IsDeleted==false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
join trialIdentityUser in _trialIdentityUserRepository.Where(x=>x.IsDeleted==false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||||
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||||
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable && !u.IsTestUser)
|
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable && !u.IsTestUser)
|
||||||
on trialIdentityUser.IdentityUserId equals identityUser.Id
|
on trialIdentityUser.IdentityUserId equals identityUser.Id
|
||||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && context.Message.NewUserTypeIds.Contains(ur.UserRole.UserTypeId) && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && context.Message.NewUserTypeIds.Contains(ur.UserRole.UserTypeId) && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||||
|
|
||||||
select new UnionDocumentWithConfirmInfoView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
IsSystemDoc = true,
|
IsSystemDoc = true,
|
||||||
Id = trialDoc.Id,
|
Id = trialDoc.Id,
|
||||||
|
|
@ -224,6 +232,8 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
CreateTime = trialDoc.CreateTime,
|
CreateTime = trialDoc.CreateTime,
|
||||||
IsDeleted = trialDoc.IsDeleted,
|
IsDeleted = trialDoc.IsDeleted,
|
||||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||||
|
TrialType = trial.TrialType,
|
||||||
|
IsTestUser = identityUser.IsTestUser,
|
||||||
Name = trialDoc.Name,
|
Name = trialDoc.Name,
|
||||||
Path = trialDoc.Path,
|
Path = trialDoc.Path,
|
||||||
FileTypeId = trialDoc.FileTypeId,
|
FileTypeId = trialDoc.FileTypeId,
|
||||||
|
|
@ -238,8 +248,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 查询所有相关角色的用户
|
// 查询所有相关角色的用户
|
||||||
systemDocQuery =
|
trialDocQuery =
|
||||||
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||||
|
|
||||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||||
join trialUserRole in _trialUserRoleRepository.Where(x=>x.IsDeleted==false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
join trialUserRole in _trialUserRoleRepository.Where(x=>x.IsDeleted==false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||||
|
|
||||||
|
|
@ -249,7 +260,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted &&trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted &&trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||||
|
|
||||||
|
|
||||||
select new UnionDocumentWithConfirmInfoView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
IsSystemDoc = false,
|
IsSystemDoc = false,
|
||||||
Id = trialDoc.Id,
|
Id = trialDoc.Id,
|
||||||
|
|
@ -258,6 +269,8 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
CreateTime = trialDoc.CreateTime,
|
CreateTime = trialDoc.CreateTime,
|
||||||
IsDeleted = trialDoc.IsDeleted,
|
IsDeleted = trialDoc.IsDeleted,
|
||||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||||
|
TrialType = trial.TrialType,
|
||||||
|
IsTestUser = identityUser.IsTestUser,
|
||||||
Name = trialDoc.Name,
|
Name = trialDoc.Name,
|
||||||
Path = trialDoc.Path,
|
Path = trialDoc.Path,
|
||||||
FileTypeId = trialDoc.FileTypeId,
|
FileTypeId = trialDoc.FileTypeId,
|
||||||
|
|
@ -270,7 +283,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var datalist = await systemDocQuery.IgnoreQueryFilters().ToListAsync();
|
var datalist = await trialDocQuery
|
||||||
|
.IgnoreQueryFilters().Where(x => ((x.TrialType == TrialType.OfficialTrial || x.TrialType == TrialType.Training) && !x.IsTestUser) || (x.TrialType == TrialType.NoneOfficial && x.IsTestUser))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||||
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync();
|
||||||
|
|
|
||||||
|
|
@ -80,14 +80,18 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrialSignDocView : UnionDocumentWithConfirmInfoView
|
public class TriaAndSystemlSignDocView : UnionDocumentWithConfirmInfoView
|
||||||
{
|
{
|
||||||
public string TrialCode { get; set; }
|
public string TrialCode { get; set; }
|
||||||
public string ResearchProgramNo { get; set; }
|
public string ResearchProgramNo { get; set; }
|
||||||
|
|
||||||
public string ExperimentName { get; set; }
|
public string ExperimentName { get; set; }
|
||||||
|
|
||||||
|
public TrialType TrialType { get; set; }
|
||||||
|
|
||||||
|
public bool IsTestUser { get; set; }
|
||||||
|
|
||||||
|
public UserWorkLanguage UserWorkLanguage { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -365,6 +369,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
public DocLanguageType DocLanguageType { get; set; }
|
public DocLanguageType DocLanguageType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,8 @@ namespace IRaCIS.Core.Application.Services
|
||||||
return ResponseOutput.Result(true);
|
return ResponseOutput.Result(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下线系统文档
|
/// 下线系统文档
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<TrialSignDocView>> GetTrialSignDocumentList(TrialDocQuery inQuery)
|
public async Task<PageOutput<TriaAndSystemlSignDocView>> GetTrialSignDocumentList(TrialDocQuery inQuery)
|
||||||
{
|
{
|
||||||
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.IsPublish)
|
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.IsPublish)
|
||||||
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
||||||
|
|
@ -164,7 +164,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||||
|
|
||||||
from confirm in cc.DefaultIfEmpty()
|
from confirm in cc.DefaultIfEmpty()
|
||||||
select new TrialSignDocView()
|
select new TriaAndSystemlSignDocView()
|
||||||
{
|
{
|
||||||
TrialCode = trialDoc.Trial.TrialCode,
|
TrialCode = trialDoc.Trial.TrialCode,
|
||||||
ResearchProgramNo = trialDoc.Trial.ResearchProgramNo,
|
ResearchProgramNo = trialDoc.Trial.ResearchProgramNo,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue