添加接口和类文件
This commit is contained in:
parent
f7e6cdd7b5
commit
881c49a4b6
|
@ -51,11 +51,14 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="api\EnergyEfficiency\get_amount_energy_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_classified_energy_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_device_operation_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_electricity_price_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_energy_benchmarking_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_energy_consumption_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_energy_flow_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_energy_trend_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_itemize_energy_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_multi_rate_response.cs" />
|
||||
<Compile Include="api\EnergyEfficiency\get_unit_consumption_response.cs" />
|
||||
<Compile Include="api\get_abutment.cs" />
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.EnergyEfficiency
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取分类能耗接口响应实体
|
||||
/// </summary>
|
||||
public class get_classified_energy_response
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回码
|
||||
/// </summary>
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.EnergyEfficiency
|
||||
{
|
||||
public class get_energy_calendar_response
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回码
|
||||
/// </summary>
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.EnergyEfficiency
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取能耗趋势接口响应实体
|
||||
/// </summary>
|
||||
public class get_energy_trend_response
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回码
|
||||
/// </summary>
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.EnergyEfficiency
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取分项能耗概况接口响应实体
|
||||
/// </summary>
|
||||
public class get_itemize_energy_response
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回码
|
||||
/// </summary>
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using DataServer.api.EnergyEfficiency;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||
{
|
||||
public class GetClassifiedEnergyController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取分类能耗接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var res = new get_classified_energy_response();
|
||||
try
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using DataServer.api.EnergyEfficiency;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||
{
|
||||
public class GetEnergyCalendarController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取能耗日历接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var res = new get_energy_calendar_response();
|
||||
try
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using DataServer.api.EnergyEfficiency;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||
{
|
||||
public class GetEnergyTrendController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取能耗趋势接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var res = new get_energy_trend_response();
|
||||
try
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
using DataServer.api.EnergyEfficiency;
|
||||
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
|
||||
{
|
||||
public class GetItemizeEnergyController : ApiController
|
||||
{
|
||||
DataServer.BLL.device_info device_bll = new DataServer.BLL.device_info();
|
||||
|
||||
DataServer.BLL.electricity_data bll = new DataServer.BLL.electricity_data();
|
||||
|
||||
/// <summary>
|
||||
/// 获取分项能耗概况接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var res = new get_itemize_energy_response();
|
||||
try
|
||||
{
|
||||
//var now = DateTime.Now;
|
||||
//var device_list = device_bll.GetModelList("");
|
||||
//var list = new List<DataServer.Model.electricity_data>();
|
||||
////判断表是否存在,不存在就创建
|
||||
//var date_base = ConfigurationManager.AppSettings["MySQLDataBase"].ToString();
|
||||
//var start_date = DateTime.Parse(now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
//var time = now.ToString("yyyyMM");
|
||||
//if (!bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
//{
|
||||
// bll.CreateTable(time);
|
||||
//}
|
||||
//list = bll.GetList("(select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_" + time + ")", " CreateTime>='" + start_date + "' and CreateTime<='" + now + "' ", "");
|
||||
|
||||
//var data = new List<energy_consumption>();
|
||||
//foreach (var item in device_list)
|
||||
//{
|
||||
// var model = new energy_consumption();
|
||||
// model.DeviceName = item.DeviceName;
|
||||
// model.OperatingPower = list.Where(a => a.DeviceId == item.DeviceId).Sum(a => a.ServiceRating).Value;
|
||||
// data.Add(model);
|
||||
//}
|
||||
|
||||
//res.code = 200;
|
||||
//res.msg = "成功";
|
||||
//res.data = data;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -161,11 +161,15 @@
|
|||
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
|
||||
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetAmountEnergyController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetClassifiedEnergyController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetDeviceOperationController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetElectricityPriceController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetEnergyBenchmarkingController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetEnergyCalendarController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetEnergyConsumptionController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetEnergyFlowController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetEnergyTrendController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetItemizeEnergyController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetMultiRateController.cs" />
|
||||
<Compile Include="Controllers\api\EnergyEfficiency\GetUnitConsumptionController.cs" />
|
||||
<Compile Include="Controllers\api\GetAirConditionerController.cs" />
|
||||
|
|
Loading…
Reference in New Issue