Commit ebb3abc8 authored by 黄奎's avatar 黄奎

页面修改

parent aca713f3
......@@ -894,6 +894,26 @@ namespace Edu.Module.Duty
return flag;
}
/// <summary>
/// 更新用户【未值班】状态
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool UpdateNoDutyModule(int Id)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Duty_PlanDetails_ViewModel.Status), (int)DutyStatusEnum.NoDuty },
};
List<WhereHelper> list = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Duty_PlanDetails_ViewModel.Id), Id),
};
var flag = duty_PlanDetailsRepository.Update(fileds, list);
return flag;
}
/// <summary>
/// 新增修改值班事项
/// </summary>
......
......@@ -36,6 +36,7 @@ namespace Edu.Repository.Duty
{
joinWhere += string.Format(" AND Status={0} ", query.QDutyStatus);
}
//迟到
if (query.QAttendanceStatus == 1)
{
......
using Edu.Common.Plugin;
using Edu.Module.Duty;
using System;
using System.IO;
using System.Threading;
......@@ -7,33 +8,44 @@ namespace Edu.WebApi.Timers
{
public class TimerJobj
{
private static DutyPlanModule dutyPlanModule = AOP.AOPHelper.CreateAOPObject<DutyPlanModule>();
static System.Timers.Timer timer1; //计时器
static System.Timers.Timer timer2;//定期处理未值班数据
public static void RunTimer()
{
timer1 = new System.Timers.Timer();
timer1.Interval = 1000 * (60 * 60) * 3; //60分钟
timer1.Elapsed += new System.Timers.ElapsedEventHandler(ClearFile);
timer1.Enabled = true;
timer2 = new System.Timers.Timer();
timer2.Interval = (1000 * 60) * (60*2); //2小时执行一次
timer2.Elapsed += new System.Timers.ElapsedEventHandler(DealDuty);
timer2.Enabled = true;
}
public static void RunStop()
public static void RunStop()
{
timer1.Enabled = false;
timer2.Enabled = false;
}
/// <summary>
/// 防止重置
/// </summary>
private static int inTimer = 0;
private static int inTimer2 = 0;
/// <summary>
/// 清理文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void ClearFile(object sender, System.Timers.ElapsedEventArgs e) {
public static void ClearFile(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
string rootBook = AppDomain.CurrentDomain.BaseDirectory;
......@@ -71,5 +83,38 @@ namespace Edu.WebApi.Timers
Interlocked.Exchange(ref inTimer, 0);
}
}
/// <summary>
/// 处理值班数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void DealDuty(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer2, 1) == 0)
{
var list = dutyPlanModule.GetDutyPlanPageModule(1, 20, out _, new Model.ViewModel.Duty.RB_Duty_Plan_ViewModel()
{
QDutyStatus = 0,
QEndDate = Common.ConvertHelper.FormatDate(DateTime.Now.AddDays(1))
});
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
foreach (var subItem in item.PlanDetails)
{
var endTime = Convert.ToDateTime((Common.ConvertHelper.FormatDate(item.Date) + " " + subItem.EndTime)).AddHours(2);
if (subItem.Status== Common.Enum.Duty.DutyStatusEnum.NoStart && endTime < DateTime.Now)
{
dutyPlanModule.UpdateNoDutyModule(subItem.Id);
}
}
}
}
Interlocked.Exchange(ref inTimer2, 0);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment