修改代码
This commit is contained in:
parent
a304e908aa
commit
ded12729d9
@ -0,0 +1,9 @@
|
|||||||
|
namespace JiShe.CollectBus.Application.Contracts
|
||||||
|
{
|
||||||
|
public interface ICommandService
|
||||||
|
{
|
||||||
|
Task<bool> AmmeterParameterSendAsync();
|
||||||
|
bool AmmeterParameterReading();
|
||||||
|
bool ActivePowerIndicationReading();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
116
JiShe.CollectBus.Application/CommandService.cs
Normal file
116
JiShe.CollectBus.Application/CommandService.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JiShe.CollectBus.Application.Contracts;
|
||||||
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Application
|
||||||
|
{
|
||||||
|
public class CommandService: ICommandService,ISingletonDependency
|
||||||
|
{
|
||||||
|
private readonly ILogger<CommandService> _logger;
|
||||||
|
private readonly INSender _nSender;
|
||||||
|
|
||||||
|
public async Task<bool> AmmeterParameterSendAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
var listMeter = new List<AmmeterParameter>()
|
||||||
|
{
|
||||||
|
new AmmeterParameter()
|
||||||
|
{
|
||||||
|
Pn = 1,
|
||||||
|
BaudRate = 3,
|
||||||
|
Port = 2,
|
||||||
|
ProtocolType = CommunicationProtocolType.DLT6452007,
|
||||||
|
Address = "312408006642",
|
||||||
|
Password = "000000",
|
||||||
|
RateNumber = 4,
|
||||||
|
IntegerBitNumber = 4,
|
||||||
|
DecimalBitNumber = 4,
|
||||||
|
CollectorAddress = "000000000000",
|
||||||
|
UserCategoryNumber = 0,
|
||||||
|
UserSubclassNumber = 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var bytes = HexStringExtensions.BuildAmmeterParameterSetSendCmd(new ReqParameter2()
|
||||||
|
{
|
||||||
|
AFN = AFN.设置参数,
|
||||||
|
FunCode = (int)CMasterStationFunCode.请求1级数据,
|
||||||
|
A = "322009872",
|
||||||
|
Seq = new Seq()
|
||||||
|
{
|
||||||
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
|
FIRFIN = FIRFIN.单帧,
|
||||||
|
CON = CON.需要对该帧进行确认,
|
||||||
|
PRSEQ = 10,
|
||||||
|
},
|
||||||
|
MSA = 13,
|
||||||
|
Pn = 0,
|
||||||
|
Fn = 10
|
||||||
|
}, listMeter);
|
||||||
|
|
||||||
|
await _nSender.SendToIssuedAsync(new MessageIssuedEvent { DeviceNo = "322009872", Message = bytes, Type = IssuedEventType.Data, MessageId = Guid.NewGuid().ToString() });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AmmeterParameterReading()
|
||||||
|
{
|
||||||
|
HexStringExtensions.BuildAmmeterParameterReadingSendCmd(new ReqParameter2()
|
||||||
|
{
|
||||||
|
AFN = AFN.查询参数,
|
||||||
|
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
||||||
|
A = "322009872",
|
||||||
|
Seq = new Seq()
|
||||||
|
{
|
||||||
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
|
FIRFIN = FIRFIN.单帧,
|
||||||
|
CON = CON.不需要对该帧进行确认,
|
||||||
|
PRSEQ = 2,
|
||||||
|
},
|
||||||
|
MSA = 13,
|
||||||
|
Pn = 0,
|
||||||
|
Fn = 10
|
||||||
|
}, new List<int>() { 1, 2 });
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ActivePowerIndicationReading()
|
||||||
|
{
|
||||||
|
|
||||||
|
//var str = "68A600A6006888203290261A0A6200000201010001000100621E426622082431000000000000040300000000000000CA16";
|
||||||
|
//var cmdResult = new BuildCommand().AnalysisCmd(str);
|
||||||
|
//if(cmdResult != null)
|
||||||
|
//{
|
||||||
|
// var list = new BuildCommand().AnalysisAFN04F10DataUnit(cmdResult.HexDatas);
|
||||||
|
//}
|
||||||
|
HexStringExtensions.BuildSendCommandBytes(new ReqParameter2()
|
||||||
|
{
|
||||||
|
AFN = AFN.请求实时数据,
|
||||||
|
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
||||||
|
A = "322009872",
|
||||||
|
Seq = new Seq()
|
||||||
|
{
|
||||||
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
|
FIRFIN = FIRFIN.单帧,
|
||||||
|
CON = CON.不需要对该帧进行确认,
|
||||||
|
PRSEQ = 2,
|
||||||
|
},
|
||||||
|
MSA = 13,
|
||||||
|
Pn = 1,
|
||||||
|
Fn = 129
|
||||||
|
});
|
||||||
|
|
||||||
|
//HexStringExtensions.AmmeterValveControl("312408006642", "", "000000", true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,7 +11,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.Application.Contracts\JiShe.CollectBus.Application.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,16 +1,23 @@
|
|||||||
using System.Reflection;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using JiShe.CollectBus.Common.Jobs;
|
using JiShe.CollectBus.Common.Jobs;
|
||||||
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
|
using MassTransit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Application
|
namespace JiShe.CollectBus.Application
|
||||||
{
|
{
|
||||||
|
[DependsOn(typeof(JiSheCollectBusMqSenderModule))]
|
||||||
public class JiSheCollectBusApplicationModule: AbpModule
|
public class JiSheCollectBusApplicationModule: AbpModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
context.Services.AddSingleton<ISendEndpointProvider>();
|
||||||
|
|
||||||
//var configuration = context.Services.GetConfiguration();
|
//var configuration = context.Services.GetConfiguration();
|
||||||
//context.Services.AddJobs(configuration);
|
//context.Services.AddJobs(configuration);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
//using JiShe.CollectBus.Common.Extensions.DependencyInjections;
|
|
||||||
//using System.Reflection;
|
|
||||||
//using JiShe.CollectBus.Common.Abstractions;
|
|
||||||
//using Microsoft.Extensions.Hosting;
|
|
||||||
//using System;
|
|
||||||
//using Microsoft.Extensions.Configuration;
|
|
||||||
//using Serilog;
|
|
||||||
|
|
||||||
//// ReSharper disable once CheckNamespace
|
|
||||||
//namespace Microsoft.Extensions.DependencyInjection
|
|
||||||
//{
|
|
||||||
// public static class DependencyInjectionExtensions
|
|
||||||
// {
|
|
||||||
// public static IServiceCollection ModuleRegister(this IServiceCollection services, IConfiguration configuration)
|
|
||||||
// {
|
|
||||||
// var assemblies = GetBinAssemblies();
|
|
||||||
|
|
||||||
// foreach (var assembly in assemblies)
|
|
||||||
// {
|
|
||||||
// var allTypes = assembly.GetTypes();
|
|
||||||
// foreach (var type in allTypes)
|
|
||||||
// {
|
|
||||||
// if (typeof(IJiSheModule).IsAssignableFrom(type) && type is { IsClass: true, IsAbstract: false })
|
|
||||||
// {
|
|
||||||
// Log.Logger.Information($"正在加载模块{type.Name}...");
|
|
||||||
// var instance = Activator.CreateInstance(type);
|
|
||||||
// _ = (type.GetMethod("ConfigureServices")?.Invoke(instance, [services, configuration]));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return services;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public static IServiceCollection ServiceRegister(this IServiceCollection services)
|
|
||||||
// {
|
|
||||||
// var assemblies = GetBinAssemblies();
|
|
||||||
|
|
||||||
// foreach (var assembly in assemblies)
|
|
||||||
// {
|
|
||||||
// var allTypes = assembly.GetTypes();
|
|
||||||
// foreach (var type in allTypes)
|
|
||||||
// {
|
|
||||||
// if (type is not { IsClass: true, IsAbstract: false }) continue;
|
|
||||||
// if (typeof(ISingletonDependency).IsAssignableFrom(type))
|
|
||||||
// {
|
|
||||||
// var interfaceTypes = type.GetInterfaces().Where(p => p.FullName != null && !p.FullName.Contains("ISingletonDependency") && !p.FullName.Contains("IDisposable"));
|
|
||||||
// foreach (var interfaceType in interfaceTypes)
|
|
||||||
// {
|
|
||||||
// Log.Logger.Information($"正在IOC注入ISingletonDependency {type.Name}...");
|
|
||||||
// services.AddSingleton(interfaceType, type);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (typeof(ITransientDependency).IsAssignableFrom(type))
|
|
||||||
// {
|
|
||||||
// var interfaceTypes = type.GetInterfaces().Where(p => p.FullName != null && !p.FullName.Contains("ITransientDependency") && !p.FullName.Contains("IDisposable"));
|
|
||||||
// foreach (var interfaceType in interfaceTypes)
|
|
||||||
// {
|
|
||||||
// Log.Logger.Information($"正在IOC注入ITransientDependency {type.Name}...");
|
|
||||||
// services.AddTransient(interfaceType, type);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (typeof(IScopedDependency).IsAssignableFrom(type))
|
|
||||||
// {
|
|
||||||
// var interfaceTypes = type.GetInterfaces().Where(p => p.FullName != null && !p.FullName.Contains("IScopedDependency") && !p.FullName.Contains("IDisposable"));
|
|
||||||
// foreach (var interfaceType in interfaceTypes)
|
|
||||||
// {
|
|
||||||
// Log.Logger.Information($"正在IOC注入IScopedDependency {type.Name}...");
|
|
||||||
// services.AddScoped(interfaceType, type);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return services;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private static IEnumerable<Assembly> GetBinAssemblies()
|
|
||||||
// {
|
|
||||||
// var directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
|
|
||||||
// if (!directory.Exists) return [];
|
|
||||||
|
|
||||||
// var files = directory.GetFiles("JiShe.CollectBus.*.dll");
|
|
||||||
|
|
||||||
// var assemblies = new List<Assembly>();
|
|
||||||
// foreach (var file in files)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var assembly = Assembly.LoadFrom(file.FullName);
|
|
||||||
// assemblies.Add(assembly);
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine($"Error loading assembly from {file.FullName}: {ex.Message}");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return assemblies;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
//namespace JiShe.CollectBus.Common.Extensions.DependencyInjections
|
|
||||||
//{
|
|
||||||
// public interface IScopedDependency
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
//namespace JiShe.CollectBus.Common.Extensions.DependencyInjections
|
|
||||||
//{
|
|
||||||
// public interface ISingletonDependency
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
//namespace JiShe.CollectBus.Common.Extensions.DependencyInjections
|
|
||||||
//{
|
|
||||||
// public interface ITransientDependency
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
7
JiShe.CollectBus.Common/Interfaces/IReceived.cs
Normal file
7
JiShe.CollectBus.Common/Interfaces/IReceived.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace JiShe.CollectBus.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IReceived
|
||||||
|
{
|
||||||
|
string ReceivedTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,12 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Abstractions\**" />
|
||||||
|
<EmbeddedResource Remove="Abstractions\**" />
|
||||||
|
<None Remove="Abstractions\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||||
@ -16,8 +22,4 @@
|
|||||||
<PackageReference Include="Volo.Abp.Core" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.Core" Version="8.3.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Abstractions\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
namespace JiShe.CollectBus.Common.Models
|
||||||
{
|
{
|
||||||
public class MessageIssuedEvent
|
public class MessageIssuedEvent
|
||||||
{
|
{
|
||||||
@ -1,8 +1,8 @@
|
|||||||
using JetBrains.Annotations;
|
using JiShe.CollectBus.Common.Interfaces;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
namespace JiShe.CollectBus.Common.Models
|
||||||
{
|
{
|
||||||
public class MessageReceivedEvent
|
public class MessageReceivedEvent:IReceived
|
||||||
{
|
{
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -33,7 +33,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 接收指令时间
|
/// 接收指令时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime ReceivedTime { get; set; }
|
public string ReceivedTime { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MessageReceivedLoginEvent: MessageReceivedEvent
|
public class MessageReceivedLoginEvent: MessageReceivedEvent
|
||||||
@ -1,11 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
|
||||||
using JiShe.CollectBus.Core.Plugins;
|
|
||||||
using JiShe.CollectBus.Core.Services;
|
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Adapters;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using TouchSocket.Core;
|
|
||||||
using TouchSocket.Sockets;
|
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
|
|||||||
@ -41,10 +41,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Core\JiShe.CollectBus.Core.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Core\JiShe.CollectBus.Network.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj" />
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.Service\JiShe.CollectBus.MQ.Consumer.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using JiShe.CollectBus.Core;
|
using JiShe.CollectBus.MQ.Consumer;
|
||||||
|
using JiShe.CollectBus.Network;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -55,17 +56,16 @@ namespace JiShe.CollectBus.Console
|
|||||||
lc.ReadFrom.Configuration(configuration)
|
lc.ReadFrom.Configuration(configuration)
|
||||||
.ReadFrom.Services(context);
|
.ReadFrom.Services(context);
|
||||||
});
|
});
|
||||||
services.AddApplication<JiSheCollectBusCoreModule>();
|
services.AddApplication<JiSheCollectBusMqConsumerModule>();
|
||||||
|
|
||||||
|
services.AddApplication<JiSheCollectBusNetworkModule>();
|
||||||
|
|
||||||
services.AddPluginApplications();
|
services.AddPluginApplications();
|
||||||
services.AddStackExchangeRedisCache(options =>
|
services.AddStackExchangeRedisCache(options =>
|
||||||
{
|
{
|
||||||
options.Configuration = configuration["RedisCache:ConnectionString"];
|
options.Configuration = configuration["RedisCache:ConnectionString"];
|
||||||
options.InstanceName = configuration["RedisCache:InstanceName"];
|
options.InstanceName = configuration["RedisCache:InstanceName"];
|
||||||
});
|
});
|
||||||
|
|
||||||
//var app = AbpApplicationFactory.Create<JiSheCollectBusCoreModule>();
|
|
||||||
//app.Initialize();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace JiShe.CollectBus.Network.Exceptions
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Exceptions
|
|
||||||
{
|
{
|
||||||
public class CloseException(string msg) : Exception(msg);
|
public class CloseException(string msg) : Exception(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,9 +20,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,18 +1,18 @@
|
|||||||
using JiShe.CollectBus.Core.Plugins;
|
using JiShe.CollectBus.MongoDB;
|
||||||
using JiShe.CollectBus.Core.Services;
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
using JiShe.CollectBus.EntityFrameworkCore;
|
using JiShe.CollectBus.Network.Plugins;
|
||||||
using JiShe.CollectBus.RabbitMQ;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
using ServerMonitor = JiShe.CollectBus.Network.Plugins.ServerMonitor;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core
|
namespace JiShe.CollectBus.Network
|
||||||
{
|
{
|
||||||
[DependsOn(typeof(JiSheCollectBusEntityFrameworkCoreModule),
|
[DependsOn(typeof(JiSheCollectBusMongoDbModule),
|
||||||
typeof(JiSheCollectBusRabbitMqModule))]
|
typeof(JiSheCollectBusMqSenderModule))]
|
||||||
public class JiSheCollectBusCoreModule : AbpModule
|
public class JiSheCollectBusNetworkModule : AbpModule
|
||||||
{
|
{
|
||||||
public override async void ConfigureServices(ServiceConfigurationContext context)
|
public override async void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
@ -23,9 +23,9 @@ namespace JiShe.CollectBus.Core
|
|||||||
//.SetTcpDataHandlingAdapter(()=>new StandardFixedHeaderDataHandlingAdapter())
|
//.SetTcpDataHandlingAdapter(()=>new StandardFixedHeaderDataHandlingAdapter())
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
a.Add<TcpClosePlugin>();
|
a.Add<TcpCloseMonitor>();
|
||||||
a.Add<TcpServicePlugin>();
|
a.Add<TcpMonitor>();
|
||||||
a.Add<BusService>();
|
a.Add<ServerMonitor>();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ namespace JiShe.CollectBus.Core
|
|||||||
config.SetBindIPHost(int.Parse(configuration["UDP:ClientPort"] ?? "10500"))
|
config.SetBindIPHost(int.Parse(configuration["UDP:ClientPort"] ?? "10500"))
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
a.Add<UdpServicePlugin>();
|
a.Add<UdpMonitor>();
|
||||||
a.Add<BusService>();
|
a.Add<ServerMonitor>();
|
||||||
})
|
})
|
||||||
.UseBroadcast()
|
.UseBroadcast()
|
||||||
.SetUdpDataHandlingAdapter(() => new NormalUdpDataHandlingAdapter());
|
.SetUdpDataHandlingAdapter(() => new NormalUdpDataHandlingAdapter());
|
||||||
@ -1,11 +1,11 @@
|
|||||||
using JiShe.CollectBus.Core.Exceptions;
|
using JiShe.CollectBus.Network.Exceptions;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Plugins
|
namespace JiShe.CollectBus.Network.Plugins
|
||||||
{
|
{
|
||||||
public partial class TcpClosePlugin(ILogger<TcpClosePlugin> logger) : PluginBase
|
public partial class TcpCloseMonitor(ILogger<TcpCloseMonitor> logger) : PluginBase
|
||||||
{
|
{
|
||||||
[GeneratorPlugin(typeof(ITcpReceivedPlugin))]
|
[GeneratorPlugin(typeof(ITcpReceivedPlugin))]
|
||||||
public async Task OnTcpReceived(ITcpSessionClient client, ReceivedDataEventArgs e)
|
public async Task OnTcpReceived(ITcpSessionClient client, ReceivedDataEventArgs e)
|
||||||
@ -29,7 +29,7 @@ namespace JiShe.CollectBus.Core.Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class UdpClosePlugin(ILog logger) : PluginBase
|
public partial class UdpCloseMonitor(ILogger<TcpCloseMonitor> logger) : PluginBase
|
||||||
{
|
{
|
||||||
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
||||||
public Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
public Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
||||||
@ -1,15 +1,10 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Services
|
namespace JiShe.CollectBus.Network.Plugins
|
||||||
{
|
{
|
||||||
public partial class BusService(ILogger<BusService> logger) : PluginBase
|
public partial class ServerMonitor(ILogger<ServerMonitor> logger) : PluginBase
|
||||||
{
|
{
|
||||||
[GeneratorPlugin(typeof(IServerStartedPlugin))]
|
[GeneratorPlugin(typeof(IServerStartedPlugin))]
|
||||||
public Task OnServerStarted(IServiceBase sender, ServiceStateEventArgs e)
|
public Task OnServerStarted(IServiceBase sender, ServiceStateEventArgs e)
|
||||||
@ -1,34 +1,22 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.MongoDB;
|
||||||
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
using JiShe.CollectBus.RabbitMQ.Senders;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using JiShe.CollectBus.MongoDB;
|
|
||||||
using MassTransit;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Plugins
|
namespace JiShe.CollectBus.Network.Plugins
|
||||||
{
|
{
|
||||||
public partial class TcpServicePlugin : PluginBase
|
public partial class TcpMonitor(
|
||||||
|
INSender nSender,
|
||||||
|
ILogger<TcpMonitor> logger,
|
||||||
|
IMongoRepository<MessageReceivedHeartbeatEvent> mongoHeartbeatRepository,
|
||||||
|
IMongoRepository<MessageReceivedLoginEvent> mongoLoginRepository)
|
||||||
|
: PluginBase
|
||||||
{
|
{
|
||||||
private readonly INSender _nSender;
|
|
||||||
private readonly ILogger<TcpServicePlugin> _logger;
|
|
||||||
public readonly IMongoRepository<MessageReceivedHeartbeatEvent> _mongoHeartbeatRepository;
|
|
||||||
public readonly IMongoRepository<MessageReceivedLoginEvent> _mongoLoginRepository;
|
|
||||||
public readonly IServiceProvider _serviceProvider;
|
|
||||||
|
|
||||||
|
|
||||||
public TcpServicePlugin(INSender nSender, ILogger<TcpServicePlugin> logger,IMongoRepository<MessageReceivedHeartbeatEvent> mongoHeartbeatRepository, IMongoRepository<MessageReceivedLoginEvent> mongoLoginRepository, IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
_nSender = nSender;
|
|
||||||
_logger = logger;
|
|
||||||
_mongoHeartbeatRepository = mongoHeartbeatRepository;
|
|
||||||
_mongoLoginRepository = mongoLoginRepository;
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[GeneratorPlugin(typeof(ITcpReceivedPlugin))]
|
[GeneratorPlugin(typeof(ITcpReceivedPlugin))]
|
||||||
public async Task OnTcpReceived(ITcpSessionClient client, ReceivedDataEventArgs e)
|
public async Task OnTcpReceived(ITcpSessionClient client, ReceivedDataEventArgs e)
|
||||||
{
|
{
|
||||||
@ -52,26 +40,11 @@ namespace JiShe.CollectBus.Core.Plugins
|
|||||||
ClientIp = client.IP,
|
ClientIp = client.IP,
|
||||||
ClientPort = client.Port,
|
ClientPort = client.Port,
|
||||||
MessageHexString = messageHexString,
|
MessageHexString = messageHexString,
|
||||||
ReceivedTime = DateTime.Now,
|
|
||||||
DeviceNo = aTuple.Item1,
|
DeviceNo = aTuple.Item1,
|
||||||
MessageId = NewId.NextGuid().ToString()
|
MessageId = NewId.NextGuid().ToString()
|
||||||
};
|
};
|
||||||
await _mongoLoginRepository.AddAsync(messageReceivedLoginEvent);
|
await mongoLoginRepository.AddAsync(messageReceivedLoginEvent);
|
||||||
await _nSender.SendToReceivedLoginAsync(messageReceivedLoginEvent);
|
await nSender.SendToReceivedLoginAsync(messageReceivedLoginEvent);
|
||||||
break;
|
|
||||||
case 2://退出登录
|
|
||||||
var messageReceivedExitLoginEvent = new MessageReceivedLoginEvent
|
|
||||||
{
|
|
||||||
ClientId = client.Id,
|
|
||||||
ClientIp = client.IP,
|
|
||||||
ClientPort = client.Port,
|
|
||||||
MessageHexString = messageHexString,
|
|
||||||
ReceivedTime = DateTime.Now,
|
|
||||||
DeviceNo = aTuple.Item1,
|
|
||||||
MessageId = NewId.NextGuid().ToString()
|
|
||||||
};
|
|
||||||
await _mongoLoginRepository.AddAsync(messageReceivedExitLoginEvent);
|
|
||||||
await _nSender.SendToReceivedLoginAsync(messageReceivedExitLoginEvent);
|
|
||||||
break;
|
break;
|
||||||
case 3://心跳
|
case 3://心跳
|
||||||
var messageReceivedHeartbeatEvent = new MessageReceivedHeartbeatEvent
|
var messageReceivedHeartbeatEvent = new MessageReceivedHeartbeatEvent
|
||||||
@ -80,18 +53,20 @@ namespace JiShe.CollectBus.Core.Plugins
|
|||||||
ClientIp = client.IP,
|
ClientIp = client.IP,
|
||||||
ClientPort = client.Port,
|
ClientPort = client.Port,
|
||||||
MessageHexString = messageHexString,
|
MessageHexString = messageHexString,
|
||||||
ReceivedTime = DateTime.Now,
|
|
||||||
DeviceNo = aTuple.Item1,
|
DeviceNo = aTuple.Item1,
|
||||||
MessageId = NewId.NextGuid().ToString()
|
MessageId = NewId.NextGuid().ToString()
|
||||||
};
|
};
|
||||||
await _mongoHeartbeatRepository.AddAsync(messageReceivedHeartbeatEvent);
|
await mongoHeartbeatRepository.AddAsync(messageReceivedHeartbeatEvent);
|
||||||
await _nSender.SendToReceivedHeartbeatAsync(messageReceivedHeartbeatEvent);
|
await nSender.SendToReceivedHeartbeatAsync(messageReceivedHeartbeatEvent);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.LogError($"指令初步解析失败,指令内容:{messageHexString}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _nSender.SendToReceivedAsync(new MessageReceivedEvent
|
await nSender.SendToReceivedAsync(new MessageReceivedEvent
|
||||||
{
|
{
|
||||||
ClientId = client.Id,
|
ClientId = client.Id,
|
||||||
ClientIp = client.IP,
|
ClientIp = client.IP,
|
||||||
@ -104,7 +79,7 @@ namespace JiShe.CollectBus.Core.Plugins
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogError($"指令初步解析失败,指令内容:{messageHexString}");
|
logger.LogError($"指令初步解析失败,指令内容:{messageHexString}");
|
||||||
}
|
}
|
||||||
|
|
||||||
await e.InvokeNext();
|
await e.InvokeNext();
|
||||||
@ -113,25 +88,21 @@ namespace JiShe.CollectBus.Core.Plugins
|
|||||||
[GeneratorPlugin(typeof(ITcpConnectingPlugin))]
|
[GeneratorPlugin(typeof(ITcpConnectingPlugin))]
|
||||||
public async Task OnTcpConnecting(ITcpSessionClient client,ConnectingEventArgs e)
|
public async Task OnTcpConnecting(ITcpSessionClient client,ConnectingEventArgs e)
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}正在连接中...");
|
logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}正在连接中...");
|
||||||
|
|
||||||
await e.InvokeNext();
|
await e.InvokeNext();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratorPlugin(typeof(ITcpConnectedPlugin))]
|
[GeneratorPlugin(typeof(ITcpConnectedPlugin))]
|
||||||
public async Task OnTcpConnected(ITcpSessionClient client,ConnectedEventArgs e)
|
public async Task OnTcpConnected(ITcpSessionClient client,ConnectedEventArgs e)
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}已连接");
|
logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}已连接");
|
||||||
|
|
||||||
await e.InvokeNext();
|
await e.InvokeNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratorPlugin(typeof(ITcpClosedPlugin))]
|
[GeneratorPlugin(typeof(ITcpClosedPlugin))]
|
||||||
public async Task OnTcpClosed(ITcpSessionClient client, ClosedEventArgs e)
|
public async Task OnTcpClosed(ITcpSessionClient client, ClosedEventArgs e)
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}已关闭连接");
|
logger.LogInformation($"[TCP] ID:{client.Id} IP:{client.GetIPPort()}已关闭连接");
|
||||||
|
|
||||||
await e.InvokeNext();
|
await e.InvokeNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,9 +2,9 @@
|
|||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Plugins
|
namespace JiShe.CollectBus.Network.Plugins
|
||||||
{
|
{
|
||||||
public partial class UdpServicePlugin : PluginBase
|
public partial class UdpMonitor : PluginBase
|
||||||
{
|
{
|
||||||
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
||||||
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
||||||
@ -1,120 +1,35 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Application.Contracts;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using Volo.Abp.AspNetCore.Mvc;
|
||||||
using JiShe.CollectBus.Common.Models;
|
|
||||||
using JiShe.CollectBus.RabbitMQ.Senders;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Host.Controllers
|
namespace JiShe.CollectBus.Host.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
public class CommandController : AbpController
|
||||||
[Route("[controller]/[action]")]
|
|
||||||
public class CommandController : ControllerBase
|
|
||||||
{
|
{
|
||||||
private readonly ILogger<CommandController> _logger;
|
private readonly ILogger<CommandController> _logger;
|
||||||
private readonly INSender _nSender;
|
private readonly ICommandService _commandService;
|
||||||
|
|
||||||
public CommandController(INSender nSender, ILogger<CommandController> logger)
|
public CommandController(ILogger<CommandController> logger, ICommandService commandService)
|
||||||
{
|
{
|
||||||
_nSender = nSender;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_commandService = commandService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "AmmeterParameterSend")]
|
|
||||||
public async Task<bool> AmmeterParameterSendAsync()
|
public async Task<bool> AmmeterParameterSendAsync()
|
||||||
{
|
{
|
||||||
|
|
||||||
var listMeter = new List<AmmeterParameter>()
|
return await _commandService.AmmeterParameterSendAsync();
|
||||||
{
|
|
||||||
new AmmeterParameter()
|
|
||||||
{
|
|
||||||
Pn = 1,
|
|
||||||
BaudRate = 3,
|
|
||||||
Port = 2,
|
|
||||||
ProtocolType = CommunicationProtocolType.DLT6452007,
|
|
||||||
Address = "312408006642",
|
|
||||||
Password = "000000",
|
|
||||||
RateNumber = 4,
|
|
||||||
IntegerBitNumber = 4,
|
|
||||||
DecimalBitNumber = 4,
|
|
||||||
CollectorAddress = "000000000000",
|
|
||||||
UserCategoryNumber = 0,
|
|
||||||
UserSubclassNumber = 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var bytes = HexStringExtensions.BuildAmmeterParameterSetSendCmd(new ReqParameter2()
|
|
||||||
{
|
|
||||||
AFN = AFN.设置参数,
|
|
||||||
FunCode = (int)CMasterStationFunCode.请求1级数据,
|
|
||||||
A = "322009872",
|
|
||||||
Seq = new Seq()
|
|
||||||
{
|
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
|
||||||
FIRFIN = FIRFIN.单帧,
|
|
||||||
CON = CON.需要对该帧进行确认,
|
|
||||||
PRSEQ = 10,
|
|
||||||
},
|
|
||||||
MSA = 13,
|
|
||||||
Pn = 0,
|
|
||||||
Fn = 10
|
|
||||||
}, listMeter);
|
|
||||||
|
|
||||||
// await _nSender.SendToIssuedAsync(new MessageIssuedEvent { DeviceNo = "322009872", Message = bytes, Type = IssuedEventType.Data,MessageId = Guid.NewGuid().ToString() });
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "AmmeterParameterReading")]
|
|
||||||
public bool AmmeterParameterReading()
|
public bool AmmeterParameterReading()
|
||||||
{
|
{
|
||||||
HexStringExtensions.BuildAmmeterParameterReadingSendCmd(new ReqParameter2()
|
return _commandService.AmmeterParameterReading();
|
||||||
{
|
|
||||||
AFN = AFN.查询参数,
|
|
||||||
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
|
||||||
A = "322009872",
|
|
||||||
Seq = new Seq()
|
|
||||||
{
|
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
|
||||||
FIRFIN = FIRFIN.单帧,
|
|
||||||
CON = CON.不需要对该帧进行确认,
|
|
||||||
PRSEQ = 2,
|
|
||||||
},
|
|
||||||
MSA = 13,
|
|
||||||
Pn = 0,
|
|
||||||
Fn = 10
|
|
||||||
}, new List<int>() { 1, 2 });
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "ActivePowerIndicationReading")]
|
|
||||||
public bool ActivePowerIndicationReading()
|
public bool ActivePowerIndicationReading()
|
||||||
{
|
{
|
||||||
|
|
||||||
//var str = "68A600A6006888203290261A0A6200000201010001000100621E426622082431000000000000040300000000000000CA16";
|
return _commandService.ActivePowerIndicationReading();
|
||||||
//var cmdResult = new BuildCommand().AnalysisCmd(str);
|
|
||||||
//if(cmdResult != null)
|
|
||||||
//{
|
|
||||||
// var list = new BuildCommand().AnalysisAFN04F10DataUnit(cmdResult.HexDatas);
|
|
||||||
//}
|
|
||||||
HexStringExtensions.BuildSendCommandBytes(new ReqParameter2()
|
|
||||||
{
|
|
||||||
AFN = AFN.请求实时数据,
|
|
||||||
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
|
||||||
A = "322009872",
|
|
||||||
Seq = new Seq()
|
|
||||||
{
|
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
|
||||||
FIRFIN = FIRFIN.单帧,
|
|
||||||
CON = CON.不需要对该帧进行确认,
|
|
||||||
PRSEQ = 2,
|
|
||||||
},
|
|
||||||
MSA = 13,
|
|
||||||
Pn = 1,
|
|
||||||
Fn = 129
|
|
||||||
});
|
|
||||||
|
|
||||||
//HexStringExtensions.AmmeterValveControl("312408006642", "", "000000", true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,49 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Hangfire;
|
using Volo.Abp.Modularity;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Adapters;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using TouchSocket.Core;
|
|
||||||
using TouchSocket.Sockets;
|
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
public static class ServiceCollectionExtensions
|
public static class ServiceCollectionExtensions
|
||||||
{
|
{
|
||||||
|
public static void AddPluginApplications(this IServiceCollection services, string pluginPath = "")
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(pluginPath))
|
||||||
|
{
|
||||||
|
pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins");
|
||||||
|
}
|
||||||
|
var assemblies = GetAssembliesFromFolder(pluginPath);
|
||||||
|
|
||||||
|
foreach (var assembly in assemblies)
|
||||||
|
{
|
||||||
|
var applicationServiceType = assembly.GetTypes()
|
||||||
|
.FirstOrDefault(a => a.IsClass && !a.IsAbstract && typeof(AbpModule).IsAssignableFrom(a));
|
||||||
|
services.AddApplication(applicationServiceType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<Assembly> GetAssembliesFromFolder(string folderPath)
|
||||||
|
{
|
||||||
|
var directory = new DirectoryInfo(folderPath);
|
||||||
|
if (!directory.Exists) return [];
|
||||||
|
|
||||||
|
var files = directory.GetFiles("*.dll");
|
||||||
|
|
||||||
|
var assemblies = new List<Assembly>();
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var assembly = Assembly.LoadFrom(file.FullName);
|
||||||
|
assemblies.Add(assembly);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error loading assembly from {file.FullName}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return assemblies;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Abp" Version="9.4.2" />
|
||||||
<PackageReference Include="Hangfire" Version="1.8.15" />
|
<PackageReference Include="Hangfire" Version="1.8.15" />
|
||||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.15" />
|
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.15" />
|
||||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||||
@ -20,16 +21,15 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
<PackageReference Include="Volo.Abp.AspNetCore" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.AspNetCore" Version="8.3.3" />
|
||||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="8.3.3" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.10" />
|
||||||
|
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.Application.Contracts\JiShe.CollectBus.Application.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Core\JiShe.CollectBus.Core.csproj" />
|
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj" />
|
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
26
JiShe.CollectBus.Host/JiSheCollectBusHostModule.cs
Normal file
26
JiShe.CollectBus.Host/JiSheCollectBusHostModule.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Abp.Dependency;
|
||||||
|
using DeviceDetectorNET.Parser.Device;
|
||||||
|
using Serilog;
|
||||||
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Host
|
||||||
|
{
|
||||||
|
public class JiSheCollectBusHostModule : AbpModule
|
||||||
|
{
|
||||||
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
|
{
|
||||||
|
var services = context.Services;
|
||||||
|
var configuration = IocManager.Instance.Resolve<IConfiguration>();
|
||||||
|
//services.AddApplication<JiSheCollectBusMqConsumerModule>();
|
||||||
|
|
||||||
|
//services.AddApplication<JiSheCollectBusNetworkModule>();
|
||||||
|
|
||||||
|
services.AddPluginApplications();
|
||||||
|
services.AddStackExchangeRedisCache(options =>
|
||||||
|
{
|
||||||
|
options.Configuration = configuration["RedisCache:ConnectionString"];
|
||||||
|
options.InstanceName = configuration["RedisCache:InstanceName"];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,8 +5,25 @@ public class Program
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
|
||||||
CreateHostBuilder(args).Build().Run();
|
CreateHostBuilder(args).Build().Run();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Fatal(ex, "Application terminated unexpectedly");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
private static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
|
|||||||
@ -3,7 +3,6 @@ using Hangfire.Dashboard.BasicAuthorization;
|
|||||||
using Hangfire.HttpJob;
|
using Hangfire.HttpJob;
|
||||||
using Hangfire.MySql;
|
using Hangfire.MySql;
|
||||||
using JiShe.CollectBus.Application;
|
using JiShe.CollectBus.Application;
|
||||||
using JiShe.CollectBus.Core;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Host
|
namespace JiShe.CollectBus.Host
|
||||||
{
|
{
|
||||||
@ -12,6 +11,7 @@ namespace JiShe.CollectBus.Host
|
|||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
|
services.AddApplication<JiSheCollectBusApplicationModule>();
|
||||||
services.AddEndpointsApiExplorer();
|
services.AddEndpointsApiExplorer();
|
||||||
services.AddSwaggerGen();
|
services.AddSwaggerGen();
|
||||||
services.AddHangfire(config =>
|
services.AddHangfire(config =>
|
||||||
@ -35,12 +35,11 @@ namespace JiShe.CollectBus.Host
|
|||||||
config.UseHangfireHttpJob();
|
config.UseHangfireHttpJob();
|
||||||
});
|
});
|
||||||
services.AddHangfireServer();
|
services.AddHangfireServer();
|
||||||
services.AddApplication<JiSheCollectBusApplicationModule>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
app.InitializeApplication();
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
@ -58,7 +57,6 @@ namespace JiShe.CollectBus.Host
|
|||||||
var dashboardOptions = new DashboardOptions();
|
var dashboardOptions = new DashboardOptions();
|
||||||
|
|
||||||
if (env.IsProduction())
|
if (env.IsProduction())
|
||||||
{
|
|
||||||
dashboardOptions = new DashboardOptions
|
dashboardOptions = new DashboardOptions
|
||||||
{
|
{
|
||||||
Authorization = new[]
|
Authorization = new[]
|
||||||
@ -77,16 +75,15 @@ namespace JiShe.CollectBus.Host
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
app.UseHangfireDashboard("/hangfire", dashboardOptions);
|
app.UseHangfireDashboard("/hangfire", dashboardOptions);
|
||||||
|
|
||||||
app.UseEndpoints(endpoint =>
|
//app.UseEndpoints(endpoints =>
|
||||||
{
|
//{
|
||||||
endpoint.MapControllers();
|
// endpoints.MapRazorPages();
|
||||||
});
|
//});
|
||||||
|
app.UseConfiguredEndpoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,8 +27,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"Default": "Data Source=192.168.111.248;Port=3306;Database=JiSheCollectBus;uid=root;pwd=123456abcD;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true",
|
"Default": "Data Source=192.168.111.248;Port=3306;Database=JiSheCollectBus;uid=root;pwd=123456abcD;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true",
|
||||||
"Default": "Data Source=localhost;Port=3306;Database=JiSheCollectBus;uid=root;pwd=123456abcD;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
|
//"Default": "Data Source=localhost;Port=3306;Database=JiSheCollectBus;uid=root;pwd=123456abcD;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
|
||||||
},
|
},
|
||||||
"MongoSettings": {
|
"MongoSettings": {
|
||||||
"Connection": "mongodb://backups_admin:jishe_mongodb_backups@118.190.144.92:27037",
|
"Connection": "mongodb://backups_admin:jishe_mongodb_backups@118.190.144.92:27037",
|
||||||
|
|||||||
@ -9,10 +9,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Volo.Abp.Timing" Version="8.3.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,15 +1,29 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using JiShe.CollectBus.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
using Volo.Abp.Timing;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.MongoDB
|
namespace JiShe.CollectBus.MongoDB
|
||||||
{
|
{
|
||||||
|
[DependsOn(typeof(AbpTimingModule),
|
||||||
|
typeof(JiSheCollectBusEntityFrameworkCoreModule))]
|
||||||
public class JiSheCollectBusMongoDbModule: AbpModule
|
public class JiSheCollectBusMongoDbModule: AbpModule
|
||||||
{
|
{
|
||||||
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
context.Services.AddSingleton<IMongoContext, MongoContext>();
|
context.Services.AddSingleton<IMongoContext, MongoContext>();
|
||||||
context.Services.AddSingleton<IUnitOfWork, UnitOfWork>();
|
context.Services.AddSingleton<IUnitOfWork, UnitOfWork>();
|
||||||
context.Services.AddSingleton(typeof(IMongoRepository<>), typeof(MongoBaseRepository<>));
|
context.Services.AddSingleton(typeof(IMongoRepository<>), typeof(MongoBaseRepository<>));
|
||||||
|
|
||||||
|
Configure<AbpClockOptions>(options =>
|
||||||
|
{
|
||||||
|
options.Kind = DateTimeKind.Local;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,9 @@ using System.Linq.Expressions;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JiShe.CollectBus.Common.Interfaces;
|
||||||
|
using JiShe.CollectBus.EntityFrameworkCore;
|
||||||
|
using Volo.Abp.Timing;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.MongoDB
|
namespace JiShe.CollectBus.MongoDB
|
||||||
{
|
{
|
||||||
@ -15,10 +18,12 @@ namespace JiShe.CollectBus.MongoDB
|
|||||||
{
|
{
|
||||||
private readonly IMongoContext _context;
|
private readonly IMongoContext _context;
|
||||||
private readonly IMongoCollection<T> _dbSet;
|
private readonly IMongoCollection<T> _dbSet;
|
||||||
|
private readonly IClock _clock;
|
||||||
|
|
||||||
public MongoBaseRepository(IMongoContext context)
|
public MongoBaseRepository(IMongoContext context, IClock clock)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_clock = clock;
|
||||||
var collectionName = typeof(T).GetCustomAttribute<TableAttribute>()?.Name ?? typeof(T).Name;
|
var collectionName = typeof(T).GetCustomAttribute<TableAttribute>()?.Name ?? typeof(T).Name;
|
||||||
_dbSet = _context.GetCollection<T>(collectionName);
|
_dbSet = _context.GetCollection<T>(collectionName);
|
||||||
}
|
}
|
||||||
@ -70,6 +75,10 @@ namespace JiShe.CollectBus.MongoDB
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task AddAsync(T objData)
|
public async Task AddAsync(T objData)
|
||||||
{
|
{
|
||||||
|
if (typeof(IReceived).IsAssignableFrom(typeof(T)))
|
||||||
|
{
|
||||||
|
(objData as IReceived)!.ReceivedTime = $"{_clock.Now:yyyy-MM-dd HH:mm:ss}";
|
||||||
|
}
|
||||||
await _dbSet.InsertOneAsync(objData);
|
await _dbSet.InsertOneAsync(objData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@ using JiShe.CollectBus.Common.Models;
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Net.Sockets;
|
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
namespace JiShe.CollectBus.Protocol.Contracts.Interfaces
|
||||||
{
|
{
|
||||||
public interface IProtocolInfo
|
public interface IProtocolInfo
|
||||||
{
|
{
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JiShe.CollectBus.Common.Models;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Interfaces
|
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
||||||
{
|
{
|
||||||
public class CustomFixedHeaderRequestInfo : IFixedHeaderRequestInfo
|
public class CustomFixedHeaderRequestInfo : IFixedHeaderRequestInfo
|
||||||
{
|
{
|
||||||
@ -1,4 +1,6 @@
|
|||||||
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Protocol.Contracts.Models
|
||||||
{
|
{
|
||||||
public class ProtocolInfo : IProtocolInfo
|
public class ProtocolInfo : IProtocolInfo
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Abstracts;
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.Protocol.Contracts.Abstracts;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Attributes;
|
using JiShe.CollectBus.Protocol.Contracts.Attributes;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
using JiShe.CollectBus.RabbitMQ;
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol
|
namespace JiShe.CollectBus.Protocol
|
||||||
{
|
{
|
||||||
|
[DependsOn(typeof(JiSheCollectBusMqSenderModule))]
|
||||||
public class JiSheCollectBusProtocolModule : AbpModule
|
public class JiSheCollectBusProtocolModule : AbpModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
|
|||||||
@ -1,17 +1,16 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Abstracts;
|
using JiShe.CollectBus.Protocol.Contracts.Abstracts;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Attributes;
|
using JiShe.CollectBus.Protocol.Contracts.Attributes;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using JiShe.CollectBus.RabbitMQ.Senders;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol
|
namespace JiShe.CollectBus.Protocol
|
||||||
{
|
{
|
||||||
[ProtocolName("StandardProtocol")]
|
public class StandardProtocolPlugin(INSender nSender, ILogger<BaseProtocolPlugin> logger) : BaseProtocolPlugin(logger), ISingletonDependency
|
||||||
public class StandardProtocolPlugin(INSender nSender, ILogger<BaseProtocolPlugin> logger) : BaseProtocolPlugin(logger)
|
|
||||||
{
|
{
|
||||||
public override async Task<ProtocolInfo> GetAsync()
|
public override async Task<ProtocolInfo> GetAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
using JiShe.CollectBus.MongoDB;
|
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
|
||||||
using MassTransit;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
|
||||||
{
|
|
||||||
public class MessageReceivedHeartbeatConsumer : IConsumer<MessageReceivedHeartbeatEvent>
|
|
||||||
{
|
|
||||||
private readonly ILogger<MessageReceivedHeartbeatConsumer> _logger;
|
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
|
|
||||||
public MessageReceivedHeartbeatConsumer(ILogger<MessageReceivedHeartbeatConsumer> logger, IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Consume(ConsumeContext<MessageReceivedHeartbeatEvent> context)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("心跳消费队列开始处理");
|
|
||||||
var protocolPlugin = _serviceProvider.GetKeyedService<IProtocolPlugin>("StandardProtocol");
|
|
||||||
if (protocolPlugin == null)
|
|
||||||
{
|
|
||||||
_logger.LogError("【心跳消费队列开始处理】协议不存在!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await protocolPlugin.HeartbeatAsync(context.Message);
|
|
||||||
_logger.LogInformation("心跳消费队列完成处理");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
|
||||||
using MassTransit;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
|
||||||
{
|
|
||||||
public class MessageReceivedLoginConsumer : IConsumer<MessageReceivedLoginEvent>
|
|
||||||
{
|
|
||||||
private readonly ILogger<MessageReceivedLoginConsumer> _logger;
|
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
|
|
||||||
public MessageReceivedLoginConsumer(ILogger<MessageReceivedLoginConsumer> logger, IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Consume(ConsumeContext<MessageReceivedLoginEvent> context)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("登录消费队列开始处理");
|
|
||||||
var protocolPlugin = _serviceProvider.GetKeyedService<IProtocolPlugin>("StandardProtocol");
|
|
||||||
if (protocolPlugin == null)
|
|
||||||
{
|
|
||||||
_logger.LogError("【登录消费队列开始处理】协议不存在!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await protocolPlugin.LoginAsync(context.Message);
|
|
||||||
_logger.LogInformation("登录消费队列完成处理");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Senders
|
namespace JiShe.CollectBus.MQ.Sender
|
||||||
{
|
{
|
||||||
public interface INSender
|
public interface INSender
|
||||||
{
|
{
|
||||||
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj" />
|
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
17
JiShe.CollectBus.RabbitMQ/JiSheCollectBusMQSenderModule.cs
Normal file
17
JiShe.CollectBus.RabbitMQ/JiSheCollectBusMQSenderModule.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Volo.Abp;
|
||||||
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.MQ.Sender
|
||||||
|
{
|
||||||
|
public class JiSheCollectBusMqSenderModule: AbpModule
|
||||||
|
{
|
||||||
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,19 +1,20 @@
|
|||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Senders
|
namespace JiShe.CollectBus.MQ.Sender
|
||||||
{
|
{
|
||||||
public class NSender : INSender, ISingletonDependency
|
public class NSender : INSender, ISingletonDependency
|
||||||
{
|
{
|
||||||
private readonly ISendEndpointProvider _sendEndpointProvider;
|
private readonly ServiceProvider _serviceProvider;
|
||||||
private readonly string _issuedKey;
|
private readonly string _issuedKey;
|
||||||
private readonly string _receivedKey;
|
private readonly string _receivedKey;
|
||||||
|
|
||||||
|
|
||||||
public NSender(ISendEndpointProvider sendEndpointProvider, IConfiguration configuration)
|
public NSender(IConfiguration configuration, ServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
_sendEndpointProvider = sendEndpointProvider;
|
_serviceProvider = serviceProvider;
|
||||||
_issuedKey = configuration["MQ:Queue:Issued"]!;
|
_issuedKey = configuration["MQ:Queue:Issued"]!;
|
||||||
_receivedKey = configuration["MQ:Queue:Received"]!;
|
_receivedKey = configuration["MQ:Queue:Received"]!;
|
||||||
}
|
}
|
||||||
@ -61,7 +62,9 @@ namespace JiShe.CollectBus.RabbitMQ.Senders
|
|||||||
|
|
||||||
public async Task SendAsync(string queueKey, object message, CancellationToken cancellationToken = default)
|
public async Task SendAsync(string queueKey, object message, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var endpoint = await _sendEndpointProvider.GetSendEndpoint(new Uri($"queue:{queueKey}"));
|
using var scope = _serviceProvider.CreateScope();
|
||||||
|
var scopedService = scope.ServiceProvider.GetRequiredService<ISendEndpointProvider>();
|
||||||
|
var endpoint = await scopedService.GetSendEndpoint(new Uri($"queue:{queueKey}"));
|
||||||
await endpoint.Send(message, cancellationToken);
|
await endpoint.Send(message, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
20
JiShe.CollectBus.Service/JiShe.CollectBus.MQ.Consumer.csproj
Normal file
20
JiShe.CollectBus.Service/JiShe.CollectBus.MQ.Consumer.csproj
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Volo.Abp.Core" Version="8.3.3" />
|
||||||
|
<PackageReference Include="MassTransit" Version="8.3.0" />
|
||||||
|
<PackageReference Include="MassTransit.RabbitMQ" Version="8.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.Core\JiShe.CollectBus.Network.csproj" />
|
||||||
|
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -1,12 +1,13 @@
|
|||||||
using JiShe.CollectBus.RabbitMQ.Consumers;
|
using JiShe.CollectBus.Network;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
{
|
{
|
||||||
public class JiSheCollectBusRabbitMqModule: AbpModule
|
[DependsOn(typeof(JiSheCollectBusNetworkModule))]
|
||||||
|
public class JiSheCollectBusMqConsumerModule: AbpModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
@ -1,11 +1,11 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Models;
|
||||||
using JiShe.CollectBus.MongoDB;
|
using JiShe.CollectBus.MongoDB;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
{
|
{
|
||||||
public class MessageIssuedConsumer(
|
public class MessageIssuedConsumer(
|
||||||
ILogger<MessageIssuedEvent> logger,
|
ILogger<MessageIssuedEvent> logger,
|
||||||
@ -1,12 +1,7 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
{
|
{
|
||||||
public class MessageIssuedFaultConsumer : IConsumer<Fault<MessageIssuedEvent>>
|
public class MessageIssuedFaultConsumer : IConsumer<Fault<MessageIssuedEvent>>
|
||||||
{
|
{
|
||||||
@ -1,11 +1,11 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.MongoDB;
|
||||||
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
|
||||||
using JiShe.CollectBus.MongoDB;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Batch 一次最多 100 个,最多 10 个并发批次
|
/// Batch 一次最多 100 个,最多 10 个并发批次
|
||||||
@ -18,7 +18,7 @@ namespace JiShe.CollectBus.RabbitMQ.Consumers
|
|||||||
{
|
{
|
||||||
public async Task Consume(ConsumeContext<Batch<MessageReceivedEvent>> context)
|
public async Task Consume(ConsumeContext<Batch<MessageReceivedEvent>> context)
|
||||||
{
|
{
|
||||||
const string protocolType = "StandardProtocol";
|
const string protocolType = "Standard";
|
||||||
var protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>(protocolType);
|
var protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>(protocolType);
|
||||||
if (protocolPlugin == null)
|
if (protocolPlugin == null)
|
||||||
{
|
{
|
||||||
@ -1,12 +1,7 @@
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RabbitMQ.Consumers
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
{
|
{
|
||||||
public class MessageReceivedFaultConsumer: IConsumer<Fault<Batch<MessageReceivedEvent>>>
|
public class MessageReceivedFaultConsumer: IConsumer<Fault<Batch<MessageReceivedEvent>>>
|
||||||
{
|
{
|
||||||
29
JiShe.CollectBus.Service/MessageReceivedHeartbeatConsumer.cs
Normal file
29
JiShe.CollectBus.Service/MessageReceivedHeartbeatConsumer.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
|
{
|
||||||
|
public class MessageReceivedHeartbeatConsumer(
|
||||||
|
ILogger<MessageReceivedHeartbeatConsumer> logger,
|
||||||
|
IServiceProvider serviceProvider)
|
||||||
|
: IConsumer<MessageReceivedHeartbeatEvent>
|
||||||
|
{
|
||||||
|
public async Task Consume(ConsumeContext<MessageReceivedHeartbeatEvent> context)
|
||||||
|
{
|
||||||
|
logger.LogInformation("心跳消费队列开始处理");
|
||||||
|
var protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>("Standard");
|
||||||
|
if (protocolPlugin == null)
|
||||||
|
{
|
||||||
|
logger.LogError("【心跳消费队列开始处理】协议不存在!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await protocolPlugin.HeartbeatAsync(context.Message);
|
||||||
|
logger.LogInformation("心跳消费队列完成处理");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
JiShe.CollectBus.Service/MessageReceivedLoginConsumer.cs
Normal file
29
JiShe.CollectBus.Service/MessageReceivedLoginConsumer.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
|
using MassTransit;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.MQ.Consumer
|
||||||
|
{
|
||||||
|
public class MessageReceivedLoginConsumer(
|
||||||
|
ILogger<MessageReceivedLoginConsumer> logger,
|
||||||
|
IServiceProvider serviceProvider)
|
||||||
|
: IConsumer<MessageReceivedLoginEvent>
|
||||||
|
{
|
||||||
|
public async Task Consume(ConsumeContext<MessageReceivedLoginEvent> context)
|
||||||
|
{
|
||||||
|
logger.LogInformation("登录消费队列开始处理");
|
||||||
|
var protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>("Standard");
|
||||||
|
if (protocolPlugin == null)
|
||||||
|
{
|
||||||
|
logger.LogError("【登录消费队列开始处理】协议不存在!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await protocolPlugin.LoginAsync(context.Message);
|
||||||
|
logger.LogInformation("登录消费队列完成处理");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,12 +4,11 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DnsClient.Internal;
|
|
||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
|
using JiShe.CollectBus.MQ.Sender;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Models;
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
||||||
using JiShe.CollectBus.RabbitMQ.Senders;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj" />
|
||||||
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj" />
|
<ProjectReference Include="..\JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.9.34728.123
|
VisualStudioVersion = 17.9.34728.123
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Core", "JiShe.CollectBus.Core\JiShe.CollectBus.Core.csproj", "{F1360C93-5B6B-4E65-9D81-1DA38740F32D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Network", "JiShe.CollectBus.Core\JiShe.CollectBus.Network.csproj", "{F1360C93-5B6B-4E65-9D81-1DA38740F32D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Console", "JiShe.CollectBus.Console\JiShe.CollectBus.Console.csproj", "{40C4F834-3080-451B-9510-6FE7BC4F801F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Console", "JiShe.CollectBus.Console\JiShe.CollectBus.Console.csproj", "{40C4F834-3080-451B-9510-6FE7BC4F801F}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Protocol.D
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.EntityFrameworkCore", "JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj", "{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.EntityFrameworkCore", "JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj", "{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.RabbitMQ", "JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj", "{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.MQ.Sender", "JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.MQ.Sender.csproj", "{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.MongoDB", "JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj", "{223DBDB1-6CD3-4D4E-8795-42550BC0A871}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.MongoDB", "JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj", "{223DBDB1-6CD3-4D4E-8795-42550BC0A871}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -35,6 +35,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Test", "Ji
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Application", "JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj", "{2760AC98-D2FA-4074-8396-FAE10BE20A3C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Application", "JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj", "{2760AC98-D2FA-4074-8396-FAE10BE20A3C}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Application.Contracts", "JiShe.CollectBus.Application.Contracts\JiShe.CollectBus.Application.Contracts.csproj", "{47B9A51B-70B5-42ED-A92A-FFEFB864CB14}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.MQ.Consumer", "JiShe.CollectBus.Service\JiShe.CollectBus.MQ.Consumer.csproj", "{024086CC-49D0-436E-8B84-A67766A30CDE}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -89,6 +93,14 @@ Global
|
|||||||
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2760AC98-D2FA-4074-8396-FAE10BE20A3C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{47B9A51B-70B5-42ED-A92A-FFEFB864CB14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{47B9A51B-70B5-42ED-A92A-FFEFB864CB14}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{47B9A51B-70B5-42ED-A92A-FFEFB864CB14}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{47B9A51B-70B5-42ED-A92A-FFEFB864CB14}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{024086CC-49D0-436E-8B84-A67766A30CDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{024086CC-49D0-436E-8B84-A67766A30CDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{024086CC-49D0-436E-8B84-A67766A30CDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{024086CC-49D0-436E-8B84-A67766A30CDE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -106,6 +118,8 @@ Global
|
|||||||
{FFA010F6-F33A-4705-8A42-B0FA3B3D2131} = {B68027BA-BD9D-4110-A383-708B87BC425D}
|
{FFA010F6-F33A-4705-8A42-B0FA3B3D2131} = {B68027BA-BD9D-4110-A383-708B87BC425D}
|
||||||
{6ED66F52-B4A0-403E-AE89-8E9A679C0885} = {3A04FB29-EA75-4499-BBF3-AF24C7D46A1D}
|
{6ED66F52-B4A0-403E-AE89-8E9A679C0885} = {3A04FB29-EA75-4499-BBF3-AF24C7D46A1D}
|
||||||
{2760AC98-D2FA-4074-8396-FAE10BE20A3C} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
|
{2760AC98-D2FA-4074-8396-FAE10BE20A3C} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
|
||||||
|
{47B9A51B-70B5-42ED-A92A-FFEFB864CB14} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
|
||||||
|
{024086CC-49D0-436E-8B84-A67766A30CDE} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {33261859-9CD1-4A43-B181-AB75C247D1CD}
|
SolutionGuid = {33261859-9CD1-4A43-B181-AB75C247D1CD}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user