Commit c518440e by wyc

重复任务关闭,科室分组

parent 9021d490
......@@ -374,25 +374,33 @@ private void Timeout(TaskService service, List<bg_task> tasks)
}
}
/// <summary>
/// 重复任务仅执行最后异常
/// 重复任务仅执行最后一次(存在执行只的任务,就将后加的任务停止)
/// </summary>
/// <param name="service"></param>
/// <param name="tasks"></param>
private void Repeat(TaskService service, List<bg_task> tasks)
{
var gps = tasks
.Where(w => w.Status == (int)Background.Status.等待)
.GroupBy(w => new { w.JobType, w.Argument });
var waitingTasks = tasks.Where(w => w.Status == (int)Background.Status.等待).ToList();
foreach (var item in gps)
var groupedTasks = waitingTasks
.GroupBy(w => new { w.JobType, w.Argument })
.ToList();
foreach (var group in groupedTasks)
{
var maxId = group.Max(w => w.ID);
var isExist = tasks.Any(w => w.JobType == group.Key.JobType && w.Argument == group.Key.Argument && w.Status == (int)Background.Status.执行中);
foreach (var task in group)
{
foreach (var task in item)
if ((task.Status == (int)Background.Status.等待 && task.ID != maxId) || isExist)
{
if (task.Status == (int)Background.Status.等待 && task.ID != item.Max(w => w.ID))
service.Update(task.ID, Background.Status.无效, "任务重复");
}
}
}
}
private class BackgroundSetting
{
......
......@@ -3334,7 +3334,7 @@
</member>
<member name="M:Performance.Api.BackgroundJob.Repeat(Performance.Services.TaskService,System.Collections.Generic.List{Performance.EntityModels.bg_task})">
<summary>
重复任务仅执行最后异常
重复任务仅执行最后一次(存在执行只的任务,就将后加的任务停止)
</summary>
<param name="service"></param>
<param name="tasks"></param>
......
......@@ -530,8 +530,17 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
}
if (request.Type == (int)AccountTypeEnum.AccountingUnit && !string.IsNullOrEmpty(request.UnitType))
exp = exp.And(t => t.UnitType.Replace("行政后勤", "行政工勤") == request.UnitType.Replace("行政后勤", "行政工勤"));
{
string processedRequestUnitType = request.UnitType
.Replace("行政后勤", "行政工勤")
.Replace("行政中层", "行政工勤")
.Replace("行政高层", "行政工勤");
exp = exp.And(t => t.UnitType
.Replace("行政后勤", "行政工勤")
.Replace("行政中层", "行政工勤")
.Replace("行政高层", "行政工勤") == processedRequestUnitType);
}
return _cofaccountingRepository.GetEntities(exp)?.OrderBy(t => t.IsVerify).ThenBy(t => ConvertHelper.To<int>(t.Code)).ToList() ?? new List<cof_accounting>();
}
......
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