实现能效剩余的接口功能
This commit is contained in:
parent
ed1a563601
commit
fa039e7ca3
|
|
@ -20,5 +20,55 @@ namespace DataServer.api.EnergyEfficiency
|
|||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
|
||||
public energy_benchmarking data { get; set; }
|
||||
}
|
||||
|
||||
public class energy_benchmarking
|
||||
{
|
||||
/// <summary>
|
||||
/// 人均用水量标准
|
||||
/// </summary>
|
||||
public decimal WateConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人均综合能耗标准
|
||||
/// </summary>
|
||||
public decimal EnergyConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位建筑面积综合能耗标准
|
||||
/// </summary>
|
||||
public decimal BuildingArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人均用水量
|
||||
/// </summary>
|
||||
public decimal AvgWaterConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人均综合能耗
|
||||
/// </summary>
|
||||
public decimal AvgEnergyConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位建筑面积综合能耗
|
||||
/// </summary>
|
||||
public decimal UnitBuildingArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人均用水量同比
|
||||
/// </summary>
|
||||
public decimal YoyWaterConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人均综合能耗同比
|
||||
/// </summary>
|
||||
public decimal YoyEnergyConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位建筑面积综合能耗同比
|
||||
/// </summary>
|
||||
public decimal YoyBuildingArea { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,51 @@ namespace DataServer.api.EnergyEfficiency
|
|||
/// 返回说明
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据
|
||||
/// </summary>
|
||||
public energy_calendar data { get; set; }
|
||||
}
|
||||
|
||||
public class energy_calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// 水数据
|
||||
/// </summary>
|
||||
public energy_calendar_list WaterList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 天然气数据
|
||||
/// </summary>
|
||||
public energy_calendar_list GasList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电数据
|
||||
/// </summary>
|
||||
public energy_calendar_list ElectricityList { get; set; }
|
||||
}
|
||||
|
||||
public class energy_calendar_list
|
||||
{
|
||||
/// <summary>
|
||||
/// 总值
|
||||
/// </summary>
|
||||
public decimal Total { get; set; }
|
||||
|
||||
public List<energy_calendar_data> List { get; set; }
|
||||
}
|
||||
|
||||
public class energy_calendar_data
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public string Time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public decimal Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -54,14 +54,29 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
upper_start_time = DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
upper_end_time = DateTime.Parse(now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
|
||||
//电
|
||||
//判断表是否存在,不存在就创建
|
||||
var time = now.ToString("yyyyMM");
|
||||
if (!bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
var time_count = Tool.GetUsedMonth1("月", upper_start_time, modern_end_time);
|
||||
var source = "";
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
bll.CreateTable(time);
|
||||
var time = upper_start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == upper_start_time.ToString("yyyyMM") || time == modern_end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, upper_start_time, modern_end_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where 1=1 ", time);
|
||||
}
|
||||
source += ") UNION all ";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
source = source.Substring(0, source.Length - 11);
|
||||
list = bll.GetList(source, "", "");
|
||||
}
|
||||
list = bll.GetModelListDate(" EntireTime='" + modern_start_time + "' or EntireTime='" + modern_end_time + "' or EntireTime='" + upper_start_time + "' or EntireTime='" + upper_end_time + "' ", time);
|
||||
}
|
||||
else if (type == "月")
|
||||
{
|
||||
|
|
@ -76,7 +91,7 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
var time = upper_start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == upper_start_time.ToString("yyyyMMdd") || time == modern_end_time.ToString("yyyyMMdd"))
|
||||
if (time == upper_start_time.ToString("yyyyMM") || time == modern_end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, upper_start_time, modern_end_time);
|
||||
}
|
||||
|
|
@ -106,7 +121,7 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
var time = upper_start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == upper_start_time.ToString("yyyyMMdd") || time == modern_end_time.ToString("yyyyMMdd"))
|
||||
if (time == upper_start_time.ToString("yyyyMM") || time == modern_end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, upper_start_time, modern_end_time);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
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;
|
||||
|
|
@ -15,7 +17,13 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
/// </summary>
|
||||
public class GetEnergyBenchmarkingController : ApiController
|
||||
{
|
||||
DataServer.BLL.device_data bll = new DataServer.BLL.device_data();
|
||||
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>
|
||||
/// 获取能效对标接口
|
||||
|
|
@ -23,14 +31,121 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
{
|
||||
var res = new get_unit_consumption_response();
|
||||
var res = new get_energy_benchmarking_response();
|
||||
try
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var start_time = now.ToString("yyyy-MM-dd") + " 00:00:00";
|
||||
var end_time = now.ToString("yyyy-MM-dd HH") + ":00:00";
|
||||
var start_time = DateTime.Parse(now.ToString("yyyy") + "-01-01 00:00:00");
|
||||
var end_time = DateTime.Parse(now.ToString("yyyy-MM-dd HH") + ":00:00");
|
||||
|
||||
decimal water_consumption = decimal.Parse(ConfigurationManager.AppSettings["WaterConsumption"].ToString());
|
||||
decimal energy_consumption = decimal.Parse(ConfigurationManager.AppSettings["EnergyConsumption"].ToString());
|
||||
decimal building_area = decimal.Parse(ConfigurationManager.AppSettings["BuildingArea"].ToString());
|
||||
|
||||
//今年电量
|
||||
decimal electricity = 0;
|
||||
var time_count = Tool.GetUsedMonth1("月", start_time, end_time);
|
||||
var date_base = ConfigurationManager.AppSettings["MySQLDataBase"].ToString();
|
||||
var list = new List<DataServer.Model.electricity_data>();
|
||||
var source = "";
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var time = start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == start_time.ToString("yyyyMM") || time == end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, start_time, end_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where 1=1 ", time);
|
||||
}
|
||||
source += ") UNION all ";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
source = source.Substring(0, source.Length - 11);
|
||||
list = bll.GetList(source, "", "");
|
||||
}
|
||||
var device_list = device_bll.GetModelList("");
|
||||
foreach (var item in device_list)
|
||||
{
|
||||
var start_data = list.Where(a => a.DeviceId == item.DeviceId && a.EntireTime.Value == start_time).FirstOrDefault();
|
||||
var end_data = list.Where(a => a.DeviceId == item.DeviceId && a.EntireTime.Value == end_time).FirstOrDefault();
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.EH != null && end_data.EH != null)
|
||||
{
|
||||
decimal eh = end_data.EH.Value - start_data.EH.Value;
|
||||
electricity += eh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//今年用水量
|
||||
decimal water = 0;
|
||||
//今年人均用水量
|
||||
decimal avg_water_consumption = 0;
|
||||
//根据事件查询两条数据,然后值相减为用水量
|
||||
var water_list = water_bll.GetModelList(" EntireTime='" + start_time + "' or EntireTime='" + end_time + "' ");
|
||||
if (water_list.Count >= 2)
|
||||
{
|
||||
var start_data = water_list.Where(a => a.EntireTime.Value == start_time).FirstOrDefault();
|
||||
var end_data = water_list.Where(a => a.EntireTime.Value == end_time).FirstOrDefault();
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.WaterYield != null && end_data.WaterYield != null)
|
||||
{
|
||||
decimal water_yield = end_data.WaterYield.Value - start_data.WaterYield.Value;
|
||||
avg_water_consumption = Math.Round(water_yield / 3300, 2);
|
||||
water = water_yield;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//今年天然气
|
||||
decimal natural_gas = 0;
|
||||
var gas_list = gas_bll.GetModelList(" EntireTime='" + start_time + "' or EntireTime='" + end_time + "' ");
|
||||
if (gas_list.Count >= 2)
|
||||
{
|
||||
var start_data = gas_list.Where(a => a.EntireTime.Value == start_time).FirstOrDefault();
|
||||
var end_data = gas_list.Where(a => a.EntireTime.Value == end_time).FirstOrDefault();
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.GasConsumption != null && end_data.GasConsumption != null)
|
||||
{
|
||||
decimal gas_consumption = end_data.GasConsumption.Value - start_data.GasConsumption.Value;
|
||||
natural_gas = gas_consumption;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//今年人均综合能耗
|
||||
decimal avg_energy_consumption = Math.Round((water + natural_gas + electricity) / 3300, 2);
|
||||
//今年单位建筑面积综合能耗
|
||||
decimal unit_building_area = Math.Round((water + natural_gas + electricity) / 59000, 2);
|
||||
|
||||
decimal yoy_water = avg_water_consumption - water_consumption;
|
||||
decimal yoy_energy_consumption = avg_energy_consumption - energy_consumption;
|
||||
decimal yoy_building_area = unit_building_area - building_area;
|
||||
|
||||
res.code = 200;
|
||||
res.msg = "成功";
|
||||
res.data = new energy_benchmarking()
|
||||
{
|
||||
WateConsumption = water_consumption,
|
||||
EnergyConsumption = energy_consumption,
|
||||
BuildingArea = building_area,
|
||||
AvgWaterConsumption = avg_water_consumption,
|
||||
AvgEnergyConsumption = avg_energy_consumption,
|
||||
UnitBuildingArea = unit_building_area,
|
||||
YoyBuildingArea = yoy_building_area,
|
||||
YoyEnergyConsumption = yoy_energy_consumption,
|
||||
YoyWaterConsumption = yoy_water
|
||||
};
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
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;
|
||||
|
|
@ -12,15 +14,143 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
{
|
||||
public class GetEnergyCalendarController : 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>
|
||||
/// <param name="Date">日期</param>
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage Get()
|
||||
public HttpResponseMessage Get(string Date)
|
||||
{
|
||||
var res = new get_energy_calendar_response();
|
||||
try
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var start_time = DateTime.Parse(Date + " 00:00:00");
|
||||
var end_time = start_time.AddDays(1);
|
||||
if (Date == now.ToString("yyyy-MM-dd"))
|
||||
{
|
||||
end_time = DateTime.Parse(now.ToString("yyyy-MM-dd HH") + ":00:00");
|
||||
}
|
||||
var water_data = new List<energy_calendar_data>();
|
||||
var gas_data = new List<energy_calendar_data>();
|
||||
var electricity_data = new List<energy_calendar_data>();
|
||||
//总水量
|
||||
decimal total_water = 0;
|
||||
//根据事件查询两条数据,然后值相减为用水量
|
||||
var water_list = water_bll.GetModelList(" EntireTime>='" + start_time + "' and EntireTime<='" + end_time + "' ");
|
||||
var count = (end_time - start_time).TotalHours;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var start = start_time.AddHours(i);
|
||||
var end = start.AddHours(1);
|
||||
var start_data = water_list.Where(a => a.EntireTime.Value == start).FirstOrDefault();
|
||||
var end_data = water_list.Where(a => a.EntireTime.Value == end).FirstOrDefault();
|
||||
decimal water = 0;
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.WaterYield != null && end_data.WaterYield != null)
|
||||
{
|
||||
decimal water_yield = end_data.WaterYield.Value - start_data.WaterYield.Value;
|
||||
water = water_yield;
|
||||
}
|
||||
}
|
||||
total_water += water;
|
||||
var model = new energy_calendar_data();
|
||||
model.Time = start.ToString("HH:mm");
|
||||
model.Value = water;
|
||||
water_data.Add(model);
|
||||
}
|
||||
|
||||
//总天然气
|
||||
decimal total_gas = 0;
|
||||
var gas_list = gas_bll.GetModelList(" EntireTime>='" + start_time + "' and EntireTime<='" + end_time + "' ");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var start = start_time.AddHours(i);
|
||||
var end = start.AddHours(1);
|
||||
var start_data = gas_list.Where(a => a.EntireTime.Value == start).FirstOrDefault();
|
||||
var end_data = gas_list.Where(a => a.EntireTime.Value == end).FirstOrDefault();
|
||||
decimal natural_gas = 0;
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.GasConsumption != null && end_data.GasConsumption != null)
|
||||
{
|
||||
decimal gas_consumption = end_data.GasConsumption.Value - start_data.GasConsumption.Value;
|
||||
natural_gas = gas_consumption;
|
||||
}
|
||||
}
|
||||
total_gas += natural_gas;
|
||||
var model = new energy_calendar_data();
|
||||
model.Time = start.ToString("HH:mm");
|
||||
model.Value = natural_gas;
|
||||
gas_data.Add(model);
|
||||
}
|
||||
|
||||
//总电
|
||||
decimal total_electricity = 0;
|
||||
//判断表是否存在,不存在就创建
|
||||
var date_base = ConfigurationManager.AppSettings["MySQLDataBase"].ToString();
|
||||
var list = new List<DataServer.Model.electricity_data>();
|
||||
var time_count = Tool.GetUsedMonth1("月", start_time, end_time);
|
||||
var source = "";
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var time = start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == start_time.ToString("yyyyMM") || time == end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, start_time, end_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where 1=1 ", time);
|
||||
}
|
||||
source += ") UNION all ";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
source = source.Substring(0, source.Length - 11);
|
||||
list = bll.GetList(source, "", "");
|
||||
}
|
||||
var device_list = device_bll.GetModelList("");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var start = start_time.AddHours(i);
|
||||
var end = start.AddHours(1);
|
||||
decimal electricity = 0;
|
||||
foreach (var item in device_list)
|
||||
{
|
||||
var start_data = list.Where(a => a.DeviceId == item.DeviceId && a.EntireTime.Value == start).FirstOrDefault();
|
||||
var end_data = list.Where(a => a.DeviceId == item.DeviceId && a.EntireTime.Value == end).FirstOrDefault();
|
||||
if (start_data != null && end_data != null)
|
||||
{
|
||||
if (start_data.EH != null && end_data.EH != null)
|
||||
{
|
||||
decimal eh = end_data.EH.Value - start_data.EH.Value;
|
||||
electricity += eh;
|
||||
}
|
||||
}
|
||||
}
|
||||
total_electricity += electricity;
|
||||
var model = new energy_calendar_data();
|
||||
model.Time = start.ToString("HH:mm");
|
||||
model.Value = electricity;
|
||||
electricity_data.Add(model);
|
||||
}
|
||||
|
||||
res.code = 200;
|
||||
res.msg = "成功";
|
||||
res.data = new energy_calendar() { ElectricityList = new energy_calendar_list() { Total = total_electricity, List = electricity_data }, GasList = new energy_calendar_list() { Total = total_gas, List = gas_data }, WaterList = new energy_calendar_list() { Total = total_water, List = water_data } };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,52 +34,42 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
var list = new List<DataServer.Model.electricity_data>();
|
||||
//判断表是否存在,不存在就创建
|
||||
var date_base = ConfigurationManager.AppSettings["MySQLDataBase"].ToString();
|
||||
var start_date = DateTime.Parse(now.ToString("yyyy") + "-01-01 00:00:00");
|
||||
if (type == "年")
|
||||
{
|
||||
var start_date = DateTime.Parse(now.ToString("yyyy") + "-01-01 00:00:00");
|
||||
var time_count = Tool.GetUsedMonth1("月", start_date, now);
|
||||
var source = "";
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var time = start_date.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == start_date.ToString("yyyyMMdd") || time == now.ToString("yyyyMMdd"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, start_date, now);
|
||||
}
|
||||
else
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where 1=1 ", time);
|
||||
}
|
||||
source += ") UNION all ";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
source = source.Substring(0, source.Length - 11);
|
||||
list = bll.GetList(source, "", "");
|
||||
}
|
||||
start_date = DateTime.Parse(now.ToString("yyyy") + "-01-01 00:00:00");
|
||||
}
|
||||
else if (type == "月")
|
||||
{
|
||||
var start_date = DateTime.Parse(now.ToString("yyyy-MM") + "-01 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 + ")", " EntireTime>='" + start_date + "' and EntireTime<='" + now + "' ", "");
|
||||
start_date = DateTime.Parse(now.ToString("yyyy-MM") + "-01 00:00:00");
|
||||
}
|
||||
else if (type == "日")
|
||||
{
|
||||
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))
|
||||
start_date = DateTime.Parse(now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
}
|
||||
|
||||
var time_count = Tool.GetUsedMonth1("月", start_date, now);
|
||||
var source = "";
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var time = start_date.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
bll.CreateTable(time);
|
||||
if (time == start_date.ToString("yyyyMM") || time == now.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, start_date, now);
|
||||
}
|
||||
else
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where 1=1 ", time);
|
||||
}
|
||||
source += ") UNION all ";
|
||||
}
|
||||
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 + ")", " EntireTime>='" + start_date + "' and EntireTime<='" + now + "' ", "");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
source = source.Substring(0, source.Length - 11);
|
||||
list = bll.GetList(source, "", "");
|
||||
}
|
||||
|
||||
var data = new List<energy_consumption>();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
var time = start_time.AddMonths(i).ToString("yyyyMM");
|
||||
if (bll.IsExistsTable(date_base, "electricity_data_" + time))
|
||||
{
|
||||
if (time == start_time.ToString("yyyyMMdd") || time == end_time.ToString("yyyyMMdd"))
|
||||
if (time == start_time.ToString("yyyyMM") || time == end_time.ToString("yyyyMM"))
|
||||
{
|
||||
source += string.Format(" (select ElectricityId,DeviceId,EH,P,Kvar,Ia,Ib,Ic,Ua,Ub,Uc,ServiceRating,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electricity_data_{0} where EntireTime>='{1}' and EntireTime<='{2}'", time, start_time, end_time);
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
}
|
||||
else if (type == "水")
|
||||
{
|
||||
var water_list = water_bll.GetModelList(" EntireTime>='" + start_time + "' or EntireTime<='" + end_time + "' ");
|
||||
var water_list = water_bll.GetModelList(" EntireTime>='" + start_time + "' and EntireTime<='" + end_time + "' ");
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var month = start_time.AddMonths(i).Month;
|
||||
|
|
@ -140,7 +140,7 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
|||
}
|
||||
else if (type == "天然气")
|
||||
{
|
||||
var gas_list = gas_bll.GetModelList(" EntireTime>='" + start_time + "' or EntireTime<='" + end_time + "' ");
|
||||
var gas_list = gas_bll.GetModelList(" EntireTime>='" + start_time + "' and EntireTime<='" + end_time + "' ");
|
||||
for (int i = 0; i <= time_count; i++)
|
||||
{
|
||||
var month = start_time.AddMonths(i).Month;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -14,7 +14,7 @@
|
|||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0=</dsig:DigestValue>
|
||||
<dsig:DigestValue>R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@
|
|||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="111616">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="115200">
|
||||
<assemblyIdentity name="DataServer" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing=</dsig:DigestValue>
|
||||
<dsig:DigestValue>jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,7 +14,7 @@
|
|||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0=</dsig:DigestValue>
|
||||
<dsig:DigestValue>R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@
|
|||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="111616">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="115200">
|
||||
<assemblyIdentity name="DataServer" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing=</dsig:DigestValue>
|
||||
<dsig:DigestValue>jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
|
|
|||
Loading…
Reference in New Issue