52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using Apache.IoTDB.DataStructure;
|
|||
|
|
using Apache.IoTDB;
|
|||
|
|
using Confluent.Kafka;
|
|||
|
|
using JiShe.CollectBus.Ammeters;
|
|||
|
|
using JiShe.CollectBus.FreeSql;
|
|||
|
|
using JiShe.CollectBus.IoTDBProvider;
|
|||
|
|
using JiShe.CollectBus.IotSystems.PrepayModel;
|
|||
|
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using Microsoft.Extensions.Options;
|
|||
|
|
using JiShe.CollectBus.IoTDBProvider.Context;
|
|||
|
|
using Microsoft.Extensions.Logging;
|
|||
|
|
using JiShe.CollectBus.Common.Helpers;
|
|||
|
|
using JiShe.CollectBus.IotSystems.AFNEntity;
|
|||
|
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
|||
|
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
using JiShe.CollectBus.Cassandra;
|
|||
|
|
using JiShe.CollectBus.Common.Enums;
|
|||
|
|
using JiShe.CollectBus.IotSystems.MessageIssueds;
|
|||
|
|
using Volo.Abp.Application.Services;
|
|||
|
|
|
|||
|
|
namespace JiShe.CollectBus.Samples;
|
|||
|
|
|
|||
|
|
[AllowAnonymous]
|
|||
|
|
public class TestAppService : CollectBusAppService, IApplicationService
|
|||
|
|
{
|
|||
|
|
private readonly ILogger<TestAppService> _logger;
|
|||
|
|
private readonly ICassandraRepository<MessageIssued,string> _messageIssuedCassandraRepository;
|
|||
|
|
public TestAppService(
|
|||
|
|
ILogger<TestAppService> logger,
|
|||
|
|
ICassandraRepository<MessageIssued, string> messageIssuedCassandraRepository
|
|||
|
|
)
|
|||
|
|
{
|
|||
|
|
_logger = logger;
|
|||
|
|
_messageIssuedCassandraRepository = messageIssuedCassandraRepository;
|
|||
|
|
}
|
|||
|
|
public async Task AddMessage()
|
|||
|
|
{
|
|||
|
|
await _messageIssuedCassandraRepository.InsertAsync(new MessageIssued
|
|||
|
|
{
|
|||
|
|
ClientId = Guid.NewGuid().ToString(),
|
|||
|
|
Message = Array.Empty<byte>(),
|
|||
|
|
DeviceNo = "123321312",
|
|||
|
|
MessageId = Guid.NewGuid().ToString(),
|
|||
|
|
Type = IssuedEventType.Data
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|