|
@@ -38,7 +38,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="dtos"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("user")]
|
|
|
- public async Task Add([FromBody] List<SchedulingUserDto> dtos)
|
|
|
+ public async Task Add([FromBody] List<UserAddDto> dtos)
|
|
|
{
|
|
|
List<SchedulingUser> user = new List<SchedulingUser>();
|
|
|
foreach (var dto in dtos)
|
|
@@ -139,7 +139,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="dtos"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("shift")]
|
|
|
- public async Task Add([FromBody] SchedulingShiftDto dto)
|
|
|
+ public async Task Add([FromBody] ShiftAddDto dto)
|
|
|
{
|
|
|
var model = _mapper.Map<SchedulingShift>(dto);
|
|
|
await _schedulingShiftRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
@@ -205,29 +205,39 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
#region 排班管理
|
|
|
/// <summary>
|
|
|
- /// 新增排班人员
|
|
|
+ /// 新增排班管理
|
|
|
/// </summary>
|
|
|
/// <param name="dtos"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
- public async Task Add([FromBody] List<SchedulingDto> dtos)
|
|
|
+ public async Task Add([FromBody] AddDto dtos)
|
|
|
{
|
|
|
List<Scheduling> schedulings = new List<Scheduling>();
|
|
|
- foreach (var dto in dtos)
|
|
|
+ foreach (var dto in dtos.UserDtos)
|
|
|
{
|
|
|
- if (string.IsNullOrEmpty(dto.SchedulingUserId))
|
|
|
+ if (string.IsNullOrEmpty(dto.UserId))
|
|
|
throw UserFriendlyException.SameMessage("请传入排班用户信息");
|
|
|
- if (string.IsNullOrEmpty(dto.ShiftId))
|
|
|
+ if (string.IsNullOrEmpty(dtos.ShiftId))
|
|
|
throw UserFriendlyException.SameMessage("请传入排班班次信息");
|
|
|
|
|
|
- var scheduling = _mapper.Map<Scheduling>(dto);
|
|
|
+ var scheduling = new Scheduling
|
|
|
+ {
|
|
|
+ SchedulingUserId = dto.UserId,
|
|
|
+ SchedulingUserName = dto.UserName,
|
|
|
+ ShiftId = dtos.ShiftId,
|
|
|
+ ShiftName = dtos.ShiftName,
|
|
|
+ SchedulingTime = dtos.SchedulingTime,
|
|
|
+ WorkingTime = dtos.WorkingTime,
|
|
|
+ OffDutyTime = dtos.OffDutyTime,
|
|
|
+ SendOrderNum = 0
|
|
|
+ };
|
|
|
schedulings.Add(scheduling);
|
|
|
}
|
|
|
await _schedulingRepository.AddRangeAsync(schedulings, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 删除排班人员
|
|
|
+ /// 删除排班管理
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -241,7 +251,7 @@ namespace Hotline.Api.Controllers
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 更新排班人员
|
|
|
+ /// 更新排班管理
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -256,7 +266,7 @@ namespace Hotline.Api.Controllers
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 批量更新排班人员
|
|
|
+ /// 批量更新排班管理
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -277,7 +287,7 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 获取排班人员列表
|
|
|
+ /// 获取排班管理列表
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -288,13 +298,15 @@ namespace Hotline.Api.Controllers
|
|
|
.Includes(x => x.SchedulingUser)
|
|
|
.Includes(x => x.SchedulingShift)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword), x => x.ShiftName.Contains(dto.Keyword!))
|
|
|
+ .WhereIF(dto.StartTime.HasValue, x => x.SchedulingTime >= dto.StartTime)
|
|
|
+ .WhereIF(dto.EndTime.HasValue, x => x.SchedulingTime <= dto.EndTime)
|
|
|
.OrderByDescending(x => x.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<Scheduling>(total, items);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 获取排班人员实体
|
|
|
+ /// 获取排班管理实体
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
/// <returns></returns>
|