发通知

This commit is contained in:
xiaolipro 2024-09-15 15:05:50 +08:00
parent 22ebcda424
commit 4a2b87ba36
3 changed files with 56 additions and 8 deletions

View File

@ -9,16 +9,17 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BSI.Stack.Rabbit" Version="2.0.9" /> <PackageReference Include="BSI.Stack.Rabbit" Version="2.0.9" />
<PackageReference Include="SJZY.FSCenter.Client" Version="1.5.7"/>
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.2.3"/> <PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.2.3"/>
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" /> <PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.9-alpha"/> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.9-alpha"/>
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" /> <PackageReference Include="SJZY.Expand.CAP" Version="7.8.0" />
<PackageReference Include="DotNetCore.CAP" Version="8.1.2"/> <PackageReference Include="DotNetCore.CAP" Version="8.2.0"/>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="8.1.2"/> <PackageReference Include="DotNetCore.CAP.Dashboard" Version="8.2.0"/>
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="8.1.2"/> <PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="8.2.0"/>
<PackageReference Include="DotNetCore.CAP.MySql" Version="8.1.2"/> <PackageReference Include="DotNetCore.CAP.MySql" Version="8.2.0"/>
<PackageReference Include="DotNetCore.CAP.InMemoryStorage" Version="8.1.2"/> <PackageReference Include="DotNetCore.CAP.InMemoryStorage" Version="8.2.0"/>
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="7.0.0"/> <PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="7.0.0"/>
</ItemGroup> </ItemGroup>

View File

@ -2,13 +2,20 @@ using System.Text;
using FreeRedis; using FreeRedis;
using SJZY.Expand.ABP.Core; using SJZY.Expand.ABP.Core;
using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.Logger;
using SJZY.FSCenter.Application.Dtos.Message;
using SJZY.FSCenter.Client.Client.Message;
using SJZY.FSCenter.Repository.Enum;
using SJZY.Track.Application.Contract.Dtos.Forewarning; using SJZY.Track.Application.Contract.Dtos.Forewarning;
using SJZY.Track.Application.Contract.Services; using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Domain.Aggregates.ForewarningAggregate; using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
using SJZY.Track.Domain.Dtos.Forewarning; using SJZY.Track.Domain.Dtos.Forewarning;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;
using SJZY.Track.Share.Enums; using SJZY.Track.Share.Enums;
using SJZY.UserCenter.HttpApi.Services.Message;
using SJZY.UserCenter.SharedModel.Dtos.Message;
using SJZY.UserCenter.SharedModel.Enums;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.DynamicProxying;
namespace SJZY.Track.Application.Services.ForewarningServices; namespace SJZY.Track.Application.Services.ForewarningServices;
@ -18,15 +25,20 @@ namespace SJZY.Track.Application.Services.ForewarningServices;
public class ForewarningNotifyService : IForewarningNotifyService, ITransientDependency public class ForewarningNotifyService : IForewarningNotifyService, ITransientDependency
{ {
private readonly IForewarningCacheService _cacheService; private readonly IForewarningCacheService _cacheService;
private readonly IMessageClient _messageClient;
private readonly IHttpClientProxy<IRequestSendMessageService> _requestSendMessageService;
private readonly IWarningQueries _warningQueries; private readonly IWarningQueries _warningQueries;
private readonly IWarningRecordEsRepository _warningRecordEsRepository; private readonly IWarningRecordEsRepository _warningRecordEsRepository;
public ForewarningNotifyService(IForewarningCacheService cacheService, IWarningQueries warningQueries, public ForewarningNotifyService(IForewarningCacheService cacheService, IWarningQueries warningQueries,
IWarningRecordEsRepository warningRecordEsRepository) IWarningRecordEsRepository warningRecordEsRepository,
IHttpClientProxy<IRequestSendMessageService> requestSendMessageService, IMessageClient messageClient)
{ {
_cacheService = cacheService; _cacheService = cacheService;
_warningQueries = warningQueries; _warningQueries = warningQueries;
_warningRecordEsRepository = warningRecordEsRepository; _warningRecordEsRepository = warningRecordEsRepository;
_requestSendMessageService = requestSendMessageService;
_messageClient = messageClient;
} }
/// <summary> /// <summary>
@ -162,11 +174,41 @@ public class ForewarningNotifyService : IForewarningNotifyService, ITransientDep
if (!string.IsNullOrEmpty(siteInternalContent)) if (!string.IsNullOrEmpty(siteInternalContent))
{ {
// todo:发送站内通知 // todo:发送站内通知
_ = _requestSendMessageService.Service.SendMessageByEmptyTemplateAsync(
new SendMessageByEmptyTemplateInput
{
IsNeedToHandle = null,
BizId = null,
MsgSource = null,
SystemId = 0,
TemplateCode = null,
Channels = null,
MsgTitle = null,
MsgContent = null,
PcURl = null,
MobileURl = null,
FileUrl = null,
fileName = null,
receivers = null,
SiteLetterComponentStyle = (ComponentStyle) 0
});
} }
if (!string.IsNullOrEmpty(feiShuContent)) if (!string.IsNullOrEmpty(feiShuContent))
{ {
// todo:发送飞书通知 // 发送飞书通知
_ = _messageClient.SendMessageAsync(new SendMessageInput
{
AppId = null,
AppSecret = null,
ReceiveIdType = IdTypeEnums.user_id,
MsgType = MsgTypeEnums.文本,
ReceiveIds = new List<string>
{
userRule.Key.ToString()
},
Content = feiShuContent
});
} }
} }

View File

@ -7,6 +7,7 @@ using Savorboard.CAP.InMemoryMessageQueue;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.Logger; using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.FSCenter.Client;
using SJZY.InterfaceRelay.Application.Contracts; using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.CAP; using SJZY.Track.Application.CAP;
using SJZY.Track.Application.Contract; using SJZY.Track.Application.Contract;
@ -34,7 +35,8 @@ namespace SJZY.Track.Application;
typeof(SjzyUserCenterHttpApiModule), typeof(SjzyUserCenterHttpApiModule),
typeof(SJZYInterfaceRelayApplicationContractsModule), typeof(SJZYInterfaceRelayApplicationContractsModule),
typeof(SjzyTrackDomainModule), typeof(SjzyTrackDomainModule),
typeof(SjzyTrackApplicationContractModule) typeof(SjzyTrackApplicationContractModule),
typeof(FSCenterModule)
)] )]
public class SjzyTrackApplicationModule : AbpModule public class SjzyTrackApplicationModule : AbpModule
{ {
@ -149,6 +151,9 @@ public class SjzyTrackApplicationModule : AbpModule
} }
}; };
}, typeof(SjzyTrackApplicationModule).Assembly); }, typeof(SjzyTrackApplicationModule).Assembly);
// 飞书
context.Services.Configure<SystemKeyOption>(option => { option.SystemKey = "aaa"; });
} }
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)