From 8f9429ce9f82ea9b46ba1087ca2bc1072472cab1 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Thu, 4 Sep 2025 15:34:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E5=92=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DahAlarm/DahuaGeneralCtlService.cs | 6 +-- .../Controllers/AlarmController.cs | 2 +- .../AlarmService.API/appsettings.json | 15 ++++++- .../Controllers/WeatherForecastController.cs | 33 +++++++++++++++ .../ThirdPartyServices.API/Program.cs | 27 ++++++++++++ .../Properties/launchSettings.json | 41 +++++++++++++++++++ .../ThirdPartyServices.API.csproj | 9 ++++ .../ThirdPartyServices.API.http | 6 +++ .../ThirdPartyServices.API/WeatherForecast.cs | 13 ++++++ .../ThirdPartyServices.API/appsettings.json | 9 ++++ .../ThirdPartyServices.Application.csproj | 9 ++++ .../ThirdPartyServices.DomainService.csproj | 9 ++++ .../ThirdPartyServices.Entity.csproj | 9 ++++ .../DaHua/VideoManageController.cs | 4 +- WeiCloud.Fusion/WeiCloud.Fusion.sln | 30 ++++++++++++++ 15 files changed, 215 insertions(+), 7 deletions(-) create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/WeatherForecastController.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Program.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Properties/launchSettings.json create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.http create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/WeatherForecast.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ThirdPartyServices.Application.csproj create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Entity/ThirdPartyServices.Entity.csproj diff --git a/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs b/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs index 2cd3c87..fe5e1f0 100644 --- a/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs +++ b/WeiCloud.Fusion/AlarmService/Alarm.DomainService/DahAlarm/DahuaGeneralCtlService.cs @@ -206,14 +206,14 @@ namespace Alarm.DomainService.DahAlarm if (dto.Info is not null) { //这是大华的残卫报警类型 - if (dto.Info.AlarmType == 4321) + if (dto.Info.AlarmType == 81) { //拼接物联平台标准的mqtt消息格式 - var payload = "[{\"taglabel\":\"DH" + dto.Info.DeviceName + "\",\"value\":\"" + dto.Info.AlarmStat + "\",\"time\":\"" + DateTimeOffset.UtcNow.ToUnixTimeSeconds() + "\"}]"; + var payload = "[{\"taglabel\":\"" + dto.Info.NodeCode + "\",\"value\":\"" + dto.Info.AlarmStat + "\",\"time\":\"" + DateTimeOffset.UtcNow.ToUnixTimeSeconds() + "\"}]"; // var payload = "[{\"taglabel\":\"残卫测试报警按钮.alarmStat\",\"value\":\"" + dto.Info.AlarmStat + "\",\"time\":\"" + DateTimeOffset.UtcNow.ToUnixTimeSeconds() + "\"}]"; await _mqttClient.EnsureConnectedAsync(mqttHostIp, mqttHostPort, mqttUsername, mqttPassword, topicName, mqttClientId); - await _mqttClientService.PublishAsync(topicName, payload); + await _mqttClientService.PublishAsync("/zrh/sun/alarm", payload); } } } diff --git a/WeiCloud.Fusion/AlarmService/AlarmService.API/Controllers/AlarmController.cs b/WeiCloud.Fusion/AlarmService/AlarmService.API/Controllers/AlarmController.cs index 31368bf..899c3ac 100644 --- a/WeiCloud.Fusion/AlarmService/AlarmService.API/Controllers/AlarmController.cs +++ b/WeiCloud.Fusion/AlarmService/AlarmService.API/Controllers/AlarmController.cs @@ -46,7 +46,7 @@ namespace AlarmService.API.Controllers EventEnvelopeDto dto = new EventEnvelopeDto(); try { - dto = JsonSerializer.Deserialize(data.ToJson())!; + dto = JsonSerializer.Deserialize(data)!; } catch (Exception ex) { diff --git a/WeiCloud.Fusion/AlarmService/AlarmService.API/appsettings.json b/WeiCloud.Fusion/AlarmService/AlarmService.API/appsettings.json index fb4d991..ac32a7a 100644 --- a/WeiCloud.Fusion/AlarmService/AlarmService.API/appsettings.json +++ b/WeiCloud.Fusion/AlarmService/AlarmService.API/appsettings.json @@ -7,7 +7,7 @@ }, "SubscribeMQTT": { - "TopicName": "/zrh/sun/alarm", + "TopicName": "/zrh/sun/alarm2", "ProjectId": 530522108656160, "HostIP": "v4.weienergy.cn", "HostPort": 18883, @@ -17,6 +17,19 @@ "ClientId": "datasource_points_AXYJPT_v4", "ApiUrl": "http://v4.weienergy.cn/datastream" }, + + //"SubscribeMQTT": { + // "TopicName": "/zrh/sun/alarm2", + // "ProjectId": 530522108656160, + // "HostIP": "demo.weienergy.cn", + // "HostPort": 1883, + // "Timeout": 5000, + // "UserName": "test", + // "Password": "test123", + // "ClientId": "mqttx_40578401", + // "ApiUrl": "http://demo.weienergy.cn/datastream" + //}, + "CorsWithOrigins": [ "https://demo.weienergy.cn:15214", "http://59.110.150.214", "https://demo.weienergy.cn/" ], "AllowedHosts": "*", //大华摄像头的配置 diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/WeatherForecastController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..a32829a --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ThirdPartyServices.API.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Program.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Program.cs new file mode 100644 index 0000000..e1b8a7c --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Program.cs @@ -0,0 +1,27 @@ +namespace ThirdPartyServices.API +{ + public class Program + { + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + + var app = builder.Build(); + + // Configure the HTTP request pipeline. + + app.UseHttpsRedirection(); + + app.UseAuthorization(); + + + app.MapControllers(); + + app.Run(); + } + } +} diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Properties/launchSettings.json b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Properties/launchSettings.json new file mode 100644 index 0000000..6d05fc1 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:45980", + "sslPort": 44353 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "http://localhost:5053", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "https://localhost:7195;http://localhost:5053", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj new file mode 100644 index 0000000..1b28a01 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.http b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.http new file mode 100644 index 0000000..6836468 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.http @@ -0,0 +1,6 @@ +@ThirdPartyServices.API_HostAddress = http://localhost:5053 + +GET {{ThirdPartyServices.API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/WeatherForecast.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/WeatherForecast.cs new file mode 100644 index 0000000..57e1c96 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace ThirdPartyServices.API +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ThirdPartyServices.Application.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ThirdPartyServices.Application.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ThirdPartyServices.Application.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Entity/ThirdPartyServices.Entity.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Entity/ThirdPartyServices.Entity.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Entity/ThirdPartyServices.Entity.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs b/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs index ff41d52..ae149b5 100644 --- a/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs +++ b/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs @@ -108,8 +108,8 @@ namespace Video.API.Controllers.DaHua $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/evo-httpnode/vod/cam/download.mp4" + $"?vcuid={dto.Vcuid.Replace("$", "%24")}" + $"&subtype=1" + - $"&starttime={dto.Starttime:yyyy_MM_dd_HH_mm_ss}" + - $"&endtime={dto.Endtime:yyyy_MM_dd_HH_mm_ss}" + + $"&starttime={dto.Starttime}" + + $"&endtime={dto.Endtime}" + $"&videoType={dto.VideoType}" + $"&token={token.Replace("bearer ", "")}" + $"&recordType={dto.RecordType}"; diff --git a/WeiCloud.Fusion/WeiCloud.Fusion.sln b/WeiCloud.Fusion/WeiCloud.Fusion.sln index 669fa95..3fc2d5f 100644 --- a/WeiCloud.Fusion/WeiCloud.Fusion.sln +++ b/WeiCloud.Fusion/WeiCloud.Fusion.sln @@ -63,6 +63,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ParkingLotEntity", "Parking EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ParkLotInfoService", "ParkingLotService\ParkLotInfoService\ParkLotInfoService.csproj", "{AAF45271-3161-46EB-971E-317577091BCF}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdPartyServices", "ThirdPartyServices", "{EDE1A83A-1BCD-4A9A-9732-AAAC2AE46216}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThirdPartyServices.API", "ThirdPartyServices\ThirdPartyServices.API\ThirdPartyServices.API.csproj", "{542D2F63-50B0-4279-9EBE-A0603C387546}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThirdPartyServices.DomainService", "ThirdPartyServices\ThirdPartyServices.DomainService\ThirdPartyServices.DomainService.csproj", "{2A33E53C-E4C0-491D-8B14-BF137ECECA83}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThirdPartyServices.Application", "ThirdPartyServices\ThirdPartyServices.Application\ThirdPartyServices.Application.csproj", "{7BC20C1A-33DA-4EFD-A61E-9BC7B3749023}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThirdPartyServices.Entity", "ThirdPartyServices\ThirdPartyServices.Entity\ThirdPartyServices.Entity.csproj", "{53A7A11F-729C-4A56-BEA7-52D7080C86E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -157,6 +167,22 @@ Global {AAF45271-3161-46EB-971E-317577091BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU {AAF45271-3161-46EB-971E-317577091BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU {AAF45271-3161-46EB-971E-317577091BCF}.Release|Any CPU.Build.0 = Release|Any CPU + {542D2F63-50B0-4279-9EBE-A0603C387546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {542D2F63-50B0-4279-9EBE-A0603C387546}.Debug|Any CPU.Build.0 = Debug|Any CPU + {542D2F63-50B0-4279-9EBE-A0603C387546}.Release|Any CPU.ActiveCfg = Release|Any CPU + {542D2F63-50B0-4279-9EBE-A0603C387546}.Release|Any CPU.Build.0 = Release|Any CPU + {2A33E53C-E4C0-491D-8B14-BF137ECECA83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A33E53C-E4C0-491D-8B14-BF137ECECA83}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A33E53C-E4C0-491D-8B14-BF137ECECA83}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A33E53C-E4C0-491D-8B14-BF137ECECA83}.Release|Any CPU.Build.0 = Release|Any CPU + {7BC20C1A-33DA-4EFD-A61E-9BC7B3749023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7BC20C1A-33DA-4EFD-A61E-9BC7B3749023}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7BC20C1A-33DA-4EFD-A61E-9BC7B3749023}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7BC20C1A-33DA-4EFD-A61E-9BC7B3749023}.Release|Any CPU.Build.0 = Release|Any CPU + {53A7A11F-729C-4A56-BEA7-52D7080C86E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53A7A11F-729C-4A56-BEA7-52D7080C86E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53A7A11F-729C-4A56-BEA7-52D7080C86E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53A7A11F-729C-4A56-BEA7-52D7080C86E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -184,6 +210,10 @@ Global {40B0D902-553C-C52F-71A2-56FB176FCCBD} = {44DAA396-C724-480A-A2BC-9A33D29E8FEA} {17CDE797-A6C8-4454-BDF2-E63679C22570} = {0A3134C8-219C-4674-B152-1FA6561E4217} {AAF45271-3161-46EB-971E-317577091BCF} = {0A3134C8-219C-4674-B152-1FA6561E4217} + {542D2F63-50B0-4279-9EBE-A0603C387546} = {EDE1A83A-1BCD-4A9A-9732-AAAC2AE46216} + {2A33E53C-E4C0-491D-8B14-BF137ECECA83} = {EDE1A83A-1BCD-4A9A-9732-AAAC2AE46216} + {7BC20C1A-33DA-4EFD-A61E-9BC7B3749023} = {EDE1A83A-1BCD-4A9A-9732-AAAC2AE46216} + {53A7A11F-729C-4A56-BEA7-52D7080C86E2} = {EDE1A83A-1BCD-4A9A-9732-AAAC2AE46216} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {379A56DA-D3F0-4E7E-8FF7-DA8E20015BF3}