20220928实名制同步定时器调整

This commit is contained in:
杨红卫 2022-09-28 15:14:24 +08:00
parent 579af300d3
commit 061826c677
3 changed files with 81 additions and 4 deletions

View File

@ -381,5 +381,80 @@ namespace BLL
}
}
#endregion
#region 5
/// <summary>
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
/// </summary>
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();
}
}
/// <summary>
/// 流程确认 定时执行 系统启动5分钟
/// </summary>
/// <param name="sender">Timer组件</param>
/// <param name="e">事件参数</param>
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
}
}

View File

@ -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 = "没有符合条件的数据!";
}

View File

@ -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)