解决冲突
This commit is contained in:
@@ -15,6 +15,7 @@ namespace IOT_API.Controllers.Asset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Route("api/Equipment")] //资产管理模块下的设备管理接口
|
[Route("api/Equipment")] //资产管理模块下的设备管理接口
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[Route("api/asset/equipment")]
|
||||||
public class EquipmentController : ControllerBase
|
public class EquipmentController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IEquipmentService _equipmentService;
|
private readonly IEquipmentService _equipmentService;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 二维码
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/asset/qrcode")]
|
||||||
|
public class QrCodeController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 二维码 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 证书管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/certificate")]
|
||||||
|
public class CertificateController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 证书管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集点位配置
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/collection-point")]
|
||||||
|
public class CollectionPointController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 采集点位配置 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集策略管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/collection-strategy")]
|
||||||
|
public class CollectionStrategyController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 采集策略管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据清洗与转换
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/data-cleaning")]
|
||||||
|
public class DataCleaningController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据清洗与转换 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备网关
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/device-gateway")]
|
||||||
|
public class DeviceGatewayController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 设备网关 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网关管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/gateway")]
|
||||||
|
public class GatewayController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 网关管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// IOT设备管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/device")]
|
||||||
|
public class IotDeviceController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 IOT设备管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网络组件与协议注册
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/network-component")]
|
||||||
|
public class NetworkComponentController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 网络组件与协议注册 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 产品管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/product")]
|
||||||
|
public class ProductController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 产品管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/protocol")]
|
||||||
|
public class ProtocolController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 协议管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议模板库
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/protocol-template")]
|
||||||
|
public class ProtocolTemplateController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 协议模板库 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 时序数据存储
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/config/time-series")]
|
||||||
|
public class TimeSeriesStorageController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 时序数据存储 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 消息告警
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/alert-message")]
|
||||||
|
public class AlertMessageController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 消息告警 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 告警规则
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/alert-rule")]
|
||||||
|
public class AlertRuleController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 告警规则 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据大屏
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/bigscreen")]
|
||||||
|
public class BigScreenController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据大屏 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备看板(温湿度)
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/dashboard")]
|
||||||
|
public class DeviceDashboardController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IDeviceDashboardService _dashboardService;
|
||||||
|
|
||||||
|
public DeviceDashboardController(IDeviceDashboardService dashboardService)
|
||||||
|
{
|
||||||
|
_dashboardService = dashboardService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有环境箱的最新温湿度数据(看板卡片,前端轮询调用)
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet("realtime")]
|
||||||
|
public async Task<IActionResult> GetRealtime()
|
||||||
|
{
|
||||||
|
return Ok(await _dashboardService.GetRealtimeAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定环境箱最近 N 分钟的温湿度曲线数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceCode">设备标识,如 BOX-001</param>
|
||||||
|
/// <param name="minutes">最近多少分钟,默认 5,最大 60</param>
|
||||||
|
[HttpGet("curve")]
|
||||||
|
public async Task<IActionResult> GetCurve([FromQuery] string deviceCode, [FromQuery] int minutes = 5)
|
||||||
|
{
|
||||||
|
minutes = Math.Clamp(minutes, 1, 60);
|
||||||
|
return Ok(await _dashboardService.GetCurveAsync(deviceCode, minutes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备效率分析
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/efficiency")]
|
||||||
|
public class EfficiencyController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 设备效率分析 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 巡检管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/patrol")]
|
||||||
|
public class PatrolController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 巡检管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 统计报表
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/inspection/report")]
|
||||||
|
public class StatisticsReportController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 统计报表 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 访问日志
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/access-log")]
|
||||||
|
public class AccessLogController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 访问日志 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作审计日志
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/audit")]
|
||||||
|
public class AuditController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 操作审计日志 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据字典管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/dict")]
|
||||||
|
public class DictController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据字典管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件存储管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/file-storage")]
|
||||||
|
public class FileStorageController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 文件存储管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 组织架构管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/organization")]
|
||||||
|
public class OrganizationController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 组织架构管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色权限管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/role")]
|
||||||
|
public class RoleController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 角色权限管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统日志
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/system-log")]
|
||||||
|
public class SystemLogController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 系统日志 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统参数配置
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/param")]
|
||||||
|
public class SystemParamController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 系统参数配置 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebAPI.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/system/user")]
|
||||||
|
public class UserController : ControllerBase
|
||||||
|
{
|
||||||
|
// TODO: 实现 用户管理 相关接口
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using Service.Implement;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace WebAPI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 业务服务依赖注入扩展
|
||||||
|
/// 约定:Service.Interface 中的 IXxxService 对应 Service.Implement 中的 XxxService
|
||||||
|
/// </summary>
|
||||||
|
public static class DependencyInjection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自动注册所有业务服务(按命名约定:接口去掉前缀 I 即为实现类名)
|
||||||
|
/// 以后在 Service 项目里新增「接口 + 实现」时,无需改动这里,会自动注册
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
-12
@@ -1,6 +1,7 @@
|
|||||||
using Common;
|
using Common;
|
||||||
using ORM;
|
using ORM;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using WebAPI.Services;
|
||||||
|
|
||||||
namespace WebAPI
|
namespace WebAPI
|
||||||
{
|
{
|
||||||
@@ -8,30 +9,42 @@ namespace WebAPI
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
// ======= ����ת����δ�����쳣ʱ�Զ����� MiniDump =======
|
//dump文件崩溃记录(不用或者使用后记得去编译路径删除,.dump文件体积很大)
|
||||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||||
{
|
{
|
||||||
//��¼dump�ļ�
|
|
||||||
Exception ex = e.ExceptionObject as Exception;
|
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);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
//注册postgre数据库
|
||||||
// Add services to the container.
|
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()
|
builder.Services.AddControllers()
|
||||||
.AddJsonOptions(options =>
|
.AddJsonOptions(options =>
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
||||||
options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString;
|
options.JsonSerializerOptions.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString;
|
||||||
|
|
||||||
// 3. �����������Ա���ԭ������ǿ��תΪ�շ壩
|
|
||||||
options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
options.JsonSerializerOptions.PropertyNamingPolicy = null;
|
||||||
});
|
});
|
||||||
// ======= �������ý��� =======
|
// 自动注册业务服务(Service.Interface -> Service.Implement)
|
||||||
|
builder.Services.AddBusinessServices();
|
||||||
|
|
||||||
|
// 温度箱模拟数据:每秒生成 100 条温湿度入库(真实设备接入后删除)
|
||||||
|
builder.Services.AddHostedService<TemperatureBoxSimulator>();
|
||||||
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
@@ -65,8 +78,9 @@ namespace WebAPI
|
|||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ע�⣺�����λ��ֻ֧�� http �����ֳ�����ʱ�������Ҫ����ʵ�����ע�͵��������� Https �ض���
|
// 关闭 Https 重定向:开启时会把 http 请求 307 到 https 端口,
|
||||||
app.UseHttpsRedirection();
|
// 导致前端 vite 代理被 CORS 拦截(Network Error);上位机/现场部署通常也只用 http
|
||||||
|
// app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
using Model.Entity;
|
||||||
|
using ORM;
|
||||||
|
|
||||||
|
namespace WebAPI.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 温度箱数据模拟器(临时用)
|
||||||
|
/// 每秒为 100 台环境箱生成一条模拟温湿度数据并批量写入数据库,
|
||||||
|
/// 真实设备接入后删除此类及 Program.cs 中的注册即可
|
||||||
|
/// </summary>
|
||||||
|
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<string, BoxState> _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<TemperatureBoxDataEntity>(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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,10 +7,12 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Database": {
|
"Database": {
|
||||||
"Server": "localhost",
|
"Type": "PostgreSQL",
|
||||||
|
"Server": "127.0.0.1",
|
||||||
"Port": 5432,
|
"Port": 5432,
|
||||||
"Database": "iot",
|
"Database": "IOT_WEB",
|
||||||
"Uid": "postgres",
|
"User": "postgres",
|
||||||
"Pwd": "postgres"
|
"Password": "kylt123",
|
||||||
|
"TenantId": 10001
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ namespace Model.Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除状态
|
/// 删除状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[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; }
|
public virtual byte IsDel { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnName = "CreateTime")]
|
[SugarColumn(ColumnName = "CreateTime")]
|
||||||
public DateTime CreateTime { get; set; }
|
public virtual DateTime? CreateTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Model.Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 温度箱看板数据实体
|
||||||
|
/// 室内环境温湿度曲线;设备温度、湿度、状态等指标;设备告警信息
|
||||||
|
/// </summary>
|
||||||
|
public class TemperatureBoxDataEntity : BaseEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备标识
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DeviceCode", ColumnDescription = "设备标识", ColumnDataType = "varchar(64)")]
|
||||||
|
public string DeviceCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备类型
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DeviceType", ColumnDescription = "设备类型", ColumnDataType = "varchar(64)")]
|
||||||
|
public string DeviceType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备温度(℃)
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DeviceTemperature", ColumnDescription = "设备温度(℃)", IsNullable = true)]
|
||||||
|
public double? DeviceTemperature { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备湿度(%)
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "DeviceHumidity", ColumnDescription = "设备湿度(%)", IsNullable = true)]
|
||||||
|
public double? DeviceHumidity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Status", ColumnDescription = "设备状态", ColumnDataType = "varchar(32)", IsNullable = true)]
|
||||||
|
public string Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备告警信息
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "AlarmInfo", ColumnDescription = "设备告警信息", IsNullable = true)]
|
||||||
|
public string AlarmInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集时间(用于绘制温湿度曲线)
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "CreateTime", ColumnDescription = "采集时间", IsNullable = true)]
|
||||||
|
public override DateTime? CreateTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
namespace Model.Model
|
namespace Model.Model
|
||||||
{
|
{
|
||||||
|
//没啥逼用,后续得改
|
||||||
public class EnovaChannelData
|
public class EnovaChannelData
|
||||||
{
|
{
|
||||||
public string Laboratory { get; set; }
|
public string Laboratory { get; set; }
|
||||||
|
|||||||
@@ -74,11 +74,12 @@ namespace ORM
|
|||||||
string DBPath = Path.Combine(folder, "SQL.db");
|
string DBPath = Path.Combine(folder, "SQL.db");
|
||||||
DbConnectionString =$@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog={DBPath};Integrated Security=True;";
|
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;
|
DbConnectionType = DbType.PostgreSQL;
|
||||||
|
|
||||||
DbConnectionString =
|
DbConnectionString =
|
||||||
$"Host={Server};Port={Port};Database={Database};Username={Uid};Password={Pwd};";
|
$"Host={server};Port={port};Database={database};Username={user};Password={password};";
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备台账 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class EquipmentService : IEquipmentService
|
||||||
|
{
|
||||||
|
// TODO: 实现 设备台账 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 二维码 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class QrCodeService : IQrCodeService
|
||||||
|
{
|
||||||
|
// TODO: 实现 二维码 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 证书管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class CertificateService : ICertificateService
|
||||||
|
{
|
||||||
|
// TODO: 实现 证书管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集点位配置 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class CollectionPointService : ICollectionPointService
|
||||||
|
{
|
||||||
|
// TODO: 实现 采集点位配置 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集策略管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class CollectionStrategyService : ICollectionStrategyService
|
||||||
|
{
|
||||||
|
// TODO: 实现 采集策略管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据清洗与转换 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class DataCleaningService : IDataCleaningService
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据清洗与转换 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备网关 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class DeviceGatewayService : IDeviceGatewayService
|
||||||
|
{
|
||||||
|
// TODO: 实现 设备网关 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网关管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class GatewayService : IGatewayService
|
||||||
|
{
|
||||||
|
// TODO: 实现 网关管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// IOT设备管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class IotDeviceService : IIotDeviceService
|
||||||
|
{
|
||||||
|
// TODO: 实现 IOT设备管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网络组件与协议注册 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class NetworkComponentService : INetworkComponentService
|
||||||
|
{
|
||||||
|
// TODO: 实现 网络组件与协议注册 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 产品管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class ProductService : IProductService
|
||||||
|
{
|
||||||
|
// TODO: 实现 产品管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class ProtocolService : IProtocolService
|
||||||
|
{
|
||||||
|
// TODO: 实现 协议管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议模板库 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class ProtocolTemplateService : IProtocolTemplateService
|
||||||
|
{
|
||||||
|
// TODO: 实现 协议模板库 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 时序数据存储 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class TimeSeriesStorageService : ITimeSeriesStorageService
|
||||||
|
{
|
||||||
|
// TODO: 实现 时序数据存储 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 消息告警 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class AlertMessageService : IAlertMessageService
|
||||||
|
{
|
||||||
|
// TODO: 实现 消息告警 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 告警规则 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class AlertRuleService : IAlertRuleService
|
||||||
|
{
|
||||||
|
// TODO: 实现 告警规则 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据大屏 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class BigScreenService : IBigScreenService
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据大屏 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备看板服务实现(温湿度)
|
||||||
|
/// </summary>
|
||||||
|
public class DeviceDashboardService : IDeviceDashboardService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取每台设备最新一条温湿度数据(看板卡片用)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Result<List<TemperatureBoxDataEntity>>> GetRealtimeAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var db = SqlSugarContext.DbContext;
|
||||||
|
|
||||||
|
// 雪花 Id 单调递增,每台设备取最大 Id 即最新一条
|
||||||
|
var latestIds = await db.Queryable<TemperatureBoxDataEntity>()
|
||||||
|
.Where(x => x.IsDel == 0)
|
||||||
|
.GroupBy(x => x.DeviceCode)
|
||||||
|
.Select(x => SqlFunc.AggregateMax(x.Id))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var list = await db.Queryable<TemperatureBoxDataEntity>()
|
||||||
|
.Where(x => latestIds.Contains(x.Id))
|
||||||
|
.OrderBy(x => x.DeviceCode)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Result<List<TemperatureBoxDataEntity>>.Success(list);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Result<List<TemperatureBoxDataEntity>>.Error("查询设备实时数据失败", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定设备最近 N 分钟的温湿度曲线数据(按时间升序)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Result<List<TemperatureBoxDataEntity>>> GetCurveAsync(string deviceCode, int minutes)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(deviceCode))
|
||||||
|
return Result<List<TemperatureBoxDataEntity>>.Error("设备标识不能为空");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var start = DateTime.Now.AddMinutes(-minutes);
|
||||||
|
var list = await SqlSugarContext.DbContext.Queryable<TemperatureBoxDataEntity>()
|
||||||
|
.Where(x => x.DeviceCode == deviceCode && x.IsDel == 0 && x.CreateTime >= start)
|
||||||
|
.OrderBy(x => x.CreateTime)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Result<List<TemperatureBoxDataEntity>>.Success(list);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Result<List<TemperatureBoxDataEntity>>.Error("查询温湿度曲线失败", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备效率分析 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class EfficiencyService : IEfficiencyService
|
||||||
|
{
|
||||||
|
// TODO: 实现 设备效率分析 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 巡检管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class PatrolService : IPatrolService
|
||||||
|
{
|
||||||
|
// TODO: 实现 巡检管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 统计报表 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class StatisticsReportService : IStatisticsReportService
|
||||||
|
{
|
||||||
|
// TODO: 实现 统计报表 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 访问日志 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class AccessLogService : IAccessLogService
|
||||||
|
{
|
||||||
|
// TODO: 实现 访问日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作审计日志 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class AuditService : IAuditService
|
||||||
|
{
|
||||||
|
// TODO: 实现 操作审计日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据字典管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class DictService : IDictService
|
||||||
|
{
|
||||||
|
// TODO: 实现 数据字典管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件存储管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class FileStorageService : IFileStorageService
|
||||||
|
{
|
||||||
|
// TODO: 实现 文件存储管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 组织架构管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class OrganizationService : IOrganizationService
|
||||||
|
{
|
||||||
|
// TODO: 实现 组织架构管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色权限管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class RoleService : IRoleService
|
||||||
|
{
|
||||||
|
// TODO: 实现 角色权限管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统日志 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class SystemLogService : ISystemLogService
|
||||||
|
{
|
||||||
|
// TODO: 实现 系统日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统参数配置 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class SystemParamService : ISystemParamService
|
||||||
|
{
|
||||||
|
// TODO: 实现 系统参数配置 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Service.Interface;
|
||||||
|
|
||||||
|
namespace Service.Implement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户管理 服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class UserService : IUserService
|
||||||
|
{
|
||||||
|
// TODO: 实现 用户管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备台账 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IEquipmentService
|
||||||
|
{
|
||||||
|
// TODO: 定义 设备台账 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 二维码 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IQrCodeService
|
||||||
|
{
|
||||||
|
// TODO: 定义 二维码 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 证书管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICertificateService
|
||||||
|
{
|
||||||
|
// TODO: 定义 证书管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集点位配置 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICollectionPointService
|
||||||
|
{
|
||||||
|
// TODO: 定义 采集点位配置 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 采集策略管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICollectionStrategyService
|
||||||
|
{
|
||||||
|
// TODO: 定义 采集策略管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据清洗与转换 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IDataCleaningService
|
||||||
|
{
|
||||||
|
// TODO: 定义 数据清洗与转换 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备网关 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IDeviceGatewayService
|
||||||
|
{
|
||||||
|
// TODO: 定义 设备网关 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网关管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IGatewayService
|
||||||
|
{
|
||||||
|
// TODO: 定义 网关管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// IOT设备管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IIotDeviceService
|
||||||
|
{
|
||||||
|
// TODO: 定义 IOT设备管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网络组件与协议注册 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface INetworkComponentService
|
||||||
|
{
|
||||||
|
// TODO: 定义 网络组件与协议注册 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 产品管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IProductService
|
||||||
|
{
|
||||||
|
// TODO: 定义 产品管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IProtocolService
|
||||||
|
{
|
||||||
|
// TODO: 定义 协议管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 协议模板库 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IProtocolTemplateService
|
||||||
|
{
|
||||||
|
// TODO: 定义 协议模板库 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 时序数据存储 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ITimeSeriesStorageService
|
||||||
|
{
|
||||||
|
// TODO: 定义 时序数据存储 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 消息告警 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IAlertMessageService
|
||||||
|
{
|
||||||
|
// TODO: 定义 消息告警 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 告警规则 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IAlertRuleService
|
||||||
|
{
|
||||||
|
// TODO: 定义 告警规则 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据大屏 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IBigScreenService
|
||||||
|
{
|
||||||
|
// TODO: 定义 数据大屏 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Model;
|
||||||
|
using Model.Entity;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备看板服务接口(温湿度)
|
||||||
|
/// </summary>
|
||||||
|
public interface IDeviceDashboardService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取每台设备最新一条温湿度数据(看板卡片用)
|
||||||
|
/// </summary>
|
||||||
|
Task<Result<List<TemperatureBoxDataEntity>>> GetRealtimeAsync();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定设备最近 N 分钟的温湿度曲线数据(升序)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceCode">设备标识</param>
|
||||||
|
/// <param name="minutes">最近多少分钟</param>
|
||||||
|
Task<Result<List<TemperatureBoxDataEntity>>> GetCurveAsync(string deviceCode, int minutes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备效率分析 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IEfficiencyService
|
||||||
|
{
|
||||||
|
// TODO: 定义 设备效率分析 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 巡检管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IPatrolService
|
||||||
|
{
|
||||||
|
// TODO: 定义 巡检管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 统计报表 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IStatisticsReportService
|
||||||
|
{
|
||||||
|
// TODO: 定义 统计报表 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 访问日志 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IAccessLogService
|
||||||
|
{
|
||||||
|
// TODO: 定义 访问日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作审计日志 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IAuditService
|
||||||
|
{
|
||||||
|
// TODO: 定义 操作审计日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据字典管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IDictService
|
||||||
|
{
|
||||||
|
// TODO: 定义 数据字典管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件存储管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IFileStorageService
|
||||||
|
{
|
||||||
|
// TODO: 定义 文件存储管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 组织架构管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IOrganizationService
|
||||||
|
{
|
||||||
|
// TODO: 定义 组织架构管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色权限管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IRoleService
|
||||||
|
{
|
||||||
|
// TODO: 定义 角色权限管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统日志 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ISystemLogService
|
||||||
|
{
|
||||||
|
// TODO: 定义 系统日志 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统参数配置 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ISystemParamService
|
||||||
|
{
|
||||||
|
// TODO: 定义 系统参数配置 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Service.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户管理 服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IUserService
|
||||||
|
{
|
||||||
|
// TODO: 定义 用户管理 相关方法
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user