diff --git a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs index 5905e50b..35f5cd9f 100644 --- a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs +++ b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs @@ -381,5 +381,80 @@ namespace BLL } } #endregion + + #region 启动监视器 系统启动5分钟 + /// + /// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟 + /// + public static void StartMonitorProject() + { + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getRProjects = from x in db.RealName_Project + select x; + if (getRProjects.Count() > 0) + { + foreach (var item in getRProjects) + { + var getSynchroSet = db.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.ProCode); + if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode)) + { + int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; + Timer messageTimerProject = new Timer(); + if (messageTimerProject != null) + { + messageTimerProject.Stop(); + messageTimerProject.Dispose(); + messageTimerProject = null; + } + if (adTimeJ > 0) + { + messageTimerProject = new Timer + { + AutoReset = true + }; + messageTimerProject.Elapsed += (sender, args) => AdUserInProcess(sender, item.ProCode); + //messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess); + messageTimerProject.Interval = 1000 * 60 * 5;// adTimeJ;// 60分钟 60000 * adTimeJ; + messageTimerProject.Start(); + } + } + } + } + } + } + catch (Exception ex) + { + StartMonitorProject(); + } + } + + /// + /// 流程确认 定时执行 系统启动5分钟 + /// + /// Timer组件 + /// 事件参数 + public static void AdUserInProcess(object sender, string ProCode) + { + try + { + SynchroSetService.PushCollCompany(); + if (!string.IsNullOrEmpty(ProCode)) + { + SynchroSetService.InsertRealNamePushLog(null, ProCode, "实名制定时器", "sucess", "200", ProCode, "成功", null); + SynchroSetService.PushProCollCompany(ProCode); + SynchroSetService.PushAttendance(ProCode); + SynchroSetService.updatePersonsExitTime(ProCode); + } + } + catch (Exception ex) + { + ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); + } + } + #endregion + } } diff --git a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs index 7bd06181..61e76b35 100644 --- a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs +++ b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs @@ -1328,7 +1328,7 @@ namespace BLL x.RealNameUpdateTime, name = x.PersonName, x.PersonId, - }); + }).Take(50); if (getData.Count() > 0) { foreach (var itemData in getData) @@ -1405,7 +1405,7 @@ namespace BLL { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - int count = 200; + int count = 50; if (ConfigurationManager.AppSettings["EnableRealName"] != "True") { count = 100; @@ -1517,7 +1517,7 @@ namespace BLL } } else - { + { mess = "没有符合条件的数据!"; } diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index c3da2910..881084d6 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.Text; using System.Timers; + using System.Linq; public class Global : System.Web.HttpApplication { @@ -42,8 +43,9 @@ { ////实名制同步定时器 try - { + { BLL.RealNameMonitorService.StartMonitor(); + // BLL.RealNameMonitorService.StartMonitorProject(); SynchroSetService.InsertRealNamePushLog(null, null, "实名制定时器开始启动", "sucess", "200", null, "成功", null); } catch (Exception ex)