JiShe.IOT.Admin/src/JiShe.IoT.HttpApi/Controllers/DeviceAggregationController.cs

132 lines
5.0 KiB
C#
Raw Normal View History

2025-07-25 17:27:21 +08:00
using JiShe.IoT.DeviceAggregation;
using JiShe.IoT.DeviceAggregation.Dto;
2025-10-31 14:13:22 +08:00
using JiShe.ServicePro;
using JiShe.ServicePro.Core;
2025-07-25 17:27:21 +08:00
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
2025-12-31 16:46:36 +08:00
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Content;
namespace JiShe.IoT.Controllers
{
/// <summary>
/// 设备聚合服务
/// </summary>
[Route("/Aggregation/Device")]
public class DeviceAggregationController : IoTController
{
private readonly IDeviceAggregationService _deviceAggregationService;
public DeviceAggregationController(IDeviceAggregationService deviceAggregationService)
{
_deviceAggregationService = deviceAggregationService;
}
/// <summary>
/// 创建设备信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(CreateAsync))]
[SwaggerOperation(summary: "创建设备信息", Tags = new[] { "AggregationDevice" })]
public async Task<bool> CreateAsync(CreateDeviceAggregationInput input)
{
2025-08-01 14:59:11 +08:00
return await _deviceAggregationService.CreateDeviceForApiAsync(input);
}
2025-08-04 11:59:07 +08:00
/// <summary>
/// 批量创建设备信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(BatchCreateAsync))]
[SwaggerOperation(summary: "批量创建设备信息", Tags = new[] { "AggregationDevice" })]
public async Task<bool> BatchCreateAsync(BatchCreateDeviceAggregationInput input)
{
return await _deviceAggregationService.BatchCreateDeviceForApiAsync(input);
}
/// <summary>
/// 删除设备信息
/// </summary>
[HttpPost(nameof(DeleteAsync))]
[SwaggerOperation(summary: "删除设备信息", Tags = new[] { "AggregationDevice" })]
public async Task<bool> DeleteAsync(IdInput input)
{
return await _deviceAggregationService.DeleteAsync(input);
}
/// <summary>
/// 根据设备ID查询设备信息
/// </summary>
[HttpPost(nameof(FindByIdAsync))]
[SwaggerOperation(summary: "根据设备ID查询设备信息", Tags = new[] { "AggregationDevice" })]
public async Task<DeviceManagementInfoDto> FindByIdAsync(IdInput input)
{
return await _deviceAggregationService.FindByIdAsync(input);
}
/// <summary>
/// 重新推送设备信息到物联网平台
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(RepushDeviceInfoToIoTPlatform))]
[SwaggerOperation(summary: "重新推送设备信息到物联网平台", Tags = new[] { "AggregationDevice" })]
public Task<DeviceManagementInfoDto> RepushDeviceInfoToIoTPlatform(IdInput input)
{
return _deviceAggregationService.RepushDeviceInfoToIoTPlatform(input);
}
/// <summary>
/// 发送设备指令信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(DeviceCommandForApiAsync))]
[SwaggerOperation(summary: "发送设备指令信息", Tags = new[] { "AggregationDevice" })]
public Task<bool> DeviceCommandForApiAsync(DeviceCommandForApiInput input)
{
return _deviceAggregationService.DeviceCommandForApiAsync(input);
}
/// <summary>
/// 获取设备属性最新值
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(GetDevicePropertyValueForApiAsync))]
[SwaggerOperation(summary: "获取设备属性最新值", Tags = new[] { "AggregationDevice" })]
public Task<Dictionary<string, object>> GetDevicePropertyValueForApiAsync(DevicePropertyValueForApiInput input)
{
return _deviceAggregationService.GetDevicePropertyValueForApiAsync(input);
}
2025-10-31 14:13:22 +08:00
/// <summary>
/// 发送设备升级指令信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost(nameof(DeviceUpgradeForApiAsync))]
[SwaggerOperation(summary: "发送设备升级指令信息", Tags = new[] { "AggregationDevice" })]
public Task<bool> DeviceUpgradeForApiAsync(DeviceUpgradeForApiInput input)
{
return _deviceAggregationService.DeviceUpgradeForApiAsync(input);
}
/// <summary>
/// 下载设备固件文件
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("DownloadFirmware")]
[HttpGet("DownloadFirmware")]
[SwaggerOperation(summary: "下载设备固件文件", Tags = new[] { "AggregationDevice" })]
2025-12-31 16:46:36 +08:00
[AllowAnonymous]
public Task<RemoteStreamContent> DownloadFirmwareInfoAsync(IdInput input)
{
return _deviceAggregationService.DownloadFirmwareInfoAsync(input);
}
}
}