using Microsoft.AspNetCore.Mvc;
using System.Net;
using System.Net.Http.Headers;
using Microsoft.Extensions.Hosting.Internal;
using Microsoft.AspNetCore.Http.Extensions;
using IStation.Untity;
using Furion.DynamicApiController;
using System.ComponentModel.DataAnnotations;
using Mapster;
using Microsoft.AspNetCore.Http;
using Furion.DependencyInjection;
using Microsoft.AspNetCore.Authorization;
using Furion.DataEncryption;
using Furion.FriendlyException;
namespace IStation.Application
{
///
/// 运行
///
[AllowAnonymous]
[Route("LargeScreen/Szjt/Run")]
[ApiDescriptionSettings("LargeScreen", Name = "苏州金庭(运行)", Order = 999)]
public class SzjtRun_Controller : IDynamicApiController, ITransient
{
private readonly IHttpContextAccessor _httpContextAccessor;
///
///
///
public SzjtRun_Controller(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
private const long _corpId = 3;
///
/// 通过 MonitorPointIds 获取最近一条数据
///
[Route("GetLastRecordByMonitorPointIds")]
[HttpGet]
public List GetLastRecordByMonitorPointIds([FromQuery][Required] MonitorPointIdsInput input)
{
var ids = LongListHelper.ToList(input.MonitorPointIds);
var list = new Service.MonitorRecord().GetLastRecord(_corpId,ids);
return list?.Select(x => new SzjtMonitorRecordDto(x)).ToList();
}
///
/// 通过 MonitorPointID 获取某天的实时数据
///
[Route("GetRealRecordListByMonitorPointIDOfDay")]
[HttpGet]
public List GetRealRecordListByMonitorPointIDOfDay
(
[Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID 必须大于0")]
long MonitorPointID,
[Required]
DateTime Day
)
{
var list = new Service.MonitorRealRecord().GetByMonitorPointIDOfDay(_corpId, MonitorPointID, Day);
return list?.Select(x => new SzjtMonitorRealRecordDto(x)).ToList();
}
}
}