From 7c43296f41afdbc18f10c56b2266b8eae8c5bf22 Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Sat, 20 Sep 2025 18:15:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=8E=B0=E5=9C=BA=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/FineUIPro.Web/common/main_new.aspx.cs | 66 +++++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index 1804313a..0a109fe3 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -13,6 +13,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using Org.BouncyCastle.Ocsp; using FineUIPro.Web.HJGL.FL; +using System.Data; namespace FineUIPro.Web.common { @@ -981,23 +982,51 @@ namespace FineUIPro.Web.common { await Task.Run(() => { - int AllCount = 0; - int MCount = 0; - var getallin = new List(); - if (pids == null) + int AllCount = 0; + int MCount = 0; + //var getallin = new List(); + //if (pids == null) + //{ + // getallin = APIPageDataService.getPersonNum(new List(), DateTime.Now); + //} + //else + //{ + // getallin = APIPageDataService.getPersonNum(pids.ToList(), DateTime.Now); + //} + + + var startDate = DateTime.Now.Date; + var endDate = startDate.AddDays(1); + + string strSql = @"select ProjectId,PostType,COUNT(distinct PersonId)PersonNum from SitePerson_PersonInOutNow + where ChangeTime >= '" + startDate.ToString("yyyy-MM-dd") + "' and ChangeTime <='" + endDate.ToString("yyyy-MM-dd") + "' and ProjectId in ('" + string.Join("','", allProjects.Select(x => x.ProjectId)) + @"') + group by ProjectId,PostType"; + + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + Dictionary dic = new Dictionary(); + foreach (DataRow row in dt.Rows) { - getallin = APIPageDataService.getPersonNum(new List(), DateTime.Now); - } - else - { - getallin = APIPageDataService.getPersonNum(pids.ToList(), DateTime.Now); - } - AllCount = getallin.Count(); - if (AllCount > 0) - { - MCount = getallin.Count(x => x.PostType == Const.PostType_1); + string projectid = row["ProjectId"].ToString(); + string postType = row["PostType"].ToString(); + int PersonNum = int.Parse(row["PersonNum"].ToString()); + if (!dic.ContainsKey(projectid)) + { + dic.Add(projectid, PersonNum); + } + else + { + dic[projectid] = dic[projectid] + PersonNum; + } + AllCount += PersonNum; + if(postType == Const.PostType_1) + { + MCount += PersonNum; + } } + + + div_xcrs.InnerHtml = AllCount.ToString(); div_zyxcrs.InnerHtml = (AllCount - MCount).ToString(); div_glxcrs.InnerHtml = MCount.ToString(); @@ -1006,7 +1035,14 @@ namespace FineUIPro.Web.common foreach (var item in allProjects) { ProjectPersonMc += "'" + item.ShortName + "',"; - ProjectPersonCount += "'" + getallin.Count(x => x.ProjectId == item.ProjectId) + "',"; + if (dic.ContainsKey(item.ProjectId)) + { + ProjectPersonCount += "'" + dic[item.ProjectId] + "',"; + } + else + { + ProjectPersonCount += "'0',"; + } } ProjectPersonMc = !string.IsNullOrWhiteSpace(ProjectPersonMc) ? ProjectPersonMc.TrimEnd(',') : string.Empty; ProjectPersonCount = !string.IsNullOrWhiteSpace(ProjectPersonCount) ? ProjectPersonCount.TrimEnd(',') : string.Empty;