This commit is contained in:
2025-03-06 15:51:05 +08:00
parent 0ae46edcd3
commit daf5d12c23
3 changed files with 23 additions and 2 deletions

View File

@@ -31,6 +31,11 @@ public class WorkGridsController : ControllerBase
_workGridScheduleService = workGridScheduleService;
}
/// <summary>
/// 人员查询选择
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpGet("gainfo-selections")]
public async Task<Pagination<WorkGridGainfoPageResponse>> GetPageAsync([FromQuery] WorkGridGainfoPageRequest request)
{
@@ -149,7 +154,7 @@ public class WorkGridsController : ControllerBase
}
/// <summary>
/// 获取网格员排班列表
/// 获取网格排班列表
/// </summary>
/// <param name="workGridCode">网格code</param>
/// <param name="date"></param>

View File

@@ -11,4 +11,10 @@ public class WorkGridScheduleResponse
public string UserCode { get; set; }
public string UserName { get; set; }
/// <summary>
/// 最大连续排班信息
/// </summary>
public WorkGridScheduleMaximumConsecutiveDto MaximumConsecutiveSchedules { get; set; }
}

View File

@@ -90,7 +90,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService
/// <inheritdoc />
public async Task<List<WorkGridScheduleResponse>> GetListAsync(Guid workGridCode, DateOnly date, WorkGridTimePeriodEnumType? periodType)
{
return await _dbContext.Queryable<WorkGridScheduleEntity>()
var data = await _dbContext.Queryable<WorkGridScheduleEntity>()
.LeftJoin<GainfoEntity>((x, ga) => x.UserCode == ga.Code)
.Where(x => x.WorkGridCode == workGridCode && x.Date == date)
.WhereIF(periodType.HasValue, x => x.PeriodType == periodType)
@@ -102,6 +102,16 @@ public class WorkGridScheduleService : IWorkGridScheduleService
UserName = ga.Name
})
.ToListAsync();
var userCodes = data.Select(x => x.UserCode).ToList();
var maximumConsecutiveUserCodes = await MaximumConsecutiveUserCodesAsync(userCodes, 1, date);
foreach (var item in data)
{
item.MaximumConsecutiveSchedules = maximumConsecutiveUserCodes.FirstOrDefault(x => x.UserCode == item.UserCode);
}
return data;
}
/// <inheritdoc />