diff --git a/IOT_API/Controllers/Asset/EquipmentController.cs b/IOT_API/Controllers/Asset/EquipmentController.cs
index 4e8336f..cfd2ea0 100644
--- a/IOT_API/Controllers/Asset/EquipmentController.cs
+++ b/IOT_API/Controllers/Asset/EquipmentController.cs
@@ -15,6 +15,7 @@ namespace IOT_API.Controllers.Asset
///
[Route("api/Equipment")] //资产管理模块下的设备管理接口
[ApiController]
+ [Route("api/asset/equipment")]
public class EquipmentController : ControllerBase
{
private readonly IEquipmentService _equipmentService;
diff --git a/IOT_API/Controllers/Asset/QrCodeController.cs b/IOT_API/Controllers/Asset/QrCodeController.cs
new file mode 100644
index 0000000..f77f454
--- /dev/null
+++ b/IOT_API/Controllers/Asset/QrCodeController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 二维码
+ ///
+ [ApiController]
+ [Route("api/asset/qrcode")]
+ public class QrCodeController : ControllerBase
+ {
+ // TODO: 实现 二维码 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/CertificateController.cs b/IOT_API/Controllers/Config/CertificateController.cs
new file mode 100644
index 0000000..562b286
--- /dev/null
+++ b/IOT_API/Controllers/Config/CertificateController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 证书管理
+ ///
+ [ApiController]
+ [Route("api/config/certificate")]
+ public class CertificateController : ControllerBase
+ {
+ // TODO: 实现 证书管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/CollectionPointController.cs b/IOT_API/Controllers/Config/CollectionPointController.cs
new file mode 100644
index 0000000..8d33160
--- /dev/null
+++ b/IOT_API/Controllers/Config/CollectionPointController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 采集点位配置
+ ///
+ [ApiController]
+ [Route("api/config/collection-point")]
+ public class CollectionPointController : ControllerBase
+ {
+ // TODO: 实现 采集点位配置 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/CollectionStrategyController.cs b/IOT_API/Controllers/Config/CollectionStrategyController.cs
new file mode 100644
index 0000000..862f56e
--- /dev/null
+++ b/IOT_API/Controllers/Config/CollectionStrategyController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 采集策略管理
+ ///
+ [ApiController]
+ [Route("api/config/collection-strategy")]
+ public class CollectionStrategyController : ControllerBase
+ {
+ // TODO: 实现 采集策略管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/DataCleaningController.cs b/IOT_API/Controllers/Config/DataCleaningController.cs
new file mode 100644
index 0000000..0831d89
--- /dev/null
+++ b/IOT_API/Controllers/Config/DataCleaningController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 数据清洗与转换
+ ///
+ [ApiController]
+ [Route("api/config/data-cleaning")]
+ public class DataCleaningController : ControllerBase
+ {
+ // TODO: 实现 数据清洗与转换 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/DeviceGatewayController.cs b/IOT_API/Controllers/Config/DeviceGatewayController.cs
new file mode 100644
index 0000000..f664dd7
--- /dev/null
+++ b/IOT_API/Controllers/Config/DeviceGatewayController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 设备网关
+ ///
+ [ApiController]
+ [Route("api/config/device-gateway")]
+ public class DeviceGatewayController : ControllerBase
+ {
+ // TODO: 实现 设备网关 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/GatewayController.cs b/IOT_API/Controllers/Config/GatewayController.cs
new file mode 100644
index 0000000..3994ff0
--- /dev/null
+++ b/IOT_API/Controllers/Config/GatewayController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 网关管理
+ ///
+ [ApiController]
+ [Route("api/config/gateway")]
+ public class GatewayController : ControllerBase
+ {
+ // TODO: 实现 网关管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/IotDeviceController.cs b/IOT_API/Controllers/Config/IotDeviceController.cs
new file mode 100644
index 0000000..59fb655
--- /dev/null
+++ b/IOT_API/Controllers/Config/IotDeviceController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// IOT设备管理
+ ///
+ [ApiController]
+ [Route("api/config/device")]
+ public class IotDeviceController : ControllerBase
+ {
+ // TODO: 实现 IOT设备管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/NetworkComponentController.cs b/IOT_API/Controllers/Config/NetworkComponentController.cs
new file mode 100644
index 0000000..d2d7a4e
--- /dev/null
+++ b/IOT_API/Controllers/Config/NetworkComponentController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 网络组件与协议注册
+ ///
+ [ApiController]
+ [Route("api/config/network-component")]
+ public class NetworkComponentController : ControllerBase
+ {
+ // TODO: 实现 网络组件与协议注册 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/ProductController.cs b/IOT_API/Controllers/Config/ProductController.cs
new file mode 100644
index 0000000..1aed918
--- /dev/null
+++ b/IOT_API/Controllers/Config/ProductController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 产品管理
+ ///
+ [ApiController]
+ [Route("api/config/product")]
+ public class ProductController : ControllerBase
+ {
+ // TODO: 实现 产品管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/ProtocolController.cs b/IOT_API/Controllers/Config/ProtocolController.cs
new file mode 100644
index 0000000..1444f9c
--- /dev/null
+++ b/IOT_API/Controllers/Config/ProtocolController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 协议管理
+ ///
+ [ApiController]
+ [Route("api/config/protocol")]
+ public class ProtocolController : ControllerBase
+ {
+ // TODO: 实现 协议管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/ProtocolTemplateController.cs b/IOT_API/Controllers/Config/ProtocolTemplateController.cs
new file mode 100644
index 0000000..30832b4
--- /dev/null
+++ b/IOT_API/Controllers/Config/ProtocolTemplateController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 协议模板库
+ ///
+ [ApiController]
+ [Route("api/config/protocol-template")]
+ public class ProtocolTemplateController : ControllerBase
+ {
+ // TODO: 实现 协议模板库 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Config/TimeSeriesStorageController.cs b/IOT_API/Controllers/Config/TimeSeriesStorageController.cs
new file mode 100644
index 0000000..85e4883
--- /dev/null
+++ b/IOT_API/Controllers/Config/TimeSeriesStorageController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 时序数据存储
+ ///
+ [ApiController]
+ [Route("api/config/time-series")]
+ public class TimeSeriesStorageController : ControllerBase
+ {
+ // TODO: 实现 时序数据存储 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/AlertMessageController.cs b/IOT_API/Controllers/Inspection/AlertMessageController.cs
new file mode 100644
index 0000000..69feae9
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/AlertMessageController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 消息告警
+ ///
+ [ApiController]
+ [Route("api/inspection/alert-message")]
+ public class AlertMessageController : ControllerBase
+ {
+ // TODO: 实现 消息告警 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/AlertRuleController.cs b/IOT_API/Controllers/Inspection/AlertRuleController.cs
new file mode 100644
index 0000000..3e9c71d
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/AlertRuleController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 告警规则
+ ///
+ [ApiController]
+ [Route("api/inspection/alert-rule")]
+ public class AlertRuleController : ControllerBase
+ {
+ // TODO: 实现 告警规则 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/BigScreenController.cs b/IOT_API/Controllers/Inspection/BigScreenController.cs
new file mode 100644
index 0000000..27f7191
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/BigScreenController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 数据大屏
+ ///
+ [ApiController]
+ [Route("api/inspection/bigscreen")]
+ public class BigScreenController : ControllerBase
+ {
+ // TODO: 实现 数据大屏 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/DeviceDashboardController.cs b/IOT_API/Controllers/Inspection/DeviceDashboardController.cs
new file mode 100644
index 0000000..cf30d4f
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/DeviceDashboardController.cs
@@ -0,0 +1,41 @@
+using Microsoft.AspNetCore.Mvc;
+using Service.Interface;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 设备看板(温湿度)
+ ///
+ [ApiController]
+ [Route("api/inspection/dashboard")]
+ public class DeviceDashboardController : ControllerBase
+ {
+ private readonly IDeviceDashboardService _dashboardService;
+
+ public DeviceDashboardController(IDeviceDashboardService dashboardService)
+ {
+ _dashboardService = dashboardService;
+ }
+
+ ///
+ /// 获取所有环境箱的最新温湿度数据(看板卡片,前端轮询调用)
+ ///
+ [HttpGet("realtime")]
+ public async Task GetRealtime()
+ {
+ return Ok(await _dashboardService.GetRealtimeAsync());
+ }
+
+ ///
+ /// 获取指定环境箱最近 N 分钟的温湿度曲线数据
+ ///
+ /// 设备标识,如 BOX-001
+ /// 最近多少分钟,默认 5,最大 60
+ [HttpGet("curve")]
+ public async Task GetCurve([FromQuery] string deviceCode, [FromQuery] int minutes = 5)
+ {
+ minutes = Math.Clamp(minutes, 1, 60);
+ return Ok(await _dashboardService.GetCurveAsync(deviceCode, minutes));
+ }
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/EfficiencyController.cs b/IOT_API/Controllers/Inspection/EfficiencyController.cs
new file mode 100644
index 0000000..377ac57
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/EfficiencyController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 设备效率分析
+ ///
+ [ApiController]
+ [Route("api/inspection/efficiency")]
+ public class EfficiencyController : ControllerBase
+ {
+ // TODO: 实现 设备效率分析 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/PatrolController.cs b/IOT_API/Controllers/Inspection/PatrolController.cs
new file mode 100644
index 0000000..0c5e3c2
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/PatrolController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 巡检管理
+ ///
+ [ApiController]
+ [Route("api/inspection/patrol")]
+ public class PatrolController : ControllerBase
+ {
+ // TODO: 实现 巡检管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/Inspection/StatisticsReportController.cs b/IOT_API/Controllers/Inspection/StatisticsReportController.cs
new file mode 100644
index 0000000..a063e36
--- /dev/null
+++ b/IOT_API/Controllers/Inspection/StatisticsReportController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 统计报表
+ ///
+ [ApiController]
+ [Route("api/inspection/report")]
+ public class StatisticsReportController : ControllerBase
+ {
+ // TODO: 实现 统计报表 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/AccessLogController.cs b/IOT_API/Controllers/System/AccessLogController.cs
new file mode 100644
index 0000000..3e02cc8
--- /dev/null
+++ b/IOT_API/Controllers/System/AccessLogController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 访问日志
+ ///
+ [ApiController]
+ [Route("api/system/access-log")]
+ public class AccessLogController : ControllerBase
+ {
+ // TODO: 实现 访问日志 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/AuditController.cs b/IOT_API/Controllers/System/AuditController.cs
new file mode 100644
index 0000000..8b1fea8
--- /dev/null
+++ b/IOT_API/Controllers/System/AuditController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 操作审计日志
+ ///
+ [ApiController]
+ [Route("api/system/audit")]
+ public class AuditController : ControllerBase
+ {
+ // TODO: 实现 操作审计日志 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/DictController.cs b/IOT_API/Controllers/System/DictController.cs
new file mode 100644
index 0000000..abae2dd
--- /dev/null
+++ b/IOT_API/Controllers/System/DictController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 数据字典管理
+ ///
+ [ApiController]
+ [Route("api/system/dict")]
+ public class DictController : ControllerBase
+ {
+ // TODO: 实现 数据字典管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/FileStorageController.cs b/IOT_API/Controllers/System/FileStorageController.cs
new file mode 100644
index 0000000..98c401b
--- /dev/null
+++ b/IOT_API/Controllers/System/FileStorageController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 文件存储管理
+ ///
+ [ApiController]
+ [Route("api/system/file-storage")]
+ public class FileStorageController : ControllerBase
+ {
+ // TODO: 实现 文件存储管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/OrganizationController.cs b/IOT_API/Controllers/System/OrganizationController.cs
new file mode 100644
index 0000000..7a29643
--- /dev/null
+++ b/IOT_API/Controllers/System/OrganizationController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 组织架构管理
+ ///
+ [ApiController]
+ [Route("api/system/organization")]
+ public class OrganizationController : ControllerBase
+ {
+ // TODO: 实现 组织架构管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/RoleController.cs b/IOT_API/Controllers/System/RoleController.cs
new file mode 100644
index 0000000..ded3e73
--- /dev/null
+++ b/IOT_API/Controllers/System/RoleController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 角色权限管理
+ ///
+ [ApiController]
+ [Route("api/system/role")]
+ public class RoleController : ControllerBase
+ {
+ // TODO: 实现 角色权限管理 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/SystemLogController.cs b/IOT_API/Controllers/System/SystemLogController.cs
new file mode 100644
index 0000000..d716094
--- /dev/null
+++ b/IOT_API/Controllers/System/SystemLogController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 系统日志
+ ///
+ [ApiController]
+ [Route("api/system/system-log")]
+ public class SystemLogController : ControllerBase
+ {
+ // TODO: 实现 系统日志 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/SystemParamController.cs b/IOT_API/Controllers/System/SystemParamController.cs
new file mode 100644
index 0000000..8822fe8
--- /dev/null
+++ b/IOT_API/Controllers/System/SystemParamController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 系统参数配置
+ ///
+ [ApiController]
+ [Route("api/system/param")]
+ public class SystemParamController : ControllerBase
+ {
+ // TODO: 实现 系统参数配置 相关接口
+ }
+}
diff --git a/IOT_API/Controllers/System/UserController.cs b/IOT_API/Controllers/System/UserController.cs
new file mode 100644
index 0000000..708c00c
--- /dev/null
+++ b/IOT_API/Controllers/System/UserController.cs
@@ -0,0 +1,14 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 用户管理
+ ///
+ [ApiController]
+ [Route("api/system/user")]
+ public class UserController : ControllerBase
+ {
+ // TODO: 实现 用户管理 相关接口
+ }
+}
diff --git a/IOT_API/DependencyInjection.cs b/IOT_API/DependencyInjection.cs
new file mode 100644
index 0000000..138e070
--- /dev/null
+++ b/IOT_API/DependencyInjection.cs
@@ -0,0 +1,48 @@
+using Service.Implement;
+using System.Reflection;
+
+namespace WebAPI
+{
+ ///
+ /// 业务服务依赖注入扩展
+ /// 约定:Service.Interface 中的 IXxxService 对应 Service.Implement 中的 XxxService
+ ///
+ public static class DependencyInjection
+ {
+ ///
+ /// 自动注册所有业务服务(按命名约定:接口去掉前缀 I 即为实现类名)
+ /// 以后在 Service 项目里新增「接口 + 实现」时,无需改动这里,会自动注册
+ ///
+ public static IServiceCollection AddBusinessServices(this IServiceCollection services)
+ {
+ // Service 项目程序集(接口与实现都在同一个程序集里)
+ Assembly assembly = typeof(BaseService<>).Assembly;
+
+ // 所有具体实现类(非抽象、非泛型定义)
+ var implTypes = assembly.GetTypes()
+ .Where(t => t.IsClass && !t.IsAbstract && !t.IsGenericTypeDefinition)
+ .ToList();
+
+ // 所有接口
+ var ifaceTypes = assembly.GetTypes()
+ .Where(t => t.IsInterface && !t.IsGenericTypeDefinition)
+ .ToList();
+
+ foreach (var iface in ifaceTypes)
+ {
+ // 接口名去掉前缀 I,得到期望的实现类名
+ string implName = iface.Name.StartsWith("I") ? iface.Name.Substring(1) : iface.Name;
+ var impl = implTypes.FirstOrDefault(t => t.Name == implName);
+ if (impl != null && iface.IsAssignableFrom(impl))
+ {
+ services.AddScoped(iface, impl);
+ }
+ }
+
+ // 泛型基础服务(IBaseService<> -> BaseService<>)单独注册
+ services.AddScoped(typeof(Service.Interface.IBaseService<>), typeof(Service.Implement.BaseService<>));
+
+ return services;
+ }
+ }
+}
diff --git a/IOT_API/Program.cs b/IOT_API/Program.cs
index 9a2a91d..1eab3c7 100644
--- a/IOT_API/Program.cs
+++ b/IOT_API/Program.cs
@@ -1,6 +1,7 @@
using Common;
using ORM;
using System.Text.Json;
+using WebAPI.Services;
namespace WebAPI
{
@@ -8,30 +9,42 @@ namespace WebAPI
{
public static void Main(string[] args)
{
- // ======= ����ת����δ�����쳣ʱ�Զ����� MiniDump =======
+ //dump文件崩溃记录(不用或者使用后记得去编译路径删除,.dump文件体积很大)
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
- //��¼dump�ļ�
Exception ex = e.ExceptionObject as Exception;
- MiniDump.TryDump($"dumps\\Error_{DateTime.Now:yyyy-MM-dd HH-mm-ss-ms}.dmp", MiniDump.Option.WithFullMemory, ex);
+ string exeDir = AppContext.BaseDirectory;
+ string dumpDir = Path.Combine(exeDir, "Dump");
+ if (!Directory.Exists(dumpDir))
+ {
+ Directory.CreateDirectory(dumpDir);
+ }
+ string dumpFileName = $"Error_{DateTime.Now:yyyy-MM-dd HH-mm-ss-fff}.dmp";
+ string dumpFullPath = Path.Combine(dumpDir, dumpFileName);
+ MiniDump.TryDump(dumpFullPath, MiniDump.Option.WithFullMemory, ex);
};
- // ======= ����ת������ =======
var builder = WebApplication.CreateBuilder(args);
-
- // Add services to the container.
- // ======= �������ÿ�ʼ =======
+ //注册postgre数据库
+ var db = builder.Configuration.GetSection("Database");
+ DatabaseConfig.InitPostgreSQL(db["Server"]!, int.Parse(db["Port"] ?? "5432"), db["Database"]!, db["User"]!, db["Password"]!);
+ if (int.TryParse(db["TenantId"], out var tenantId))
+ DatabaseConfig.SetTenant(tenantId);
+ DatabaseConfig.CreateDatabaseAndCheckConnection(createDatabase: true, checkConnection: true);
+ SqlSugarContext.InitDatabase();
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString;
- // 3. �����������Ա���ԭ������ǿ��תΪ�շ壩
options.JsonSerializerOptions.PropertyNamingPolicy = null;
});
- // ======= �������ý��� =======
+ // 自动注册业务服务(Service.Interface -> Service.Implement)
+ builder.Services.AddBusinessServices();
+
+ // 温度箱模拟数据:每秒生成 100 条温湿度入库(真实设备接入后删除)
+ builder.Services.AddHostedService();
- // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
@@ -65,8 +78,9 @@ namespace WebAPI
app.UseSwaggerUI();
}
- // ע�⣺�����λ��ֻ֧�� http �����ֳ�����ʱ�������Ҫ����ʵ�����ע�͵��������� Https �ض���
- app.UseHttpsRedirection();
+ // 关闭 Https 重定向:开启时会把 http 请求 307 到 https 端口,
+ // 导致前端 vite 代理被 CORS 拦截(Network Error);上位机/现场部署通常也只用 http
+ // app.UseHttpsRedirection();
app.UseAuthorization();
diff --git a/IOT_API/Services/TemperatureBoxSimulator.cs b/IOT_API/Services/TemperatureBoxSimulator.cs
new file mode 100644
index 0000000..5d48bf5
--- /dev/null
+++ b/IOT_API/Services/TemperatureBoxSimulator.cs
@@ -0,0 +1,82 @@
+using Model.Entity;
+using ORM;
+
+namespace WebAPI.Services
+{
+ ///
+ /// 温度箱数据模拟器(临时用)
+ /// 每秒为 100 台环境箱生成一条模拟温湿度数据并批量写入数据库,
+ /// 真实设备接入后删除此类及 Program.cs 中的注册即可
+ ///
+ public class TemperatureBoxSimulator : BackgroundService
+ {
+ private const int DeviceCount = 100;
+ private const double AlarmTemp = 80.0; // 高温报警阈值
+ private static readonly Random Rnd = new();
+
+ // 每台设备维护一份模拟状态(随机游走需要基于上一次的值)
+ private class BoxState
+ {
+ public double Temperature = Rnd.Next(20, 60);
+ public double Humidity = Rnd.Next(30, 70);
+ }
+
+ private readonly Dictionary _states = new();
+
+ public TemperatureBoxSimulator()
+ {
+ for (int i = 1; i <= DeviceCount; i++)
+ {
+ _states[$"BOX-{i:D3}"] = new BoxState();
+ }
+ }
+
+ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
+ {
+ while (!stoppingToken.IsCancellationRequested)
+ {
+ try
+ {
+ var now = DateTime.Now;
+ var batch = new List(DeviceCount);
+
+ foreach (var kv in _states)
+ {
+ var s = kv.Value;
+ // 随机游走,让曲线平滑连续
+ s.Temperature = Math.Clamp(s.Temperature + (Rnd.NextDouble() - 0.48) * 2, 15, 95);
+ s.Humidity = Math.Clamp(s.Humidity + (Rnd.NextDouble() - 0.5) * 3, 20, 90);
+
+ bool alarm = s.Temperature >= AlarmTemp;
+ batch.Add(new TemperatureBoxDataEntity
+ {
+ DeviceCode = kv.Key,
+ DeviceType = "TemperatureBox",
+ DeviceTemperature = Math.Round(s.Temperature, 1),
+ DeviceHumidity = Math.Round(s.Humidity, 1),
+ Status = alarm ? "报警" : "运行",
+ AlarmInfo = alarm ? "温度超限报警" : "",
+ CreateTime = now
+ });
+ }
+
+ // 批量插入
+ await SqlSugarContext.DbContext.Insertable(batch).ExecuteCommandAsync();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"[温度箱模拟器] 写入失败: {ex.Message}");
+ }
+
+ try
+ {
+ await Task.Delay(1000, stoppingToken);
+ }
+ catch (TaskCanceledException)
+ {
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/IOT_API/appsettings.json b/IOT_API/appsettings.json
index 853529b..403b81a 100644
--- a/IOT_API/appsettings.json
+++ b/IOT_API/appsettings.json
@@ -7,10 +7,12 @@
},
"AllowedHosts": "*",
"Database": {
- "Server": "localhost",
+ "Type": "PostgreSQL",
+ "Server": "127.0.0.1",
"Port": 5432,
- "Database": "iot",
- "Uid": "postgres",
- "Pwd": "postgres"
+ "Database": "IOT_WEB",
+ "User": "postgres",
+ "Password": "kylt123",
+ "TenantId": 10001
}
}
diff --git a/Model/Entity/BaseEntity.cs b/Model/Entity/BaseEntity.cs
index 8f6f7b0..fedbe21 100644
--- a/Model/Entity/BaseEntity.cs
+++ b/Model/Entity/BaseEntity.cs
@@ -18,10 +18,10 @@ namespace Model.Entity
///
/// 删除状态
///
- [SugarColumn(ColumnName = "IsDel", ColumnDescription = "删除状态(0、未删除;1、已删除)", ColumnDataType = "tinyint", DefaultValue = "0", CreateTableFieldSort = 106)]
+ [SugarColumn(ColumnName = "IsDel", ColumnDescription = "删除状态(0、未删除;1、已删除)", ColumnDataType = "smallint", DefaultValue = "0", CreateTableFieldSort = 106)]
public virtual byte IsDel { get; set; }
[SugarColumn(ColumnName = "CreateTime")]
- public DateTime CreateTime { get; set; }
+ public virtual DateTime? CreateTime { get; set; }
}
}
diff --git a/Model/Entity/TemperatureBoxDataEntity.cs b/Model/Entity/TemperatureBoxDataEntity.cs
new file mode 100644
index 0000000..17b5a49
--- /dev/null
+++ b/Model/Entity/TemperatureBoxDataEntity.cs
@@ -0,0 +1,54 @@
+using SqlSugar;
+using System;
+
+namespace Model.Entity
+{
+ ///
+ /// 温度箱看板数据实体
+ /// 室内环境温湿度曲线;设备温度、湿度、状态等指标;设备告警信息
+ ///
+ public class TemperatureBoxDataEntity : BaseEntity
+ {
+ ///
+ /// 设备标识
+ ///
+ [SugarColumn(ColumnName = "DeviceCode", ColumnDescription = "设备标识", ColumnDataType = "varchar(64)")]
+ public string DeviceCode { get; set; }
+
+ ///
+ /// 设备类型
+ ///
+ [SugarColumn(ColumnName = "DeviceType", ColumnDescription = "设备类型", ColumnDataType = "varchar(64)")]
+ public string DeviceType { get; set; }
+
+ ///
+ /// 设备温度(℃)
+ ///
+ [SugarColumn(ColumnName = "DeviceTemperature", ColumnDescription = "设备温度(℃)", IsNullable = true)]
+ public double? DeviceTemperature { get; set; }
+
+ ///
+ /// 设备湿度(%)
+ ///
+ [SugarColumn(ColumnName = "DeviceHumidity", ColumnDescription = "设备湿度(%)", IsNullable = true)]
+ public double? DeviceHumidity { get; set; }
+
+ ///
+ /// 设备状态
+ ///
+ [SugarColumn(ColumnName = "Status", ColumnDescription = "设备状态", ColumnDataType = "varchar(32)", IsNullable = true)]
+ public string Status { get; set; }
+
+ ///
+ /// 设备告警信息
+ ///
+ [SugarColumn(ColumnName = "AlarmInfo", ColumnDescription = "设备告警信息", IsNullable = true)]
+ public string AlarmInfo { get; set; }
+
+ ///
+ /// 采集时间(用于绘制温湿度曲线)
+ ///
+ [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "采集时间", IsNullable = true)]
+ public override DateTime? CreateTime { get; set; }
+ }
+}
diff --git a/Model/Model/EnovaChannelData.cs b/Model/Model/EnovaChannelData.cs
index 0b9fc29..9d8b6d3 100644
--- a/Model/Model/EnovaChannelData.cs
+++ b/Model/Model/EnovaChannelData.cs
@@ -1,6 +1,7 @@
using System.Text.Json.Serialization;
namespace Model.Model
{
+ //没啥逼用,后续得改
public class EnovaChannelData
{
public string Laboratory { get; set; }
diff --git a/ORM/DatabaseConfig.cs b/ORM/DatabaseConfig.cs
index 9eca36b..5fd0656 100644
--- a/ORM/DatabaseConfig.cs
+++ b/ORM/DatabaseConfig.cs
@@ -74,11 +74,12 @@ namespace ORM
string DBPath = Path.Combine(folder, "SQL.db");
DbConnectionString =$@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog={DBPath};Integrated Security=True;";
}
- public static void InitPostgreSql(string Server, int Port, string Database, string Uid, string Pwd)
+ public static void InitPostgreSQL(string server, int port, string database, string user, string password)
{
DbConnectionType = DbType.PostgreSQL;
+
DbConnectionString =
- $"Host={Server};Port={Port};Database={Database};Username={Uid};Password={Pwd};";
+ $"Host={server};Port={port};Database={database};Username={user};Password={password};";
}
#endregion
///
diff --git a/Service/Implement/Asset/EquipmentService.cs b/Service/Implement/Asset/EquipmentService.cs
new file mode 100644
index 0000000..f6d87c8
--- /dev/null
+++ b/Service/Implement/Asset/EquipmentService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 设备台账 服务实现
+ ///
+ public class EquipmentService : IEquipmentService
+ {
+ // TODO: 实现 设备台账 相关方法
+ }
+}
diff --git a/Service/Implement/Asset/QrCodeService.cs b/Service/Implement/Asset/QrCodeService.cs
new file mode 100644
index 0000000..1aa77af
--- /dev/null
+++ b/Service/Implement/Asset/QrCodeService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 二维码 服务实现
+ ///
+ public class QrCodeService : IQrCodeService
+ {
+ // TODO: 实现 二维码 相关方法
+ }
+}
diff --git a/Service/Implement/Config/CertificateService.cs b/Service/Implement/Config/CertificateService.cs
new file mode 100644
index 0000000..29d57bd
--- /dev/null
+++ b/Service/Implement/Config/CertificateService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 证书管理 服务实现
+ ///
+ public class CertificateService : ICertificateService
+ {
+ // TODO: 实现 证书管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/CollectionPointService.cs b/Service/Implement/Config/CollectionPointService.cs
new file mode 100644
index 0000000..56d4c9c
--- /dev/null
+++ b/Service/Implement/Config/CollectionPointService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 采集点位配置 服务实现
+ ///
+ public class CollectionPointService : ICollectionPointService
+ {
+ // TODO: 实现 采集点位配置 相关方法
+ }
+}
diff --git a/Service/Implement/Config/CollectionStrategyService.cs b/Service/Implement/Config/CollectionStrategyService.cs
new file mode 100644
index 0000000..82e7817
--- /dev/null
+++ b/Service/Implement/Config/CollectionStrategyService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 采集策略管理 服务实现
+ ///
+ public class CollectionStrategyService : ICollectionStrategyService
+ {
+ // TODO: 实现 采集策略管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/DataCleaningService.cs b/Service/Implement/Config/DataCleaningService.cs
new file mode 100644
index 0000000..3fdd025
--- /dev/null
+++ b/Service/Implement/Config/DataCleaningService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 数据清洗与转换 服务实现
+ ///
+ public class DataCleaningService : IDataCleaningService
+ {
+ // TODO: 实现 数据清洗与转换 相关方法
+ }
+}
diff --git a/Service/Implement/Config/DeviceGatewayService.cs b/Service/Implement/Config/DeviceGatewayService.cs
new file mode 100644
index 0000000..357a2fe
--- /dev/null
+++ b/Service/Implement/Config/DeviceGatewayService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 设备网关 服务实现
+ ///
+ public class DeviceGatewayService : IDeviceGatewayService
+ {
+ // TODO: 实现 设备网关 相关方法
+ }
+}
diff --git a/Service/Implement/Config/GatewayService.cs b/Service/Implement/Config/GatewayService.cs
new file mode 100644
index 0000000..781e7ec
--- /dev/null
+++ b/Service/Implement/Config/GatewayService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 网关管理 服务实现
+ ///
+ public class GatewayService : IGatewayService
+ {
+ // TODO: 实现 网关管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/IotDeviceService.cs b/Service/Implement/Config/IotDeviceService.cs
new file mode 100644
index 0000000..7c5f911
--- /dev/null
+++ b/Service/Implement/Config/IotDeviceService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// IOT设备管理 服务实现
+ ///
+ public class IotDeviceService : IIotDeviceService
+ {
+ // TODO: 实现 IOT设备管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/NetworkComponentService.cs b/Service/Implement/Config/NetworkComponentService.cs
new file mode 100644
index 0000000..c16004b
--- /dev/null
+++ b/Service/Implement/Config/NetworkComponentService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 网络组件与协议注册 服务实现
+ ///
+ public class NetworkComponentService : INetworkComponentService
+ {
+ // TODO: 实现 网络组件与协议注册 相关方法
+ }
+}
diff --git a/Service/Implement/Config/ProductService.cs b/Service/Implement/Config/ProductService.cs
new file mode 100644
index 0000000..1254ca9
--- /dev/null
+++ b/Service/Implement/Config/ProductService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 产品管理 服务实现
+ ///
+ public class ProductService : IProductService
+ {
+ // TODO: 实现 产品管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/ProtocolService.cs b/Service/Implement/Config/ProtocolService.cs
new file mode 100644
index 0000000..fd83f7f
--- /dev/null
+++ b/Service/Implement/Config/ProtocolService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 协议管理 服务实现
+ ///
+ public class ProtocolService : IProtocolService
+ {
+ // TODO: 实现 协议管理 相关方法
+ }
+}
diff --git a/Service/Implement/Config/ProtocolTemplateService.cs b/Service/Implement/Config/ProtocolTemplateService.cs
new file mode 100644
index 0000000..57ce174
--- /dev/null
+++ b/Service/Implement/Config/ProtocolTemplateService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 协议模板库 服务实现
+ ///
+ public class ProtocolTemplateService : IProtocolTemplateService
+ {
+ // TODO: 实现 协议模板库 相关方法
+ }
+}
diff --git a/Service/Implement/Config/TimeSeriesStorageService.cs b/Service/Implement/Config/TimeSeriesStorageService.cs
new file mode 100644
index 0000000..46e13f3
--- /dev/null
+++ b/Service/Implement/Config/TimeSeriesStorageService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 时序数据存储 服务实现
+ ///
+ public class TimeSeriesStorageService : ITimeSeriesStorageService
+ {
+ // TODO: 实现 时序数据存储 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/AlertMessageService.cs b/Service/Implement/Inspection/AlertMessageService.cs
new file mode 100644
index 0000000..5d58f2e
--- /dev/null
+++ b/Service/Implement/Inspection/AlertMessageService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 消息告警 服务实现
+ ///
+ public class AlertMessageService : IAlertMessageService
+ {
+ // TODO: 实现 消息告警 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/AlertRuleService.cs b/Service/Implement/Inspection/AlertRuleService.cs
new file mode 100644
index 0000000..40e65d3
--- /dev/null
+++ b/Service/Implement/Inspection/AlertRuleService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 告警规则 服务实现
+ ///
+ public class AlertRuleService : IAlertRuleService
+ {
+ // TODO: 实现 告警规则 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/BigScreenService.cs b/Service/Implement/Inspection/BigScreenService.cs
new file mode 100644
index 0000000..8fbb757
--- /dev/null
+++ b/Service/Implement/Inspection/BigScreenService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 数据大屏 服务实现
+ ///
+ public class BigScreenService : IBigScreenService
+ {
+ // TODO: 实现 数据大屏 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/DeviceDashboardService.cs b/Service/Implement/Inspection/DeviceDashboardService.cs
new file mode 100644
index 0000000..3d85167
--- /dev/null
+++ b/Service/Implement/Inspection/DeviceDashboardService.cs
@@ -0,0 +1,70 @@
+using Model;
+using Model.Entity;
+using ORM;
+using Service.Interface;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Service.Implement
+{
+ ///
+ /// 设备看板服务实现(温湿度)
+ ///
+ public class DeviceDashboardService : IDeviceDashboardService
+ {
+ ///
+ /// 获取每台设备最新一条温湿度数据(看板卡片用)
+ ///
+ public async Task>> GetRealtimeAsync()
+ {
+ try
+ {
+ var db = SqlSugarContext.DbContext;
+
+ // 雪花 Id 单调递增,每台设备取最大 Id 即最新一条
+ var latestIds = await db.Queryable()
+ .Where(x => x.IsDel == 0)
+ .GroupBy(x => x.DeviceCode)
+ .Select(x => SqlFunc.AggregateMax(x.Id))
+ .ToListAsync();
+
+ var list = await db.Queryable()
+ .Where(x => latestIds.Contains(x.Id))
+ .OrderBy(x => x.DeviceCode)
+ .ToListAsync();
+
+ return Result>.Success(list);
+ }
+ catch (Exception ex)
+ {
+ return Result>.Error("查询设备实时数据失败", ex);
+ }
+ }
+
+ ///
+ /// 获取指定设备最近 N 分钟的温湿度曲线数据(按时间升序)
+ ///
+ public async Task>> GetCurveAsync(string deviceCode, int minutes)
+ {
+ if (string.IsNullOrWhiteSpace(deviceCode))
+ return Result>.Error("设备标识不能为空");
+
+ try
+ {
+ var start = DateTime.Now.AddMinutes(-minutes);
+ var list = await SqlSugarContext.DbContext.Queryable()
+ .Where(x => x.DeviceCode == deviceCode && x.IsDel == 0 && x.CreateTime >= start)
+ .OrderBy(x => x.CreateTime)
+ .ToListAsync();
+
+ return Result>.Success(list);
+ }
+ catch (Exception ex)
+ {
+ return Result>.Error("查询温湿度曲线失败", ex);
+ }
+ }
+ }
+}
diff --git a/Service/Implement/Inspection/EfficiencyService.cs b/Service/Implement/Inspection/EfficiencyService.cs
new file mode 100644
index 0000000..041c04c
--- /dev/null
+++ b/Service/Implement/Inspection/EfficiencyService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 设备效率分析 服务实现
+ ///
+ public class EfficiencyService : IEfficiencyService
+ {
+ // TODO: 实现 设备效率分析 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/PatrolService.cs b/Service/Implement/Inspection/PatrolService.cs
new file mode 100644
index 0000000..79a5684
--- /dev/null
+++ b/Service/Implement/Inspection/PatrolService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 巡检管理 服务实现
+ ///
+ public class PatrolService : IPatrolService
+ {
+ // TODO: 实现 巡检管理 相关方法
+ }
+}
diff --git a/Service/Implement/Inspection/StatisticsReportService.cs b/Service/Implement/Inspection/StatisticsReportService.cs
new file mode 100644
index 0000000..2c22ab0
--- /dev/null
+++ b/Service/Implement/Inspection/StatisticsReportService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 统计报表 服务实现
+ ///
+ public class StatisticsReportService : IStatisticsReportService
+ {
+ // TODO: 实现 统计报表 相关方法
+ }
+}
diff --git a/Service/Implement/System/AccessLogService.cs b/Service/Implement/System/AccessLogService.cs
new file mode 100644
index 0000000..a51b7aa
--- /dev/null
+++ b/Service/Implement/System/AccessLogService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 访问日志 服务实现
+ ///
+ public class AccessLogService : IAccessLogService
+ {
+ // TODO: 实现 访问日志 相关方法
+ }
+}
diff --git a/Service/Implement/System/AuditService.cs b/Service/Implement/System/AuditService.cs
new file mode 100644
index 0000000..b8b673e
--- /dev/null
+++ b/Service/Implement/System/AuditService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 操作审计日志 服务实现
+ ///
+ public class AuditService : IAuditService
+ {
+ // TODO: 实现 操作审计日志 相关方法
+ }
+}
diff --git a/Service/Implement/System/DictService.cs b/Service/Implement/System/DictService.cs
new file mode 100644
index 0000000..9b50928
--- /dev/null
+++ b/Service/Implement/System/DictService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 数据字典管理 服务实现
+ ///
+ public class DictService : IDictService
+ {
+ // TODO: 实现 数据字典管理 相关方法
+ }
+}
diff --git a/Service/Implement/System/FileStorageService.cs b/Service/Implement/System/FileStorageService.cs
new file mode 100644
index 0000000..e4297e7
--- /dev/null
+++ b/Service/Implement/System/FileStorageService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 文件存储管理 服务实现
+ ///
+ public class FileStorageService : IFileStorageService
+ {
+ // TODO: 实现 文件存储管理 相关方法
+ }
+}
diff --git a/Service/Implement/System/OrganizationService.cs b/Service/Implement/System/OrganizationService.cs
new file mode 100644
index 0000000..38bc98b
--- /dev/null
+++ b/Service/Implement/System/OrganizationService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 组织架构管理 服务实现
+ ///
+ public class OrganizationService : IOrganizationService
+ {
+ // TODO: 实现 组织架构管理 相关方法
+ }
+}
diff --git a/Service/Implement/System/RoleService.cs b/Service/Implement/System/RoleService.cs
new file mode 100644
index 0000000..9f91219
--- /dev/null
+++ b/Service/Implement/System/RoleService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 角色权限管理 服务实现
+ ///
+ public class RoleService : IRoleService
+ {
+ // TODO: 实现 角色权限管理 相关方法
+ }
+}
diff --git a/Service/Implement/System/SystemLogService.cs b/Service/Implement/System/SystemLogService.cs
new file mode 100644
index 0000000..1227052
--- /dev/null
+++ b/Service/Implement/System/SystemLogService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 系统日志 服务实现
+ ///
+ public class SystemLogService : ISystemLogService
+ {
+ // TODO: 实现 系统日志 相关方法
+ }
+}
diff --git a/Service/Implement/System/SystemParamService.cs b/Service/Implement/System/SystemParamService.cs
new file mode 100644
index 0000000..d0f3770
--- /dev/null
+++ b/Service/Implement/System/SystemParamService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 系统参数配置 服务实现
+ ///
+ public class SystemParamService : ISystemParamService
+ {
+ // TODO: 实现 系统参数配置 相关方法
+ }
+}
diff --git a/Service/Implement/System/UserService.cs b/Service/Implement/System/UserService.cs
new file mode 100644
index 0000000..e636da2
--- /dev/null
+++ b/Service/Implement/System/UserService.cs
@@ -0,0 +1,12 @@
+using Service.Interface;
+
+namespace Service.Implement
+{
+ ///
+ /// 用户管理 服务实现
+ ///
+ public class UserService : IUserService
+ {
+ // TODO: 实现 用户管理 相关方法
+ }
+}
diff --git a/Service/Interface/Asset/IEquipmentService.cs b/Service/Interface/Asset/IEquipmentService.cs
new file mode 100644
index 0000000..98be808
--- /dev/null
+++ b/Service/Interface/Asset/IEquipmentService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 设备台账 服务接口
+ ///
+ public interface IEquipmentService
+ {
+ // TODO: 定义 设备台账 相关方法
+ }
+}
diff --git a/Service/Interface/Asset/IQrCodeService.cs b/Service/Interface/Asset/IQrCodeService.cs
new file mode 100644
index 0000000..88a0fca
--- /dev/null
+++ b/Service/Interface/Asset/IQrCodeService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 二维码 服务接口
+ ///
+ public interface IQrCodeService
+ {
+ // TODO: 定义 二维码 相关方法
+ }
+}
diff --git a/Service/Interface/Config/ICertificateService.cs b/Service/Interface/Config/ICertificateService.cs
new file mode 100644
index 0000000..71a3ff2
--- /dev/null
+++ b/Service/Interface/Config/ICertificateService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 证书管理 服务接口
+ ///
+ public interface ICertificateService
+ {
+ // TODO: 定义 证书管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/ICollectionPointService.cs b/Service/Interface/Config/ICollectionPointService.cs
new file mode 100644
index 0000000..e8e501a
--- /dev/null
+++ b/Service/Interface/Config/ICollectionPointService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 采集点位配置 服务接口
+ ///
+ public interface ICollectionPointService
+ {
+ // TODO: 定义 采集点位配置 相关方法
+ }
+}
diff --git a/Service/Interface/Config/ICollectionStrategyService.cs b/Service/Interface/Config/ICollectionStrategyService.cs
new file mode 100644
index 0000000..ee51337
--- /dev/null
+++ b/Service/Interface/Config/ICollectionStrategyService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 采集策略管理 服务接口
+ ///
+ public interface ICollectionStrategyService
+ {
+ // TODO: 定义 采集策略管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IDataCleaningService.cs b/Service/Interface/Config/IDataCleaningService.cs
new file mode 100644
index 0000000..39b36af
--- /dev/null
+++ b/Service/Interface/Config/IDataCleaningService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 数据清洗与转换 服务接口
+ ///
+ public interface IDataCleaningService
+ {
+ // TODO: 定义 数据清洗与转换 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IDeviceGatewayService.cs b/Service/Interface/Config/IDeviceGatewayService.cs
new file mode 100644
index 0000000..b5b78b2
--- /dev/null
+++ b/Service/Interface/Config/IDeviceGatewayService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 设备网关 服务接口
+ ///
+ public interface IDeviceGatewayService
+ {
+ // TODO: 定义 设备网关 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IGatewayService.cs b/Service/Interface/Config/IGatewayService.cs
new file mode 100644
index 0000000..b955005
--- /dev/null
+++ b/Service/Interface/Config/IGatewayService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 网关管理 服务接口
+ ///
+ public interface IGatewayService
+ {
+ // TODO: 定义 网关管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IIotDeviceService.cs b/Service/Interface/Config/IIotDeviceService.cs
new file mode 100644
index 0000000..73a6566
--- /dev/null
+++ b/Service/Interface/Config/IIotDeviceService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// IOT设备管理 服务接口
+ ///
+ public interface IIotDeviceService
+ {
+ // TODO: 定义 IOT设备管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/INetworkComponentService.cs b/Service/Interface/Config/INetworkComponentService.cs
new file mode 100644
index 0000000..19611fd
--- /dev/null
+++ b/Service/Interface/Config/INetworkComponentService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 网络组件与协议注册 服务接口
+ ///
+ public interface INetworkComponentService
+ {
+ // TODO: 定义 网络组件与协议注册 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IProductService.cs b/Service/Interface/Config/IProductService.cs
new file mode 100644
index 0000000..c2f8448
--- /dev/null
+++ b/Service/Interface/Config/IProductService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 产品管理 服务接口
+ ///
+ public interface IProductService
+ {
+ // TODO: 定义 产品管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IProtocolService.cs b/Service/Interface/Config/IProtocolService.cs
new file mode 100644
index 0000000..25b2cb6
--- /dev/null
+++ b/Service/Interface/Config/IProtocolService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 协议管理 服务接口
+ ///
+ public interface IProtocolService
+ {
+ // TODO: 定义 协议管理 相关方法
+ }
+}
diff --git a/Service/Interface/Config/IProtocolTemplateService.cs b/Service/Interface/Config/IProtocolTemplateService.cs
new file mode 100644
index 0000000..08d4f57
--- /dev/null
+++ b/Service/Interface/Config/IProtocolTemplateService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 协议模板库 服务接口
+ ///
+ public interface IProtocolTemplateService
+ {
+ // TODO: 定义 协议模板库 相关方法
+ }
+}
diff --git a/Service/Interface/Config/ITimeSeriesStorageService.cs b/Service/Interface/Config/ITimeSeriesStorageService.cs
new file mode 100644
index 0000000..7620ce3
--- /dev/null
+++ b/Service/Interface/Config/ITimeSeriesStorageService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 时序数据存储 服务接口
+ ///
+ public interface ITimeSeriesStorageService
+ {
+ // TODO: 定义 时序数据存储 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IAlertMessageService.cs b/Service/Interface/Inspection/IAlertMessageService.cs
new file mode 100644
index 0000000..a25ca23
--- /dev/null
+++ b/Service/Interface/Inspection/IAlertMessageService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 消息告警 服务接口
+ ///
+ public interface IAlertMessageService
+ {
+ // TODO: 定义 消息告警 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IAlertRuleService.cs b/Service/Interface/Inspection/IAlertRuleService.cs
new file mode 100644
index 0000000..71d3da8
--- /dev/null
+++ b/Service/Interface/Inspection/IAlertRuleService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 告警规则 服务接口
+ ///
+ public interface IAlertRuleService
+ {
+ // TODO: 定义 告警规则 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IBigScreenService.cs b/Service/Interface/Inspection/IBigScreenService.cs
new file mode 100644
index 0000000..25833d2
--- /dev/null
+++ b/Service/Interface/Inspection/IBigScreenService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 数据大屏 服务接口
+ ///
+ public interface IBigScreenService
+ {
+ // TODO: 定义 数据大屏 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IDeviceDashboardService.cs b/Service/Interface/Inspection/IDeviceDashboardService.cs
new file mode 100644
index 0000000..8952c98
--- /dev/null
+++ b/Service/Interface/Inspection/IDeviceDashboardService.cs
@@ -0,0 +1,25 @@
+using Model;
+using Model.Entity;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Service.Interface
+{
+ ///
+ /// 设备看板服务接口(温湿度)
+ ///
+ public interface IDeviceDashboardService
+ {
+ ///
+ /// 获取每台设备最新一条温湿度数据(看板卡片用)
+ ///
+ Task>> GetRealtimeAsync();
+
+ ///
+ /// 获取指定设备最近 N 分钟的温湿度曲线数据(升序)
+ ///
+ /// 设备标识
+ /// 最近多少分钟
+ Task>> GetCurveAsync(string deviceCode, int minutes);
+ }
+}
diff --git a/Service/Interface/Inspection/IEfficiencyService.cs b/Service/Interface/Inspection/IEfficiencyService.cs
new file mode 100644
index 0000000..383e2e6
--- /dev/null
+++ b/Service/Interface/Inspection/IEfficiencyService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 设备效率分析 服务接口
+ ///
+ public interface IEfficiencyService
+ {
+ // TODO: 定义 设备效率分析 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IPatrolService.cs b/Service/Interface/Inspection/IPatrolService.cs
new file mode 100644
index 0000000..7200630
--- /dev/null
+++ b/Service/Interface/Inspection/IPatrolService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 巡检管理 服务接口
+ ///
+ public interface IPatrolService
+ {
+ // TODO: 定义 巡检管理 相关方法
+ }
+}
diff --git a/Service/Interface/Inspection/IStatisticsReportService.cs b/Service/Interface/Inspection/IStatisticsReportService.cs
new file mode 100644
index 0000000..f81ce8e
--- /dev/null
+++ b/Service/Interface/Inspection/IStatisticsReportService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 统计报表 服务接口
+ ///
+ public interface IStatisticsReportService
+ {
+ // TODO: 定义 统计报表 相关方法
+ }
+}
diff --git a/Service/Interface/System/IAccessLogService.cs b/Service/Interface/System/IAccessLogService.cs
new file mode 100644
index 0000000..49b40df
--- /dev/null
+++ b/Service/Interface/System/IAccessLogService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 访问日志 服务接口
+ ///
+ public interface IAccessLogService
+ {
+ // TODO: 定义 访问日志 相关方法
+ }
+}
diff --git a/Service/Interface/System/IAuditService.cs b/Service/Interface/System/IAuditService.cs
new file mode 100644
index 0000000..7562aec
--- /dev/null
+++ b/Service/Interface/System/IAuditService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 操作审计日志 服务接口
+ ///
+ public interface IAuditService
+ {
+ // TODO: 定义 操作审计日志 相关方法
+ }
+}
diff --git a/Service/Interface/System/IDictService.cs b/Service/Interface/System/IDictService.cs
new file mode 100644
index 0000000..b1047dd
--- /dev/null
+++ b/Service/Interface/System/IDictService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 数据字典管理 服务接口
+ ///
+ public interface IDictService
+ {
+ // TODO: 定义 数据字典管理 相关方法
+ }
+}
diff --git a/Service/Interface/System/IFileStorageService.cs b/Service/Interface/System/IFileStorageService.cs
new file mode 100644
index 0000000..433012b
--- /dev/null
+++ b/Service/Interface/System/IFileStorageService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 文件存储管理 服务接口
+ ///
+ public interface IFileStorageService
+ {
+ // TODO: 定义 文件存储管理 相关方法
+ }
+}
diff --git a/Service/Interface/System/IOrganizationService.cs b/Service/Interface/System/IOrganizationService.cs
new file mode 100644
index 0000000..fdf5967
--- /dev/null
+++ b/Service/Interface/System/IOrganizationService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 组织架构管理 服务接口
+ ///
+ public interface IOrganizationService
+ {
+ // TODO: 定义 组织架构管理 相关方法
+ }
+}
diff --git a/Service/Interface/System/IRoleService.cs b/Service/Interface/System/IRoleService.cs
new file mode 100644
index 0000000..800ed6d
--- /dev/null
+++ b/Service/Interface/System/IRoleService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 角色权限管理 服务接口
+ ///
+ public interface IRoleService
+ {
+ // TODO: 定义 角色权限管理 相关方法
+ }
+}
diff --git a/Service/Interface/System/ISystemLogService.cs b/Service/Interface/System/ISystemLogService.cs
new file mode 100644
index 0000000..d4c042e
--- /dev/null
+++ b/Service/Interface/System/ISystemLogService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 系统日志 服务接口
+ ///
+ public interface ISystemLogService
+ {
+ // TODO: 定义 系统日志 相关方法
+ }
+}
diff --git a/Service/Interface/System/ISystemParamService.cs b/Service/Interface/System/ISystemParamService.cs
new file mode 100644
index 0000000..eeef52b
--- /dev/null
+++ b/Service/Interface/System/ISystemParamService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 系统参数配置 服务接口
+ ///
+ public interface ISystemParamService
+ {
+ // TODO: 定义 系统参数配置 相关方法
+ }
+}
diff --git a/Service/Interface/System/IUserService.cs b/Service/Interface/System/IUserService.cs
new file mode 100644
index 0000000..a49b995
--- /dev/null
+++ b/Service/Interface/System/IUserService.cs
@@ -0,0 +1,10 @@
+namespace Service.Interface
+{
+ ///
+ /// 用户管理 服务接口
+ ///
+ public interface IUserService
+ {
+ // TODO: 定义 用户管理 相关方法
+ }
+}