91 lines
3.3 KiB
C#
91 lines
3.3 KiB
C#
using JiShe.IoT.DeviceAggregation;
|
|
using JiShe.IoT.DeviceAggregation.Dto;
|
|
using JiShe.ServicePro.Core;
|
|
using JiShe.ServicePro.DeviceManagement.DeviceInfos;
|
|
|
|
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)
|
|
{
|
|
return await _deviceAggregationService.CreateDeviceForApiAsync(input);
|
|
}
|
|
|
|
/// <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);
|
|
}
|
|
|
|
}
|
|
}
|