diff --git a/JiShe.CollectBus.Api/JiShe.CollectBus.Api.csproj b/JiShe.CollectBus.Api/JiShe.CollectBus.Api.csproj
deleted file mode 100644
index f86353b..0000000
--- a/JiShe.CollectBus.Api/JiShe.CollectBus.Api.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- net8.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/JiShe.CollectBus.Api/JiShe.CollectBus.Api.http b/JiShe.CollectBus.Api/JiShe.CollectBus.Api.http
deleted file mode 100644
index 41908ae..0000000
--- a/JiShe.CollectBus.Api/JiShe.CollectBus.Api.http
+++ /dev/null
@@ -1,6 +0,0 @@
-@JiShe.CollectBus.Api_HostAddress = http://localhost:5233
-
-GET {{JiShe.CollectBus.Api_HostAddress}}/weatherforecast/
-Accept: application/json
-
-###
diff --git a/JiShe.CollectBus.Api/Program.cs b/JiShe.CollectBus.Api/Program.cs
deleted file mode 100644
index 48863a6..0000000
--- a/JiShe.CollectBus.Api/Program.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-var builder = WebApplication.CreateBuilder(args);
-
-// Add services to the container.
-
-builder.Services.AddControllers();
-// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
-builder.Services.AddEndpointsApiExplorer();
-builder.Services.AddSwaggerGen();
-
-var app = builder.Build();
-
-// Configure the HTTP request pipeline.
-if (app.Environment.IsDevelopment())
-{
- app.UseSwagger();
- app.UseSwaggerUI();
-}
-
-app.UseHttpsRedirection();
-
-app.UseAuthorization();
-
-app.MapControllers();
-
-app.Run();
diff --git a/JiShe.CollectBus.ClickHouse/JiShe.CollectBus.ClickHouse.csproj b/JiShe.CollectBus.ClickHouse/JiShe.CollectBus.ClickHouse.csproj
deleted file mode 100644
index 58d0070..0000000
--- a/JiShe.CollectBus.ClickHouse/JiShe.CollectBus.ClickHouse.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- net8.0
- enable
- enable
- preview
-
-
-
-
-
-
-
diff --git a/JiShe.CollectBus.Common/Extensions/HexStringExtensions.cs b/JiShe.CollectBus.Common/Extensions/HexStringExtensions.cs
index 5f12944..674359e 100644
--- a/JiShe.CollectBus.Common/Extensions/HexStringExtensions.cs
+++ b/JiShe.CollectBus.Common/Extensions/HexStringExtensions.cs
@@ -232,7 +232,7 @@ namespace JiShe.CollectBus.Common.Extensions
string strP = password.StrAddSpan().StrReverseOrder();
string strSJY = " " + pwdLevel + " " + strP + " 01 00 00 00 " + Code + " 00 " + strDate;
string strLen = (strSJY.Replace(" ", "").Length / 2).ToString("X2");
- string strReturn = "68 " + address.StrAddSpan().StrReverseOrder() + " 68 1C " + strLen + " " + StrAddHex33(strSJY) + " ";
+ string strReturn = "68 " + address.StrAddSpan().StrReverseOrder() + " 68 1C " + strLen + " " + strSJY.StrAddHex33() + " ";
string strSum = strReturn.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(i => Convert.ToInt32(i, 16)).Sum().ToString("X");
strReturn += strSum.Substring(strSum.Length - 2) + " 16";
diff --git a/JiShe.CollectBus.Console/JiShe.CollectBus.Console.csproj b/JiShe.CollectBus.Console/JiShe.CollectBus.Console.csproj
index 1bdd619..d823ab9 100644
--- a/JiShe.CollectBus.Console/JiShe.CollectBus.Console.csproj
+++ b/JiShe.CollectBus.Console/JiShe.CollectBus.Console.csproj
@@ -39,7 +39,6 @@
-
diff --git a/JiShe.CollectBus.Consumer/JiShe.CollectBus.Consumer.csproj b/JiShe.CollectBus.Consumer/JiShe.CollectBus.Consumer.csproj
deleted file mode 100644
index 2150e37..0000000
--- a/JiShe.CollectBus.Consumer/JiShe.CollectBus.Consumer.csproj
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- enable
-
-
-
diff --git a/JiShe.CollectBus.Consumer/Program.cs b/JiShe.CollectBus.Consumer/Program.cs
deleted file mode 100644
index 3751555..0000000
--- a/JiShe.CollectBus.Consumer/Program.cs
+++ /dev/null
@@ -1,2 +0,0 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
diff --git a/JiShe.CollectBus.Api/Controllers/WeatherForecastController.cs b/JiShe.CollectBus.Host/Controllers/WeatherForecastController.cs
similarity index 74%
rename from JiShe.CollectBus.Api/Controllers/WeatherForecastController.cs
rename to JiShe.CollectBus.Host/Controllers/WeatherForecastController.cs
index 1cdb5fd..647b47c 100644
--- a/JiShe.CollectBus.Api/Controllers/WeatherForecastController.cs
+++ b/JiShe.CollectBus.Host/Controllers/WeatherForecastController.cs
@@ -1,21 +1,19 @@
using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Models;
-using JiShe.CollectBus.Protocol.Contracts.Models;
using JiShe.CollectBus.RabbitMQ.Senders;
using Microsoft.AspNetCore.Mvc;
-using TouchSocket.Sockets;
-namespace JiShe.CollectBus.Api.Controllers
+namespace JiShe.CollectBus.Host.Controllers
{
[ApiController]
- [Route("[controller]")]
+ [Route("[controller]/[action]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
private readonly ILogger _logger;
private readonly INSender _nSender;
@@ -35,26 +33,31 @@ namespace JiShe.CollectBus.Api.Controllers
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
- .ToArray();
+ .ToArray();
}
[HttpGet(Name = "AmmeterParameterSend")]
- public async Task AmmeterParameterSendAsync() {
-
- var listMeter = new List() { 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
- }};
+ public async Task AmmeterParameterSendAsync()
+ {
+
+ var listMeter = new List()
+ {
+ 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.ÉèÖòÎÊý,
@@ -72,7 +75,7 @@ namespace JiShe.CollectBus.Api.Controllers
Fn = 10
}, listMeter);
- // await _nSender.SendToIssuedAsync(new MessageIssuedEvent { DeviceNo = "322009872", Message = bytes, Type = IssuedEventType.Data,MessageId = Guid.NewGuid().ToString() });
+ // await _nSender.SendToIssuedAsync(new MessageIssuedEvent { DeviceNo = "322009872", Message = bytes, Type = IssuedEventType.Data,MessageId = Guid.NewGuid().ToString() });
return true;
}
@@ -131,8 +134,5 @@ namespace JiShe.CollectBus.Api.Controllers
return true;
}
-
-
-
}
}
diff --git a/JiShe.CollectBus.Host/JiShe.CollectBus.Host.csproj b/JiShe.CollectBus.Host/JiShe.CollectBus.Host.csproj
new file mode 100644
index 0000000..3d6716f
--- /dev/null
+++ b/JiShe.CollectBus.Host/JiShe.CollectBus.Host.csproj
@@ -0,0 +1,27 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/JiShe.CollectBus.Host/Program.cs b/JiShe.CollectBus.Host/Program.cs
new file mode 100644
index 0000000..6579f81
--- /dev/null
+++ b/JiShe.CollectBus.Host/Program.cs
@@ -0,0 +1,25 @@
+using JiShe.CollectBus.Host;
+using Serilog;
+
+public class Program
+{
+ public static void Main(string[] args)
+ {
+ CreateHostBuilder(args).Build().Run();
+
+ }
+
+ private static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 1024 * 50; });
+ webBuilder.UseStartup();
+ })
+ .UseSerilog((context, loggerConfiguration) =>
+ {
+ loggerConfiguration.ReadFrom.Configuration(context.Configuration);
+ });
+}
+
diff --git a/JiShe.CollectBus.Api/Properties/launchSettings.json b/JiShe.CollectBus.Host/Properties/launchSettings.json
similarity index 82%
rename from JiShe.CollectBus.Api/Properties/launchSettings.json
rename to JiShe.CollectBus.Host/Properties/launchSettings.json
index 5c21dc5..de025ab 100644
--- a/JiShe.CollectBus.Api/Properties/launchSettings.json
+++ b/JiShe.CollectBus.Host/Properties/launchSettings.json
@@ -4,17 +4,25 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
- "applicationUrl": "http://localhost:22429",
- "sslPort": 44364
+ "applicationUrl": "http://localhost:15225",
+ "sslPort": 44348
}
},
"profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "http://localhost:5233",
+ "applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
@@ -24,15 +32,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "https://localhost:7280;http://localhost:5233",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "launchUrl": "swagger",
+ "applicationUrl": "https://localhost:7219;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/JiShe.CollectBus.Host/Startup.cs b/JiShe.CollectBus.Host/Startup.cs
new file mode 100644
index 0000000..ea6d1e4
--- /dev/null
+++ b/JiShe.CollectBus.Host/Startup.cs
@@ -0,0 +1,36 @@
+namespace JiShe.CollectBus.Host
+{
+ public class Startup(IConfiguration configuration)
+ {
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddControllers();
+ // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
+ services.AddEndpointsApiExplorer();
+ services.AddSwaggerGen();
+ }
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ app.UseSwagger();
+ app.UseSwaggerUI();
+ }
+
+ app.UseHttpsRedirection();
+ app.UseStaticFiles();
+
+ app.UseRouting();
+
+ app.UseAuthorization();
+
+ //app.UseEndpoints(endpoints =>
+ //{
+ // endpoints.MapRazorPages();
+ //});
+ }
+ }
+
+}
diff --git a/JiShe.CollectBus.Api/WeatherForecast.cs b/JiShe.CollectBus.Host/WeatherForecast.cs
similarity index 88%
rename from JiShe.CollectBus.Api/WeatherForecast.cs
rename to JiShe.CollectBus.Host/WeatherForecast.cs
index 81b998a..137fed8 100644
--- a/JiShe.CollectBus.Api/WeatherForecast.cs
+++ b/JiShe.CollectBus.Host/WeatherForecast.cs
@@ -1,4 +1,4 @@
-namespace JiShe.CollectBus.Api
+namespace JiShe.CollectBus.Host
{
public class WeatherForecast
{
diff --git a/JiShe.CollectBus.Api/appsettings.Development.json b/JiShe.CollectBus.Host/appsettings.Development.json
similarity index 100%
rename from JiShe.CollectBus.Api/appsettings.Development.json
rename to JiShe.CollectBus.Host/appsettings.Development.json
diff --git a/JiShe.CollectBus.Api/appsettings.json b/JiShe.CollectBus.Host/appsettings.json
similarity index 100%
rename from JiShe.CollectBus.Api/appsettings.json
rename to JiShe.CollectBus.Host/appsettings.json
diff --git a/JiShe.CollectBus.sln b/JiShe.CollectBus.sln
index 20ab982..c3fed3c 100644
--- a/JiShe.CollectBus.sln
+++ b/JiShe.CollectBus.sln
@@ -13,21 +13,21 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Protocol.C
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Common", "JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj", "{1D3A5A4E-B977-4E33-A1AF-62508110C3B7}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3A04FB29-EA75-4499-BBF3-AF24C7D46A1D}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.test", "3.test", "{3A04FB29-EA75-4499-BBF3-AF24C7D46A1D}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.core", "2.core", "{C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.Protocol.Test", "JiShe.CollectBus.Protocol.Test\JiShe.CollectBus.Protocol.Test.csproj", "{289196B4-FFBE-4E40-A3A1-FCFADBE945ED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.EntityFrameworkCore", "JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj", "{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.ClickHouse", "JiShe.CollectBus.ClickHouse\JiShe.CollectBus.ClickHouse.csproj", "{65A2837C-A5EE-475B-8079-EE5A1BCD2E8F}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.RabbitMQ", "JiShe.CollectBus.RabbitMQ\JiShe.CollectBus.RabbitMQ.csproj", "{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JiShe.CollectBus.MongoDB", "JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj", "{223DBDB1-6CD3-4D4E-8795-42550BC0A871}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Api", "JiShe.CollectBus.Api\JiShe.CollectBus.Api.csproj", "{E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.host", "1.host", "{B68027BA-BD9D-4110-A383-708B87BC425D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Host", "JiShe.CollectBus.Host\JiShe.CollectBus.Host.csproj", "{FFA010F6-F33A-4705-8A42-B0FA3B3D2131}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,10 +63,6 @@ Global
{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C}.Release|Any CPU.Build.0 = Release|Any CPU
- {65A2837C-A5EE-475B-8079-EE5A1BCD2E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {65A2837C-A5EE-475B-8079-EE5A1BCD2E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {65A2837C-A5EE-475B-8079-EE5A1BCD2E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {65A2837C-A5EE-475B-8079-EE5A1BCD2E8F}.Release|Any CPU.Build.0 = Release|Any CPU
{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB46D90E-304D-48B7-9ED6-F4DCC95D3824}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -75,26 +71,25 @@ Global
{223DBDB1-6CD3-4D4E-8795-42550BC0A871}.Debug|Any CPU.Build.0 = Debug|Any CPU
{223DBDB1-6CD3-4D4E-8795-42550BC0A871}.Release|Any CPU.ActiveCfg = Release|Any CPU
{223DBDB1-6CD3-4D4E-8795-42550BC0A871}.Release|Any CPU.Build.0 = Release|Any CPU
- {E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FFA010F6-F33A-4705-8A42-B0FA3B3D2131}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FFA010F6-F33A-4705-8A42-B0FA3B3D2131}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FFA010F6-F33A-4705-8A42-B0FA3B3D2131}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FFA010F6-F33A-4705-8A42-B0FA3B3D2131}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F1360C93-5B6B-4E65-9D81-1DA38740F32D} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
- {40C4F834-3080-451B-9510-6FE7BC4F801F} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
+ {40C4F834-3080-451B-9510-6FE7BC4F801F} = {B68027BA-BD9D-4110-A383-708B87BC425D}
{B2C476F1-AE32-419D-BDA2-291FCE639CF6} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
{4468B52D-3AAE-4918-B4D6-E6E8F000825D} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
{1D3A5A4E-B977-4E33-A1AF-62508110C3B7} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
{289196B4-FFBE-4E40-A3A1-FCFADBE945ED} = {3A04FB29-EA75-4499-BBF3-AF24C7D46A1D}
{16D42BCF-EDB8-4153-B37D-0B10FB6DF36C} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
- {65A2837C-A5EE-475B-8079-EE5A1BCD2E8F} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
{DB46D90E-304D-48B7-9ED6-F4DCC95D3824} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
{223DBDB1-6CD3-4D4E-8795-42550BC0A871} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
- {E40862CE-DEF4-4FF9-93EC-B3E1C4D2DCD1} = {C7DEC9FB-3F75-4584-85B0-16EA3CB222E5}
+ {FFA010F6-F33A-4705-8A42-B0FA3B3D2131} = {B68027BA-BD9D-4110-A383-708B87BC425D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {33261859-9CD1-4A43-B181-AB75C247D1CD}