From 7a5a4da768f34af612b7dbb50aebcb6e447296e8 Mon Sep 17 00:00:00 2001 From: xukanghao <15731082219@163.com> Date: Mon, 8 Jan 2024 17:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/DongYingAPI/config/applicationhost.config | 2 +- .../DataServer.csproj.AssemblyReference.cache | Bin 8205 -> 11374 bytes ...gnTimeResolveAssemblyReferencesInput.cache | Bin 7034 -> 7019 bytes DongYingAPI | 1 - .../api/GetCarbonFluxController.cs | 95 ++++++++++++++++++ ...gnTimeResolveAssemblyReferencesInput.cache | Bin 8073 -> 8016 bytes .../Security.csproj.AssemblyReference.cache | Bin 26956 -> 32051 bytes 7 files changed, 96 insertions(+), 2 deletions(-) delete mode 160000 DongYingAPI create mode 100644 DongYingAPI/Controllers/api/GetCarbonFluxController.cs 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 90c6e9cd535d6c1842a3bc4c323036e563f2265a..2a3dc6a8f41aec4d9ee7154555b8e5221e289f7b 100644 GIT binary patch delta 318 zcmeBmco)IJ#wg0bz`&R|c_Dk~#@G$=OpIZZKk{2l))7c!jGH`D#9{I^f!&h>Sa~MT z5w`%+ER*jub4WIp*Fzx8Atk(|ks1RN*d5jhApYN@E-Eti(3L^5DtPl0_1?RT%0^`dl(o4z3mI`jDBEd IsDvsr0IA3njQ{`u delta 77 zcmaED_RDO;5^lz-$#T3F%#Hz`lkajrnJmj|31 + /// 碳-碳流图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 8567c8508a6752ab61e65b967298acc05daffab5..7047644631b597b2c40aa79c94fdeb970d61565f 100644 GIT binary patch delta 137 zcmeCQzhJjv2{&Wu-lTl^{0GL}XJ^%m! delta 186 zcmca$*J;0D2{&WKWI;X)X2$@}$#=OQG5UjevOr!;aB6aCQD#YHjAKE8UUGh3T4p+% z6axc82uKAFvWm%$yrPV8n8N+M@{I8yVX*1Xc{Lep;5<)0H^xjj?*yMQV=j!h*@T~$ Yak2oPB}m)mDuF6)h^xR{T^VI&0Kum<3jhEB diff --git a/Security/obj/Debug/Security.csproj.AssemblyReference.cache b/Security/obj/Debug/Security.csproj.AssemblyReference.cache index eb17f85c722e7a9f51e05e7cb94896183d0c7c7d..1e86bbdbedb7b504ce5d2c045a387955295b8783 100644 GIT binary patch delta 240 zcmX?eiE;BUMh-Sc3kC)T#`wt-T?02pe$HTGjG6o~+G6s&6tT(c>_k|OAJ`*3`Iwyr zW6ET~RENp$6T~J**e{)2Ai_GC&B1wctDyJfyaesZ2Ernf&!=-te(vBlnUz;)@&*pk z$q|nHled{!PUd5Dn=GjBJh|N5Y4bzI{Va@WU>hE?8BhLfV#SyTHn`CA@Z^9nx5*1Q zOc=Ak^3OF28H+%2o6mE4F*BBd1*3SKC!3l(G1h@4_Lxs*octhyXY%|A*U1JVQzpl; b0BK+M$$a8blLZvGCOcT$PHu1pIY$`)*%Vja delta 23 fcmdn|i}B1QMh-ScV+IBW#`wt-T?02pe$D^@URDSX