2025-06-06 16:00:39 +08:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using VOL.Business.IServices;
|
|
|
|
|
|
using VOL.Business.IServices.School;
|
|
|
|
|
|
using VOL.Business.Services;
|
|
|
|
|
|
using VOL.Business.Services.Norm;
|
|
|
|
|
|
using VOL.Business.Services.School;
|
|
|
|
|
|
using VOL.Core.Filters;
|
|
|
|
|
|
using VOL.Core.ManageUser;
|
|
|
|
|
|
using VOL.Core.Utilities;
|
|
|
|
|
|
using VOL.Model;
|
|
|
|
|
|
using VOL.Model.HomeWork;
|
|
|
|
|
|
using VOL.Model.Norm.Request;
|
|
|
|
|
|
using VOL.Model.Norm.Response;
|
|
|
|
|
|
|
|
|
|
|
|
namespace VOL.WebApi.Controllers.Business
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 作业列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
[ApiExplorerSettings(GroupName = "v3")]
|
|
|
|
|
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|
|
|
|
|
public class HomeWorkController : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 初始化
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IS_HomeWorkService _homeWorkService;
|
|
|
|
|
|
public HomeWorkController(
|
|
|
|
|
|
IS_HomeWorkService homeWorkService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_homeWorkService = homeWorkService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 作业列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet(nameof(GetHomeWorkPageList))]
|
|
|
|
|
|
public async Task<PageDataDto<HomeWorkListModel>> GetHomeWorkPageList(HomeWorkPageListParam paramDto)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _homeWorkService.GetHomeWorkPageList(paramDto);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-28 17:30:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 批量导出作业学生明细。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[HttpGet(nameof(ExportHomeWorkStudents))]
|
|
|
|
|
|
public async Task<ActionResult> ExportHomeWorkStudents([FromQuery] HomeWorkExportParam paramDto)
|
|
|
|
|
|
{
|
|
|
|
|
|
var rows = await _homeWorkService.GetHomeWorkStudentExportList(paramDto);
|
|
|
|
|
|
var sheets = new Dictionary<string, List<HomeWorkStudentExportModel>>
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "作业学生明细", rows }
|
|
|
|
|
|
};
|
|
|
|
|
|
var columns = new List<string>
|
|
|
|
|
|
{
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.WorkTypeName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.TeacherName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.WorkName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.GradeAndClassName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.StudentScopeName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.WorkText),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.StartTime),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.EndTime),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.StudentNo),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.StudentName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.SexName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.StudentWorkStatusName),
|
|
|
|
|
|
nameof(HomeWorkStudentExportModel.Result)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-07-31 15:44:11 +08:00
|
|
|
|
var excelBytes = Tool.ExportToExcel(sheets, columns, autoFitColumns: false);
|
2026-07-28 17:30:11 +08:00
|
|
|
|
var fileName = $"作业学生明细{DateTime.Now:yyyyMMddHHmmss}.xlsx";
|
|
|
|
|
|
return File(
|
|
|
|
|
|
excelBytes,
|
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
|
fileName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-06 16:00:39 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 作业下学生列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet(nameof(GetHomeWorkStudents))]
|
|
|
|
|
|
public async Task<PageDataDto<HomeWorkStudentsModel>> GetHomeWorkStudents(HomeWorkStudentsParam paramDto)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _homeWorkService.GetHomeWorkStudents(paramDto);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 作业详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet(nameof(GetSubmittedAssignments))]
|
|
|
|
|
|
public async Task<List<SubmittedAssignmentsModel>> GetSubmittedAssignments(int homeWorkId, string studentNo)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _homeWorkService.GetSubmittedAssignments(homeWorkId, studentNo);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|