20220313 3张表格 导出excel功能
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using Furion;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TempTask.WebEntry.ApiController.Dto;
|
||||
using TempTask.WebEntry.Tools;
|
||||
|
||||
namespace TempTask.WebEntry.ApiController
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class NumZjController : IDynamicApiController
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> Download([FromBody] NumZjDownloadInput numZjDownloadInput)
|
||||
{
|
||||
//var asd = ExcelHelper.ToColumnIndex("C");
|
||||
//return null;
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
var configs = App.GetConfig<NumZjConfig>("NumZjConfig");
|
||||
var current = configs.numZjExcels.Find(a => (int)a.excel_no == numZjDownloadInput.type);
|
||||
//var sheet_names = new Dictionary<int, string> { { 4, "房地产业分行业(项目信息)" }, { 5, "分地区(项目信息)" } };
|
||||
var filepath = NumZjHelper.WriteTemplate(numZjDownloadInput.year, numZjDownloadInput.month, numZjDownloadInput.week, current.excel_no, current.sheets);
|
||||
return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = current.excel_name };
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user