You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.3 KiB
67 lines
2.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Domain.Entities.Events.Distributed;
|
|
using Volo.Abp.EventBus.Distributed;
|
|
using Volo.Abp.Guids;
|
|
using Volo.Abp.Timing;
|
|
using Win.Abp.SerialNumber;
|
|
using Win_in.Sfs.Message.Domain;
|
|
using Win_in.Sfs.Shared.Event;
|
|
|
|
namespace Win_in.Sfs.Message.Event
|
|
{
|
|
public class SystemMessageEventHandler : IDistributedEventHandler<EntityCreatedEto<SystemMessageETO>>,
|
|
ITransientDependency
|
|
{
|
|
private readonly IClock _clock;
|
|
private readonly ISerialNumberGenerator _numberGenerator;
|
|
private readonly IGuidGenerator _guidGenerator;
|
|
private readonly ISystemMessageRepository _systemMessageRepository;
|
|
|
|
//TODO 开关放到系统配置中,通过依赖注入获取
|
|
private bool _autoCreateDeliverPlanByCustomerAsn = true;
|
|
|
|
public async Task HandleEventAsync(EntityCreatedEto<SystemMessageETO> eventData)
|
|
{
|
|
//开关控制
|
|
if (!_autoCreateDeliverPlanByCustomerAsn)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var arriveNotices = CreateSystemMessage(eventData.Entity);
|
|
|
|
await _systemMessageRepository.InsertAsync(arriveNotices);
|
|
}
|
|
|
|
private SystemMessage CreateSystemMessage(SystemMessageETO systemMessageEto)
|
|
{
|
|
var systemMessage = new SystemMessage()
|
|
{
|
|
Company= systemMessageEto.Company,
|
|
Site = systemMessageEto.Site,
|
|
TenantId= systemMessageEto.TenantId,
|
|
|
|
|
|
Content = systemMessageEto.Content,
|
|
From= systemMessageEto.From,
|
|
IsPush= systemMessageEto.IsPush,
|
|
IsRead= systemMessageEto.IsRead,
|
|
MessageContentType=systemMessageEto.MessageContentType,
|
|
MessageLevel=systemMessageEto.MessageLevel,
|
|
MessageSendTypeEnum=systemMessageEto.MessageSendTypeEnum,
|
|
NotificationLevel=systemMessageEto.NotificationLevel,
|
|
ReadTime=systemMessageEto.ReadTime,
|
|
To= systemMessageEto.To,
|
|
Title=systemMessageEto.Title,
|
|
SendTime=systemMessageEto.SendTime,
|
|
|
|
};
|
|
|
|
return systemMessage;
|
|
}
|
|
}
|
|
}
|
|
|