Commit 8b147012 authored by 黄奎's avatar 黄奎

页面修改

parent 700413a1
...@@ -1112,5 +1112,49 @@ namespace Edu.Module.Duty ...@@ -1112,5 +1112,49 @@ namespace Edu.Module.Duty
{ {
return visitorRepository.GetVisitorCountRepository(model); return visitorRepository.GetVisitorCountRepository(model);
} }
/// <summary>
/// 更新值班【未值班,值班未打卡】状态
/// </summary>
public void UpdateDutyModule()
{
double addhours = 1.5;
var list = 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(addhours);
if (subItem.Status == Common.Enum.Duty.DutyStatusEnum.NoStart && endTime < DateTime.Now)
{
UpdateNoDutyModule(subItem.Id);
}
}
}
}
var list2 = GetDutyPlanPageModule(1, 20, out _, new Model.ViewModel.Duty.RB_Duty_Plan_ViewModel()
{
QDutyStatus = 1,
QEndDate = Common.ConvertHelper.FormatDate(DateTime.Now)
});
foreach (var item in list2)
{
foreach (var subItem in item.PlanDetails)
{
var endTime = Convert.ToDateTime((Common.ConvertHelper.FormatDate(item.Date) + " " + subItem.EndTime)).AddHours(addhours);
if (subItem.Status == Common.Enum.Duty.DutyStatusEnum.DutyIng && endTime < DateTime.Now)
{
UpdateDutyFinishedModule(subItem.Id);
}
}
}
}
} }
} }
...@@ -118,7 +118,14 @@ WHERE 1=1 ...@@ -118,7 +118,14 @@ WHERE 1=1
builder.AppendFormat(@" AND A.{0}<'{1}' ", nameof(RB_Duty_Plan_ViewModel.Date), Common.ConvertHelper.FormatDate(DateTime.Now)); builder.AppendFormat(@" AND A.{0}<'{1}' ", nameof(RB_Duty_Plan_ViewModel.Date), Common.ConvertHelper.FormatDate(DateTime.Now));
} }
} }
builder.AppendFormat(@" ORDER BY A.{0} ASC ", nameof(RB_Duty_Plan_ViewModel.Date)); if (query.IsFinish == 1)
{
builder.AppendFormat(@" ORDER BY A.{0} DESC ", nameof(RB_Duty_Plan_ViewModel.Date));
}
else
{
builder.AppendFormat(@" ORDER BY A.{0} ASC ", nameof(RB_Duty_Plan_ViewModel.Date));
}
return GetPage<RB_Duty_Plan_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList(); return GetPage<RB_Duty_Plan_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
} }
......
...@@ -56,6 +56,7 @@ namespace Edu.WebApi.Controllers.Duty ...@@ -56,6 +56,7 @@ namespace Edu.WebApi.Controllers.Duty
query.SchoolIdList = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("School_Ids")); query.SchoolIdList = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("School_Ids"));
query.Group_Id = base.UserInfo.Group_Id; query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>(); List<object> result = new List<object>();
dutyPlanModule.UpdateDutyModule();
var list = dutyPlanModule.GetDutyPlanPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query); var list = dutyPlanModule.GetDutyPlanPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list) foreach (var item in list)
{ {
...@@ -108,6 +109,7 @@ namespace Edu.WebApi.Controllers.Duty ...@@ -108,6 +109,7 @@ namespace Edu.WebApi.Controllers.Duty
[HttpPost] [HttpPost]
public ApiResult GetMyDutyPlanPage() public ApiResult GetMyDutyPlanPage()
{ {
dutyPlanModule.UpdateDutyModule();
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString()); var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Duty_Plan_ViewModel() var query = new RB_Duty_Plan_ViewModel()
{ {
......
...@@ -101,45 +101,9 @@ namespace Edu.WebApi.Timers ...@@ -101,45 +101,9 @@ namespace Edu.WebApi.Timers
/// <param name="e"></param> /// <param name="e"></param>
public static void DealDuty(object sender, System.Timers.ElapsedEventArgs e) public static void DealDuty(object sender, System.Timers.ElapsedEventArgs e)
{ {
double addhours = 1.5;
if (Interlocked.Exchange(ref inTimer2, 1) == 0) if (Interlocked.Exchange(ref inTimer2, 1) == 0)
{ {
var list = dutyPlanModule.GetDutyPlanPageModule(1, 20, out _, new Model.ViewModel.Duty.RB_Duty_Plan_ViewModel() dutyPlanModule.UpdateDutyModule();
{
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(addhours);
if (subItem.Status == Common.Enum.Duty.DutyStatusEnum.NoStart && endTime < DateTime.Now)
{
dutyPlanModule.UpdateNoDutyModule(subItem.Id);
}
}
}
}
var list2 = dutyPlanModule.GetDutyPlanPageModule(1, 20, out _, new Model.ViewModel.Duty.RB_Duty_Plan_ViewModel()
{
QDutyStatus = 1,
QEndDate = Common.ConvertHelper.FormatDate(DateTime.Now)
});
foreach (var item in list2)
{
foreach (var subItem in item.PlanDetails)
{
var endTime = Convert.ToDateTime((Common.ConvertHelper.FormatDate(item.Date) + " " + subItem.EndTime)).AddHours(addhours);
if (subItem.Status == Common.Enum.Duty.DutyStatusEnum.DutyIng && endTime < DateTime.Now)
{
dutyPlanModule.UpdateDutyFinishedModule(subItem.Id);
}
}
}
Interlocked.Exchange(ref inTimer2, 0); 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