62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
using DataServer.api.EnergyEfficiency;
|
|
using DongYingAPI.Util;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
|
|
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|
{
|
|
/// <summary>
|
|
/// 获取能效对标接口
|
|
/// </summary>
|
|
public class GetEnergyBenchmarkingController : ApiController
|
|
{
|
|
DataServer.BLL.device_info device_bll = new DataServer.BLL.device_info();
|
|
|
|
DataServer.BLL.electricity_data bll = new DataServer.BLL.electricity_data();
|
|
|
|
DataServer.BLL.water_data water_bll = new DataServer.BLL.water_data();
|
|
|
|
DataServer.BLL.gas_data gas_bll = new DataServer.BLL.gas_data();
|
|
|
|
/// <summary>
|
|
/// 获取能效对标接口
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public HttpResponseMessage Get()
|
|
{
|
|
var res = new get_energy_benchmarking_response();
|
|
try
|
|
{
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = new energy_benchmarking()
|
|
{
|
|
WateConsumption = "21.46立方米",
|
|
EnergyConsumption = "221.92千克标准煤",
|
|
BuildingArea = "9千克标准煤/平方米",
|
|
AvgWaterConsumption = 18,
|
|
AvgEnergyConsumption = Convert.ToDecimal(227.96),
|
|
UnitBuildingArea = Convert.ToDecimal(8.89),
|
|
YoyBuildingArea = Convert.ToDecimal(0.16),
|
|
YoyEnergyConsumption = Convert.ToDecimal(-0.03),
|
|
YoyWaterConsumption = Convert.ToDecimal(0.01)
|
|
};
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = "失败," + ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
}
|