From 15256b5c7c8bf022635399ffaa9a3fc7518e19b1 Mon Sep 17 00:00:00 2001 From: Frane Date: Mon, 16 May 2022 11:07:36 +0800 Subject: [PATCH] =?UTF-8?q?20220516=20=E5=AE=9E=E5=90=8D=E5=88=B6=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E5=99=A8=E4=BC=98=E5=8C=96=E3=80=81=E8=80=83=E5=8B=A4?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E3=80=81=E8=80=83=E8=AF=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/API/APIGetHttpService.cs | 7 +- SGGL/BLL/API/HSSE/APITestPlanService.cs | 7 +- SGGL/BLL/HSSE/SitePerson/PersonService.cs | 3 +- .../ZHGL/RealName/RealNameMonitorService.cs | 66 +-- SGGL/BLL/ZHGL/RealName/SynchroSetService.cs | 14 +- SGGL/FineUIPro.Web/Global.asax.cs | 13 +- .../HSSE/SitePerson/PersonInfoIn.aspx.cs | 22 +- SGGL/FineUIPro.Web/common/main.aspx | 2 +- .../Controllers/HSSE/TestRecordController.cs | 2 +- .../Controllers/HSSE/TestingController.cs | 384 ++++++++++++++++++ SGGL/WebAPI/WebAPI.csproj | 1 + 11 files changed, 469 insertions(+), 52 deletions(-) create mode 100644 SGGL/WebAPI/Controllers/HSSE/TestingController.cs diff --git a/SGGL/BLL/API/APIGetHttpService.cs b/SGGL/BLL/API/APIGetHttpService.cs index 4f21dc38..6a40502c 100644 --- a/SGGL/BLL/API/APIGetHttpService.cs +++ b/SGGL/BLL/API/APIGetHttpService.cs @@ -30,7 +30,7 @@ namespace BLL } } request.Headers.Add("token", "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"); - request.Timeout = 5000; /// 设置5秒超时 + request.Timeout = 20000; /// 设置5秒超时 if (!string.IsNullOrEmpty(data)) { Stream RequestStream = request.GetRequestStream(); @@ -93,8 +93,7 @@ namespace BLL HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = string.IsNullOrEmpty(method) ? "GET" : method; - request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; - request.Timeout = 5000; /// 设置5秒超时 + request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; if (header != null) { foreach (var i in header.Keys) @@ -163,7 +162,7 @@ namespace BLL HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = string.IsNullOrEmpty(method) ? "GET" : method; request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; - request.Timeout = 5000; /// 设置5秒超时 + request.Timeout = 20000; /// 设置5秒超时 if (header != null) { foreach (var i in header.Keys) diff --git a/SGGL/BLL/API/HSSE/APITestPlanService.cs b/SGGL/BLL/API/HSSE/APITestPlanService.cs index c9d98b02..3255143e 100644 --- a/SGGL/BLL/API/HSSE/APITestPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITestPlanService.cs @@ -66,7 +66,7 @@ namespace BLL returnItem.TestPlanName = getTestP.PlanName; returnItem.TestPlanManId = getTestP.PlanManId; returnItem.TestPlanManName = UserService.GetUserNameByUserId(getTestP.PlanManId); - returnItem.TestPlanDate = string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.PlanDate); + returnItem.TestPlanDate = getTestP.PlanDate.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.PlanDate) : ""; returnItem.TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.TestStartTime); returnItem.TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.TestEndTime); returnItem.Duration = getTestP.Duration; @@ -81,7 +81,10 @@ namespace BLL returnItem.WorkPostIds = getTestP.WorkPostIds; returnItem.WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(getTestP.WorkPostIds); returnItem.States = getTestP.States; - returnItem.QRCodeUrl = getTestP.QRCodeUrl.Replace('\\', '/'); + if (!string.IsNullOrEmpty(getTestP.QRCodeUrl)) + { + returnItem.QRCodeUrl = getTestP.QRCodeUrl.Replace('\\', '/'); + } returnItem.TrainingPlanId = getTestP.PlanId; } return returnItem; diff --git a/SGGL/BLL/HSSE/SitePerson/PersonService.cs b/SGGL/BLL/HSSE/SitePerson/PersonService.cs index 75a8548d..31e56d0b 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonService.cs @@ -63,7 +63,8 @@ namespace BLL } if (!string.IsNullOrEmpty(workPostIds)) { - getPersonList = getPersonList.Where(x => workPostIds.Contains(x.WorkPostId)); + List wIds = Funs.GetStrListByStr(workPostIds, ','); + getPersonList = getPersonList.Where(x => wIds.Contains(x.WorkPostId)); } if (ckTrain) { diff --git a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs index 2e9acc12..520fb69c 100644 --- a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs +++ b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs @@ -11,19 +11,15 @@ namespace BLL /// /// 监视组件 /// - private static Timer messageTimer; + // private static Timer messageTimer; /// /// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟 /// - public static void StartMonitor() - { - int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; - //var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(); - //if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue) - //{ - // adTimeJ = getSynchroSet.Intervaltime.Value; - //} + public static void StartMonitor(string jtProCode) + { + int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; + Timer messageTimer = new Timer(); if (messageTimer != null) { messageTimer.Stop(); @@ -36,7 +32,8 @@ namespace BLL { AutoReset = true }; - messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess); + messageTimer.Elapsed += (sender, args) => AdUserInProcess(sender, jtProCode); + //messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess); messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ; messageTimer.Start(); } @@ -47,34 +44,45 @@ namespace BLL /// /// Timer组件 /// 事件参数 - private static void AdUserInProcess(object sender, ElapsedEventArgs e) + public static void AdUserInProcess(object sender, string jtProCode) { try { SynchroSetService.PushCollCompany(); - var getRProjects = from x in Funs.DB.RealName_Project - select x; - if (getRProjects.Count() > 0) + if (!string.IsNullOrEmpty(jtProCode)) { - foreach (var item in getRProjects) - { - var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.JTproCode); - if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode)) - { - SynchroSetService.PushProCollCompany(item.JTproCode); - //SynchroSetService.PushCollTeam(item.ProCode); - //SynchroSetService.getCollTeam(item.ProCode); - SynchroSetService.PushPersons(Const.BtnAdd, item.JTproCode, null); - SynchroSetService.PushPersons(Const.BtnModify, item.JTproCode, null); - SynchroSetService.PushAttendance(item.JTproCode); - SynchroSetService.updatePersonsExitTime(item.JTproCode); - } - } + SynchroSetService.PushProCollCompany(jtProCode); + SynchroSetService.PushCollTeam(jtProCode); + SynchroSetService.getCollTeam(jtProCode); + SynchroSetService.PushPersons(Const.BtnAdd, jtProCode, null); + SynchroSetService.PushPersons(Const.BtnModify, jtProCode, null); + SynchroSetService.PushAttendance(jtProCode); + SynchroSetService.updatePersonsExitTime(jtProCode); } + + //var getRProjects = from x in Funs.DB.RealName_Project + // select x; + //if (getRProjects.Count() > 0) + //{ + // foreach (var item in getRProjects) + // { + // var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.JTproCode); + // if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode)) + // { + // SynchroSetService.PushProCollCompany(item.JTproCode); + // //SynchroSetService.PushCollTeam(item.ProCode); + // //SynchroSetService.getCollTeam(item.ProCode); + // SynchroSetService.PushPersons(Const.BtnAdd, item.JTproCode, null); + // SynchroSetService.PushPersons(Const.BtnModify, item.JTproCode, null); + // SynchroSetService.PushAttendance(item.JTproCode); + // SynchroSetService.updatePersonsExitTime(item.JTproCode); + // } + // } + //} } catch (Exception ex) { - StartMonitor(); + StartMonitor(jtProCode); ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); } } diff --git a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs index 9b6d1631..5f566b9f 100644 --- a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs +++ b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs @@ -56,6 +56,11 @@ namespace BLL } #endregion + public static List GetRealNameProject() + { + return (from x in Funs.DB.RealName_Project select x).ToList(); + } + #region 项目基础数据下拉框 /// /// 表下拉框 @@ -1426,7 +1431,14 @@ namespace BLL addTeam(getData.Select(x => x.TeamGroupId).Distinct().ToList(), newToken); getTeam(proCode, newToken); - addPerson(getData.Select(x => x.PersonId).Distinct().ToList(), newToken); + + var getPersonS = getData.Select(x => x.idcardNumber).Distinct().ToList(); + foreach (var pitem in getPersonS) + { + PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem); + PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem); + } + pushContent = JsonConvert.SerializeObject(listObject); var returndata = BLL.APIGetHttpService.OutsideHttp(url, "POST", null, newToken, pushContent); if (!string.IsNullOrEmpty(returndata)) diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index 6e42ce52..8ae475fd 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -1,11 +1,12 @@ namespace FineUIPro.Web { + using BLL; + using Model; using System; using System.Configuration; using System.Globalization; using System.Text; - using BLL; - using Model; + using System.Timers; public class Global : System.Web.HttpApplication { @@ -39,11 +40,15 @@ ////实名制同步定时器 try - { + { BLL.RealNameMonitorService.StartInOutMonitor(); if (ConfigurationManager.AppSettings["EnableRealName"] == "True") { - BLL.RealNameMonitorService.StartMonitor(); + var getProjects = SynchroSetService.GetRealNameProject(); + foreach (var item in getProjects) + { + BLL.RealNameMonitorService.StartMonitor(item.JTproCode); + } } BLL.RealNameMonitorService.StartInOutMonitor(); BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "实名制同步定时器启动成功!"); diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs index 7b36bd71..afa730dc 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs @@ -409,16 +409,20 @@ namespace FineUIPro.Web.HSSE.SitePerson { foreach (var item in viewCheckings) { - Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + var getCheck = Funs.DB.SitePerson_Checking.FirstOrDefault(x => x.CheckingId == item.CheckingId); + if (getCheck == null) { - CheckingId = item.CheckingId, - ProjectId = item.ProjectId, - IdentityCard = item.IdentityCard, - IntoOutTime = item.IntoOutTime, - IntoOut = item.IntoOut, - PersonId = item.PersonId - }; - BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); + Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + { + CheckingId = item.CheckingId, + ProjectId = item.ProjectId, + IdentityCard = item.IdentityCard, + IntoOutTime = item.IntoOutTime, + IntoOut = item.IntoOut, + PersonId = item.PersonId + }; + BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); + } } //int a = viewCheckings.Count(); //for (int i = 0; i < a; i++) diff --git a/SGGL/FineUIPro.Web/common/main.aspx b/SGGL/FineUIPro.Web/common/main.aspx index 1592029c..f5ae9395 100644 --- a/SGGL/FineUIPro.Web/common/main.aspx +++ b/SGGL/FineUIPro.Web/common/main.aspx @@ -888,7 +888,7 @@ } }) - +