diff --git a/DataServer/api/EnergyEfficiency/get_energy_benchmarking_response.cs b/DataServer/api/EnergyEfficiency/get_energy_benchmarking_response.cs index 49b8e51..cebe22d 100644 --- a/DataServer/api/EnergyEfficiency/get_energy_benchmarking_response.cs +++ b/DataServer/api/EnergyEfficiency/get_energy_benchmarking_response.cs @@ -20,5 +20,55 @@ namespace DataServer.api.EnergyEfficiency /// 返回说明 /// public string msg { get; set; } + + public energy_benchmarking data { get; set; } + } + + public class energy_benchmarking + { + /// + /// 人均用水量标准 + /// + public decimal WateConsumption { get; set; } + + /// + /// 人均综合能耗标准 + /// + public decimal EnergyConsumption { get; set; } + + /// + /// 单位建筑面积综合能耗标准 + /// + public decimal BuildingArea { get; set; } + + /// + /// 人均用水量 + /// + public decimal AvgWaterConsumption { get; set; } + + /// + /// 人均综合能耗 + /// + public decimal AvgEnergyConsumption { get; set; } + + /// + /// 单位建筑面积综合能耗 + /// + public decimal UnitBuildingArea { get; set; } + + /// + /// 人均用水量同比 + /// + public decimal YoyWaterConsumption { get; set; } + + /// + /// 人均综合能耗同比 + /// + public decimal YoyEnergyConsumption { get; set; } + + /// + /// 单位建筑面积综合能耗同比 + /// + public decimal YoyBuildingArea { get; set; } } } diff --git a/DataServer/api/EnergyEfficiency/get_energy_calendar_response.cs b/DataServer/api/EnergyEfficiency/get_energy_calendar_response.cs index 0302168..5db2c56 100644 --- a/DataServer/api/EnergyEfficiency/get_energy_calendar_response.cs +++ b/DataServer/api/EnergyEfficiency/get_energy_calendar_response.cs @@ -17,5 +17,51 @@ namespace DataServer.api.EnergyEfficiency /// 返回说明 /// public string msg { get; set; } + + /// + /// 数据 + /// + public energy_calendar data { get; set; } + } + + public class energy_calendar + { + /// + /// 水数据 + /// + public energy_calendar_list WaterList { get; set; } + + /// + /// 天然气数据 + /// + public energy_calendar_list GasList { get; set; } + + /// + /// 电数据 + /// + public energy_calendar_list ElectricityList { get; set; } + } + + public class energy_calendar_list + { + /// + /// 总值 + /// + public decimal Total { get; set; } + + public List List { get; set; } + } + + public class energy_calendar_data + { + /// + /// 时间 + /// + public string Time { get; set; } + + /// + /// 值 + /// + public decimal Value { get; set; } } } diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs index ebaefad..11a1f40 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs @@ -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); } diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyBenchmarkingController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyBenchmarkingController.cs index 80fe4eb..72091c2 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyBenchmarkingController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyBenchmarkingController.cs @@ -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 /// 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(); /// /// 获取能效对标接口 @@ -23,14 +31,121 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency /// 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(); + 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) { diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyCalendarController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyCalendarController.cs index a59ef33..0e58bfd 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyCalendarController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyCalendarController.cs @@ -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(); + /// /// 获取能耗日历接口 /// + /// 日期 /// - 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(); + var gas_data = new List(); + var electricity_data = new List(); + //总水量 + 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(); + 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) { diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyConsumptionController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyConsumptionController.cs index c1d5a0f..c787ea0 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyConsumptionController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyConsumptionController.cs @@ -34,52 +34,42 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency var list = new List(); //判断表是否存在,不存在就创建 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(); diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyTrendController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyTrendController.cs index 5a155e1..f32598f 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyTrendController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetEnergyTrendController.cs @@ -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; diff --git a/Security/bin/Debug/ServiceSecurity.application b/Security/bin/Debug/ServiceSecurity.application index 6a33a1b..ecd2436 100644 --- a/Security/bin/Debug/ServiceSecurity.application +++ b/Security/bin/Debug/ServiceSecurity.application @@ -14,7 +14,19 @@ +<<<<<<< HEAD YDl3zNtJOrDsWH9OgTkhH2nFTuPB9l5c5Gj8UHZF/8U= +======= +<<<<<<< HEAD + R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ= +======= +<<<<<<< HEAD + DFDrtnOeo9dpim2EB6ODebG9pNDAOWi8cJsCQmPQWpo= +======= + 5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341 diff --git a/Security/bin/Debug/ServiceSecurity.exe.manifest b/Security/bin/Debug/ServiceSecurity.exe.manifest index c0d23d7..44047b4 100644 --- a/Security/bin/Debug/ServiceSecurity.exe.manifest +++ b/Security/bin/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,38 @@ +<<<<<<< HEAD +======= +<<<<<<< HEAD + +======= +<<<<<<< HEAD + +======= + +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341 +<<<<<<< HEAD 4mMN3zm7d9ErM3wCOV90C/WiVh2brt6Zs7rkAtdDVeU= +======= +<<<<<<< HEAD + jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU= +======= +<<<<<<< HEAD + aWndXXAkdQBx2rtrRCdbWDqmcwtd1zO16Sk2hz+kv6w= +======= + wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341 diff --git a/Security/obj/Debug/ServiceSecurity.application b/Security/obj/Debug/ServiceSecurity.application index 6a33a1b..ecd2436 100644 --- a/Security/obj/Debug/ServiceSecurity.application +++ b/Security/obj/Debug/ServiceSecurity.application @@ -14,7 +14,19 @@ +<<<<<<< HEAD YDl3zNtJOrDsWH9OgTkhH2nFTuPB9l5c5Gj8UHZF/8U= +======= +<<<<<<< HEAD + R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ= +======= +<<<<<<< HEAD + DFDrtnOeo9dpim2EB6ODebG9pNDAOWi8cJsCQmPQWpo= +======= + 5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341 diff --git a/Security/obj/Debug/ServiceSecurity.exe.manifest b/Security/obj/Debug/ServiceSecurity.exe.manifest index c0d23d7..44047b4 100644 --- a/Security/obj/Debug/ServiceSecurity.exe.manifest +++ b/Security/obj/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,38 @@ +<<<<<<< HEAD +======= +<<<<<<< HEAD + +======= +<<<<<<< HEAD + +======= + +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341 +<<<<<<< HEAD 4mMN3zm7d9ErM3wCOV90C/WiVh2brt6Zs7rkAtdDVeU= +======= +<<<<<<< HEAD + jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU= +======= +<<<<<<< HEAD + aWndXXAkdQBx2rtrRCdbWDqmcwtd1zO16Sk2hz+kv6w= +======= + wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +>>>>>>> 53710abf1cc61565a1c5136966797c66d7a67341