提交代码
This commit is contained in:
@@ -42,6 +42,28 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartUpdateSitePerson()
|
||||
{
|
||||
//var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault();
|
||||
//if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue)
|
||||
//{
|
||||
// adTimeJ = getSynchroSet.Intervaltime.Value;
|
||||
//}
|
||||
if (messageTimer != null)
|
||||
{
|
||||
messageTimer.Stop();
|
||||
messageTimer.Dispose();
|
||||
messageTimer = null;
|
||||
}
|
||||
messageTimer = new Timer
|
||||
{
|
||||
AutoReset = true
|
||||
};
|
||||
messageTimer.Elapsed += new ElapsedEventHandler(UpdateSitePerson);
|
||||
messageTimer.Interval = 1000 * 60 * 60 * 24;// 60分钟 60000 * adTimeJ;
|
||||
messageTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程确认 定时执行 系统启动5分钟
|
||||
/// </summary>
|
||||
@@ -75,6 +97,49 @@ namespace BLL
|
||||
ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程确认 定时执行 系统启动5分钟
|
||||
/// </summary>
|
||||
/// <param name="sender">Timer组件</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
private static void UpdateSitePerson(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var persons = from x in db.SitePerson_Person
|
||||
join y in db.Base_Project on x.ProjectId equals y.ProjectId
|
||||
join z in db.RealName_Project on y.JTProjectCode equals z.ProCode
|
||||
join p in db.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
|
||||
join v in db.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
||||
join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId
|
||||
where z.JTproCode != null && x.IsCardNoOK == true && v.TeamId.HasValue && !x.OutTime.HasValue
|
||||
&& p.IsSynchro == true
|
||||
select x;
|
||||
var personInOutNows = from x in db.RealName_PersonInOutNow select x;
|
||||
foreach (var person in persons)
|
||||
{
|
||||
var personInOutNow = personInOutNows.OrderByDescending(x => x.ChangeTime).FirstOrDefault();
|
||||
if (personInOutNow == null)
|
||||
{
|
||||
person.OutTime = DateTime.Now;
|
||||
}
|
||||
else if (personInOutNow.ChangeTime < DateTime.Now.AddDays(-3))
|
||||
{
|
||||
person.OutTime = personInOutNow.ChangeTime;
|
||||
}
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StartMonitor();
|
||||
ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 启动监视器 系统启动5分钟-实名制出入记录去重
|
||||
@@ -159,7 +224,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
if (delCount >= 10000)
|
||||
{
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -185,7 +250,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static void StartMonitorDeletePushLog()
|
||||
{
|
||||
int adTimeJ = 60 * 4;
|
||||
int adTimeJ = 60 * 4;
|
||||
if (messageTimer1 != null)
|
||||
{
|
||||
messageTimer1.Stop();
|
||||
|
||||
Reference in New Issue
Block a user