93 lines
3.3 KiB
C#
93 lines
3.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;
|
|
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;
|
|
|
|
namespace VOL.WebApi.Controllers.Business
|
|
{
|
|
/// <summary>
|
|
/// 体测管理
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[ApiExplorerSettings(GroupName = "v3")]
|
|
[TypeFilter(typeof(CustomApiResponseFilter))]
|
|
public class HealthStandardsController : ControllerBase
|
|
{
|
|
#region 初始化
|
|
|
|
private readonly IN_HealthStandardsService _healthStandardsService;
|
|
public HealthStandardsController(
|
|
IN_HealthStandardsService healthStandardsService)
|
|
{
|
|
_healthStandardsService = healthStandardsService;
|
|
}
|
|
|
|
#endregion
|
|
/// <summary>
|
|
/// 分页获体测标准列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetHealthStandardsPageList))]
|
|
public async Task<PageDataDto<HealthStandardsPageListModel>> GetHealthStandardsPageList(HealthStandardsPageListParam paramDto)
|
|
{
|
|
return await _healthStandardsService.GetHealthStandardsPageList(paramDto);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(AddHealthStandards))]
|
|
public async Task<ActionResult> AddHealthStandards([FromBody] List<AddHealthStandardsParam> paramDto)
|
|
{
|
|
await _healthStandardsService.AddHealthStandards(paramDto);
|
|
return Ok("新增成功");
|
|
}
|
|
/// <summary>
|
|
/// 更新
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost(nameof(ModifyHealthStandards))]
|
|
public async Task<ActionResult> ModifyHealthStandards([FromBody] List<AddHealthStandardsParam> paramDto)
|
|
{
|
|
await _healthStandardsService.ModifyHealthStandards(paramDto);
|
|
return Ok("更新成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出体测标准列表
|
|
/// </summary>
|
|
/// <param name="paramDto"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(nameof(GetHealthStandardsList))]
|
|
public async Task<ActionResult> GetHealthStandardsList(HealthStandardsExportParam paramDto)
|
|
{
|
|
var rseList = await _healthStandardsService.GetHealthStandardsList(paramDto);
|
|
|
|
var disList = new Dictionary<string, List<HealthStandardsPageListModel>>();
|
|
disList.Add("体测标准", rseList);
|
|
|
|
var exportColumns = Tool.GetPropertyNames<HealthStandardsPageListModel>();
|
|
|
|
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")}");
|
|
}
|
|
}
|
|
}
|