diff --git a/DataServer/DataServer.csproj b/DataServer/DataServer.csproj index 8922103..e3df65e 100644 --- a/DataServer/DataServer.csproj +++ b/DataServer/DataServer.csproj @@ -66,9 +66,13 @@ + + + + diff --git a/DataServer/api/get_carbon_intensity.cs b/DataServer/api/get_carbon_intensity.cs new file mode 100644 index 0000000..2860a36 --- /dev/null +++ b/DataServer/api/get_carbon_intensity.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ConstrainedExecution; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_intensity + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_intensityData + { + public string time { get; set; } + public decimal? CarbonPer { get; set; } + public decimal? ArealCarbon { get;set;} + } +} diff --git a/DataServer/api/get_carbon_offset.cs b/DataServer/api/get_carbon_offset.cs new file mode 100644 index 0000000..340ee06 --- /dev/null +++ b/DataServer/api/get_carbon_offset.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_offset + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_offsetData + { + public decimal? CarbonOffse { get; set; } + } +} diff --git a/DataServer/api/get_carbon_reduction.cs b/DataServer/api/get_carbon_reduction.cs new file mode 100644 index 0000000..ff35ec1 --- /dev/null +++ b/DataServer/api/get_carbon_reduction.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + + public class get_carbon_reduction + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_reductionData + { + public decimal? Aount { get; set; } + public List list { get; set; } + } + public class carbon_reduction + { + public decimal? AirConditioner { get; set; } + public decimal? Illumination { get; set;} + public decimal? Other { get; set;} + } +} diff --git a/DataServer/api/get_daily_electricity.cs b/DataServer/api/get_daily_electricity.cs new file mode 100644 index 0000000..d5f8530 --- /dev/null +++ b/DataServer/api/get_daily_electricity.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_daily_electricity + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class daily_electricityData + { + public decimal? CurrentDate { get; set; } + public decimal? YesterDay { get; set; } + } +} diff --git a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache index fec6602..318629e 100644 --- a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache +++ b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache @@ -1 +1,5 @@ +<<<<<<< HEAD +4c49ecb8992ee253af38dc297bc68a59dc3931a1 +======= f8c698525a16b5084430f058269e79a2d843daa4 +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 diff --git a/DongYingAPI/Controllers/api/GetCarbonIntensityController.cs b/DongYingAPI/Controllers/api/GetCarbonIntensityController.cs new file mode 100644 index 0000000..4ac881a --- /dev/null +++ b/DongYingAPI/Controllers/api/GetCarbonIntensityController.cs @@ -0,0 +1,65 @@ +using DataServer.api; +using DataServer.Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace DongYingAPI.Controllers.api +{ + /// + /// 碳-排放强度 + /// + public class GetCarbonIntensityController : ApiController + { + DataServer.BLL.electricity_data bll = new DataServer.BLL.electricity_data(); + DataServer.BLL.device_info bll_info = new DataServer.BLL.device_info(); + public HttpResponseMessage Get() + { + var res = new get_carbon_intensity(); + try + { + var data =new List(); + var time = DateTime.Now.ToString("yyyyMM"); + for (int i = 0; i < 6; i++) + { + var model=new carbon_intensityData(); + var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); + model.time = atime; + var now = DateTime.Now; + var sdate = Convert.ToDateTime(now.AddMonths(-i).ToString("yyyy-MM-01 00:00:00")); + var edate = Convert.ToDateTime(now.AddMonths(-i+1).ToString("yyyy-MM-01 00:00:00")); + var list = bll_info.GetModelList(""); + decimal? num = 0; + foreach (var item in list) + { + var list1 = bll.GetModelListDate("", time).Where(x => x.EntireTime >= sdate && x.EntireTime < edate&&x.DeviceId==item.DeviceId).ToList(); + foreach (var aitem in list1) + { + num += aitem.EH; + } + } + model.CarbonPer = (num / 1000 * Convert.ToDecimal(0.5703))/100000; + model.ArealCarbon = (num / 1000 * Convert.ToDecimal(0.5703)) / 59000; + 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; + } + } +} \ No newline at end of file diff --git a/DongYingAPI/Controllers/api/GetCarbonOffsetController.cs b/DongYingAPI/Controllers/api/GetCarbonOffsetController.cs new file mode 100644 index 0000000..d5e965c --- /dev/null +++ b/DongYingAPI/Controllers/api/GetCarbonOffsetController.cs @@ -0,0 +1,59 @@ +using DataServer.api; +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 +{ + /// + /// 碳-碳抵消 + /// + public class GetCarbonOffsetController : ApiController + { + public HttpResponseMessage Get(string date="") + { + var res = new get_carbon_offset(); + try + { + if(!string.IsNullOrEmpty(date)) + { + var data = new List(); + if (date == "年") + { + var model =new carbon_offsetData(); + model.CarbonOffse = 0; + data.Add(model); + }else if (date == "月") + { + var model = new carbon_offsetData(); + model.CarbonOffse = 0; + data.Add(model); + } + + res.code = 200; + res.msg = "成功"; + res.data = data; + } + else + { + res.code = 201; + res.msg = "参数不能为空"; + } + + + } + 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; + } + } +} \ No newline at end of file diff --git a/DongYingAPI/Controllers/api/GetCarbonReductionController.cs b/DongYingAPI/Controllers/api/GetCarbonReductionController.cs new file mode 100644 index 0000000..8af8c1c --- /dev/null +++ b/DongYingAPI/Controllers/api/GetCarbonReductionController.cs @@ -0,0 +1,52 @@ +using DataServer.api; +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 +{ + /// + /// 碳-碳减排量 + /// + public class GetCarbonReductionController : ApiController + { + public HttpResponseMessage Get() + { + var res = new get_carbon_reduction(); + try + { + var data = new List(); + var model=new carbon_reductionData(); + //总量 + model.Aount = 333; + var blist=new List(); + var bmodel=new carbon_reduction(); + //空调 + bmodel.AirConditioner = 111; + //照明 + bmodel.Illumination = 111; + //其它 + bmodel.Other = 111; + blist.Add(bmodel); + model.list = blist; + 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; + } + } +} \ No newline at end of file diff --git a/DongYingAPI/Controllers/api/GetDailyElectricityController.cs b/DongYingAPI/Controllers/api/GetDailyElectricityController.cs new file mode 100644 index 0000000..86a18df --- /dev/null +++ b/DongYingAPI/Controllers/api/GetDailyElectricityController.cs @@ -0,0 +1,72 @@ +using DataServer.api; +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 +{ + /// + /// 空调-日用电量 + /// + public class GetDailyElectricityController : ApiController + { + DataServer.BLL.electricity_data bll = new DataServer.BLL.electricity_data(); + DataServer.BLL.device_info bll_info = new DataServer.BLL.device_info(); + public HttpResponseMessage Get() + { + var res = new get_daily_electricity(); + try + { + var data = new List(); + var time = DateTime.Now.ToString("yyyyMM"); + //今天 + var sdate = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); + //昨天 + var edate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00"); + //前天 + var qdate=DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00"); + //今天列表 + var list1=bll.GetModelListDate("",time).Where(x=>x.EntireTime==Convert.ToDateTime(sdate)).ToList(); + decimal? num1 = 0; + foreach (var item in list1) + { + num1 += item.EH; + } + //明天列表 + var list2 = bll.GetModelListDate("", time).Where(x => x.EntireTime == Convert.ToDateTime(sdate)).ToList(); + decimal? num2 = 0; + foreach (var item in list1) + { + num2 += item.EH; + } + //昨天列表 + var list3 = bll.GetModelListDate("", time).Where(x => x.EntireTime == Convert.ToDateTime(sdate)).ToList(); + decimal? num3 = 0; + foreach (var item in list1) + { + num3 += item.EH; + } + var model = new daily_electricityData(); + model.CurrentDate = num1 - num2; + model.YesterDay=num2- num3; + 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; + } + } +} \ No newline at end of file diff --git a/DongYingAPI/DongYingAPI.csproj b/DongYingAPI/DongYingAPI.csproj index 26ccc68..34725ae 100644 --- a/DongYingAPI/DongYingAPI.csproj +++ b/DongYingAPI/DongYingAPI.csproj @@ -175,9 +175,13 @@ + + + + diff --git a/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache b/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache index 2ef41e2..4da2ea6 100644 --- a/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache +++ b/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache @@ -1 +1,5 @@ +<<<<<<< HEAD +468880470fff5b79419feffd9db81238259f3645 +======= 6c9d14040a1da93afa29b893b8d2e1b7aae7c133 +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 diff --git a/Security/bin/Debug/ServiceSecurity.application b/Security/bin/Debug/ServiceSecurity.application index 169f53e..f450e83 100644 --- a/Security/bin/Debug/ServiceSecurity.application +++ b/Security/bin/Debug/ServiceSecurity.application @@ -14,7 +14,15 @@ +<<<<<<< HEAD R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ= +======= +<<<<<<< HEAD + DFDrtnOeo9dpim2EB6ODebG9pNDAOWi8cJsCQmPQWpo= +======= + 5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 diff --git a/Security/bin/Debug/ServiceSecurity.exe.manifest b/Security/bin/Debug/ServiceSecurity.exe.manifest index 0bfcf67..2d7987e 100644 --- a/Security/bin/Debug/ServiceSecurity.exe.manifest +++ b/Security/bin/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,30 @@ +<<<<<<< HEAD +======= +<<<<<<< HEAD + +======= + +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +<<<<<<< HEAD jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU= +======= +<<<<<<< HEAD + aWndXXAkdQBx2rtrRCdbWDqmcwtd1zO16Sk2hz+kv6w= +======= + wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 diff --git a/Security/obj/Debug/ServiceSecurity.application b/Security/obj/Debug/ServiceSecurity.application index 169f53e..f450e83 100644 --- a/Security/obj/Debug/ServiceSecurity.application +++ b/Security/obj/Debug/ServiceSecurity.application @@ -14,7 +14,15 @@ +<<<<<<< HEAD R/fXQ8YNWnYzGAnZOCkkNJLl3mwpgt3uhSTYVgRcrxQ= +======= +<<<<<<< HEAD + DFDrtnOeo9dpim2EB6ODebG9pNDAOWi8cJsCQmPQWpo= +======= + 5bGkkmasvGwv0JCWHDW7zc72Mkr/5VqC8X+hEudh6w0= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 diff --git a/Security/obj/Debug/ServiceSecurity.exe.manifest b/Security/obj/Debug/ServiceSecurity.exe.manifest index 0bfcf67..2d7987e 100644 --- a/Security/obj/Debug/ServiceSecurity.exe.manifest +++ b/Security/obj/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,30 @@ +<<<<<<< HEAD +======= +<<<<<<< HEAD + +======= + +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238 +<<<<<<< HEAD jodAUMsPfpVOtY0heILyPhzqWz09Qb5YaUSWUh49jCU= +======= +<<<<<<< HEAD + aWndXXAkdQBx2rtrRCdbWDqmcwtd1zO16Sk2hz+kv6w= +======= + wXbJaoaVkZ4nWsDBuqFZJDHFJELkSuDr//lug4KQing= +>>>>>>> ed1a5636011cbbab43211edc340b78e5091aabc9 +>>>>>>> e663b85f3f0c9a8c32fb9527e9c15287ca018238