作业
This commit is contained in:
parent
92f9bce683
commit
c1c1f3d934
@ -6,6 +6,7 @@ using YD_WeChatApplet.Api.SmartSportsEntitys;
|
|||||||
using YD_WeChatApplet.Api.Utilities;
|
using YD_WeChatApplet.Api.Utilities;
|
||||||
using YD_WeChatApplet.Commons.Dto;
|
using YD_WeChatApplet.Commons.Dto;
|
||||||
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
||||||
|
using YD_WeChatApplet.Commons.Dto.Patriarch;
|
||||||
using YD_WeChatApplet.Commons.Dto.School;
|
using YD_WeChatApplet.Commons.Dto.School;
|
||||||
using YD_WeChatApplet.Commons.Enum;
|
using YD_WeChatApplet.Commons.Enum;
|
||||||
using YD_WeChatApplet.Context;
|
using YD_WeChatApplet.Context;
|
||||||
@ -101,7 +102,7 @@ namespace YD_WeChatApplet.Api.Services.Impl
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<PageDataDto<HomeWorkRecordDto>> HomeWorkRecordByTeacher(PageDto dto)
|
public async Task<PageDataDto<HomeWorkRecordDto>> HomeWorkRecordByTeacher(PatriarchHomeWorkHistoryDto dto)
|
||||||
{
|
{
|
||||||
var userId = UserLoginContext.Current.UserId;
|
var userId = UserLoginContext.Current.UserId;
|
||||||
var currentTime = DateTime.Now;
|
var currentTime = DateTime.Now;
|
||||||
@ -109,6 +110,21 @@ namespace YD_WeChatApplet.Api.Services.Impl
|
|||||||
var query = _sportsContext.HomeWork
|
var query = _sportsContext.HomeWork
|
||||||
.Where(x => x.TeacherId == userId);
|
.Where(x => x.TeacherId == userId);
|
||||||
|
|
||||||
|
switch (dto.WorkStatus)
|
||||||
|
{
|
||||||
|
case 1: // 未开始
|
||||||
|
query = query.Where(x => x.StartTime > currentTime);
|
||||||
|
break;
|
||||||
|
case 2: // 进行中
|
||||||
|
query = query.Where(x => x.StartTime <= currentTime && x.EndTime >= currentTime);
|
||||||
|
break;
|
||||||
|
case 3: // 已结束
|
||||||
|
query = query.Where(x => x.EndTime < currentTime);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var totalCount = await query.CountAsync();
|
var totalCount = await query.CountAsync();
|
||||||
|
|
||||||
var list = await query
|
var list = await query
|
||||||
@ -117,11 +133,12 @@ namespace YD_WeChatApplet.Api.Services.Impl
|
|||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
WorkName = x.WorkName,
|
WorkName = x.WorkName,
|
||||||
WorkTypeName = x.WorkTypeName,
|
WorkTypeName = x.WorkTypeName,
|
||||||
WorkStatus = x.EndTime < currentTime ? 3 : (x.StartTime > currentTime ? 1 : 2),
|
//WorkStatus = x.EndTime < currentTime ? 3 : (x.StartTime > currentTime ? 1 : 2),
|
||||||
|
WorkStatus = dto.WorkStatus,
|
||||||
StartTime = x.StartTime,
|
StartTime = x.StartTime,
|
||||||
EndTime = x.EndTime
|
EndTime = x.EndTime
|
||||||
})
|
})
|
||||||
.OrderByDescending(x => x.Id)
|
.OrderByDescending(x => x.EndTime)
|
||||||
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
||||||
.Take(dto.PageSize)
|
.Take(dto.PageSize)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
@ -104,9 +104,25 @@ namespace YD_WeChatApplet.Api.Services.Impl
|
|||||||
})
|
})
|
||||||
.Where(a => a.StudentNo == userNo);
|
.Where(a => a.StudentNo == userNo);
|
||||||
|
|
||||||
query = dto.IsHistory
|
switch (dto.WorkStatus)
|
||||||
? query.Where(x => x.EndTime < currentTime)
|
{
|
||||||
: query.Where(x => x.EndTime >= currentTime);
|
case 1: // 未开始
|
||||||
|
query = query.Where(x => x.StartTime > currentTime);
|
||||||
|
break;
|
||||||
|
case 2: // 进行中
|
||||||
|
query = query.Where(x => x.StartTime <= currentTime && x.EndTime >= currentTime);
|
||||||
|
break;
|
||||||
|
case 3: // 已结束
|
||||||
|
query = query.Where(x => x.EndTime < currentTime);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//query = dto.IsHistory
|
||||||
|
// ? query.Where(x => x.EndTime < currentTime)
|
||||||
|
// : query.Where(x => x.EndTime >= currentTime);
|
||||||
|
|
||||||
|
|
||||||
var totalCount = await query.CountAsync();
|
var totalCount = await query.CountAsync();
|
||||||
|
|
||||||
@ -116,13 +132,14 @@ namespace YD_WeChatApplet.Api.Services.Impl
|
|||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
WorkName = x.WorkName,
|
WorkName = x.WorkName,
|
||||||
WorkTypeName = x.WorkTypeName,
|
WorkTypeName = x.WorkTypeName,
|
||||||
WorkStatus = x.EndTime < currentTime ? 3 : (x.StartTime > currentTime ? 1 : 2),
|
//WorkStatus = x.EndTime < currentTime ? 3 : (x.StartTime > currentTime ? 1 : 2),
|
||||||
|
WorkStatus = dto.WorkStatus,
|
||||||
GroupNumber = x.GroupNumber,
|
GroupNumber = x.GroupNumber,
|
||||||
IsComplete = x.WorkStatus == 2,
|
IsComplete = x.WorkStatus == 2,
|
||||||
StartTime = x.StartTime,
|
StartTime = x.StartTime,
|
||||||
EndTime = x.EndTime
|
EndTime = x.EndTime
|
||||||
})
|
})
|
||||||
.OrderByDescending(x => x.Id)
|
.OrderByDescending(x => x.EndTime)
|
||||||
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
||||||
.Take(dto.PageSize)
|
.Take(dto.PageSize)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
@ -5,6 +5,7 @@ using YD_WeChatApplet.Api.Entitys;
|
|||||||
using YD_WeChatApplet.Commons;
|
using YD_WeChatApplet.Commons;
|
||||||
using YD_WeChatApplet.Commons.Dto;
|
using YD_WeChatApplet.Commons.Dto;
|
||||||
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
||||||
|
using YD_WeChatApplet.Commons.Dto.Patriarch;
|
||||||
using YD_WeChatApplet.Commons.Dto.School;
|
using YD_WeChatApplet.Commons.Dto.School;
|
||||||
|
|
||||||
namespace YD_WeChatApplet.Services
|
namespace YD_WeChatApplet.Services
|
||||||
@ -23,7 +24,7 @@ namespace YD_WeChatApplet.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PageDataDto<HomeWorkRecordDto>> HomeWorkRecordByTeacher(PageDto dto);
|
Task<PageDataDto<HomeWorkRecordDto>> HomeWorkRecordByTeacher(PatriarchHomeWorkHistoryDto dto);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 作业详情
|
/// 作业详情
|
||||||
|
@ -59,6 +59,9 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PatriarchHomeWorkHistoryDto : PageDto
|
public class PatriarchHomeWorkHistoryDto : PageDto
|
||||||
{
|
{
|
||||||
public bool IsHistory { get; set; }
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public int WorkStatus { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user