[前台api][後端] PostHistoryRawDataFilter Model 調整 | API 調整

This commit is contained in:
dev01 2023-05-16 18:33:34 +08:00
parent 104260b662
commit 5d193a8b1e
4 changed files with 12 additions and 11 deletions

View File

@ -1,14 +1,14 @@
var ytAjax = typeof YourTeam !== "undefined" ? new YourTeam.Ajax() : null; //公用AJAX初始化 var ytAjax = typeof YourTeam !== "undefined" ? new YourTeam.Ajax() : null; //公用AJAX初始化
//var baseApiUrl = "http://localhost:3604"; // 本地開發用 var baseApiUrl = "http://localhost:3604"; // 本地開發用
//var baseImgUrl = "https://localhost:44376"; // 本地開發用 var baseImgUrl = "https://localhost:44376"; // 本地開發用
// Mitsubishi // Mitsubishi
//var baseApiUrl = "http://220.132.206.5"; // production 用 //var baseApiUrl = "http://220.132.206.5"; // production 用
//var baseImgUrl = "http://220.132.206.5:8848"; // production 用 //var baseImgUrl = "http://220.132.206.5:8848"; // production 用
// WSP // WSP
var baseApiUrl = "http://220.132.206.5:8001"; // production 用 //var baseApiUrl = "http://220.132.206.5:8001"; // production 用
var baseImgUrl = "http://220.132.206.5:8849"; // production 用 //var baseImgUrl = "http://220.132.206.5:8849"; // production 用
//var baseApiUrl = "http://localhost"; //var baseApiUrl = "http://localhost";
//var baseImgUrl = "http://localhost:8848"; //var baseImgUrl = "http://localhost:8848";

View File

@ -983,8 +983,8 @@ namespace FrontendWebApi.ApiControllers
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_numbers }); var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_numbers });
//轉換日期格式 //轉換日期格式
var start = string.Format("{0}T00:00:00.000+08:00", post.Start_timstamp); var start = string.Format("{0}T00:00:00.000+08:00", post.Start_timestamp);
var end = string.Format("{0}T23:59:59.000+08:00", post.End_timstamp); var end = string.Format("{0}T23:59:59.000+08:00", post.End_timestamp);
var historyQueryFilter = $@"<obj is='obix: HistoryFilter'> var historyQueryFilter = $@"<obj is='obix: HistoryFilter'>
<abstime name = 'start' val = '{start}' /> <abstime name = 'start' val = '{start}' />
@ -1115,16 +1115,16 @@ namespace FrontendWebApi.ApiControllers
List<string> tableName = new List<string>(); List<string> tableName = new List<string>();
foreach (var dn in input.tableDeviceName) foreach (var dn in input.tableDeviceName)
{ {
tableName.AddRange(await backgroundServiceMsSqlRepository.GetAllAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '{dn}%'")); tableName.AddRange(await backgroundServiceMsSqlRepository.GetAllAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{dn}%'"));
} }
if (tableName.Count > 0) if (tableName.Count > 0)
{ {
foreach (var tn in tableName) foreach (var tn in tableName)
{ {
var data = new HistoryRealTimeOutput(); var data = new HistoryRealTimeOutput() { HistoryRealTime = new List<HistoryRealTime>()};
data.deviceNumber = tn; data.deviceNumber = tn;
var sql = $@"select timestamp as timeStamp, round(value, 2) as value from {tn} where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime ordr by timestamp"; var sql = $@"select timestamp as timeStamp, round(value, 2) as value from {tn} where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp";
data.HistoryRealTime.AddRange( data.HistoryRealTime.AddRange(
await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRealTime>(sql, new { startTime = input.startTime, endTime = input.endTime }) await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRealTime>(sql, new { startTime = input.startTime, endTime = input.endTime })
); );

View File

@ -256,8 +256,8 @@ namespace FrontendWebApi.Models
public class PostHistoryRawDataFilter public class PostHistoryRawDataFilter
{ {
public string Start_timstamp { get; set; } public string Start_timestamp { get; set; }
public string End_timstamp { get; set; } public string End_timestamp { get; set; }
public List<HistoryItem> HistoryItems { get; set; } public List<HistoryItem> HistoryItems { get; set; }
} }