136 lines
4.3 KiB
C#
136 lines
4.3 KiB
C#
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.School;
|
|
using VOL.Core.Filters;
|
|
using VOL.Core.ManageUser;
|
|
using VOL.Core.Utilities;
|
|
using VOL.Model;
|
|
using VOL.Model.School.Request;
|
|
|
|
namespace VOL.WebApi.Controllers.Business
|
|
{
|
|
/// <summary>
|
|
/// 年级管理
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[ApiExplorerSettings(GroupName = "v3")]
|
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|
public class GradeController : ControllerBase
|
|
{
|
|
#region 初始化
|
|
|
|
private readonly IS_GradeService _gradeService;
|
|
public GradeController(
|
|
IS_GradeService gradeService)
|
|
{
|
|
_gradeService = gradeService;
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 获取所有年级名称
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetGradeNames))]
|
|
public async Task<List<GradeNameModel>> GetGradeNames()
|
|
{
|
|
return await _gradeService.GetGradeNames();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有性质年级名称
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetNatureGradeNames))]
|
|
public async Task<List<NatureGradeNameModel>> GetNatureGradeNames()
|
|
{
|
|
return await _gradeService.GetNatureGradeNames();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取年级列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetGradeList))]
|
|
public async Task<List<GradeListModel>> GetGradeList()
|
|
{
|
|
return await _gradeService.GetGradeList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取年级对应项目名称
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(CategoryList))]
|
|
public async Task<List<CategoryModel>> CategoryList(GradeDataStatsParam paramDto)
|
|
{
|
|
return await _gradeService.GetCategoryList(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 年级列表导出
|
|
/// </summary>
|
|
/// <param name="year"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GradeListExport))]
|
|
public async Task<ActionResult> GradeListExport()
|
|
{
|
|
var rseList = await _gradeService.GetGradeList();
|
|
|
|
var disList = new Dictionary<string, List<GradeListModel>>
|
|
{
|
|
{ "年级数据", rseList }
|
|
};
|
|
|
|
var exportColumns = Tool.GetPropertyNames<GradeListModel>();
|
|
|
|
var excelBytes = Tool.ExportToExcel(disList, exportColumns);
|
|
|
|
Response.Headers.Add("Content-Disposition", "attachment; filename=ExportedData.xlsx");
|
|
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
return File(excelBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"年级数据_{DateTime.Now.ToString("yyyyMMddHHmmss")}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 年级数据统计
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GradeWholeDataStats))]
|
|
public async Task<GradeDataStatsModel> GradeWholeDataStats(GradeDataStatsParam paramDto)
|
|
{
|
|
return await _gradeService.GradeWholeDataStats(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 各体测项目等级占比
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(CategoryRankRatio))]
|
|
public async Task<Dictionary<string, float>> CategoryRankRatio(CategoryParam paramDto)
|
|
{
|
|
return await _gradeService.CategoryRankRatio(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 成绩趋势
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(ResultTrends))]
|
|
public async Task<VariousSportsProportion> ResultTrends(GradeResultTrendsParam paramDto)
|
|
{
|
|
return await _gradeService.ResultTrends(paramDto);
|
|
}
|
|
}
|
|
}
|