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 { /// /// /// public class NumZjController : IDynamicApiController { /// /// /// /// public async Task Download([FromBody] NumZjDownloadInput numZjDownloadInput) { //var asd = ExcelHelper.ToColumnIndex("C"); //return null; return await Task.Run(() => { var configs = App.GetConfig("NumZjConfig"); var current = configs.numZjExcels.Find(a => (int)a.excel_no == numZjDownloadInput.type); //var sheet_names = new Dictionary { { 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 }; }); } } }