diff --git a/.vs/DongYingAPI/config/applicationhost.config b/.vs/DongYingAPI/config/applicationhost.config index 6a2c2be..9900f5c 100644 --- a/.vs/DongYingAPI/config/applicationhost.config +++ b/.vs/DongYingAPI/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/DataServer/obj/Debug/DataServer.csproj.AssemblyReference.cache b/DataServer/obj/Debug/DataServer.csproj.AssemblyReference.cache index 90c6e9c..2a3dc6a 100644 Binary files a/DataServer/obj/Debug/DataServer.csproj.AssemblyReference.cache and b/DataServer/obj/Debug/DataServer.csproj.AssemblyReference.cache differ diff --git a/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 3b523aa..695dc4b 100644 Binary files a/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/DongYingAPI b/DongYingAPI deleted file mode 160000 index 881f5b6..0000000 --- a/DongYingAPI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 881f5b60d1e6b13295043c26c26bbed88f765d82 diff --git a/DongYingAPI/Controllers/api/GetCarbonFluxController.cs b/DongYingAPI/Controllers/api/GetCarbonFluxController.cs new file mode 100644 index 0000000..5bd607f --- /dev/null +++ b/DongYingAPI/Controllers/api/GetCarbonFluxController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Runtime.Serialization; +using System.Text; +using System.Web.Http; + +namespace DongYingAPI.Controllers.api +{ + /// + /// 碳-碳流图1 + /// + public class GetCarbonFluxController : ApiController + { + DataServer.BLL.device_data bll = new DataServer.BLL.device_data(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_carbon_flux(); + try + { + if (!string.IsNullOrEmpty(date)) + { + var data = new List(); + var list = bll.GetModelList(""); + var model = new carbon_fluxData(); + var now = DateTime.Now; + var sdate = now.ToString("yyyy-MM-dd 00:00:00"); + var edate = now.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); + var alist = list.Where(x => x.CreateTime >= Convert.ToDateTime(sdate) && x.CreateTime < Convert.ToDateTime(edate)).ToList(); + decimal? num = 0; + foreach (var item in alist) + { + num += item.EH; + } + #region 一级 + model.AggregateName = "总量"; + model.AggregateValue = Math.Round(Convert.ToDecimal(num / 1000 * Convert.ToDecimal(0.5703)), 3); + #endregion + #region 二级 + + #endregion + var amodel = new secondlevel(); + amodel.SecondName = "天然气"; + amodel.SecondValue = 0; + var amodel1=new secondlevel(); + amodel1.SecondName = "电"; + amodel1.SecondValue = Math.Round(Convert.ToDecimal(num / 1000 * Convert.ToDecimal(0.5703)), 3); + model.list.Add(amodel); + model.list.Add(amodel1); + var bmodel=new threelevel(); + bmodel.ThreeName = "空调"; + var klist=alist.Where(x=>x.DeviceName.Contains("空调")).ToList(); + decimal? num1 = 0; + foreach (var item in klist) + { + num1 += item.EH; + } + bmodel.ThreeValue= Math.Round(Convert.ToDecimal(num1 / 1000 * Convert.ToDecimal(0.5703)), 3); + amodel.list.Add(bmodel); + var bmodel1=new threelevel(); + bmodel1.ThreeName = "照明"; + var zlist = alist.Where(x => x.DeviceName.Contains("照明")).ToList(); + decimal? num2 = 0; + foreach (var item in zlist) + { + num2 += item.EH; + } + bmodel1.ThreeValue= Math.Round(Convert.ToDecimal(num2 / 1000 * Convert.ToDecimal(0.5703)), 3); + + 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/Security/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Security/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 8567c85..7047644 100644 Binary files a/Security/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Security/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Security/obj/Debug/Security.csproj.AssemblyReference.cache b/Security/obj/Debug/Security.csproj.AssemblyReference.cache index eb17f85..1e86bbd 100644 Binary files a/Security/obj/Debug/Security.csproj.AssemblyReference.cache and b/Security/obj/Debug/Security.csproj.AssemblyReference.cache differ