首页数据格式调整

This commit is contained in:
yanghongwei 2024-08-01 23:13:56 +08:00
parent 51b79bde5d
commit bb33e69cd8
3 changed files with 8 additions and 3 deletions

View File

@ -43,5 +43,7 @@
public string OrgId { get; set; } public string OrgId { get; set; }
public int DeviceType { get; set; } public int DeviceType { get; set; }
public string VideoUrl { get; set; } public string VideoUrl { get; set; }
public double lng { get; set; }
public double lat { get; set; }
} }
} }

View File

@ -18,7 +18,7 @@
public class Rate public class Rate
{ {
public string key { get; set; } public string key { get; set; }
public string val { get; set; } public double val { get; set; }
} }
public class alarmList public class alarmList
{ {

View File

@ -5,6 +5,7 @@ using langguanApi.Model;
using System.Linq.Expressions; using System.Linq.Expressions;
using langguanApi.Common.Proxy; using langguanApi.Common.Proxy;
using langguanApi.Model.Dto; using langguanApi.Model.Dto;
using Npoi.Mapper;
namespace langguanApi.Service namespace langguanApi.Service
{ {
@ -47,7 +48,8 @@ namespace langguanApi.Service
/// <returns></returns> /// <returns></returns>
public async Task<ApiResult> View() public async Task<ApiResult> View()
{ {
var devices = await _deviceService.GetAsync(); Expression<Func<Device, bool>> exp = x => x.IsDelete == false && x.lng > 0 && x.lat > 0;
var devices = (await _deviceService.GetListWithExp(exp)).ToList();
var cleanData = new var cleanData = new
{ {
Yesterday = 0.8, Yesterday = 0.8,
@ -70,6 +72,7 @@ namespace langguanApi.Service
// 获取远程接口污染物排放率 // 获取远程接口污染物排放率
var rateResp = await _httpProxy.Get<RespModel<List<Rate>>>(null, _configuration.GetValue<string>("Apis:RateUrl")); var rateResp = await _httpProxy.Get<RespModel<List<Rate>>>(null, _configuration.GetValue<string>("Apis:RateUrl"));
var rate = rateResp.data.ToList().Take(6); var rate = rateResp.data.ToList().Take(6);
rate.ForEach(x => x.val = Math.Round( x.val / 100,2));
var AlermResp = await _httpProxy.Get<RespModel<alarmList>>(null, _configuration.GetValue<string>("Apis:AlertUrl")); var AlermResp = await _httpProxy.Get<RespModel<alarmList>>(null, _configuration.GetValue<string>("Apis:AlertUrl"));
if (AlermResp.code == 0 && AlermResp.data.List.Any()) if (AlermResp.code == 0 && AlermResp.data.List.Any())
{ {