Files
HTCloud/HT.Cloud.Web/Areas/ReportManage/Controllers/HistoryReportController.cs

42 lines
1.5 KiB
C#
Raw Normal View History

2023-03-03 16:07:50 +08:00
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using HT.Cloud.Service.ChartsManage;
using HT.Cloud.Service.ReportManage;
namespace HT.Cloud.Web.Areas.ReportManage.Controllers
{
[Area("ReportManage")]
public class HistoryReportController : BaseController
{
public HistoryReportService _historyReportService { get; set; }
[HttpPost]
public async Task<ActionResult> GetReport(Reportparam reportparam)
{
//var StartTime = reportparam.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
//var EndTime = reportparam.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
var StartTime = Gettime( reportparam.StartTime.ToString());
var EndTime = Gettime( reportparam.EndTime.ToString());
var Interval = int.Parse(reportparam.Interval);
var data = await _historyReportService.GetReportFileName(StartTime, EndTime, Interval);
return Content(data);
}
public string Gettime(string longtime)
{
long jsTimeStamp =long.Parse( longtime);
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
DateTime dt = startTime.AddMilliseconds(jsTimeStamp);
return (dt.ToString("yyyy/MM/dd HH:mm:ss"));
}
public class Reportparam
{
public string StartTime { get; set; }
public string EndTime { get; set; }
public string Interval { get; set; }
}
}
}